cognite-neat 0.89.0__tar.gz → 0.90.1__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.89.0 → cognite_neat-0.90.1}/PKG-INFO +1 -1
- cognite_neat-0.90.1/cognite/neat/_version.py +1 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/constants.py +3 -3
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/__init__.py +2 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_classic_cdf/_base.py +2 -2
- cognite_neat-0.90.1/cognite/neat/graph/extractors/_dms.py +158 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_mock_graph_generator.py +49 -9
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/loaders/_rdf2dms.py +16 -13
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/models.py +1 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/queries/_base.py +4 -2
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/_base.py +1 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/warnings/__init__.py +2 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/warnings/_properties.py +12 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_dms2rules.py +1 -1
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_inference2rules.py +27 -32
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/dms/_exporter.py +16 -19
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/transformers/_converters.py +11 -2
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/store/_base.py +2 -2
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +5 -9
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/lib/current/graph_loader.py +2 -2
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/pyproject.toml +1 -1
- cognite_neat-0.89.0/cognite/neat/_version.py +0 -1
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/LICENSE +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/README.md +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/_shared.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/asgi/metrics.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/configuration.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/context_manager/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/context_manager/manager.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/data_classes/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/data_classes/rest.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/explorer.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/routers/configuration.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/routers/crud.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/routers/metrics.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/routers/workflows.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/utils/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/utils/data_mapping.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/utils/logging.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/api/utils/query_templates.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/main.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/monitoring/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/monitoring/metrics.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/index.html +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/README.md +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/config.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/_shared.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/_tracking/base.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/_tracking/log.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/examples/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_base.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_classic_cdf/_assets.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_classic_cdf/_labels.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_classic_cdf/_relationships.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_classic_cdf/_sequences.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/loaders/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/loaders/_base.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/loaders/_rdf2asset.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/queries/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/queries/_construct.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/queries/_shared.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/transformers/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/transformers/_base.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/transformers/_classic_cdf.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/transformers/_rdfpath.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/errors/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/errors/_external.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/errors/_general.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/errors/_properties.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/errors/_resources.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/errors/_workflow.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/formatters.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/warnings/_external.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/warnings/_general.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/warnings/_models.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/warnings/_resources.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/issues/warnings/user_modeling.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/py.typed +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/_shared.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/analysis/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/analysis/_asset.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/analysis/_base.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/analysis/_information.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/examples/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/exporters/_base.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_base.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_imf2rules/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2classes.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2metadata.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2properties.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2rules.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2classes.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2metadata.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2properties.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_rdf/_shared.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/_base_input.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/_base_rules.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/_rdfpath.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/_types.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/asset/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/asset/_rules.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/asset/_rules_input.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/asset/_serializer.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/asset/_validation.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/data_types.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/dms/_rules.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/dms/_rules_input.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/dms/_schema.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/dms/_serializer.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/dms/_validation.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/domain.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/entities/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/entities/_constants.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/entities/_loaders.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/entities/_multi_value.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/entities/_single_value.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/entities/_types.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/entities/_wrapped.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/information/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/information/_rules.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/information/_rules_input.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/information/_serializer.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/models/information/_validation.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/transformers/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/transformers/_base.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/transformers/_map_onto.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/transformers/_pipelines.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/rules/transformers/_verification.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/store/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/store/_provenance.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/auth.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/auxiliary.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/cdf/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/cdf/data_classes.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/cdf/loaders/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/cdf/loaders/_base.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/cdf/loaders/_data_modeling.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/cdf/loaders/_ingestion.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/collection_.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/rdf_.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/regex_patterns.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/spreadsheet.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/text.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/time_.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/upload.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/utils/xml_.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/base.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/cdf_store.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/manager.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/model.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/data_contracts.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/lib/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/lib/current/rules_importer.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps/step_model.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/steps_registry.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/tasks.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/triggers.py +0 -0
- {cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/workflows/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.90.1"
|
|
@@ -7,11 +7,11 @@ from cognite import neat
|
|
|
7
7
|
PACKAGE_DIRECTORY = Path(neat.__file__).parent
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
EXAMPLE_RULES = PACKAGE_DIRECTORY / "
|
|
11
|
-
EXAMPLE_GRAPHS = PACKAGE_DIRECTORY / "
|
|
12
|
-
_OLD_WORKFLOWS = PACKAGE_DIRECTORY / "legacy" / "workflows" / "examples"
|
|
10
|
+
EXAMPLE_RULES = PACKAGE_DIRECTORY / "rules" / "examples"
|
|
11
|
+
EXAMPLE_GRAPHS = PACKAGE_DIRECTORY / "graph" / "examples"
|
|
13
12
|
EXAMPLE_WORKFLOWS = PACKAGE_DIRECTORY / "workflows" / "examples"
|
|
14
13
|
|
|
14
|
+
DEFAULT_SPACE_URI = "http://purl.org/cognite/{space}#"
|
|
15
15
|
DEFAULT_NAMESPACE = Namespace("http://purl.org/cognite/neat#")
|
|
16
16
|
|
|
17
17
|
|
|
@@ -7,6 +7,7 @@ from ._classic_cdf._relationships import RelationshipsExtractor
|
|
|
7
7
|
from ._classic_cdf._sequences import SequencesExtractor
|
|
8
8
|
from ._classic_cdf._timeseries import TimeSeriesExtractor
|
|
9
9
|
from ._dexpi import DexpiExtractor
|
|
10
|
+
from ._dms import DMSExtractor
|
|
10
11
|
from ._mock_graph_generator import MockGraphGenerator
|
|
11
12
|
from ._rdf_file import RdfFileExtractor
|
|
12
13
|
|
|
@@ -22,6 +23,7 @@ __all__ = [
|
|
|
22
23
|
"LabelsExtractor",
|
|
23
24
|
"RdfFileExtractor",
|
|
24
25
|
"DexpiExtractor",
|
|
26
|
+
"DMSExtractor",
|
|
25
27
|
]
|
|
26
28
|
|
|
27
29
|
|
{cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_classic_cdf/_base.py
RENAMED
|
@@ -5,7 +5,7 @@ from collections.abc import Callable, Iterable, Set
|
|
|
5
5
|
from typing import Generic, TypeVar
|
|
6
6
|
|
|
7
7
|
from cognite.client.data_classes._base import CogniteResource
|
|
8
|
-
from rdflib import Literal, Namespace, URIRef
|
|
8
|
+
from rdflib import XSD, Literal, Namespace, URIRef
|
|
9
9
|
|
|
10
10
|
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
11
11
|
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
@@ -93,7 +93,7 @@ class ClassicCDFExtractor(BaseExtractor, ABC, Generic[T_CogniteResource]):
|
|
|
93
93
|
Literal(string_to_ideal_type(value)),
|
|
94
94
|
)
|
|
95
95
|
else:
|
|
96
|
-
yield id_, self.namespace.metadata, Literal(json.dumps(metadata))
|
|
96
|
+
yield id_, self.namespace.metadata, Literal(json.dumps(metadata), datatype=XSD._NS["json"])
|
|
97
97
|
|
|
98
98
|
def _get_rdf_type(self, item: T_CogniteResource) -> str:
|
|
99
99
|
type_ = self._default_rdf_type
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
from collections.abc import Iterable, Iterator
|
|
2
|
+
from typing import cast
|
|
3
|
+
|
|
4
|
+
from cognite.client import CogniteClient
|
|
5
|
+
from cognite.client import data_modeling as dm
|
|
6
|
+
from cognite.client.data_classes.data_modeling import DataModelIdentifier
|
|
7
|
+
from cognite.client.data_classes.data_modeling.instances import Instance, PropertyValue
|
|
8
|
+
from rdflib import RDF, XSD, Literal, Namespace, URIRef
|
|
9
|
+
|
|
10
|
+
from cognite.neat.constants import DEFAULT_SPACE_URI
|
|
11
|
+
from cognite.neat.graph.models import Triple
|
|
12
|
+
from cognite.neat.issues.errors import ResourceRetrievalError
|
|
13
|
+
|
|
14
|
+
from ._base import BaseExtractor
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DMSExtractor(BaseExtractor):
|
|
18
|
+
"""Extract data from Cognite Data Fusion DMS instances into Neat.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
items: The items to extract.
|
|
22
|
+
total: The total number of items to extract. If provided, this will be used to estimate the progress.
|
|
23
|
+
limit: The maximum number of items to extract.
|
|
24
|
+
overwrite_namespace: If provided, this will overwrite the space of the extracted items.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(
|
|
28
|
+
self,
|
|
29
|
+
items: Iterable[Instance],
|
|
30
|
+
total: int | None = None,
|
|
31
|
+
limit: int | None = None,
|
|
32
|
+
overwrite_namespace: Namespace | None = None,
|
|
33
|
+
) -> None:
|
|
34
|
+
self.items = items
|
|
35
|
+
self.total = total
|
|
36
|
+
self.limit = limit
|
|
37
|
+
self.overwrite_namespace = overwrite_namespace
|
|
38
|
+
|
|
39
|
+
@classmethod
|
|
40
|
+
def from_data_model(
|
|
41
|
+
cls, client: CogniteClient, data_model: DataModelIdentifier, limit: int | None = None
|
|
42
|
+
) -> "DMSExtractor":
|
|
43
|
+
"""Create an extractor from a data model.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
client: The Cognite client to use.
|
|
47
|
+
data_model: The data model to extract.
|
|
48
|
+
limit: The maximum number of instances to extract.
|
|
49
|
+
"""
|
|
50
|
+
retrieved = client.data_modeling.data_models.retrieve(data_model, inline_views=True)
|
|
51
|
+
if not retrieved:
|
|
52
|
+
raise ResourceRetrievalError(dm.DataModelId.load(data_model), "data model", "Data Model is missing in CDF")
|
|
53
|
+
return cls.from_views(client, retrieved.latest_version().views, limit)
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_views(cls, client: CogniteClient, views: Iterable[dm.View], limit: int | None = None) -> "DMSExtractor":
|
|
57
|
+
"""Create an extractor from a set of views.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
client: The Cognite client to use.
|
|
61
|
+
views: The views to extract.
|
|
62
|
+
limit: The maximum number of instances to extract.
|
|
63
|
+
"""
|
|
64
|
+
return cls(_InstanceIterator(client, views), total=None, limit=limit)
|
|
65
|
+
|
|
66
|
+
def extract(self) -> Iterable[Triple]:
|
|
67
|
+
for count, item in enumerate(self.items, 1):
|
|
68
|
+
if self.limit and count > self.limit:
|
|
69
|
+
break
|
|
70
|
+
yield from self._extract_instance(item)
|
|
71
|
+
|
|
72
|
+
def _extract_instance(self, instance: Instance) -> Iterable[Triple]:
|
|
73
|
+
if isinstance(instance, dm.Edge):
|
|
74
|
+
if not instance.properties:
|
|
75
|
+
yield (
|
|
76
|
+
self._as_uri_ref(instance.start_node),
|
|
77
|
+
self._as_uri_ref(instance.type),
|
|
78
|
+
self._as_uri_ref(instance.end_node),
|
|
79
|
+
)
|
|
80
|
+
return
|
|
81
|
+
else:
|
|
82
|
+
# If the edge has properties, we create a node for the edge and connect it to the start and end nodes.
|
|
83
|
+
id_ = self._as_uri_ref(instance)
|
|
84
|
+
yield id_, RDF.type, self._as_uri_ref(instance.type)
|
|
85
|
+
yield id_, RDF.type, self._get_namespace(instance.space).Edge
|
|
86
|
+
yield (
|
|
87
|
+
id_,
|
|
88
|
+
self._as_uri_ref(dm.DirectRelationReference(instance.space, "startNode")),
|
|
89
|
+
self._as_uri_ref(instance.start_node),
|
|
90
|
+
)
|
|
91
|
+
yield (
|
|
92
|
+
id_,
|
|
93
|
+
self._as_uri_ref(dm.DirectRelationReference(instance.space, "endNode")),
|
|
94
|
+
self._as_uri_ref(instance.end_node),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
elif isinstance(instance, dm.Node):
|
|
98
|
+
id_ = self._as_uri_ref(instance)
|
|
99
|
+
if instance.type:
|
|
100
|
+
type_ = self._as_uri_ref(cast(dm.DirectRelationReference, instance.type))
|
|
101
|
+
else:
|
|
102
|
+
type_ = self._get_namespace(instance.space).Node
|
|
103
|
+
|
|
104
|
+
yield id_, RDF.type, type_
|
|
105
|
+
else:
|
|
106
|
+
raise NotImplementedError(f"Unknown instance type {type(instance)}")
|
|
107
|
+
|
|
108
|
+
for view_id, properties in instance.properties.items():
|
|
109
|
+
namespace = self._get_namespace(view_id.space)
|
|
110
|
+
for key, value in properties.items():
|
|
111
|
+
for object_ in self._get_objects(value):
|
|
112
|
+
yield id_, namespace[key], object_
|
|
113
|
+
|
|
114
|
+
def _get_objects(self, value: PropertyValue) -> Iterable[Literal | URIRef]:
|
|
115
|
+
if isinstance(value, str | float | bool | int):
|
|
116
|
+
yield Literal(value)
|
|
117
|
+
elif isinstance(value, dict) and "space" in value and "externalId" in value:
|
|
118
|
+
yield self._as_uri_ref(dm.DirectRelationReference.load(value))
|
|
119
|
+
elif isinstance(value, dict):
|
|
120
|
+
# This object is a json object.
|
|
121
|
+
yield Literal(str(value), datatype=XSD._NS["json"])
|
|
122
|
+
elif isinstance(value, list):
|
|
123
|
+
for item in value:
|
|
124
|
+
yield from self._get_objects(item)
|
|
125
|
+
|
|
126
|
+
def _as_uri_ref(self, instance: Instance | dm.DirectRelationReference) -> URIRef:
|
|
127
|
+
return self._get_namespace(instance.space)[instance.external_id]
|
|
128
|
+
|
|
129
|
+
def _get_namespace(self, space: str) -> Namespace:
|
|
130
|
+
if self.overwrite_namespace:
|
|
131
|
+
return self.overwrite_namespace
|
|
132
|
+
return Namespace(DEFAULT_SPACE_URI.format(space=space))
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class _InstanceIterator(Iterator[Instance]):
|
|
136
|
+
def __init__(self, client: CogniteClient, views: Iterable[dm.View]):
|
|
137
|
+
self.client = client
|
|
138
|
+
self.views = views
|
|
139
|
+
|
|
140
|
+
def __iter__(self) -> Iterator[Instance]:
|
|
141
|
+
return self
|
|
142
|
+
|
|
143
|
+
def __next__(self) -> Instance: # type: ignore[misc]
|
|
144
|
+
for view in self.views:
|
|
145
|
+
# All nodes and edges with properties
|
|
146
|
+
yield from self.client.data_modeling.instances(chunk_size=None, instance_type="node", sources=[view])
|
|
147
|
+
yield from self.client.data_modeling.instances(chunk_size=None, instance_type="edge", sources=[view])
|
|
148
|
+
|
|
149
|
+
for prop in view.properties.values():
|
|
150
|
+
if isinstance(prop, dm.EdgeConnection):
|
|
151
|
+
# Get all edges with properties
|
|
152
|
+
yield from self.client.data_modeling.instances(
|
|
153
|
+
chunk_size=None,
|
|
154
|
+
instance_type="edge",
|
|
155
|
+
filter=dm.filters.Equals(
|
|
156
|
+
["edge", "type"], {"space": prop.type.space, "externalId": prop.type.external_id}
|
|
157
|
+
),
|
|
158
|
+
)
|
{cognite_neat-0.89.0 → cognite_neat-0.90.1}/cognite/neat/graph/extractors/_mock_graph_generator.py
RENAMED
|
@@ -17,7 +17,6 @@ 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.rules.transformers import DMSToInformation
|
|
21
20
|
from cognite.neat.utils.rdf_ import remove_namespace_from_uri
|
|
22
21
|
|
|
23
22
|
from ._base import BaseExtractor
|
|
@@ -43,6 +42,9 @@ class MockGraphGenerator(BaseExtractor):
|
|
|
43
42
|
allow_isolated_classes: bool = True,
|
|
44
43
|
):
|
|
45
44
|
if isinstance(rules, DMSRules):
|
|
45
|
+
# fixes potential issues with circular dependencies
|
|
46
|
+
from cognite.neat.rules.transformers import DMSToInformation
|
|
47
|
+
|
|
46
48
|
self.rules = DMSToInformation().transform(rules).rules
|
|
47
49
|
elif isinstance(rules, InformationRules):
|
|
48
50
|
self.rules = rules
|
|
@@ -152,21 +154,33 @@ def generate_triples(
|
|
|
152
154
|
# generate triples for connected classes
|
|
153
155
|
for class_ in generation_order:
|
|
154
156
|
triples += _generate_triples_per_class(
|
|
155
|
-
class_,
|
|
157
|
+
class_,
|
|
158
|
+
class_property_pairs,
|
|
159
|
+
sym_pairs,
|
|
160
|
+
instance_ids,
|
|
161
|
+
namespace,
|
|
162
|
+
stop_on_exception,
|
|
156
163
|
)
|
|
157
164
|
|
|
158
165
|
# generate triples for isolated classes
|
|
159
166
|
if allow_isolated_classes:
|
|
160
167
|
for class_ in set(class_count.keys()) - set(generation_order):
|
|
161
168
|
triples += _generate_triples_per_class(
|
|
162
|
-
class_,
|
|
169
|
+
class_,
|
|
170
|
+
class_property_pairs,
|
|
171
|
+
sym_pairs,
|
|
172
|
+
instance_ids,
|
|
173
|
+
namespace,
|
|
174
|
+
stop_on_exception,
|
|
163
175
|
)
|
|
164
176
|
|
|
165
177
|
return triples
|
|
166
178
|
|
|
167
179
|
|
|
168
180
|
def _get_generation_order(
|
|
169
|
-
class_linkage: pd.DataFrame,
|
|
181
|
+
class_linkage: pd.DataFrame,
|
|
182
|
+
parent_col: str = "source_class",
|
|
183
|
+
child_col: str = "target_class",
|
|
170
184
|
) -> dict:
|
|
171
185
|
parent_child_list: list[list[str]] = class_linkage[[parent_col, child_col]].values.tolist()
|
|
172
186
|
# Build a directed graph and a list of all names that have no parent
|
|
@@ -244,7 +258,10 @@ def _remove_non_requested_sym_pairs(class_linkage: pd.DataFrame, class_count: di
|
|
|
244
258
|
|
|
245
259
|
|
|
246
260
|
def _generate_mock_data_property_triples(
|
|
247
|
-
instance_ids: list[URIRef],
|
|
261
|
+
instance_ids: list[URIRef],
|
|
262
|
+
property_: str,
|
|
263
|
+
namespace: Namespace,
|
|
264
|
+
value_type: DataType,
|
|
248
265
|
) -> list[tuple[URIRef, URIRef, Literal]]:
|
|
249
266
|
"""Generates triples for data properties."""
|
|
250
267
|
|
|
@@ -254,7 +271,13 @@ def _generate_mock_data_property_triples(
|
|
|
254
271
|
if python_type is int:
|
|
255
272
|
triples.append((id_, URIRef(namespace[property_]), Literal(random.randint(1, 1983))))
|
|
256
273
|
elif python_type is float:
|
|
257
|
-
triples.append(
|
|
274
|
+
triples.append(
|
|
275
|
+
(
|
|
276
|
+
id_,
|
|
277
|
+
URIRef(namespace[property_]),
|
|
278
|
+
Literal(numpy.float32(random.uniform(1, 1983))),
|
|
279
|
+
)
|
|
280
|
+
)
|
|
258
281
|
# generate string
|
|
259
282
|
else:
|
|
260
283
|
triples.append(
|
|
@@ -293,7 +316,12 @@ def _generate_mock_object_property_triples(
|
|
|
293
316
|
|
|
294
317
|
if tuple((class_, property_definition.value_type)) in sym_pairs:
|
|
295
318
|
symmetric_class_properties = class_property_pairs[cast(ClassEntity, property_definition.value_type)]
|
|
296
|
-
candidates = list(
|
|
319
|
+
candidates = list(
|
|
320
|
+
filter(
|
|
321
|
+
lambda instance: instance.value_type == class_,
|
|
322
|
+
symmetric_class_properties,
|
|
323
|
+
)
|
|
324
|
+
)
|
|
297
325
|
symmetric_property = candidates[0]
|
|
298
326
|
if len(candidates) > 1:
|
|
299
327
|
warnings.warn(
|
|
@@ -310,10 +338,22 @@ def _generate_mock_object_property_triples(
|
|
|
310
338
|
target = instance_ids[cast(ClassEntity, property_definition.value_type)][
|
|
311
339
|
i % len(instance_ids[cast(ClassEntity, property_definition.value_type)])
|
|
312
340
|
]
|
|
313
|
-
triples += [
|
|
341
|
+
triples += [
|
|
342
|
+
(
|
|
343
|
+
URIRef(source),
|
|
344
|
+
URIRef(namespace[property_definition.property_]),
|
|
345
|
+
URIRef(target),
|
|
346
|
+
)
|
|
347
|
+
]
|
|
314
348
|
|
|
315
349
|
if symmetric_property:
|
|
316
|
-
triples += [
|
|
350
|
+
triples += [
|
|
351
|
+
(
|
|
352
|
+
URIRef(target),
|
|
353
|
+
URIRef(namespace[symmetric_property.property_]),
|
|
354
|
+
URIRef(source),
|
|
355
|
+
)
|
|
356
|
+
]
|
|
317
357
|
|
|
318
358
|
if symmetric_property:
|
|
319
359
|
class_property_pairs[cast(ClassEntity, property_definition.value_type)].remove(symmetric_property)
|
|
@@ -13,8 +13,10 @@ from cognite.client.data_classes.data_modeling.ids import InstanceId
|
|
|
13
13
|
from cognite.client.data_classes.data_modeling.views import SingleEdgeConnection
|
|
14
14
|
from cognite.client.exceptions import CogniteAPIError
|
|
15
15
|
from pydantic import BaseModel, ValidationInfo, create_model, field_validator
|
|
16
|
+
from rdflib import RDF
|
|
16
17
|
|
|
17
18
|
from cognite.neat.graph._tracking import LogTracker, Tracker
|
|
19
|
+
from cognite.neat.graph.models import InstanceType
|
|
18
20
|
from cognite.neat.issues import IssueList, NeatIssue, NeatIssueList
|
|
19
21
|
from cognite.neat.issues.errors import (
|
|
20
22
|
ResourceConvertionError,
|
|
@@ -108,7 +110,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
108
110
|
for view in self.data_model.views:
|
|
109
111
|
view_id = view.as_id()
|
|
110
112
|
tracker.start(repr(view_id))
|
|
111
|
-
pydantic_cls,
|
|
113
|
+
pydantic_cls, edge_by_type, issues = self._create_validation_classes(view) # type: ignore[var-annotated]
|
|
112
114
|
yield from issues
|
|
113
115
|
tracker.issue(issues)
|
|
114
116
|
class_name = self.class_by_view_id.get(view.as_id(), view.external_id)
|
|
@@ -122,7 +124,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
122
124
|
if stop_on_exception:
|
|
123
125
|
raise error from e
|
|
124
126
|
yield error
|
|
125
|
-
yield from self._create_edges(identifier, properties,
|
|
127
|
+
yield from self._create_edges(identifier, properties, edge_by_type, tracker)
|
|
126
128
|
tracker.finish(repr(view_id))
|
|
127
129
|
|
|
128
130
|
def write_to_file(self, filepath: Path) -> None:
|
|
@@ -147,16 +149,16 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
147
149
|
|
|
148
150
|
def _create_validation_classes(
|
|
149
151
|
self, view: dm.View
|
|
150
|
-
) -> tuple[type[BaseModel], dict[str, dm.EdgeConnection], NeatIssueList]:
|
|
152
|
+
) -> tuple[type[BaseModel], dict[str, tuple[str, dm.EdgeConnection]], NeatIssueList]:
|
|
151
153
|
issues = IssueList()
|
|
152
154
|
field_definitions: dict[str, tuple[type, Any]] = {}
|
|
153
|
-
edge_by_property: dict[str, dm.EdgeConnection] = {}
|
|
155
|
+
edge_by_property: dict[str, tuple[str, dm.EdgeConnection]] = {}
|
|
154
156
|
validators: dict[str, classmethod] = {}
|
|
155
157
|
direct_relation_by_property: dict[str, dm.DirectRelation] = {}
|
|
156
158
|
json_fields: list[str] = []
|
|
157
159
|
for prop_name, prop in view.properties.items():
|
|
158
160
|
if isinstance(prop, dm.EdgeConnection):
|
|
159
|
-
edge_by_property[
|
|
161
|
+
edge_by_property[prop.type.external_id] = prop_name, prop
|
|
160
162
|
if isinstance(prop, dm.MappedProperty):
|
|
161
163
|
if isinstance(prop.type, dm.DirectRelation):
|
|
162
164
|
direct_relation_by_property[prop_name] = prop.type
|
|
@@ -215,7 +217,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
215
217
|
|
|
216
218
|
def parse_direct_relation(cls, value: list, info: ValidationInfo) -> dict | list[dict]:
|
|
217
219
|
# We validate above that we only get one value for single direct relations.
|
|
218
|
-
if
|
|
220
|
+
if list.__name__ in _get_field_value_types(cls, info):
|
|
219
221
|
return [{"space": self.instance_space, "externalId": v} for v in value]
|
|
220
222
|
elif value:
|
|
221
223
|
return {"space": self.instance_space, "externalId": value[0]}
|
|
@@ -231,16 +233,17 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
231
233
|
def _create_node(
|
|
232
234
|
self,
|
|
233
235
|
identifier: str,
|
|
234
|
-
properties: dict[str, list[str]],
|
|
236
|
+
properties: dict[str | InstanceType, list[str]],
|
|
235
237
|
pydantic_cls: type[BaseModel],
|
|
236
238
|
view_id: dm.ViewId,
|
|
237
239
|
) -> dm.InstanceApply:
|
|
240
|
+
type_ = properties.pop(RDF.type, [None])[0]
|
|
238
241
|
created = pydantic_cls.model_validate(properties)
|
|
239
242
|
|
|
240
243
|
return dm.NodeApply(
|
|
241
244
|
space=self.instance_space,
|
|
242
245
|
external_id=identifier,
|
|
243
|
-
|
|
246
|
+
type=dm.DirectRelationReference(view_id.space, type_) if type_ is not None else None,
|
|
244
247
|
sources=[dm.NodeOrEdgeData(source=view_id, properties=dict(created.model_dump().items()))],
|
|
245
248
|
)
|
|
246
249
|
|
|
@@ -248,13 +251,13 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
248
251
|
self,
|
|
249
252
|
identifier: str,
|
|
250
253
|
properties: dict[str, list[str]],
|
|
251
|
-
|
|
254
|
+
edge_by_type: dict[str, tuple[str, dm.EdgeConnection]],
|
|
252
255
|
tracker: Tracker,
|
|
253
256
|
) -> Iterable[dm.EdgeApply | NeatIssue]:
|
|
254
|
-
for
|
|
255
|
-
if
|
|
257
|
+
for predicate, values in properties.items():
|
|
258
|
+
if predicate not in edge_by_type:
|
|
256
259
|
continue
|
|
257
|
-
edge =
|
|
260
|
+
prop_id, edge = edge_by_type[predicate]
|
|
258
261
|
if isinstance(edge, SingleEdgeConnection) and len(values) > 1:
|
|
259
262
|
error = ResourceDuplicatedError(
|
|
260
263
|
resource_type="edge",
|
|
@@ -264,7 +267,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
264
267
|
tracker.issue(error)
|
|
265
268
|
yield error
|
|
266
269
|
for target in values:
|
|
267
|
-
external_id = f"{identifier}.{
|
|
270
|
+
external_id = f"{identifier}.{prop_id}.{target}"
|
|
268
271
|
yield dm.EdgeApply(
|
|
269
272
|
space=self.instance_space,
|
|
270
273
|
external_id=(external_id if len(external_id) < 256 else create_sha256_hash(external_id)),
|
|
@@ -6,6 +6,7 @@ from rdflib import RDF, Graph, URIRef
|
|
|
6
6
|
from rdflib import Literal as RdfLiteral
|
|
7
7
|
from rdflib.query import ResultRow
|
|
8
8
|
|
|
9
|
+
from cognite.neat.graph.models import InstanceType
|
|
9
10
|
from cognite.neat.rules.models.entities import ClassEntity
|
|
10
11
|
from cognite.neat.rules.models.information import InformationRules
|
|
11
12
|
from cognite.neat.utils.rdf_ import remove_namespace_from_uri
|
|
@@ -98,7 +99,7 @@ class Queries:
|
|
|
98
99
|
self,
|
|
99
100
|
instance_id: URIRef,
|
|
100
101
|
property_renaming_config: dict | None = None,
|
|
101
|
-
) -> tuple[str, dict[str, list[str]]] | None:
|
|
102
|
+
) -> tuple[str, dict[str | InstanceType, list[str]]] | None:
|
|
102
103
|
"""DESCRIBE instance for a given class from the graph store
|
|
103
104
|
|
|
104
105
|
Args:
|
|
@@ -126,7 +127,8 @@ class Queries:
|
|
|
126
127
|
# losing the namespace from the predicate!
|
|
127
128
|
if not property_renaming_config and predicate != RDF.type:
|
|
128
129
|
property_values[remove_namespace_from_uri(predicate, validation="prefix")].append(value)
|
|
129
|
-
|
|
130
|
+
elif predicate == RDF.type:
|
|
131
|
+
property_values[RDF.type].append(value)
|
|
130
132
|
# use-case: calling describe with renaming properties
|
|
131
133
|
# renaming the property to the new name, if the property is defined
|
|
132
134
|
# in the RULES sheet
|
|
@@ -26,6 +26,7 @@ from ._properties import (
|
|
|
26
26
|
PropertyDefinitionDuplicatedWarning,
|
|
27
27
|
PropertyNotFoundWarning,
|
|
28
28
|
PropertyTypeNotSupportedWarning,
|
|
29
|
+
PropertyValueTypeUndefinedWarning,
|
|
29
30
|
)
|
|
30
31
|
from ._resources import (
|
|
31
32
|
ResourceNeatWarning,
|
|
@@ -49,6 +50,7 @@ __all__ = [
|
|
|
49
50
|
"PropertyDefinitionDuplicatedWarning",
|
|
50
51
|
"PropertyTypeNotSupportedWarning",
|
|
51
52
|
"PropertyNotFoundWarning",
|
|
53
|
+
"PropertyValueTypeUndefinedWarning",
|
|
52
54
|
"ResourceNeatWarning",
|
|
53
55
|
"ResourcesDuplicatedWarning",
|
|
54
56
|
"RegexViolationWarning",
|
|
@@ -42,3 +42,15 @@ class PropertyDefinitionDuplicatedWarning(PropertyWarning[T_Identifier]):
|
|
|
42
42
|
values: frozenset[str]
|
|
43
43
|
default_action: str
|
|
44
44
|
recommended_action: str | None = None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass(frozen=True)
|
|
48
|
+
class PropertyValueTypeUndefinedWarning(PropertyWarning[T_Identifier]):
|
|
49
|
+
"""The {resource_type} with identifier {identifier} has a property {property_name}
|
|
50
|
+
which has undefined value type. This may result in unexpected behavior when exporting rules.
|
|
51
|
+
{default_action}"""
|
|
52
|
+
|
|
53
|
+
extra = "Recommended action: {recommended_action}"
|
|
54
|
+
|
|
55
|
+
default_action: str
|
|
56
|
+
recommended_action: str | None = None
|
|
@@ -113,7 +113,7 @@ class DMSImporter(BaseImporter[DMSInputRules]):
|
|
|
113
113
|
DMSSchema(),
|
|
114
114
|
[
|
|
115
115
|
ResourceRetrievalError(
|
|
116
|
-
dm.DataModelId.load(
|
|
116
|
+
dm.DataModelId.load(data_model_id), # type: ignore[arg-type]
|
|
117
117
|
"data model",
|
|
118
118
|
"Data Model is missing in CDF",
|
|
119
119
|
)
|