cognite-neat 0.87.3__tar.gz → 0.87.6__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.
Potentially problematic release.
This version of cognite-neat might be problematic. Click here for more details.
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/PKG-INFO +1 -1
- cognite_neat-0.87.6/cognite/neat/_version.py +1 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/routers/rules.py +1 -1
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_classic_cdf/_assets.py +8 -2
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_mock_graph_generator.py +2 -2
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/loaders/_base.py +17 -12
- cognite_neat-0.87.6/cognite/neat/graph/loaders/_rdf2asset.py +418 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/loaders/_rdf2dms.py +1 -1
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +2 -2
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/models/rules.py +1 -1
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/analysis/_asset.py +31 -1
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_dms2rules.py +7 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/dms/_exporter.py +2 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/dms/_rules.py +1 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/dms/_rules_input.py +3 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/information/_rules.py +1 -1
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/pyproject.toml +1 -1
- cognite_neat-0.87.3/cognite/neat/_version.py +0 -1
- cognite_neat-0.87.3/cognite/neat/graph/loaders/_rdf2asset.py +0 -253
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/LICENSE +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/README.md +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/_shared.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/asgi/metrics.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/configuration.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/context_manager/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/context_manager/manager.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/data_classes/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/data_classes/rest.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/explorer.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/routers/configuration.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/routers/core.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/routers/crud.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/routers/data_exploration.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/routers/metrics.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/routers/workflows.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/utils/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/utils/data_mapping.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/utils/logging.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/api/utils/query_templates.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/main.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/monitoring/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/monitoring/metrics.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/index.html +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/README.md +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css.map +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.LICENSE.txt +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.map +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/config.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/constants.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/exceptions.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/_shared.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/_tracking/base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/_tracking/log.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/examples/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/exceptions.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_classic_cdf/_labels.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_classic_cdf/_relationships.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_classic_cdf/_sequences.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/issues/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/issues/loader.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/loaders/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/models.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/queries/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/queries/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/queries/_construct.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/queries/_shared.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/stores/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/stores/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/stores/_oxrdflib.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/stores/_provenance.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/transformers/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/transformers/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/transformers/_classic_cdf.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/transformers/_rdfpath.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/issues.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/examples/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/exceptions.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/extractors/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/extractors/_graph_capturing_sheet.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/loaders/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/loaders/_asset_loader.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/loaders/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/loaders/_exceptions.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/loaders/core/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/loaders/core/labels.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/loaders/core/models.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/loaders/rdf_to_dms.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/loaders/validator.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/models.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/stores/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/stores/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/stores/_graphdb_store.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/stores/_memory_store.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/stores/_oxigraph_store.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/stores/_oxrdflib.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/stores/_rdf_to_graph.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/transformations/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/transformations/entity_matcher.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/transformations/query_generator/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/transformations/query_generator/sparql.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/graph/transformations/transformer.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/analysis.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/examples/Rules-Nordic44.xlsx +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/examples/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/examples/power-grid-containers.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/examples/power-grid-example.xlsx +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/examples/power-grid-model.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/examples/rules-template.xlsx +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/examples/skos-rules.xlsx +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exceptions.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/_core/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/_core/rules2labels.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/_rules2graphql.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/_rules2pydantic_models.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/_rules2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/_rules2triples.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_dict2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_dms2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_graph2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_json2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2classes.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2metadata.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2properties.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_xsd2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/models/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/models/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/models/raw_rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/models/rdfpath.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/models/tables.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/rules/models/value_types.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/py.typed +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/_shared.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/analysis/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/analysis/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/analysis/_information.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/examples/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/exceptions.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/exporters/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_inference2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_owl2rules/_owl2classes.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_owl2rules/_owl2properties.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/issues/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/issues/base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/issues/dms.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/issues/fileread.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/issues/formatters.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/issues/importing.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/issues/spreadsheet.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/issues/spreadsheet_file.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/_constants.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/_rdfpath.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/_types/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/_types/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/_types/_field.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/asset/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/asset/_converter.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/asset/_rules.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/asset/_rules_input.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/asset/_serializer.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/asset/_validation.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/data_types.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/dms/_converter.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/dms/_schema.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/dms/_serializer.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/dms/_validation.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/domain.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/entities.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/information/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/information/_converter.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/information/_rules_input.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/information/_serializer.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/information/_validation.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/rules/models/wrapped_entities.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/auth.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/auxiliary.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/cdf/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/cdf/data_classes.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/cdf/loaders/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/cdf/loaders/_base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/cdf/loaders/_data_modeling.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/cdf/loaders/_ingestion.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/collection_.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/rdf_.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/spreadsheet.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/text.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/time_.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/upload.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/utils/xml_.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/_exceptions.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/base.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/cdf_store.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/manager.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/migration/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/migration/steps.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/migration/wf_manifests.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/model.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/data_contracts.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/current/rules_importer.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/legacy/__init__.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/legacy/graph_contextualization.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/legacy/graph_extractor.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/legacy/graph_loader.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/legacy/graph_store.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/legacy/graph_transformer.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/legacy/rules_exporter.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/lib/legacy/rules_importer.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps/step_model.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/steps_registry.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/tasks.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/triggers.py +0 -0
- {cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/workflows/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.87.6"
|
|
@@ -166,7 +166,7 @@ def get_original_rules_from_workflow(workflow_name: str):
|
|
|
166
166
|
return {"error": f"Workflow {workflow_name} is not found"}
|
|
167
167
|
context = workflow.get_context()
|
|
168
168
|
rules_data = context["RulesData"]
|
|
169
|
-
if type(rules_data)
|
|
169
|
+
if type(rules_data) is not RulesData:
|
|
170
170
|
return {"error": "RulesData is not found in workflow context"}
|
|
171
171
|
|
|
172
172
|
return Response(content=rules_data.rules.model_dump_json(), media_type="application/json")
|
{cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_classic_cdf/_assets.py
RENAMED
|
@@ -30,6 +30,8 @@ class AssetsExtractor(BaseExtractor):
|
|
|
30
30
|
limit the extraction to 1000 assets to test the setup.
|
|
31
31
|
unpack_metadata (bool, optional): Whether to unpack metadata. Defaults to False, which yields the metadata as
|
|
32
32
|
a JSON string.
|
|
33
|
+
skip_metadata_values (set[str] | frozenset[str] | None, optional): A set of values to skip when unpacking
|
|
34
|
+
metadata. Defaults to frozenset({"nan", "null", "none", ""}).
|
|
33
35
|
"""
|
|
34
36
|
|
|
35
37
|
_SPACE_PATTERN = re.compile(r"\s+")
|
|
@@ -42,6 +44,7 @@ class AssetsExtractor(BaseExtractor):
|
|
|
42
44
|
total: int | None = None,
|
|
43
45
|
limit: int | None = None,
|
|
44
46
|
unpack_metadata: bool = True,
|
|
47
|
+
skip_metadata_values: set[str] | frozenset[str] | None = frozenset({"nan", "null", "none", ""}),
|
|
45
48
|
):
|
|
46
49
|
self.namespace = namespace or DEFAULT_NAMESPACE
|
|
47
50
|
self.assets = assets
|
|
@@ -49,6 +52,7 @@ class AssetsExtractor(BaseExtractor):
|
|
|
49
52
|
self.total = total
|
|
50
53
|
self.limit = min(limit, total) if limit and total else limit
|
|
51
54
|
self.unpack_metadata = unpack_metadata
|
|
55
|
+
self.skip_metadata_values = skip_metadata_values
|
|
52
56
|
|
|
53
57
|
@classmethod
|
|
54
58
|
def from_dataset(
|
|
@@ -162,7 +166,7 @@ class AssetsExtractor(BaseExtractor):
|
|
|
162
166
|
if asset.source:
|
|
163
167
|
triples.append((id_, self.namespace.source, Literal(asset.source)))
|
|
164
168
|
|
|
165
|
-
# properties ref creation and update
|
|
169
|
+
# properties' ref creation and update
|
|
166
170
|
triples.append(
|
|
167
171
|
(
|
|
168
172
|
id_,
|
|
@@ -193,7 +197,9 @@ class AssetsExtractor(BaseExtractor):
|
|
|
193
197
|
if asset.metadata:
|
|
194
198
|
if self.unpack_metadata:
|
|
195
199
|
for key, value in asset.metadata.items():
|
|
196
|
-
if value
|
|
200
|
+
if value and (
|
|
201
|
+
self.skip_metadata_values is None or value.casefold() not in self.skip_metadata_values
|
|
202
|
+
):
|
|
197
203
|
triples.append(
|
|
198
204
|
(
|
|
199
205
|
id_,
|
{cognite_neat-0.87.3 → cognite_neat-0.87.6}/cognite/neat/graph/extractors/_mock_graph_generator.py
RENAMED
|
@@ -250,9 +250,9 @@ def _generate_mock_data_property_triples(
|
|
|
250
250
|
python_type = value_type.python
|
|
251
251
|
triples = []
|
|
252
252
|
for id_ in instance_ids:
|
|
253
|
-
if python_type
|
|
253
|
+
if python_type is int:
|
|
254
254
|
triples.append((id_, URIRef(namespace[property_]), Literal(random.randint(1, 1983))))
|
|
255
|
-
elif python_type
|
|
255
|
+
elif python_type is float:
|
|
256
256
|
triples.append((id_, URIRef(namespace[property_]), Literal(numpy.float32(random.uniform(1, 1983)))))
|
|
257
257
|
# generate string
|
|
258
258
|
else:
|
|
@@ -48,18 +48,23 @@ class BaseLoader(ABC, Generic[T_Output]):
|
|
|
48
48
|
class CDFLoader(BaseLoader[T_Output]):
|
|
49
49
|
_UPLOAD_BATCH_SIZE: ClassVar[int] = 1000
|
|
50
50
|
|
|
51
|
-
def load_into_cdf(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
def load_into_cdf(
|
|
52
|
+
self, client: CogniteClient, dry_run: bool = False, check_client: bool = True
|
|
53
|
+
) -> UploadResultList:
|
|
54
|
+
return UploadResultList(self.load_into_cdf_iterable(client, dry_run, check_client))
|
|
55
|
+
|
|
56
|
+
def load_into_cdf_iterable(
|
|
57
|
+
self, client: CogniteClient, dry_run: bool = False, check_client: bool = True
|
|
58
|
+
) -> Iterable[UploadResult]:
|
|
59
|
+
if check_client:
|
|
60
|
+
missing_capabilities = client.iam.verify_capabilities(self._get_required_capabilities())
|
|
61
|
+
if missing_capabilities:
|
|
62
|
+
upload_result = UploadResult[Hashable](name=type(self).__name__)
|
|
63
|
+
upload_result.issues.append(
|
|
64
|
+
FailedAuthorizationError(action="Upload to CDF", reason=str(missing_capabilities))
|
|
65
|
+
)
|
|
66
|
+
yield upload_result
|
|
67
|
+
return
|
|
63
68
|
|
|
64
69
|
issues = NeatIssueList[NeatIssue]()
|
|
65
70
|
items: list[T_Output] = []
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from collections.abc import Iterable, Sequence
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any, cast
|
|
5
|
+
|
|
6
|
+
import yaml
|
|
7
|
+
from cognite.client import CogniteClient
|
|
8
|
+
from cognite.client.data_classes import (
|
|
9
|
+
AssetWrite,
|
|
10
|
+
LabelDefinitionWrite,
|
|
11
|
+
RelationshipWrite,
|
|
12
|
+
)
|
|
13
|
+
from cognite.client.data_classes.capabilities import (
|
|
14
|
+
AssetsAcl,
|
|
15
|
+
Capability,
|
|
16
|
+
RelationshipsAcl,
|
|
17
|
+
)
|
|
18
|
+
from cognite.client.exceptions import CogniteAPIError, CogniteDuplicatedError
|
|
19
|
+
|
|
20
|
+
from cognite.neat.graph._tracking.base import Tracker
|
|
21
|
+
from cognite.neat.graph._tracking.log import LogTracker
|
|
22
|
+
from cognite.neat.graph.issues import loader as loader_issues
|
|
23
|
+
from cognite.neat.graph.stores import NeatGraphStore
|
|
24
|
+
from cognite.neat.issues import NeatIssue, NeatIssueList
|
|
25
|
+
from cognite.neat.rules.analysis._asset import AssetAnalysis
|
|
26
|
+
from cognite.neat.rules.models import AssetRules
|
|
27
|
+
from cognite.neat.rules.models.entities import ClassEntity, EntityTypes
|
|
28
|
+
from cognite.neat.utils.auxiliary import create_sha256_hash
|
|
29
|
+
from cognite.neat.utils.upload import UploadResult
|
|
30
|
+
|
|
31
|
+
from ._base import _END_OF_CLASS, CDFLoader
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class AssetLoader(CDFLoader[AssetWrite]):
|
|
35
|
+
"""Load Assets and their relationships from NeatGraph to Cognite Data Fusions.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
graph_store (NeatGraphStore): The graph store to load the data into.
|
|
39
|
+
rules (AssetRules): The rules to load the assets with.
|
|
40
|
+
data_set_id (int): The CDF data set id to load the Assets into.
|
|
41
|
+
use_orphanage (bool): Whether to use an orphanage for assets that are not part
|
|
42
|
+
of the hierarchy. Defaults to False.
|
|
43
|
+
use_labels (bool): Whether to use labels for assets. Defaults to False.
|
|
44
|
+
external_id_prefix (str | None): The prefix to use for the external ids. Defaults to None.
|
|
45
|
+
create_issues (Sequence[NeatIssue] | None): A list of issues that occurred during reading. Defaults to None.
|
|
46
|
+
tracker (type[Tracker] | None): The tracker to use. Defaults to None.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
def __init__(
|
|
50
|
+
self,
|
|
51
|
+
graph_store: NeatGraphStore,
|
|
52
|
+
rules: AssetRules,
|
|
53
|
+
data_set_id: int,
|
|
54
|
+
use_orphanage: bool = False,
|
|
55
|
+
use_labels: bool = False,
|
|
56
|
+
external_id_prefix: str | None = None,
|
|
57
|
+
create_issues: Sequence[NeatIssue] | None = None,
|
|
58
|
+
tracker: type[Tracker] | None = None,
|
|
59
|
+
):
|
|
60
|
+
super().__init__(graph_store)
|
|
61
|
+
|
|
62
|
+
self.rules = rules
|
|
63
|
+
self.data_set_id = data_set_id
|
|
64
|
+
|
|
65
|
+
self.use_labels = use_labels
|
|
66
|
+
|
|
67
|
+
self.orphanage = (
|
|
68
|
+
AssetWrite.load(
|
|
69
|
+
{
|
|
70
|
+
"dataSetId": self.data_set_id,
|
|
71
|
+
"externalId": (f"{external_id_prefix or ''}orphanage-{data_set_id}" if use_orphanage else None),
|
|
72
|
+
"name": "Orphanage",
|
|
73
|
+
"description": "Orphanage for assets whose parents do not exist",
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
if use_orphanage
|
|
77
|
+
else None
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
self.external_id_prefix = external_id_prefix
|
|
81
|
+
|
|
82
|
+
self.processed_assets: set[str] = set()
|
|
83
|
+
self._issues = NeatIssueList[NeatIssue](create_issues or [])
|
|
84
|
+
self._tracker: type[Tracker] = tracker or LogTracker
|
|
85
|
+
|
|
86
|
+
def _load(self, stop_on_exception: bool = False) -> Iterable[AssetWrite | NeatIssue | type[_END_OF_CLASS]]:
|
|
87
|
+
if self._issues.has_errors and stop_on_exception:
|
|
88
|
+
raise self._issues.as_exception()
|
|
89
|
+
elif self._issues.has_errors:
|
|
90
|
+
yield from self._issues
|
|
91
|
+
return
|
|
92
|
+
if not self.rules:
|
|
93
|
+
# There should already be an error in this case.
|
|
94
|
+
return
|
|
95
|
+
|
|
96
|
+
ordered_classes = AssetAnalysis(self.rules).class_topological_sort()
|
|
97
|
+
|
|
98
|
+
tracker = self._tracker(
|
|
99
|
+
type(self).__name__,
|
|
100
|
+
[repr(class_.id) for class_ in ordered_classes],
|
|
101
|
+
"classes",
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
if self.use_labels:
|
|
105
|
+
yield from self._create_labels()
|
|
106
|
+
|
|
107
|
+
if self.orphanage:
|
|
108
|
+
yield self.orphanage
|
|
109
|
+
self.processed_assets.add(cast(str, self.orphanage.external_id))
|
|
110
|
+
|
|
111
|
+
yield from self._create_assets(ordered_classes, tracker, stop_on_exception)
|
|
112
|
+
yield from self._create_relationship(ordered_classes, tracker, stop_on_exception)
|
|
113
|
+
|
|
114
|
+
def _create_labels(self) -> Iterable[Any]:
|
|
115
|
+
for label in AssetAnalysis(self.rules).define_labels():
|
|
116
|
+
yield LabelDefinitionWrite(name=label, external_id=label, data_set_id=self.data_set_id)
|
|
117
|
+
yield _END_OF_CLASS
|
|
118
|
+
|
|
119
|
+
def _create_assets(
|
|
120
|
+
self,
|
|
121
|
+
ordered_classes: list[ClassEntity],
|
|
122
|
+
tracker: Tracker,
|
|
123
|
+
stop_on_exception: bool,
|
|
124
|
+
) -> Iterable[Any]:
|
|
125
|
+
for class_ in ordered_classes:
|
|
126
|
+
tracker.start(repr(class_.id))
|
|
127
|
+
|
|
128
|
+
property_renaming_config = AssetAnalysis(self.rules).define_asset_property_renaming_config(class_)
|
|
129
|
+
|
|
130
|
+
for identifier, properties in self.graph_store.read(class_.suffix):
|
|
131
|
+
identifier = f"{self.external_id_prefix or ''}{identifier}"
|
|
132
|
+
|
|
133
|
+
fields = _process_asset_properties(properties, property_renaming_config)
|
|
134
|
+
# set data set id and external id
|
|
135
|
+
fields["dataSetId"] = self.data_set_id
|
|
136
|
+
fields["externalId"] = identifier
|
|
137
|
+
|
|
138
|
+
if self.use_labels:
|
|
139
|
+
fields["labels"] = [class_.suffix]
|
|
140
|
+
|
|
141
|
+
if parent_external_id := fields.get("parentExternalId", None):
|
|
142
|
+
fields["parentExternalId"] = f"{self.external_id_prefix or ''}{parent_external_id}"
|
|
143
|
+
|
|
144
|
+
# check on parent
|
|
145
|
+
if "parentExternalId" in fields and fields["parentExternalId"] not in self.processed_assets:
|
|
146
|
+
error = loader_issues.InvalidInstanceError(
|
|
147
|
+
type_=EntityTypes.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
|
|
169
|
+
|
|
170
|
+
try:
|
|
171
|
+
yield AssetWrite.load(fields)
|
|
172
|
+
self.processed_assets.add(identifier)
|
|
173
|
+
except KeyError as e:
|
|
174
|
+
error = loader_issues.InvalidInstanceError(
|
|
175
|
+
type_=EntityTypes.asset, identifier=identifier, reason=str(e)
|
|
176
|
+
)
|
|
177
|
+
tracker.issue(error)
|
|
178
|
+
if stop_on_exception:
|
|
179
|
+
raise error.as_exception() from e
|
|
180
|
+
yield error
|
|
181
|
+
|
|
182
|
+
yield _END_OF_CLASS
|
|
183
|
+
|
|
184
|
+
def _create_relationship(
|
|
185
|
+
self,
|
|
186
|
+
ordered_classes: list[ClassEntity],
|
|
187
|
+
tracker: Tracker,
|
|
188
|
+
stop_on_exception: bool,
|
|
189
|
+
) -> Iterable[Any]:
|
|
190
|
+
for class_ in ordered_classes:
|
|
191
|
+
tracker.start(repr(class_.id))
|
|
192
|
+
|
|
193
|
+
property_renaming_config = AssetAnalysis(self.rules).define_relationship_property_renaming_config(class_)
|
|
194
|
+
|
|
195
|
+
# class does not have any relationship properties
|
|
196
|
+
if not property_renaming_config:
|
|
197
|
+
continue
|
|
198
|
+
|
|
199
|
+
for source_external_id, properties in self.graph_store.read(class_.suffix):
|
|
200
|
+
relationships = _process_relationship_properties(properties, property_renaming_config)
|
|
201
|
+
|
|
202
|
+
source_external_id = f"{self.external_id_prefix or ''}{source_external_id}"
|
|
203
|
+
|
|
204
|
+
# check if source asset exists
|
|
205
|
+
if source_external_id not in self.processed_assets:
|
|
206
|
+
error = loader_issues.InvalidInstanceError(
|
|
207
|
+
type_=EntityTypes.relationship,
|
|
208
|
+
identifier=source_external_id,
|
|
209
|
+
reason=(
|
|
210
|
+
f"Asset {source_external_id} does not exist! "
|
|
211
|
+
"Aborting creation of relationships which use this asset as the source."
|
|
212
|
+
),
|
|
213
|
+
)
|
|
214
|
+
tracker.issue(error)
|
|
215
|
+
if stop_on_exception:
|
|
216
|
+
raise error.as_exception()
|
|
217
|
+
yield error
|
|
218
|
+
continue
|
|
219
|
+
|
|
220
|
+
for label, target_external_ids in relationships.items():
|
|
221
|
+
# we can have 1-many relationships
|
|
222
|
+
for target_external_id in target_external_ids:
|
|
223
|
+
target_external_id = f"{self.external_id_prefix or ''}{target_external_id}"
|
|
224
|
+
# check if source asset exists
|
|
225
|
+
if target_external_id not in self.processed_assets:
|
|
226
|
+
error = loader_issues.InvalidInstanceError(
|
|
227
|
+
type_=EntityTypes.relationship,
|
|
228
|
+
identifier=target_external_id,
|
|
229
|
+
reason=(
|
|
230
|
+
f"Asset {target_external_id} does not exist! "
|
|
231
|
+
f"Cannot create relationship between {source_external_id}"
|
|
232
|
+
f" and {target_external_id}. "
|
|
233
|
+
),
|
|
234
|
+
)
|
|
235
|
+
tracker.issue(error)
|
|
236
|
+
if stop_on_exception:
|
|
237
|
+
raise error.as_exception()
|
|
238
|
+
yield error
|
|
239
|
+
continue
|
|
240
|
+
|
|
241
|
+
external_id = "relationship_" + create_sha256_hash(f"{source_external_id}_{target_external_id}")
|
|
242
|
+
try:
|
|
243
|
+
yield RelationshipWrite(
|
|
244
|
+
external_id=external_id,
|
|
245
|
+
source_external_id=source_external_id,
|
|
246
|
+
target_external_id=target_external_id,
|
|
247
|
+
source_type="asset",
|
|
248
|
+
target_type="asset",
|
|
249
|
+
data_set_id=self.data_set_id,
|
|
250
|
+
labels=[label] if self.use_labels else None,
|
|
251
|
+
)
|
|
252
|
+
except KeyError as e:
|
|
253
|
+
error = loader_issues.InvalidInstanceError(
|
|
254
|
+
type_=EntityTypes.relationship,
|
|
255
|
+
identifier=external_id,
|
|
256
|
+
reason=str(e),
|
|
257
|
+
)
|
|
258
|
+
tracker.issue(error)
|
|
259
|
+
if stop_on_exception:
|
|
260
|
+
raise error.as_exception() from e
|
|
261
|
+
yield error
|
|
262
|
+
|
|
263
|
+
yield _END_OF_CLASS
|
|
264
|
+
|
|
265
|
+
def _get_required_capabilities(self) -> list[Capability]:
|
|
266
|
+
return [
|
|
267
|
+
AssetsAcl(
|
|
268
|
+
actions=[
|
|
269
|
+
AssetsAcl.Action.Write,
|
|
270
|
+
AssetsAcl.Action.Read,
|
|
271
|
+
],
|
|
272
|
+
scope=AssetsAcl.Scope.DataSet([self.data_set_id]),
|
|
273
|
+
),
|
|
274
|
+
RelationshipsAcl(
|
|
275
|
+
actions=[
|
|
276
|
+
RelationshipsAcl.Action.Write,
|
|
277
|
+
RelationshipsAcl.Action.Read,
|
|
278
|
+
],
|
|
279
|
+
scope=RelationshipsAcl.Scope.DataSet([self.data_set_id]),
|
|
280
|
+
),
|
|
281
|
+
]
|
|
282
|
+
|
|
283
|
+
def _upload_to_cdf(
|
|
284
|
+
self,
|
|
285
|
+
client: CogniteClient,
|
|
286
|
+
items: list[AssetWrite] | list[RelationshipWrite] | list[LabelDefinitionWrite],
|
|
287
|
+
dry_run: bool,
|
|
288
|
+
read_issues: NeatIssueList,
|
|
289
|
+
) -> Iterable[UploadResult]:
|
|
290
|
+
if isinstance(items[0], AssetWrite) and all(isinstance(item, AssetWrite) for item in items):
|
|
291
|
+
yield from self._upload_assets_to_cdf(client, cast(list[AssetWrite], items), dry_run, read_issues)
|
|
292
|
+
elif isinstance(items[0], RelationshipWrite) and all(isinstance(item, RelationshipWrite) for item in items):
|
|
293
|
+
yield from self._upload_relationships_to_cdf(
|
|
294
|
+
client, cast(list[RelationshipWrite], items), dry_run, read_issues
|
|
295
|
+
)
|
|
296
|
+
elif isinstance(items[0], LabelDefinitionWrite) and all(
|
|
297
|
+
isinstance(item, LabelDefinitionWrite) for item in items
|
|
298
|
+
):
|
|
299
|
+
yield from self._upload_labels_to_cdf(client, cast(list[LabelDefinitionWrite], items), dry_run, read_issues)
|
|
300
|
+
else:
|
|
301
|
+
raise ValueError(f"Item {items[0]} is not supported. This is a bug in neat please report it.")
|
|
302
|
+
|
|
303
|
+
def _upload_labels_to_cdf(
|
|
304
|
+
self,
|
|
305
|
+
client: CogniteClient,
|
|
306
|
+
items: list[LabelDefinitionWrite],
|
|
307
|
+
dry_run: bool,
|
|
308
|
+
read_issues: NeatIssueList,
|
|
309
|
+
) -> Iterable[UploadResult]:
|
|
310
|
+
try:
|
|
311
|
+
created = client.labels.create(items)
|
|
312
|
+
except (CogniteAPIError, CogniteDuplicatedError) as e:
|
|
313
|
+
result = UploadResult[str](name="Label", issues=read_issues)
|
|
314
|
+
result.error_messages.append(str(e))
|
|
315
|
+
result.failed_created.update(item.external_id for item in e.failed + e.unknown)
|
|
316
|
+
result.created.update(item.external_id for item in e.successful)
|
|
317
|
+
yield result
|
|
318
|
+
else:
|
|
319
|
+
for label in created:
|
|
320
|
+
result = UploadResult[str](name="Label", issues=read_issues)
|
|
321
|
+
result.upserted.add(cast(str, label.external_id))
|
|
322
|
+
yield result
|
|
323
|
+
|
|
324
|
+
def _upload_assets_to_cdf(
|
|
325
|
+
self,
|
|
326
|
+
client: CogniteClient,
|
|
327
|
+
items: list[AssetWrite],
|
|
328
|
+
dry_run: bool,
|
|
329
|
+
read_issues: NeatIssueList,
|
|
330
|
+
) -> Iterable[UploadResult]:
|
|
331
|
+
try:
|
|
332
|
+
upserted = client.assets.upsert(items, mode="replace")
|
|
333
|
+
except CogniteAPIError as e:
|
|
334
|
+
result = UploadResult[str](name="Asset", issues=read_issues)
|
|
335
|
+
result.error_messages.append(str(e))
|
|
336
|
+
result.failed_upserted.update(item.external_id for item in e.failed + e.unknown)
|
|
337
|
+
result.upserted.update(item.external_id for item in e.successful)
|
|
338
|
+
yield result
|
|
339
|
+
else:
|
|
340
|
+
for asset in upserted:
|
|
341
|
+
result = UploadResult[str](name="Asset", issues=read_issues)
|
|
342
|
+
result.upserted.add(cast(str, asset.external_id))
|
|
343
|
+
yield result
|
|
344
|
+
|
|
345
|
+
def _upload_relationships_to_cdf(
|
|
346
|
+
self,
|
|
347
|
+
client: CogniteClient,
|
|
348
|
+
items: list[RelationshipWrite],
|
|
349
|
+
dry_run: bool,
|
|
350
|
+
read_issues: NeatIssueList,
|
|
351
|
+
) -> Iterable[UploadResult]:
|
|
352
|
+
try:
|
|
353
|
+
upserted = client.relationships.upsert(items, mode="replace")
|
|
354
|
+
except CogniteAPIError as e:
|
|
355
|
+
result = UploadResult[str](name="Relationship", issues=read_issues)
|
|
356
|
+
result.error_messages.append(str(e))
|
|
357
|
+
result.failed_upserted.update(item.external_id for item in e.failed + e.unknown)
|
|
358
|
+
result.upserted.update(item.external_id for item in e.successful)
|
|
359
|
+
yield result
|
|
360
|
+
else:
|
|
361
|
+
for relationship in upserted:
|
|
362
|
+
result = UploadResult[str](name="relationship", issues=read_issues)
|
|
363
|
+
result.upserted.add(cast(str, relationship.external_id))
|
|
364
|
+
yield result
|
|
365
|
+
|
|
366
|
+
def write_to_file(self, filepath: Path) -> None:
|
|
367
|
+
if filepath.suffix not in [".json", ".yaml", ".yml"]:
|
|
368
|
+
raise ValueError(f"File format {filepath.suffix} is not supported")
|
|
369
|
+
dumped: dict[str, list] = {"assets": [], "relationship": []}
|
|
370
|
+
for item in self.load(stop_on_exception=False):
|
|
371
|
+
key = {
|
|
372
|
+
AssetWrite: "assets",
|
|
373
|
+
RelationshipWrite: "relationship",
|
|
374
|
+
NeatIssue: "issues",
|
|
375
|
+
_END_OF_CLASS: "end_of_class",
|
|
376
|
+
}.get(type(item))
|
|
377
|
+
if key is None:
|
|
378
|
+
# This should never happen, and is a bug in neat
|
|
379
|
+
raise ValueError(f"Item {item} is not supported. This is a bug in neat please report it.")
|
|
380
|
+
if key == "end_of_class":
|
|
381
|
+
continue
|
|
382
|
+
dumped[key].append(item.dump())
|
|
383
|
+
with filepath.open("w", encoding=self._encoding, newline=self._new_line) as f:
|
|
384
|
+
if filepath.suffix == ".json":
|
|
385
|
+
json.dump(dumped, f, indent=2)
|
|
386
|
+
else:
|
|
387
|
+
yaml.safe_dump(dumped, f, sort_keys=False)
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def _process_asset_properties(properties: dict[str, list[str]], property_renaming_config: dict[str, str]) -> dict:
|
|
391
|
+
metadata: dict[str, str] = {}
|
|
392
|
+
fields: dict[str, str | dict] = {}
|
|
393
|
+
|
|
394
|
+
for original_property, values in properties.items():
|
|
395
|
+
if renamed_property := property_renaming_config.get(original_property, None):
|
|
396
|
+
if renamed_property.startswith("metadata."):
|
|
397
|
+
# Asset metadata contains only string values
|
|
398
|
+
metadata[original_property] = ", ".join(values)
|
|
399
|
+
else:
|
|
400
|
+
# Asset fields can contain only one value
|
|
401
|
+
fields[renamed_property] = values[0]
|
|
402
|
+
|
|
403
|
+
if metadata:
|
|
404
|
+
fields["metadata"] = metadata
|
|
405
|
+
|
|
406
|
+
return fields
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
def _process_relationship_properties(
|
|
410
|
+
properties: dict[str, list[str]], property_renaming_config: dict[str, str]
|
|
411
|
+
) -> dict:
|
|
412
|
+
relationships: dict[str, list[str]] = {}
|
|
413
|
+
|
|
414
|
+
for original_property, values in properties.items():
|
|
415
|
+
if renamed_property := property_renaming_config.get(original_property, None):
|
|
416
|
+
relationships[renamed_property] = values
|
|
417
|
+
|
|
418
|
+
return relationships
|
|
@@ -34,7 +34,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
34
34
|
data_model (dm.DataModel[dm.View] | None): The data model to load.
|
|
35
35
|
instance_space (str): The instance space to load the data into.
|
|
36
36
|
class_by_view_id (dict[ViewId, str] | None): A mapping from view id to class name. Defaults to None.
|
|
37
|
-
|
|
37
|
+
create_issues (Sequence[NeatIssue] | None): A list of issues that occurred during reading. Defaults to None.
|
|
38
38
|
tracker (type[Tracker] | None): The tracker to use. Defaults to None.
|
|
39
39
|
"""
|
|
40
40
|
|
|
@@ -241,9 +241,9 @@ def _generate_mock_data_property_triples(
|
|
|
241
241
|
python_type = XSD_VALUE_TYPE_MAPPINGS[value_type].python
|
|
242
242
|
triples = []
|
|
243
243
|
for id_ in instance_ids:
|
|
244
|
-
if python_type
|
|
244
|
+
if python_type is int:
|
|
245
245
|
triples.append((id_, URIRef(namespace[property_]), Literal(random.randint(1, 1983))))
|
|
246
|
-
elif python_type
|
|
246
|
+
elif python_type is float:
|
|
247
247
|
triples.append((id_, URIRef(namespace[property_]), Literal(numpy.float32(random.uniform(1, 1983)))))
|
|
248
248
|
# generate string
|
|
249
249
|
else:
|
|
@@ -886,7 +886,7 @@ class Property(Resource):
|
|
|
886
886
|
if self.property_type == "DatatypeProperty" and self.default:
|
|
887
887
|
default_value = self.default[0] if isinstance(self.default, list) else self.default
|
|
888
888
|
|
|
889
|
-
if type(default_value)
|
|
889
|
+
if type(default_value) is not self.expected_value_type.python:
|
|
890
890
|
try:
|
|
891
891
|
if isinstance(self.default, list):
|
|
892
892
|
updated_list = []
|
|
@@ -128,7 +128,7 @@ class AssetAnalysis(BaseAnalysis[AssetRules, AssetClass, AssetProperty, ClassEnt
|
|
|
128
128
|
implementation_type=EntityTypes.relationship,
|
|
129
129
|
)
|
|
130
130
|
|
|
131
|
-
def
|
|
131
|
+
def define_asset_property_renaming_config(self, class_: ClassEntity) -> dict[str, str]:
|
|
132
132
|
property_renaming_configuration = {}
|
|
133
133
|
|
|
134
134
|
if asset_definition := self.asset_definition().get(class_, None):
|
|
@@ -141,3 +141,33 @@ class AssetAnalysis(BaseAnalysis[AssetRules, AssetClass, AssetProperty, ClassEnt
|
|
|
141
141
|
property_renaming_configuration[property_] = f"{asset_property}.{property_}"
|
|
142
142
|
|
|
143
143
|
return property_renaming_configuration
|
|
144
|
+
|
|
145
|
+
def define_relationship_property_renaming_config(self, class_: ClassEntity) -> dict[str, str]:
|
|
146
|
+
property_renaming_configuration = {}
|
|
147
|
+
|
|
148
|
+
if relationship_definition := self.relationship_definition().get(class_, None):
|
|
149
|
+
for property_, transformation in relationship_definition.items():
|
|
150
|
+
relationship = cast(list[RelationshipEntity], transformation.implementation)[0]
|
|
151
|
+
|
|
152
|
+
if relationship.label:
|
|
153
|
+
property_renaming_configuration[property_] = relationship.label
|
|
154
|
+
else:
|
|
155
|
+
property_renaming_configuration[property_] = property_
|
|
156
|
+
|
|
157
|
+
return property_renaming_configuration
|
|
158
|
+
|
|
159
|
+
def define_labels(self) -> set:
|
|
160
|
+
labels = set()
|
|
161
|
+
|
|
162
|
+
for _, properties in AssetAnalysis(self.rules).relationship_definition().items():
|
|
163
|
+
for property_, definition in properties.items():
|
|
164
|
+
labels.add(
|
|
165
|
+
cast(RelationshipEntity, definition.implementation[0]).label
|
|
166
|
+
if cast(RelationshipEntity, definition.implementation[0]).label
|
|
167
|
+
else property_
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
for class_ in AssetAnalysis(self.rules).asset_definition().keys():
|
|
171
|
+
labels.add(class_.suffix)
|
|
172
|
+
|
|
173
|
+
return labels
|
|
@@ -346,6 +346,7 @@ class DMSImporter(BaseImporter):
|
|
|
346
346
|
value_type=value_type,
|
|
347
347
|
is_list=self._get_is_list(prop),
|
|
348
348
|
nullable=self._get_nullable(prop),
|
|
349
|
+
immutable=self._get_immutable(prop),
|
|
349
350
|
default=self._get_default(prop),
|
|
350
351
|
container=ContainerEntity.from_id(prop.container) if isinstance(prop, dm.MappedPropertyApply) else None,
|
|
351
352
|
container_property=prop.container_property_identifier if isinstance(prop, dm.MappedPropertyApply) else None,
|
|
@@ -402,6 +403,12 @@ class DMSImporter(BaseImporter):
|
|
|
402
403
|
else:
|
|
403
404
|
return None
|
|
404
405
|
|
|
406
|
+
def _get_immutable(self, prop: ViewPropertyApply) -> bool | None:
|
|
407
|
+
if isinstance(prop, dm.MappedPropertyApply):
|
|
408
|
+
return self._container_prop_unsafe(prop).immutable
|
|
409
|
+
else:
|
|
410
|
+
return None
|
|
411
|
+
|
|
405
412
|
def _get_is_list(self, prop: ViewPropertyApply) -> bool | None:
|
|
406
413
|
if isinstance(prop, dm.MappedPropertyApply):
|
|
407
414
|
prop_type = self._container_prop_unsafe(prop).type
|
|
@@ -290,7 +290,9 @@ class _DMSExporter:
|
|
|
290
290
|
type_ = type_cls()
|
|
291
291
|
container.properties[prop.container_property] = dm.ContainerProperty(
|
|
292
292
|
type=type_,
|
|
293
|
+
# If not set, nullable is True and immutable is False
|
|
293
294
|
nullable=prop.nullable if prop.nullable is not None else True,
|
|
295
|
+
immutable=prop.immutable if prop.immutable is not None else False,
|
|
294
296
|
default_value=prop.default,
|
|
295
297
|
name=prop.name,
|
|
296
298
|
description=prop.description,
|
|
@@ -177,6 +177,7 @@ class DMSProperty(SheetEntity):
|
|
|
177
177
|
connection: Literal["direct", "edge", "reverse"] | None = Field(None, alias="Connection")
|
|
178
178
|
value_type: DataType | ViewPropertyEntity | ViewEntity | DMSUnknownEntity = Field(alias="Value Type")
|
|
179
179
|
nullable: bool | None = Field(default=None, alias="Nullable")
|
|
180
|
+
immutable: bool | None = Field(default=None, alias="Immutable")
|
|
180
181
|
is_list: bool | None = Field(default=None, alias="Is List")
|
|
181
182
|
default: str | int | dict | None = Field(None, alias="Default")
|
|
182
183
|
reference: URLEntity | ReferenceEntity | None = Field(default=None, alias="Reference", union_mode="left_to_right")
|