cognite-neat 0.87.0__tar.gz → 0.87.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/PKG-INFO +2 -2
- cognite_neat-0.87.3/cognite/neat/_version.py +1 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/configuration.py +1 -10
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/routers/data_exploration.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/config.py +84 -17
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_assets.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_events.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_files.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_labels.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_relationships.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_sequences.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_timeseries.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_dexpi.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_mock_graph_generator.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/loaders/_rdf2asset.py +108 -52
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/loaders/_rdf2dms.py +6 -6
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/queries/_base.py +20 -11
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/queries/_construct.py +3 -3
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/queries/_shared.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/stores/_base.py +14 -3
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/transformers/__init__.py +3 -0
- cognite_neat-0.87.3/cognite/neat/graph/transformers/_rdfpath.py +49 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/loaders/_asset_loader.py +2 -2
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +5 -2
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +4 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/loaders/rdf_to_dms.py +3 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/transformations/query_generator/sparql.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/transformations/transformer.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/_rules2dms.py +8 -3
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/_rules2graphql.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/_rules2ontology.py +2 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/_rules2pydantic_models.py +3 -4
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_dms2rules.py +4 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_graph2rules.py +5 -32
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2classes.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2metadata.py +2 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2properties.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/models/raw_rules.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/analysis/_asset.py +15 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/analysis/_base.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/analysis/_information.py +40 -12
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/exporters/_rules2dms.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/exporters/_rules2ontology.py +2 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_dms2rules.py +3 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_inference2rules.py +1 -5
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_owl2rules/_owl2classes.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +2 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_owl2rules/_owl2properties.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/issues/spreadsheet.py +35 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/_rdfpath.py +17 -21
- cognite_neat-0.87.3/cognite/neat/rules/models/asset/_validation.py +41 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/dms/_exporter.py +7 -3
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/dms/_schema.py +5 -4
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/entities.py +26 -8
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/information/_validation.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/utils/auth.py +47 -28
- cognite_neat-0.87.3/cognite/neat/utils/auxiliary.py +175 -0
- cognite_neat-0.87.0/cognite/neat/utils/cdf_classes.py → cognite_neat-0.87.3/cognite/neat/utils/cdf/data_classes.py +122 -2
- {cognite_neat-0.87.0/cognite/neat/utils/cdf_loaders → cognite_neat-0.87.3/cognite/neat/utils/cdf/loaders}/_data_modeling.py +37 -0
- {cognite_neat-0.87.0/cognite/neat/utils/cdf_loaders → cognite_neat-0.87.3/cognite/neat/utils/cdf/loaders}/_ingestion.py +2 -1
- cognite_neat-0.87.3/cognite/neat/utils/collection_.py +18 -0
- cognite_neat-0.87.3/cognite/neat/utils/rdf_.py +165 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/utils/text.py +4 -0
- cognite_neat-0.87.3/cognite/neat/utils/time_.py +17 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/utils/upload.py +13 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/_exceptions.py +5 -5
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/base.py +1 -1
- cognite_neat-0.87.3/cognite/neat/workflows/steps/__init__.py +0 -0
- cognite_neat-0.87.3/cognite/neat/workflows/steps/lib/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/current/rules_validator.py +2 -2
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/legacy/graph_extractor.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/legacy/graph_loader.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/legacy/rules_exporter.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/legacy/rules_importer.py +1 -1
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/pyproject.toml +2 -2
- cognite_neat-0.87.0/cognite/neat/_version.py +0 -1
- cognite_neat-0.87.0/cognite/neat/graph/transformers/_rdfpath.py +0 -7
- cognite_neat-0.87.0/cognite/neat/rules/models/asset/_validation.py +0 -4
- cognite_neat-0.87.0/cognite/neat/utils/__init__.py +0 -3
- cognite_neat-0.87.0/cognite/neat/utils/auxiliary.py +0 -35
- cognite_neat-0.87.0/cognite/neat/utils/cdf.py +0 -59
- cognite_neat-0.87.0/cognite/neat/utils/cdf_loaders/data_classes.py +0 -121
- cognite_neat-0.87.0/cognite/neat/utils/exceptions.py +0 -41
- cognite_neat-0.87.0/cognite/neat/utils/utils.py +0 -429
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/LICENSE +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/README.md +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/_shared.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/asgi/metrics.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/context_manager/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/context_manager/manager.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/data_classes/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/data_classes/rest.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/explorer.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/routers/configuration.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/routers/core.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/routers/crud.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/routers/metrics.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/routers/rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/routers/workflows.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/utils/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/utils/data_mapping.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/utils/logging.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/utils/query_templates.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/main.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/monitoring/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/monitoring/metrics.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/index.html +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/README.md +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css.map +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.LICENSE.txt +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.map +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/constants.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/exceptions.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/_shared.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/_tracking/base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/_tracking/log.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/examples/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/exceptions.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/issues/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/issues/loader.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/loaders/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/loaders/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/models.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/queries/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/stores/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/stores/_oxrdflib.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/stores/_provenance.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/transformers/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/transformers/_classic_cdf.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/issues.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/examples/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/exceptions.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/extractors/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/extractors/_graph_capturing_sheet.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/loaders/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/loaders/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/loaders/_exceptions.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/loaders/core/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/loaders/core/labels.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/loaders/core/models.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/loaders/validator.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/models.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/stores/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/stores/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/stores/_graphdb_store.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/stores/_memory_store.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/stores/_oxigraph_store.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/stores/_oxrdflib.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/stores/_rdf_to_graph.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/transformations/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/transformations/entity_matcher.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/graph/transformations/query_generator/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/analysis.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/examples/Rules-Nordic44.xlsx +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/examples/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/examples/power-grid-containers.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/examples/power-grid-example.xlsx +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/examples/power-grid-model.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/examples/rules-template.xlsx +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/examples/skos-rules.xlsx +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exceptions.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/_core/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/_core/rules2labels.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/_rules2rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/_rules2triples.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_dict2rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_json2rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_xsd2rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/models/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/models/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/models/rdfpath.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/models/rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/models/tables.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/rules/models/value_types.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/py.typed +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/_shared.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/analysis/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/examples/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/exceptions.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/exporters/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/issues/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/issues/base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/issues/dms.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/issues/fileread.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/issues/formatters.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/issues/importing.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/issues/spreadsheet_file.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/_constants.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/_types/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/_types/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/_types/_field.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/asset/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/asset/_converter.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/asset/_rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/asset/_rules_input.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/asset/_serializer.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/data_types.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/dms/_converter.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/dms/_rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/dms/_rules_input.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/dms/_serializer.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/dms/_validation.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/domain.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/information/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/information/_converter.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/information/_rules.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/information/_rules_input.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/information/_serializer.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/rules/models/wrapped_entities.py +0 -0
- {cognite_neat-0.87.0/cognite/neat/workflows/migration → cognite_neat-0.87.3/cognite/neat/utils}/__init__.py +0 -0
- {cognite_neat-0.87.0/cognite/neat/workflows/steps → cognite_neat-0.87.3/cognite/neat/utils/cdf}/__init__.py +0 -0
- {cognite_neat-0.87.0/cognite/neat/utils/cdf_loaders → cognite_neat-0.87.3/cognite/neat/utils/cdf/loaders}/__init__.py +0 -0
- {cognite_neat-0.87.0/cognite/neat/utils/cdf_loaders → cognite_neat-0.87.3/cognite/neat/utils/cdf/loaders}/_base.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/utils/spreadsheet.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/utils/xml_.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/cdf_store.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/manager.py +0 -0
- {cognite_neat-0.87.0/cognite/neat/workflows/steps/lib → cognite_neat-0.87.3/cognite/neat/workflows/migration}/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/migration/steps.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/migration/wf_manifests.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/model.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/data_contracts.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/current/rules_importer.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/legacy/__init__.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/legacy/graph_contextualization.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/legacy/graph_store.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/lib/legacy/graph_transformer.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps/step_model.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/steps_registry.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/tasks.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/triggers.py +0 -0
- {cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/workflows/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cognite-neat
|
|
3
|
-
Version: 0.87.
|
|
3
|
+
Version: 0.87.3
|
|
4
4
|
Summary: Knowledge graph transformation
|
|
5
5
|
Home-page: https://cognite-neat.readthedocs-hosted.com/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -21,7 +21,7 @@ Provides-Extra: oxi
|
|
|
21
21
|
Provides-Extra: service
|
|
22
22
|
Requires-Dist: PyYAML
|
|
23
23
|
Requires-Dist: backports.strenum (>=1.2,<2.0) ; python_version < "3.11"
|
|
24
|
-
Requires-Dist: cognite-sdk (>=7.
|
|
24
|
+
Requires-Dist: cognite-sdk (>=7.54.6,<8.0.0)
|
|
25
25
|
Requires-Dist: deepdiff
|
|
26
26
|
Requires-Dist: exceptiongroup (>=1.1.3,<2.0.0) ; python_version < "3.11"
|
|
27
27
|
Requires-Dist: fastapi (>=0,<1) ; extra == "service" or extra == "all"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.87.3"
|
|
@@ -9,8 +9,6 @@ from fastapi import FastAPI
|
|
|
9
9
|
from cognite import neat
|
|
10
10
|
from cognite.neat.config import Config, configure_logging, copy_examples_to_directory, create_data_dir_structure
|
|
11
11
|
from cognite.neat.constants import PACKAGE_DIRECTORY
|
|
12
|
-
from cognite.neat.utils.cdf import ServiceCogniteClient
|
|
13
|
-
from cognite.neat.utils.utils import get_cognite_client_from_config, get_cognite_client_from_token
|
|
14
12
|
from cognite.neat.workflows.cdf_store import CdfStore
|
|
15
13
|
from cognite.neat.workflows.manager import WorkflowManager
|
|
16
14
|
from cognite.neat.workflows.triggers import TriggerManager
|
|
@@ -36,14 +34,7 @@ class NeatApp:
|
|
|
36
34
|
self.config = config
|
|
37
35
|
logging.info("Initializing global objects")
|
|
38
36
|
if not self.cdf_client:
|
|
39
|
-
|
|
40
|
-
if self.config.cdf_client.client_id:
|
|
41
|
-
self.cdf_client = get_cognite_client_from_config(self.config.cdf_client)
|
|
42
|
-
else:
|
|
43
|
-
# If no client_id is provided, we assume that the token is provided instead of secret.
|
|
44
|
-
self.cdf_client = get_cognite_client_from_token(self.config.cdf_client)
|
|
45
|
-
else:
|
|
46
|
-
raise ValueError("Only ServiceCogniteClient is supported at the moment.")
|
|
37
|
+
self.cdf_client = self.config.cdf_auth_config.get_client()
|
|
47
38
|
self.cdf_store = CdfStore(
|
|
48
39
|
self.cdf_client,
|
|
49
40
|
self.config.cdf_default_dataset_id,
|
{cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/app/api/routers/data_exploration.py
RENAMED
|
@@ -17,7 +17,7 @@ from cognite.neat.app.api.data_classes.rest import (
|
|
|
17
17
|
from cognite.neat.app.api.utils.data_mapping import rdf_result_to_api_response
|
|
18
18
|
from cognite.neat.app.api.utils.query_templates import query_templates
|
|
19
19
|
from cognite.neat.legacy.graph.transformations import query_generator
|
|
20
|
-
from cognite.neat.utils.
|
|
20
|
+
from cognite.neat.utils.rdf_ import remove_namespace_from_uri
|
|
21
21
|
from cognite.neat.workflows.steps.data_contracts import RulesData, SolutionGraph, SourceGraph
|
|
22
22
|
|
|
23
23
|
router = APIRouter()
|
|
@@ -4,14 +4,14 @@ import os
|
|
|
4
4
|
import shutil
|
|
5
5
|
import sys
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from typing import Literal, cast
|
|
7
|
+
from typing import Any, Literal, cast
|
|
8
8
|
|
|
9
9
|
import yaml
|
|
10
|
-
from pydantic import BaseModel, Field
|
|
10
|
+
from pydantic import BaseModel, Field, field_serializer, model_validator
|
|
11
11
|
from yaml import safe_load
|
|
12
12
|
|
|
13
13
|
from cognite.neat.constants import EXAMPLE_GRAPHS, EXAMPLE_RULES, EXAMPLE_WORKFLOWS
|
|
14
|
-
from cognite.neat.utils.
|
|
14
|
+
from cognite.neat.utils.auth import EnvironmentVariables
|
|
15
15
|
|
|
16
16
|
if sys.version_info >= (3, 11):
|
|
17
17
|
from enum import StrEnum
|
|
@@ -41,7 +41,7 @@ class WorkflowsStoreType(StrEnum):
|
|
|
41
41
|
URL = "url"
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
class Config(BaseModel):
|
|
44
|
+
class Config(BaseModel, arbitrary_types_allowed=True):
|
|
45
45
|
workflows_store_type: WorkflowsStoreType = WorkflowsStoreType.FILE
|
|
46
46
|
data_store_path: Path = Field(default_factory=lambda: Path.cwd() / "data")
|
|
47
47
|
|
|
@@ -51,7 +51,7 @@ class Config(BaseModel):
|
|
|
51
51
|
default=None,
|
|
52
52
|
)
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
cdf_auth_config: EnvironmentVariables = Field(default_factory=EnvironmentVariables.default)
|
|
55
55
|
cdf_default_dataset_id: int = 0
|
|
56
56
|
load_examples: bool = True
|
|
57
57
|
|
|
@@ -60,9 +60,64 @@ class Config(BaseModel):
|
|
|
60
60
|
download_workflows_from_cdf: bool = Field(
|
|
61
61
|
default=False, description="Downloads all workflows from CDF automatically and stores them locally"
|
|
62
62
|
)
|
|
63
|
-
|
|
64
63
|
stop_on_error: bool = False
|
|
65
64
|
|
|
65
|
+
@model_validator(mode="before")
|
|
66
|
+
def backwards_compatible(cls, data: Any):
|
|
67
|
+
if not isinstance(data, dict):
|
|
68
|
+
return data
|
|
69
|
+
if "cdf_client" in data:
|
|
70
|
+
cdf_client = data["cdf_client"]
|
|
71
|
+
if isinstance(cdf_client, dict):
|
|
72
|
+
if "base_url" in cdf_client:
|
|
73
|
+
base_url = cdf_client["base_url"]
|
|
74
|
+
cluster = base_url.removeprefix("https://").removesuffix(".cognitedata.com")
|
|
75
|
+
else:
|
|
76
|
+
base_url, cluster = "Missing", "Missing"
|
|
77
|
+
if "scopes" in cdf_client:
|
|
78
|
+
scopes = cdf_client["scopes"]
|
|
79
|
+
if isinstance(scopes, list):
|
|
80
|
+
scopes = ",".join(scopes)
|
|
81
|
+
else:
|
|
82
|
+
scopes = "Missing"
|
|
83
|
+
data["cdf_auth_config"] = EnvironmentVariables(
|
|
84
|
+
CDF_PROJECT=cdf_client.get("project", "Missing"),
|
|
85
|
+
CDF_CLUSTER=cluster,
|
|
86
|
+
CDF_URL=base_url,
|
|
87
|
+
IDP_CLIENT_ID=cdf_client.get("client_id", "Missing"),
|
|
88
|
+
IDP_CLIENT_SECRET=cdf_client.get("client_secret", "Missing"),
|
|
89
|
+
IDP_TOKEN_URL=cdf_client.get("token_url", "Missing"),
|
|
90
|
+
IDP_SCOPES=scopes,
|
|
91
|
+
CDF_TIMEOUT=int(cdf_client.get("timeout", 60)),
|
|
92
|
+
CDF_MAX_WORKERS=int(cdf_client.get("max_workers", 3)),
|
|
93
|
+
)
|
|
94
|
+
return data
|
|
95
|
+
|
|
96
|
+
@staticmethod
|
|
97
|
+
@field_serializer("cdf_auth_config", when_used="always", return_type=dict)
|
|
98
|
+
def backwards_compatible_serialize(cdf_auth_config: EnvironmentVariables) -> dict[str, Any]:
|
|
99
|
+
output: dict[str, Any] = {}
|
|
100
|
+
config = cdf_auth_config
|
|
101
|
+
if config.CDF_PROJECT not in {"Missing", "NOT SET"}:
|
|
102
|
+
output["project"] = config.CDF_PROJECT
|
|
103
|
+
if config.CDF_CLUSTER not in {"Missing", "NOT SET"}:
|
|
104
|
+
output["cluster"] = config.CDF_CLUSTER
|
|
105
|
+
if config.CDF_URL:
|
|
106
|
+
output["base_url"] = config.CDF_URL
|
|
107
|
+
if config.IDP_CLIENT_ID:
|
|
108
|
+
output["client_id"] = config.IDP_CLIENT_ID
|
|
109
|
+
if config.IDP_CLIENT_SECRET:
|
|
110
|
+
output["client_secret"] = config.IDP_CLIENT_SECRET
|
|
111
|
+
if config.IDP_TOKEN_URL:
|
|
112
|
+
output["token_url"] = config.IDP_TOKEN_URL
|
|
113
|
+
if config.IDP_SCOPES:
|
|
114
|
+
output["scopes"] = config.idp_scopes
|
|
115
|
+
if config.CDF_TIMEOUT:
|
|
116
|
+
output["timeout"] = config.CDF_TIMEOUT
|
|
117
|
+
if config.CDF_MAX_WORKERS:
|
|
118
|
+
output["max_workers"] = config.CDF_MAX_WORKERS
|
|
119
|
+
return output
|
|
120
|
+
|
|
66
121
|
@property
|
|
67
122
|
def _dir_suffix(self) -> str:
|
|
68
123
|
is_test_running = "pytest" in sys.modules
|
|
@@ -93,7 +148,7 @@ class Config(BaseModel):
|
|
|
93
148
|
|
|
94
149
|
def to_yaml(self, filepath: Path):
|
|
95
150
|
# Parse as json to avoid Path and Enum objects
|
|
96
|
-
dump = json.loads(self.
|
|
151
|
+
dump = json.loads(self.model_dump_json())
|
|
97
152
|
|
|
98
153
|
with filepath.open("w") as f:
|
|
99
154
|
yaml.safe_dump(dump, f)
|
|
@@ -101,15 +156,27 @@ class Config(BaseModel):
|
|
|
101
156
|
@classmethod
|
|
102
157
|
def from_env(cls) -> Self:
|
|
103
158
|
missing = "Missing"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
base_url=os.environ
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
159
|
+
# This is to be backwards compatible with the old config
|
|
160
|
+
|
|
161
|
+
base_url: str | None = None
|
|
162
|
+
if "NEAT_CDF_BASE_URL" in os.environ:
|
|
163
|
+
base_url = os.environ["NEAT_CDF_BASE_URL"]
|
|
164
|
+
if isinstance(base_url, str):
|
|
165
|
+
cluster = base_url.removeprefix("https://").removesuffix(".cognitedata.com")
|
|
166
|
+
else:
|
|
167
|
+
cluster = missing
|
|
168
|
+
variables = EnvironmentVariables(
|
|
169
|
+
CDF_PROJECT=os.environ.get("NEAT_CDF_PROJECT", missing),
|
|
170
|
+
CDF_CLUSTER=cluster,
|
|
171
|
+
CDF_URL=base_url,
|
|
172
|
+
IDP_CLIENT_ID=os.environ.get("NEAT_CDF_CLIENT_ID"),
|
|
173
|
+
IDP_CLIENT_SECRET=os.environ.get("NEAT_CDF_CLIENT_SECRET"),
|
|
174
|
+
IDP_TOKEN_URL=os.environ.get("NEAT_CDF_TOKEN_URL"),
|
|
175
|
+
IDP_SCOPES=os.environ.get("NEAT_CDF_SCOPES"),
|
|
176
|
+
CDF_TIMEOUT=int(os.environ["NEAT_CDF_CLIENT_TIMEOUT"] if "NEAT_CDF_CLIENT_TIMEOUT" in os.environ else 60),
|
|
177
|
+
CDF_MAX_WORKERS=int(
|
|
178
|
+
os.environ["NEAT_CDF_CLIENT_MAX_WORKERS"] if "NEAT_CDF_CLIENT_MAX_WORKERS" in os.environ else 3
|
|
179
|
+
),
|
|
113
180
|
)
|
|
114
181
|
|
|
115
182
|
if workflow_downloader_filter_value := os.environ.get("NEAT_WORKFLOW_DOWNLOADER_FILTER", None):
|
|
@@ -118,7 +185,7 @@ class Config(BaseModel):
|
|
|
118
185
|
workflow_downloader_filter = None
|
|
119
186
|
|
|
120
187
|
return cls(
|
|
121
|
-
|
|
188
|
+
cdf_auth_config=variables,
|
|
122
189
|
workflows_store_type=os.environ.get( # type: ignore[arg-type]
|
|
123
190
|
"NEAT_WORKFLOWS_STORE_TYPE", WorkflowsStoreType.FILE
|
|
124
191
|
),
|
{cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_assets.py
RENAMED
|
@@ -12,7 +12,7 @@ from rdflib import RDF, Literal, Namespace
|
|
|
12
12
|
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
13
13
|
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
14
14
|
from cognite.neat.graph.models import Triple
|
|
15
|
-
from cognite.neat.utils.
|
|
15
|
+
from cognite.neat.utils.auxiliary import create_sha256_hash, string_to_ideal_type
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class AssetsExtractor(BaseExtractor):
|
{cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_events.py
RENAMED
|
@@ -12,7 +12,7 @@ from rdflib import RDF, Literal, Namespace, URIRef
|
|
|
12
12
|
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
13
13
|
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
14
14
|
from cognite.neat.graph.models import Triple
|
|
15
|
-
from cognite.neat.utils.
|
|
15
|
+
from cognite.neat.utils.auxiliary import string_to_ideal_type
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class EventsExtractor(BaseExtractor):
|
{cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_files.py
RENAMED
|
@@ -13,7 +13,7 @@ from rdflib import RDF, Literal, Namespace, URIRef
|
|
|
13
13
|
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
14
14
|
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
15
15
|
from cognite.neat.graph.models import Triple
|
|
16
|
-
from cognite.neat.utils.
|
|
16
|
+
from cognite.neat.utils.auxiliary import string_to_ideal_type
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class FilesExtractor(BaseExtractor):
|
{cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_labels.py
RENAMED
|
@@ -10,7 +10,7 @@ from rdflib import RDF, Literal, Namespace
|
|
|
10
10
|
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
11
11
|
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
12
12
|
from cognite.neat.graph.models import Triple
|
|
13
|
-
from cognite.neat.utils.
|
|
13
|
+
from cognite.neat.utils.auxiliary import create_sha256_hash
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class LabelsExtractor(BaseExtractor):
|
|
@@ -11,7 +11,7 @@ from rdflib import RDF, Literal, Namespace
|
|
|
11
11
|
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
12
12
|
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
13
13
|
from cognite.neat.graph.models import Triple
|
|
14
|
-
from cognite.neat.utils.
|
|
14
|
+
from cognite.neat.utils.auxiliary import create_sha256_hash
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class RelationshipsExtractor(BaseExtractor):
|
{cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_classic_cdf/_sequences.py
RENAMED
|
@@ -12,7 +12,7 @@ from rdflib import RDF, Literal, Namespace, URIRef
|
|
|
12
12
|
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
13
13
|
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
14
14
|
from cognite.neat.graph.models import Triple
|
|
15
|
-
from cognite.neat.utils.
|
|
15
|
+
from cognite.neat.utils.auxiliary import string_to_ideal_type
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class SequencesExtractor(BaseExtractor):
|
|
@@ -12,7 +12,7 @@ from rdflib import RDF, Literal, Namespace, URIRef
|
|
|
12
12
|
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
13
13
|
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
14
14
|
from cognite.neat.graph.models import Triple
|
|
15
|
-
from cognite.neat.utils.
|
|
15
|
+
from cognite.neat.utils.auxiliary import string_to_ideal_type
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class TimeSeriesExtractor(BaseExtractor):
|
|
@@ -9,7 +9,7 @@ from rdflib import RDF, RDFS, XSD, Literal, Namespace, URIRef
|
|
|
9
9
|
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
10
10
|
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
11
11
|
from cognite.neat.graph.models import Triple
|
|
12
|
-
from cognite.neat.utils.
|
|
12
|
+
from cognite.neat.utils.rdf_ import as_neat_compliant_uri
|
|
13
13
|
from cognite.neat.utils.xml_ import get_children, iterate_tree
|
|
14
14
|
|
|
15
15
|
DEXPI = Namespace("http://sandbox.dexpi.org/rdl/")
|
{cognite_neat-0.87.0 → cognite_neat-0.87.3}/cognite/neat/graph/extractors/_mock_graph_generator.py
RENAMED
|
@@ -17,7 +17,7 @@ from cognite.neat.rules.models import DMSRules, InformationRules
|
|
|
17
17
|
from cognite.neat.rules.models.data_types import DataType
|
|
18
18
|
from cognite.neat.rules.models.entities import ClassEntity, EntityTypes
|
|
19
19
|
from cognite.neat.rules.models.information import InformationProperty
|
|
20
|
-
from cognite.neat.utils.
|
|
20
|
+
from cognite.neat.utils.rdf_ import remove_namespace_from_uri
|
|
21
21
|
|
|
22
22
|
from ._base import BaseExtractor
|
|
23
23
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import json
|
|
2
2
|
from collections.abc import Iterable, Sequence
|
|
3
3
|
from dataclasses import dataclass, fields
|
|
4
4
|
from pathlib import Path
|
|
5
|
+
from typing import cast
|
|
5
6
|
|
|
7
|
+
import yaml
|
|
6
8
|
from cognite.client import CogniteClient
|
|
7
9
|
from cognite.client.data_classes import AssetWrite
|
|
8
|
-
from cognite.client.data_classes.capabilities import Capability
|
|
10
|
+
from cognite.client.data_classes.capabilities import AssetsAcl, Capability
|
|
11
|
+
from cognite.client.exceptions import CogniteAPIError
|
|
9
12
|
|
|
10
13
|
from cognite.neat.graph._tracking.base import Tracker
|
|
11
14
|
from cognite.neat.graph._tracking.log import LogTracker
|
|
@@ -81,10 +84,20 @@ class AssetLoader(CDFLoader[AssetWrite]):
|
|
|
81
84
|
self.rules = rules
|
|
82
85
|
self.data_set_id = data_set_id
|
|
83
86
|
self.use_labels = use_labels
|
|
84
|
-
self.use_orphanage = use_orphanage
|
|
85
87
|
|
|
86
|
-
self.
|
|
87
|
-
|
|
88
|
+
self.orphanage = (
|
|
89
|
+
AssetWrite.load(
|
|
90
|
+
{
|
|
91
|
+
"dataSetId": self.data_set_id,
|
|
92
|
+
"externalId": (
|
|
93
|
+
f"{asset_external_id_prefix or ''}orphanage-{data_set_id}" if use_orphanage else None
|
|
94
|
+
),
|
|
95
|
+
"name": "Orphanage",
|
|
96
|
+
"description": "Orphanage for assets whose parents do not exist",
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
if use_orphanage
|
|
100
|
+
else None
|
|
88
101
|
)
|
|
89
102
|
|
|
90
103
|
self.asset_external_id_prefix = asset_external_id_prefix
|
|
@@ -93,23 +106,6 @@ class AssetLoader(CDFLoader[AssetWrite]):
|
|
|
93
106
|
self._issues = NeatIssueList[NeatIssue](create_issues or [])
|
|
94
107
|
self._tracker: type[Tracker] = tracker or LogTracker
|
|
95
108
|
|
|
96
|
-
def _create_validation_classes(self) -> None:
|
|
97
|
-
# need to get back class-property pairs where are definition of
|
|
98
|
-
# asset implementations, extend InformationRulesAnalysis make it generic
|
|
99
|
-
|
|
100
|
-
# by default if there is not explicitly stated external_id
|
|
101
|
-
# use rdf:type and drop the prefix
|
|
102
|
-
|
|
103
|
-
# based on those create pydantic model AssetDefinition
|
|
104
|
-
# which will have .to_asset_write()
|
|
105
|
-
|
|
106
|
-
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
107
|
-
|
|
108
|
-
def categorize_assets(self, client: CogniteClient) -> None:
|
|
109
|
-
"""Categorize assets to those to be created, updated, decommissioned, or resurrected"""
|
|
110
|
-
|
|
111
|
-
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
112
|
-
|
|
113
109
|
def _load(self, stop_on_exception: bool = False) -> Iterable[AssetWrite | NeatIssue | type[_END_OF_CLASS]]:
|
|
114
110
|
if self._issues.has_errors and stop_on_exception:
|
|
115
111
|
raise self._issues.as_exception()
|
|
@@ -120,50 +116,79 @@ class AssetLoader(CDFLoader[AssetWrite]):
|
|
|
120
116
|
# There should already be an error in this case.
|
|
121
117
|
return
|
|
122
118
|
|
|
123
|
-
|
|
124
|
-
tracker = self._tracker(type(self).__name__, class_ids, "classes")
|
|
119
|
+
ordered_classes = AssetAnalysis(self.rules).class_topological_sort()
|
|
125
120
|
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
tracker = self._tracker(
|
|
122
|
+
type(self).__name__,
|
|
123
|
+
[repr(class_.id) for class_ in ordered_classes],
|
|
124
|
+
"classes",
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
processed_instances = set()
|
|
128
|
+
|
|
129
|
+
if self.orphanage:
|
|
130
|
+
yield self.orphanage
|
|
131
|
+
processed_instances.add(self.orphanage.external_id)
|
|
128
132
|
|
|
129
|
-
|
|
133
|
+
for class_ in ordered_classes:
|
|
134
|
+
tracker.start(repr(class_.id))
|
|
130
135
|
|
|
131
|
-
|
|
136
|
+
property_renaming_config = AssetAnalysis(self.rules).define_property_renaming_config(class_)
|
|
137
|
+
|
|
138
|
+
for identifier, properties in self.graph_store.read(class_.suffix):
|
|
132
139
|
fields = _process_properties(properties, property_renaming_config)
|
|
133
140
|
# set data set id and external id
|
|
134
|
-
fields["
|
|
135
|
-
fields["
|
|
141
|
+
fields["dataSetId"] = self.data_set_id
|
|
142
|
+
fields["externalId"] = identifier
|
|
143
|
+
|
|
144
|
+
# check on parent
|
|
145
|
+
if "parentExternalId" in fields and fields["parentExternalId"] not in processed_instances:
|
|
146
|
+
error = loader_issues.InvalidInstanceError(
|
|
147
|
+
type_="asset",
|
|
148
|
+
identifier=identifier,
|
|
149
|
+
reason=(
|
|
150
|
+
f"Parent asset {fields['parentExternalId']} does not exist or failed creation"
|
|
151
|
+
f""" {
|
|
152
|
+
f', moving the asset {identifier} under orphanage {self.orphanage.external_id}'
|
|
153
|
+
if self.orphanage
|
|
154
|
+
else ''}"""
|
|
155
|
+
),
|
|
156
|
+
)
|
|
157
|
+
tracker.issue(error)
|
|
158
|
+
if stop_on_exception:
|
|
159
|
+
raise error.as_exception()
|
|
160
|
+
yield error
|
|
161
|
+
|
|
162
|
+
# if orphanage is set asset will use orphanage as parent
|
|
163
|
+
if self.orphanage:
|
|
164
|
+
fields["parentExternalId"] = self.orphanage.external_id
|
|
165
|
+
|
|
166
|
+
# otherwise asset will be skipped
|
|
167
|
+
else:
|
|
168
|
+
continue
|
|
136
169
|
|
|
137
170
|
try:
|
|
138
171
|
yield AssetWrite.load(fields)
|
|
172
|
+
processed_instances.add(identifier)
|
|
139
173
|
except KeyError as e:
|
|
140
174
|
error = loader_issues.InvalidInstanceError(type_="asset", identifier=identifier, reason=str(e))
|
|
141
175
|
tracker.issue(error)
|
|
142
176
|
if stop_on_exception:
|
|
143
177
|
raise error.as_exception() from e
|
|
144
178
|
yield error
|
|
145
|
-
yield _END_OF_CLASS
|
|
146
179
|
|
|
147
|
-
|
|
148
|
-
# generate assets
|
|
149
|
-
# check for circular asset hierarchy
|
|
150
|
-
# check for orphaned assets
|
|
151
|
-
# batch upsert of assets to CDF (otherwise we will hit the API rate limit)
|
|
152
|
-
|
|
153
|
-
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
154
|
-
|
|
155
|
-
@classmethod
|
|
156
|
-
def _check_for_circular_asset_hierarchy(cls, assets: list[AssetWrite]) -> None:
|
|
157
|
-
"""Check for circular references in the asset rules"""
|
|
158
|
-
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
159
|
-
|
|
160
|
-
@classmethod
|
|
161
|
-
def _check_for_orphaned_assets(cls, assets: list[AssetWrite]) -> None:
|
|
162
|
-
"""Check for circular references in the asset rules"""
|
|
163
|
-
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
180
|
+
yield _END_OF_CLASS
|
|
164
181
|
|
|
165
182
|
def _get_required_capabilities(self) -> list[Capability]:
|
|
166
|
-
|
|
183
|
+
return [
|
|
184
|
+
AssetsAcl(
|
|
185
|
+
actions=[
|
|
186
|
+
AssetsAcl.Action.Write,
|
|
187
|
+
AssetsAcl.Action.Read,
|
|
188
|
+
],
|
|
189
|
+
scope=AssetsAcl.Scope.DataSet([self.data_set_id]),
|
|
190
|
+
)
|
|
191
|
+
]
|
|
167
192
|
|
|
168
193
|
def _upload_to_cdf(
|
|
169
194
|
self,
|
|
@@ -172,14 +197,45 @@ class AssetLoader(CDFLoader[AssetWrite]):
|
|
|
172
197
|
dry_run: bool,
|
|
173
198
|
read_issues: NeatIssueList,
|
|
174
199
|
) -> Iterable[UploadResult]:
|
|
175
|
-
|
|
200
|
+
try:
|
|
201
|
+
upserted = client.assets.upsert(items, mode="replace")
|
|
202
|
+
except CogniteAPIError as e:
|
|
203
|
+
result = UploadResult[str](name="Asset", issues=read_issues)
|
|
204
|
+
result.error_messages.append(str(e))
|
|
205
|
+
result.failed_upserted.update(item.as_id() for item in e.failed + e.unknown)
|
|
206
|
+
result.upserted.update(item.as_id() for item in e.successful)
|
|
207
|
+
yield result
|
|
208
|
+
else:
|
|
209
|
+
for asset in upserted:
|
|
210
|
+
result = UploadResult[str](name="asset", issues=read_issues)
|
|
211
|
+
result.upserted.add(cast(str, asset.external_id))
|
|
212
|
+
yield result
|
|
176
213
|
|
|
177
214
|
def write_to_file(self, filepath: Path) -> None:
|
|
178
|
-
|
|
215
|
+
if filepath.suffix not in [".json", ".yaml", ".yml"]:
|
|
216
|
+
raise ValueError(f"File format {filepath.suffix} is not supported")
|
|
217
|
+
dumped: dict[str, list] = {"assets": []}
|
|
218
|
+
for item in self.load(stop_on_exception=False):
|
|
219
|
+
key = {
|
|
220
|
+
AssetWrite: "assets",
|
|
221
|
+
NeatIssue: "issues",
|
|
222
|
+
_END_OF_CLASS: "end_of_class",
|
|
223
|
+
}.get(type(item))
|
|
224
|
+
if key is None:
|
|
225
|
+
# This should never happen, and is a bug in neat
|
|
226
|
+
raise ValueError(f"Item {item} is not supported. This is a bug in neat please report it.")
|
|
227
|
+
if key == "end_of_class":
|
|
228
|
+
continue
|
|
229
|
+
dumped[key].append(item.dump())
|
|
230
|
+
with filepath.open("w", encoding=self._encoding, newline=self._new_line) as f:
|
|
231
|
+
if filepath.suffix == ".json":
|
|
232
|
+
json.dump(dumped, f, indent=2)
|
|
233
|
+
else:
|
|
234
|
+
yaml.safe_dump(dumped, f, sort_keys=False)
|
|
179
235
|
|
|
180
236
|
|
|
181
237
|
def _process_properties(properties: dict[str, list[str]], property_renaming_config: dict[str, str]) -> dict:
|
|
182
|
-
metadata: dict[str, str] =
|
|
238
|
+
metadata: dict[str, str] = {}
|
|
183
239
|
fields: dict[str, str | dict] = {}
|
|
184
240
|
|
|
185
241
|
for original_property, values in properties.items():
|
|
@@ -8,11 +8,11 @@ from cognite.client import CogniteClient
|
|
|
8
8
|
from cognite.client import data_modeling as dm
|
|
9
9
|
from cognite.client.data_classes.capabilities import Capability, DataModelInstancesAcl
|
|
10
10
|
from cognite.client.data_classes.data_modeling import ViewId
|
|
11
|
+
from cognite.client.data_classes.data_modeling.data_types import ListablePropertyType
|
|
11
12
|
from cognite.client.data_classes.data_modeling.ids import InstanceId
|
|
12
13
|
from cognite.client.data_classes.data_modeling.views import SingleEdgeConnection
|
|
13
14
|
from cognite.client.exceptions import CogniteAPIError
|
|
14
|
-
from pydantic import ValidationInfo, create_model, field_validator
|
|
15
|
-
from pydantic.main import Model
|
|
15
|
+
from pydantic import BaseModel, ValidationInfo, create_model, field_validator
|
|
16
16
|
|
|
17
17
|
from cognite.neat.graph._tracking import LogTracker, Tracker
|
|
18
18
|
from cognite.neat.graph.issues import loader as loader_issues
|
|
@@ -20,8 +20,8 @@ from cognite.neat.graph.stores import NeatGraphStore
|
|
|
20
20
|
from cognite.neat.issues import NeatIssue, NeatIssueList
|
|
21
21
|
from cognite.neat.rules.models import DMSRules
|
|
22
22
|
from cognite.neat.rules.models.data_types import _DATA_TYPE_BY_DMS_TYPE, Json
|
|
23
|
+
from cognite.neat.utils.auxiliary import create_sha256_hash
|
|
23
24
|
from cognite.neat.utils.upload import UploadResult
|
|
24
|
-
from cognite.neat.utils.utils import create_sha256_hash
|
|
25
25
|
|
|
26
26
|
from ._base import CDFLoader
|
|
27
27
|
|
|
@@ -140,7 +140,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
140
140
|
|
|
141
141
|
def _create_validation_classes(
|
|
142
142
|
self, view: dm.View
|
|
143
|
-
) -> tuple[type[
|
|
143
|
+
) -> tuple[type[BaseModel], dict[str, dm.EdgeConnection], NeatIssueList]:
|
|
144
144
|
issues = NeatIssueList[NeatIssue]()
|
|
145
145
|
field_definitions: dict[str, tuple[type, Any]] = {}
|
|
146
146
|
edge_by_property: dict[str, dm.EdgeConnection] = {}
|
|
@@ -168,7 +168,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
168
168
|
if data_type == Json:
|
|
169
169
|
json_fields.append(prop_name)
|
|
170
170
|
python_type = data_type.python
|
|
171
|
-
if prop.type.is_list:
|
|
171
|
+
if isinstance(prop.type, ListablePropertyType) and prop.type.is_list:
|
|
172
172
|
python_type = list[python_type]
|
|
173
173
|
default_value: Any = prop.default_value
|
|
174
174
|
if prop.nullable:
|
|
@@ -223,7 +223,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
223
223
|
self,
|
|
224
224
|
identifier: str,
|
|
225
225
|
properties: dict[str, list[str]],
|
|
226
|
-
pydantic_cls: type[
|
|
226
|
+
pydantic_cls: type[BaseModel],
|
|
227
227
|
view_id: dm.ViewId,
|
|
228
228
|
) -> dm.InstanceApply:
|
|
229
229
|
created = pydantic_cls.model_validate(properties)
|
|
@@ -8,7 +8,7 @@ from rdflib.query import ResultRow
|
|
|
8
8
|
|
|
9
9
|
from cognite.neat.rules.models.entities import ClassEntity
|
|
10
10
|
from cognite.neat.rules.models.information import InformationRules
|
|
11
|
-
from cognite.neat.utils.
|
|
11
|
+
from cognite.neat.utils.rdf_ import remove_namespace_from_uri
|
|
12
12
|
|
|
13
13
|
from ._construct import build_construct_query
|
|
14
14
|
|
|
@@ -112,25 +112,34 @@ class Queries:
|
|
|
112
112
|
property_values: dict[str, list[str]] = defaultdict(list)
|
|
113
113
|
|
|
114
114
|
for subject, predicate, object_ in cast(list[ResultRow], self.graph.query(f"DESCRIBE <{instance_id}>")):
|
|
115
|
-
|
|
116
|
-
# or if the object is empty
|
|
117
|
-
if predicate != RDF.type and object_.lower() not in [
|
|
115
|
+
if object_.lower() not in [
|
|
118
116
|
"",
|
|
119
117
|
"none",
|
|
120
118
|
"nan",
|
|
121
119
|
"null",
|
|
122
120
|
]:
|
|
123
121
|
# we are skipping deep validation with Pydantic to remove namespace here
|
|
124
|
-
# as it
|
|
125
|
-
identifier,
|
|
126
|
-
(str, str
|
|
127
|
-
remove_namespace_from_uri(*(subject,
|
|
122
|
+
# as it reduces time to process triples by 10-15x
|
|
123
|
+
identifier, value = cast( # type: ignore[misc]
|
|
124
|
+
(str, str),
|
|
125
|
+
remove_namespace_from_uri(*(subject, object_), validation="prefix"),
|
|
128
126
|
) # type: ignore[misc, index]
|
|
129
127
|
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
# use-case: calling describe without renaming properties
|
|
129
|
+
# losing the namespace from the predicate!
|
|
130
|
+
if not property_renaming_config and predicate != RDF.type:
|
|
131
|
+
property_values[remove_namespace_from_uri(predicate, validation="prefix")].append(value)
|
|
132
|
+
|
|
133
|
+
# use-case: calling describe with renaming properties
|
|
134
|
+
# renaming the property to the new name, if the property is defined
|
|
135
|
+
# in the RULES sheet
|
|
136
|
+
elif property_renaming_config and (property_ := property_renaming_config.get(predicate, None)):
|
|
137
|
+
property_values[property_].append(value)
|
|
138
|
+
|
|
139
|
+
# use-case: skip the property if it is not defined in property_renaming_config
|
|
140
|
+
else:
|
|
141
|
+
continue
|
|
132
142
|
|
|
133
|
-
property_values[property_].append(value)
|
|
134
143
|
if property_values:
|
|
135
144
|
return (
|
|
136
145
|
identifier,
|
|
@@ -5,15 +5,15 @@ from rdflib import Graph, URIRef
|
|
|
5
5
|
|
|
6
6
|
from cognite.neat.rules.analysis import InformationAnalysis
|
|
7
7
|
from cognite.neat.rules.models._rdfpath import (
|
|
8
|
-
AllReferences,
|
|
9
8
|
Hop,
|
|
10
9
|
RDFPath,
|
|
10
|
+
SelfReferenceProperty,
|
|
11
11
|
SingleProperty,
|
|
12
12
|
Traversal,
|
|
13
13
|
)
|
|
14
14
|
from cognite.neat.rules.models.entities import ClassEntity
|
|
15
15
|
from cognite.neat.rules.models.information import InformationProperty, InformationRules
|
|
16
|
-
from cognite.neat.utils.
|
|
16
|
+
from cognite.neat.utils.collection_ import most_occurring_element
|
|
17
17
|
|
|
18
18
|
from ._shared import Triple, hop2property_path
|
|
19
19
|
|
|
@@ -121,7 +121,7 @@ def to_construct_triples(
|
|
|
121
121
|
templates.append(graph_template_triple)
|
|
122
122
|
|
|
123
123
|
# use case AllReferences: binding instance to certain rdf property
|
|
124
|
-
if isinstance(traversal,
|
|
124
|
+
if isinstance(traversal, SelfReferenceProperty):
|
|
125
125
|
graph_pattern_triple = Triple(
|
|
126
126
|
subject="BIND(?instance",
|
|
127
127
|
predicate="AS",
|