cognite-neat 0.86.0__tar.gz → 0.87.0__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.86.0 → cognite_neat-0.87.0}/PKG-INFO +1 -1
- cognite_neat-0.87.0/cognite/neat/_version.py +1 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/constants.py +11 -9
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_mock_graph_generator.py +7 -8
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/loaders/__init__.py +5 -2
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/loaders/_base.py +13 -5
- cognite_neat-0.87.0/cognite/neat/graph/loaders/_rdf2asset.py +197 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/loaders/_rdf2dms.py +1 -1
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/queries/_base.py +1 -1
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/queries/_construct.py +2 -2
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/queries/_shared.py +20 -6
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/stores/_base.py +4 -3
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/extractors/_dexpi.py +0 -5
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/stores/_base.py +24 -8
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/stores/_graphdb_store.py +3 -2
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/stores/_memory_store.py +3 -3
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/stores/_oxigraph_store.py +8 -4
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/stores/_rdf_to_graph.py +5 -3
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/transformations/query_generator/sparql.py +48 -15
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_graph2rules.py +34 -7
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/models/raw_rules.py +18 -6
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/models/rules.py +32 -12
- cognite_neat-0.87.0/cognite/neat/rules/_shared.py +10 -0
- cognite_neat-0.87.0/cognite/neat/rules/analysis/__init__.py +6 -0
- cognite_neat-0.87.0/cognite/neat/rules/analysis/_asset.py +128 -0
- cognite_neat-0.87.0/cognite/neat/rules/analysis/_base.py +392 -0
- cognite_neat-0.87.0/cognite/neat/rules/analysis/_information.py +155 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/exporters/_rules2ontology.py +4 -4
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +2 -8
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_inference2rules.py +2 -2
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/_base.py +7 -7
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/asset/_rules.py +4 -5
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/dms/_converter.py +1 -2
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/dms/_rules.py +3 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/domain.py +5 -2
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/entities.py +2 -9
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/information/_rules.py +10 -8
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/information/_rules_input.py +1 -2
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/information/_validation.py +1 -1
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/current/graph_store.py +28 -8
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/legacy/graph_extractor.py +129 -27
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/legacy/graph_store.py +4 -4
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/pyproject.toml +1 -1
- cognite_neat-0.86.0/cognite/neat/_version.py +0 -1
- cognite_neat-0.86.0/cognite/neat/graph/loaders/_rdf2asset.py +0 -123
- cognite_neat-0.86.0/cognite/neat/rules/_shared.py +0 -5
- cognite_neat-0.86.0/cognite/neat/rules/analysis/__init__.py +0 -6
- cognite_neat-0.86.0/cognite/neat/rules/analysis/_base.py +0 -13
- cognite_neat-0.86.0/cognite/neat/rules/analysis/_information_rules.py +0 -476
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/LICENSE +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/README.md +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/_shared.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/asgi/metrics.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/configuration.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/context_manager/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/context_manager/manager.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/data_classes/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/data_classes/rest.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/explorer.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/routers/configuration.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/routers/core.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/routers/crud.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/routers/data_exploration.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/routers/metrics.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/routers/rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/routers/workflows.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/utils/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/utils/data_mapping.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/utils/logging.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/api/utils/query_templates.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/main.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/monitoring/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/monitoring/metrics.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/index.html +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/README.md +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css.map +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.LICENSE.txt +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.map +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/config.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/exceptions.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/_shared.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/_tracking/base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/_tracking/log.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/examples/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/exceptions.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_classic_cdf/_assets.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_classic_cdf/_labels.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_classic_cdf/_relationships.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_classic_cdf/_sequences.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/issues/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/issues/loader.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/models.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/queries/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/stores/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/stores/_oxrdflib.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/stores/_provenance.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/transformers/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/transformers/_base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/transformers/_classic_cdf.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/transformers/_rdfpath.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/issues.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/examples/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/exceptions.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/extractors/_base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/extractors/_graph_capturing_sheet.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/loaders/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/loaders/_asset_loader.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/loaders/_base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/loaders/_exceptions.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/loaders/core/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/loaders/core/labels.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/loaders/core/models.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/loaders/rdf_to_dms.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/loaders/validator.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/models.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/stores/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/stores/_oxrdflib.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/transformations/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/transformations/entity_matcher.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/transformations/query_generator/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/transformations/transformer.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/analysis.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/examples/Rules-Nordic44.xlsx +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/examples/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/examples/power-grid-containers.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/examples/power-grid-example.xlsx +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/examples/power-grid-model.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/examples/rules-template.xlsx +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/examples/skos-rules.xlsx +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exceptions.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/_base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/_core/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/_core/rules2labels.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/_rules2graphql.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/_rules2pydantic_models.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/_rules2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/_rules2triples.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_dict2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_dms2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_json2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2classes.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2metadata.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2properties.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_xsd2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/models/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/models/_base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/models/rdfpath.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/models/tables.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/rules/models/value_types.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/py.typed +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/examples/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/exceptions.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/exporters/_base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_dms2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_owl2rules/_owl2classes.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_owl2rules/_owl2properties.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/issues/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/issues/base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/issues/dms.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/issues/fileread.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/issues/formatters.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/issues/importing.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/issues/spreadsheet.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/issues/spreadsheet_file.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/_constants.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/_rdfpath.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/_types/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/_types/_base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/_types/_field.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/asset/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/asset/_converter.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/asset/_rules_input.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/asset/_serializer.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/asset/_validation.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/data_types.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/dms/_exporter.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/dms/_rules_input.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/dms/_schema.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/dms/_serializer.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/dms/_validation.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/information/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/information/_converter.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/information/_serializer.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/rules/models/wrapped_entities.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/auth.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/auxiliary.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/cdf.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/cdf_classes.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/cdf_loaders/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/cdf_loaders/_base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/cdf_loaders/_data_modeling.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/cdf_loaders/_ingestion.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/cdf_loaders/data_classes.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/exceptions.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/spreadsheet.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/text.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/upload.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/utils.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/utils/xml_.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/_exceptions.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/base.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/cdf_store.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/manager.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/migration/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/migration/steps.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/migration/wf_manifests.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/model.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/data_contracts.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/current/rules_importer.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/legacy/__init__.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/legacy/graph_contextualization.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/legacy/graph_loader.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/legacy/graph_transformer.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/legacy/rules_exporter.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/lib/legacy/rules_importer.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps/step_model.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/steps_registry.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/tasks.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/triggers.py +0 -0
- {cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/workflows/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.87.0"
|
|
@@ -14,15 +14,17 @@ EXAMPLE_WORKFLOWS = PACKAGE_DIRECTORY / "workflows" / "examples"
|
|
|
14
14
|
|
|
15
15
|
DEFAULT_NAMESPACE = Namespace("http://purl.org/cognite/neat#")
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
|
|
18
|
+
def get_default_prefixes() -> dict[str, Namespace]:
|
|
19
|
+
return {
|
|
20
|
+
"rdf": RDF._NS,
|
|
21
|
+
"rdfs": RDFS._NS,
|
|
22
|
+
"dct": DCTERMS._NS,
|
|
23
|
+
"skos": SKOS._NS,
|
|
24
|
+
"owl": OWL._NS,
|
|
25
|
+
"xsd": XSD._NS,
|
|
26
|
+
"pav": Namespace("http://purl.org/pav/"),
|
|
27
|
+
}
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
DEFAULT_URI = ""
|
{cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/graph/extractors/_mock_graph_generator.py
RENAMED
|
@@ -12,7 +12,7 @@ import pandas as pd
|
|
|
12
12
|
from rdflib import RDF, Literal, Namespace, URIRef
|
|
13
13
|
|
|
14
14
|
from cognite.neat.graph.models import Triple
|
|
15
|
-
from cognite.neat.rules.analysis import
|
|
15
|
+
from cognite.neat.rules.analysis import InformationAnalysis
|
|
16
16
|
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
|
|
@@ -50,8 +50,7 @@ class MockGraphGenerator(BaseExtractor):
|
|
|
50
50
|
|
|
51
51
|
if not class_count:
|
|
52
52
|
self.class_count = {
|
|
53
|
-
class_: 1
|
|
54
|
-
for class_ in InformationArchitectRulesAnalysis(self.rules).defined_classes(consider_inheritance=True)
|
|
53
|
+
class_: 1 for class_ in InformationAnalysis(self.rules).defined_classes(consider_inheritance=True)
|
|
55
54
|
}
|
|
56
55
|
elif all(isinstance(key, str) for key in class_count.keys()):
|
|
57
56
|
self.class_count = {
|
|
@@ -101,7 +100,7 @@ def generate_triples(
|
|
|
101
100
|
"""
|
|
102
101
|
|
|
103
102
|
namespace = rules.metadata.namespace
|
|
104
|
-
defined_classes =
|
|
103
|
+
defined_classes = InformationAnalysis(rules).defined_classes(consider_inheritance=True)
|
|
105
104
|
|
|
106
105
|
if non_existing_classes := set(class_count.keys()) - defined_classes:
|
|
107
106
|
msg = f"Class count contains classes {non_existing_classes} for which properties are not defined in Data Model!"
|
|
@@ -115,16 +114,16 @@ def generate_triples(
|
|
|
115
114
|
|
|
116
115
|
# Subset data model to only classes that are defined in class count
|
|
117
116
|
rules = (
|
|
118
|
-
|
|
117
|
+
InformationAnalysis(rules).subset_rules(set(class_count.keys()))
|
|
119
118
|
if defined_classes != set(class_count.keys())
|
|
120
119
|
else rules
|
|
121
120
|
)
|
|
122
121
|
|
|
123
|
-
class_linkage =
|
|
122
|
+
class_linkage = InformationAnalysis(rules).class_linkage().to_pandas()
|
|
124
123
|
|
|
125
124
|
# Remove one of symmetric pairs from class linkage to maintain proper linking
|
|
126
125
|
# among instances of symmetrically linked classes
|
|
127
|
-
if sym_pairs :=
|
|
126
|
+
if sym_pairs := InformationAnalysis(rules).symmetrically_connected_classes():
|
|
128
127
|
class_linkage = _remove_higher_occurring_sym_pair(class_linkage, sym_pairs)
|
|
129
128
|
|
|
130
129
|
# Remove any of symmetric pairs containing classes that are not present class count
|
|
@@ -134,7 +133,7 @@ def generate_triples(
|
|
|
134
133
|
generation_order = _prettify_generation_order(_get_generation_order(class_linkage))
|
|
135
134
|
|
|
136
135
|
# Generated simple view of data model
|
|
137
|
-
class_property_pairs =
|
|
136
|
+
class_property_pairs = InformationAnalysis(rules).classes_with_properties(consider_inheritance=True)
|
|
138
137
|
|
|
139
138
|
# pregenerate instance ids for each remaining class
|
|
140
139
|
instance_ids = {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
from ._base import BaseLoader, CDFLoader
|
|
2
|
+
from ._rdf2asset import AssetLoader
|
|
2
3
|
from ._rdf2dms import DMSLoader
|
|
3
4
|
|
|
4
|
-
__all__ = ["BaseLoader", "CDFLoader", "DMSLoader"]
|
|
5
|
+
__all__ = ["BaseLoader", "CDFLoader", "DMSLoader", "AssetLoader"]
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def _repr_html_() -> str:
|
|
@@ -11,7 +12,9 @@ def _repr_html_() -> str:
|
|
|
11
12
|
[
|
|
12
13
|
{
|
|
13
14
|
"Loader": name,
|
|
14
|
-
"Description":
|
|
15
|
+
"Description": (
|
|
16
|
+
globals()[name].__doc__.strip().split("\n")[0] if globals()[name].__doc__ else "Missing"
|
|
17
|
+
),
|
|
15
18
|
}
|
|
16
19
|
for name in __all__
|
|
17
20
|
if name not in ("BaseLoader", "CDFLoader")
|
|
@@ -15,6 +15,11 @@ from cognite.neat.utils.upload import UploadResult, UploadResultList
|
|
|
15
15
|
T_Output = TypeVar("T_Output")
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
# Sentinel value to indicate in the load method that all instances of a class have been loaded.
|
|
19
|
+
# https://en.wikipedia.org/wiki/Sentinel_value
|
|
20
|
+
class _END_OF_CLASS: ...
|
|
21
|
+
|
|
22
|
+
|
|
18
23
|
class BaseLoader(ABC, Generic[T_Output]):
|
|
19
24
|
_new_line = "\n"
|
|
20
25
|
_encoding = "utf-8"
|
|
@@ -28,10 +33,10 @@ class BaseLoader(ABC, Generic[T_Output]):
|
|
|
28
33
|
|
|
29
34
|
def load(self, stop_on_exception: bool = False) -> Iterable[T_Output | NeatIssue]:
|
|
30
35
|
"""Load the graph with data."""
|
|
31
|
-
return self._load(stop_on_exception)
|
|
36
|
+
return (item for item in self._load(stop_on_exception) if item is not _END_OF_CLASS) # type: ignore[misc]
|
|
32
37
|
|
|
33
38
|
@abstractmethod
|
|
34
|
-
def _load(self, stop_on_exception: bool = False) -> Iterable[T_Output | NeatIssue]:
|
|
39
|
+
def _load(self, stop_on_exception: bool = False) -> Iterable[T_Output | NeatIssue | type[_END_OF_CLASS]]:
|
|
35
40
|
"""Load the graph with data."""
|
|
36
41
|
pass
|
|
37
42
|
|
|
@@ -58,13 +63,16 @@ class CDFLoader(BaseLoader[T_Output]):
|
|
|
58
63
|
|
|
59
64
|
issues = NeatIssueList[NeatIssue]()
|
|
60
65
|
items: list[T_Output] = []
|
|
61
|
-
for result in self.
|
|
66
|
+
for result in self._load(stop_on_exception=False):
|
|
62
67
|
if isinstance(result, NeatIssue):
|
|
63
68
|
issues.append(result)
|
|
69
|
+
elif result is _END_OF_CLASS:
|
|
70
|
+
...
|
|
64
71
|
else:
|
|
65
|
-
|
|
72
|
+
# MyPy does not understand else means the item will be of type T_Output
|
|
73
|
+
items.append(result) # type: ignore[arg-type]
|
|
66
74
|
|
|
67
|
-
if len(items) >= self._UPLOAD_BATCH_SIZE:
|
|
75
|
+
if len(items) >= self._UPLOAD_BATCH_SIZE or result is _END_OF_CLASS:
|
|
68
76
|
yield from self._upload_to_cdf(client, items, dry_run, issues)
|
|
69
77
|
issues = NeatIssueList[NeatIssue]()
|
|
70
78
|
items = []
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
from collections import defaultdict
|
|
2
|
+
from collections.abc import Iterable, Sequence
|
|
3
|
+
from dataclasses import dataclass, fields
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from cognite.client import CogniteClient
|
|
7
|
+
from cognite.client.data_classes import AssetWrite
|
|
8
|
+
from cognite.client.data_classes.capabilities import Capability
|
|
9
|
+
|
|
10
|
+
from cognite.neat.graph._tracking.base import Tracker
|
|
11
|
+
from cognite.neat.graph._tracking.log import LogTracker
|
|
12
|
+
from cognite.neat.graph.issues import loader as loader_issues
|
|
13
|
+
from cognite.neat.graph.stores import NeatGraphStore
|
|
14
|
+
from cognite.neat.issues import NeatIssue, NeatIssueList
|
|
15
|
+
from cognite.neat.rules.analysis._asset import AssetAnalysis
|
|
16
|
+
from cognite.neat.rules.models import AssetRules
|
|
17
|
+
from cognite.neat.utils.upload import UploadResult
|
|
18
|
+
|
|
19
|
+
from ._base import _END_OF_CLASS, CDFLoader
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True)
|
|
23
|
+
class AssetLoaderMetadataKeys:
|
|
24
|
+
"""Class holding mapping between NEAT metadata key names and their desired names
|
|
25
|
+
in CDF Asset metadata
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
start_time: Start time key name
|
|
29
|
+
end_time: End time key name
|
|
30
|
+
update_time: Update time key name
|
|
31
|
+
resurrection_time: Resurrection time key name
|
|
32
|
+
identifier: Identifier key name
|
|
33
|
+
active: Active key name
|
|
34
|
+
type: Type key name
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
start_time: str = "start_time"
|
|
38
|
+
end_time: str = "end_time"
|
|
39
|
+
update_time: str = "update_time"
|
|
40
|
+
resurrection_time: str = "resurrection_time"
|
|
41
|
+
identifier: str = "identifier"
|
|
42
|
+
active: str = "active"
|
|
43
|
+
type: str = "type"
|
|
44
|
+
|
|
45
|
+
def as_aliases(self) -> dict[str, str]:
|
|
46
|
+
return {str(field.default): getattr(self, field.name) for field in fields(self)}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class AssetLoader(CDFLoader[AssetWrite]):
|
|
50
|
+
"""Load Assets from NeatGraph to Cognite Data Fusions.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
graph_store (NeatGraphStore): The graph store to load the data into.
|
|
54
|
+
rules (AssetRules): The rules to load the assets with.
|
|
55
|
+
data_set_id (int): The CDF data set id to load the Assets into.
|
|
56
|
+
use_orphanage (bool): Whether to use an orphanage for assets that are not part
|
|
57
|
+
of the hierarchy. Defaults to False.
|
|
58
|
+
use_labels (bool): Whether to use labels for assets. Defaults to False.
|
|
59
|
+
asset_external_id_prefix (str | None): The prefix to use for the external id of the assets.
|
|
60
|
+
Defaults to None.
|
|
61
|
+
metadata_keys (AssetLoaderMetadataKeys | None): Mapping between NEAT metadata key names and
|
|
62
|
+
their desired names in CDF Asset metadata. Defaults to None.
|
|
63
|
+
create_issues (Sequence[NeatIssue] | None): A list of issues that occurred during reading. Defaults to None.
|
|
64
|
+
tracker (type[Tracker] | None): The tracker to use. Defaults to None.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
def __init__(
|
|
68
|
+
self,
|
|
69
|
+
graph_store: NeatGraphStore,
|
|
70
|
+
rules: AssetRules,
|
|
71
|
+
data_set_id: int,
|
|
72
|
+
use_orphanage: bool = False,
|
|
73
|
+
use_labels: bool = False,
|
|
74
|
+
asset_external_id_prefix: str | None = None,
|
|
75
|
+
metadata_keys: AssetLoaderMetadataKeys | None = None,
|
|
76
|
+
create_issues: Sequence[NeatIssue] | None = None,
|
|
77
|
+
tracker: type[Tracker] | None = None,
|
|
78
|
+
):
|
|
79
|
+
super().__init__(graph_store)
|
|
80
|
+
|
|
81
|
+
self.rules = rules
|
|
82
|
+
self.data_set_id = data_set_id
|
|
83
|
+
self.use_labels = use_labels
|
|
84
|
+
self.use_orphanage = use_orphanage
|
|
85
|
+
|
|
86
|
+
self.orphanage_external_id = (
|
|
87
|
+
f"{asset_external_id_prefix or ''}orphanage-{data_set_id}" if use_orphanage else None
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
self.asset_external_id_prefix = asset_external_id_prefix
|
|
91
|
+
self.metadata_keys = metadata_keys or AssetLoaderMetadataKeys()
|
|
92
|
+
|
|
93
|
+
self._issues = NeatIssueList[NeatIssue](create_issues or [])
|
|
94
|
+
self._tracker: type[Tracker] = tracker or LogTracker
|
|
95
|
+
|
|
96
|
+
def _create_validation_classes(self) -> None:
|
|
97
|
+
# need to get back class-property pairs where are definition of
|
|
98
|
+
# asset implementations, extend InformationRulesAnalysis make it generic
|
|
99
|
+
|
|
100
|
+
# by default if there is not explicitly stated external_id
|
|
101
|
+
# use rdf:type and drop the prefix
|
|
102
|
+
|
|
103
|
+
# based on those create pydantic model AssetDefinition
|
|
104
|
+
# which will have .to_asset_write()
|
|
105
|
+
|
|
106
|
+
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
107
|
+
|
|
108
|
+
def categorize_assets(self, client: CogniteClient) -> None:
|
|
109
|
+
"""Categorize assets to those to be created, updated, decommissioned, or resurrected"""
|
|
110
|
+
|
|
111
|
+
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
112
|
+
|
|
113
|
+
def _load(self, stop_on_exception: bool = False) -> Iterable[AssetWrite | NeatIssue | type[_END_OF_CLASS]]:
|
|
114
|
+
if self._issues.has_errors and stop_on_exception:
|
|
115
|
+
raise self._issues.as_exception()
|
|
116
|
+
elif self._issues.has_errors:
|
|
117
|
+
yield from self._issues
|
|
118
|
+
return
|
|
119
|
+
if not self.rules:
|
|
120
|
+
# There should already be an error in this case.
|
|
121
|
+
return
|
|
122
|
+
|
|
123
|
+
class_ids = [repr(class_.class_.id) for class_ in self.rules.classes]
|
|
124
|
+
tracker = self._tracker(type(self).__name__, class_ids, "classes")
|
|
125
|
+
|
|
126
|
+
for class_ in self.rules.classes:
|
|
127
|
+
tracker.start(repr(class_.class_.id))
|
|
128
|
+
|
|
129
|
+
property_renaming_config = AssetAnalysis(self.rules).define_property_renaming_config(class_.class_)
|
|
130
|
+
|
|
131
|
+
for identifier, properties in self.graph_store.read(class_.class_.suffix):
|
|
132
|
+
fields = _process_properties(properties, property_renaming_config)
|
|
133
|
+
# set data set id and external id
|
|
134
|
+
fields["data_set_id"] = self.data_set_id
|
|
135
|
+
fields["external_id"] = identifier
|
|
136
|
+
|
|
137
|
+
try:
|
|
138
|
+
yield AssetWrite.load(fields)
|
|
139
|
+
except KeyError as e:
|
|
140
|
+
error = loader_issues.InvalidInstanceError(type_="asset", identifier=identifier, reason=str(e))
|
|
141
|
+
tracker.issue(error)
|
|
142
|
+
if stop_on_exception:
|
|
143
|
+
raise error.as_exception() from e
|
|
144
|
+
yield error
|
|
145
|
+
yield _END_OF_CLASS
|
|
146
|
+
|
|
147
|
+
def load_to_cdf(self, client: CogniteClient, dry_run: bool = False) -> Sequence[AssetWrite]:
|
|
148
|
+
# generate assets
|
|
149
|
+
# check for circular asset hierarchy
|
|
150
|
+
# check for orphaned assets
|
|
151
|
+
# batch upsert of assets to CDF (otherwise we will hit the API rate limit)
|
|
152
|
+
|
|
153
|
+
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
154
|
+
|
|
155
|
+
@classmethod
|
|
156
|
+
def _check_for_circular_asset_hierarchy(cls, assets: list[AssetWrite]) -> None:
|
|
157
|
+
"""Check for circular references in the asset rules"""
|
|
158
|
+
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
159
|
+
|
|
160
|
+
@classmethod
|
|
161
|
+
def _check_for_orphaned_assets(cls, assets: list[AssetWrite]) -> None:
|
|
162
|
+
"""Check for circular references in the asset rules"""
|
|
163
|
+
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
164
|
+
|
|
165
|
+
def _get_required_capabilities(self) -> list[Capability]:
|
|
166
|
+
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
167
|
+
|
|
168
|
+
def _upload_to_cdf(
|
|
169
|
+
self,
|
|
170
|
+
client: CogniteClient,
|
|
171
|
+
items: list[AssetWrite],
|
|
172
|
+
dry_run: bool,
|
|
173
|
+
read_issues: NeatIssueList,
|
|
174
|
+
) -> Iterable[UploadResult]:
|
|
175
|
+
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
176
|
+
|
|
177
|
+
def write_to_file(self, filepath: Path) -> None:
|
|
178
|
+
raise NotImplementedError("Not implemented yet, this is placeholder")
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def _process_properties(properties: dict[str, list[str]], property_renaming_config: dict[str, str]) -> dict:
|
|
182
|
+
metadata: dict[str, str] = defaultdict(str)
|
|
183
|
+
fields: dict[str, str | dict] = {}
|
|
184
|
+
|
|
185
|
+
for original_property, values in properties.items():
|
|
186
|
+
if renamed_property := property_renaming_config.get(original_property, None):
|
|
187
|
+
if renamed_property.startswith("metadata."):
|
|
188
|
+
# Asset metadata contains only string values
|
|
189
|
+
metadata[original_property] = ", ".join(values)
|
|
190
|
+
else:
|
|
191
|
+
# Asset fields can contain only one value
|
|
192
|
+
fields[renamed_property] = values[0]
|
|
193
|
+
|
|
194
|
+
if metadata:
|
|
195
|
+
fields["metadata"] = metadata
|
|
196
|
+
|
|
197
|
+
return fields
|
|
@@ -27,7 +27,7 @@ from ._base import CDFLoader
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
30
|
-
"""
|
|
30
|
+
"""Loads Instances to Cognite Data Fusion Data Model Service from NeatGraph.
|
|
31
31
|
|
|
32
32
|
Args:
|
|
33
33
|
graph_store (NeatGraphStore): The graph store to load the data into.
|
|
@@ -128,7 +128,7 @@ class Queries:
|
|
|
128
128
|
) # type: ignore[misc, index]
|
|
129
129
|
|
|
130
130
|
if property_renaming_config:
|
|
131
|
-
|
|
131
|
+
property_ = property_renaming_config.get(property_, property_)
|
|
132
132
|
|
|
133
133
|
property_values[property_].append(value)
|
|
134
134
|
if property_values:
|
|
@@ -3,7 +3,7 @@ from typing import cast
|
|
|
3
3
|
|
|
4
4
|
from rdflib import Graph, URIRef
|
|
5
5
|
|
|
6
|
-
from cognite.neat.rules.analysis import
|
|
6
|
+
from cognite.neat.rules.analysis import InformationAnalysis
|
|
7
7
|
from cognite.neat.rules.models._rdfpath import (
|
|
8
8
|
AllReferences,
|
|
9
9
|
Hop,
|
|
@@ -55,7 +55,7 @@ def build_construct_query(
|
|
|
55
55
|
"""
|
|
56
56
|
|
|
57
57
|
if (
|
|
58
|
-
transformations :=
|
|
58
|
+
transformations := InformationAnalysis(rules)
|
|
59
59
|
.class_property_pairs(only_rdfpath=True, consider_inheritance=True)
|
|
60
60
|
.get(class_, None)
|
|
61
61
|
):
|
|
@@ -6,7 +6,7 @@ from pydantic import BaseModel, ConfigDict, Field
|
|
|
6
6
|
from rdflib import Graph, Literal, Namespace
|
|
7
7
|
from rdflib.term import URIRef
|
|
8
8
|
|
|
9
|
-
from cognite.neat.constants import
|
|
9
|
+
from cognite.neat.constants import get_default_prefixes
|
|
10
10
|
from cognite.neat.rules.models._rdfpath import (
|
|
11
11
|
Hop,
|
|
12
12
|
Step,
|
|
@@ -37,24 +37,30 @@ class Triple(BaseModel):
|
|
|
37
37
|
return cls(subject=triple[0], predicate=triple[1], object=triple[2])
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
def generate_prefix_header(prefixes: dict[str, Namespace] =
|
|
40
|
+
def generate_prefix_header(prefixes: dict[str, Namespace] | None = None) -> str:
|
|
41
41
|
"""Generate prefix header which is added to SPARQL query and allows for shorten query statements
|
|
42
42
|
|
|
43
43
|
Parameters
|
|
44
44
|
----------
|
|
45
45
|
prefixes : dict
|
|
46
|
-
Dict containing prefix - namespace pairs,
|
|
46
|
+
Dict containing prefix - namespace pairs, defaults to internal set of prefixes
|
|
47
47
|
|
|
48
48
|
Returns
|
|
49
49
|
-------
|
|
50
50
|
str
|
|
51
51
|
Prefix header
|
|
52
52
|
"""
|
|
53
|
+
|
|
54
|
+
prefixes = prefixes or get_default_prefixes()
|
|
55
|
+
|
|
53
56
|
return "".join(f"PREFIX {key}:<{value}>\n" for key, value in prefixes.items())
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
def get_predicate_id(
|
|
57
|
-
graph: Graph,
|
|
60
|
+
graph: Graph,
|
|
61
|
+
subject_type_id: str,
|
|
62
|
+
object_type_id: str,
|
|
63
|
+
prefixes: dict[str, Namespace] | None = None,
|
|
58
64
|
) -> URIRef:
|
|
59
65
|
"""Returns predicate (aka property) URI (i.e., ID) that connects subject and object
|
|
60
66
|
|
|
@@ -67,13 +73,16 @@ def get_predicate_id(
|
|
|
67
73
|
object_type_id : str
|
|
68
74
|
ID of object type (aka object class)
|
|
69
75
|
prefixes : dict, optional
|
|
70
|
-
Dict containing prefix - namespace pairs,
|
|
76
|
+
Dict containing prefix - namespace pairs, defaults to internal set of prefixes
|
|
71
77
|
|
|
72
78
|
Returns
|
|
73
79
|
-------
|
|
74
80
|
URIRef
|
|
75
81
|
ID of predicate (aka property) connecting subject and object
|
|
76
82
|
"""
|
|
83
|
+
|
|
84
|
+
prefixes = prefixes or get_default_prefixes()
|
|
85
|
+
|
|
77
86
|
query = """
|
|
78
87
|
|
|
79
88
|
SELECT ?predicateTypeID
|
|
@@ -93,7 +102,11 @@ def get_predicate_id(
|
|
|
93
102
|
return res[0][0]
|
|
94
103
|
|
|
95
104
|
|
|
96
|
-
def hop2property_path(
|
|
105
|
+
def hop2property_path(
|
|
106
|
+
graph: Graph,
|
|
107
|
+
hop: Hop,
|
|
108
|
+
prefixes: dict[str, Namespace] | None = None,
|
|
109
|
+
) -> str:
|
|
97
110
|
"""Converts hop to property path string
|
|
98
111
|
|
|
99
112
|
Parameters
|
|
@@ -110,6 +123,7 @@ def hop2property_path(graph: Graph, hop: Hop, prefixes: dict[str, Namespace]) ->
|
|
|
110
123
|
str
|
|
111
124
|
Property path string for hop traversal (e.g. ^rdf:type/rdfs:subClassOf)
|
|
112
125
|
"""
|
|
126
|
+
prefixes = prefixes if prefixes else get_default_prefixes()
|
|
113
127
|
|
|
114
128
|
# setting previous step to origin, as we are starting from there
|
|
115
129
|
previous_step = Step(class_=hop.class_, direction="origin")
|
|
@@ -15,7 +15,7 @@ from cognite.neat.graph.extractors import RdfFileExtractor, TripleExtractors
|
|
|
15
15
|
from cognite.neat.graph.models import Triple
|
|
16
16
|
from cognite.neat.graph.queries import Queries
|
|
17
17
|
from cognite.neat.graph.transformers import Transformers
|
|
18
|
-
from cognite.neat.rules.analysis import
|
|
18
|
+
from cognite.neat.rules.analysis import InformationAnalysis
|
|
19
19
|
from cognite.neat.rules.models import InformationRules
|
|
20
20
|
from cognite.neat.rules.models.entities import ClassEntity
|
|
21
21
|
from cognite.neat.utils.auxiliary import local_import
|
|
@@ -179,7 +179,7 @@ class NeatGraphStore:
|
|
|
179
179
|
warnings.warn("Desired type not found in graph!", stacklevel=2)
|
|
180
180
|
return None
|
|
181
181
|
|
|
182
|
-
if
|
|
182
|
+
if InformationAnalysis(self.rules).has_hop_transformations():
|
|
183
183
|
warnings.warn(
|
|
184
184
|
"Rules contain Hop rdfpath, run ReduceHopTraversal transformer first!",
|
|
185
185
|
stacklevel=2,
|
|
@@ -188,7 +188,8 @@ class NeatGraphStore:
|
|
|
188
188
|
|
|
189
189
|
instance_ids = self.queries.list_instances_ids_of_class(self.rules.metadata.namespace[class_])
|
|
190
190
|
|
|
191
|
-
property_renaming_config =
|
|
191
|
+
property_renaming_config = InformationAnalysis(self.rules).define_property_renaming_config(class_entity)
|
|
192
|
+
print(property_renaming_config)
|
|
192
193
|
|
|
193
194
|
for instance_id in instance_ids:
|
|
194
195
|
yield self.queries.describe(instance_id, property_renaming_config)
|
|
@@ -9,11 +9,6 @@ from cognite.neat.legacy.graph.models import Triple
|
|
|
9
9
|
|
|
10
10
|
from ._base import BaseExtractor
|
|
11
11
|
|
|
12
|
-
_DEXPI_PREFIXES = {
|
|
13
|
-
"dexpi": Namespace("http://sandbox.dexpi.org/rdl/"),
|
|
14
|
-
"posccaesar": Namespace("http://data.posccaesar.org/rdl/"),
|
|
15
|
-
}
|
|
16
|
-
|
|
17
12
|
|
|
18
13
|
class DexpiXML(BaseExtractor):
|
|
19
14
|
"""
|
|
@@ -11,7 +11,7 @@ from prometheus_client import Gauge, Summary
|
|
|
11
11
|
from rdflib import Graph, Namespace, URIRef
|
|
12
12
|
from rdflib.query import Result, ResultRow
|
|
13
13
|
|
|
14
|
-
from cognite.neat.constants import DEFAULT_NAMESPACE,
|
|
14
|
+
from cognite.neat.constants import DEFAULT_NAMESPACE, get_default_prefixes
|
|
15
15
|
from cognite.neat.legacy.graph.models import Triple
|
|
16
16
|
from cognite.neat.legacy.graph.stores._rdf_to_graph import rdf_file_to_graph
|
|
17
17
|
from cognite.neat.legacy.rules.models.rules import Rules
|
|
@@ -25,7 +25,11 @@ prom_qsm = Summary("store_query_time_summary_legacy", "Time spent processing que
|
|
|
25
25
|
prom_sq = Gauge("store_single_query_time_legacy", "Time spent processing a single query", ["query"])
|
|
26
26
|
|
|
27
27
|
MIMETypes: TypeAlias = Literal[
|
|
28
|
-
"application/rdf+xml",
|
|
28
|
+
"application/rdf+xml",
|
|
29
|
+
"text/turtle",
|
|
30
|
+
"application/n-triple",
|
|
31
|
+
"application/n-quads",
|
|
32
|
+
"application/trig",
|
|
29
33
|
]
|
|
30
34
|
|
|
31
35
|
|
|
@@ -35,7 +39,8 @@ class NeatGraphStoreBase(ABC):
|
|
|
35
39
|
|
|
36
40
|
Args:
|
|
37
41
|
graph : Instance of rdflib.Graph class for graph storage
|
|
38
|
-
base_prefix : Used as a base prefix for graph namespace,
|
|
42
|
+
base_prefix : Used as a base prefix for graph namespace,
|
|
43
|
+
allowing querying graph data using a short form of a URI
|
|
39
44
|
namespace : Namespace (aka URI) used to resolve any relative URI in the graph
|
|
40
45
|
prefixes : Dictionary of additional prefixes used and bounded to the graph
|
|
41
46
|
"""
|
|
@@ -47,12 +52,12 @@ class NeatGraphStoreBase(ABC):
|
|
|
47
52
|
graph: Graph | None = None,
|
|
48
53
|
base_prefix: str = "", # usually empty
|
|
49
54
|
namespace: Namespace = DEFAULT_NAMESPACE,
|
|
50
|
-
prefixes: dict =
|
|
55
|
+
prefixes: dict[str, Namespace] | None = None,
|
|
51
56
|
):
|
|
52
57
|
self.graph = graph or Graph()
|
|
53
58
|
self.base_prefix: str = base_prefix
|
|
54
59
|
self.namespace: Namespace = namespace
|
|
55
|
-
self.prefixes: dict[str, Namespace] = prefixes
|
|
60
|
+
self.prefixes: dict[str, Namespace] = prefixes or get_default_prefixes()
|
|
56
61
|
|
|
57
62
|
self.rdf_store_query_url: str | None = None
|
|
58
63
|
self.rdf_store_update_url: str | None = None
|
|
@@ -164,7 +169,10 @@ class NeatGraphStoreBase(ABC):
|
|
|
164
169
|
return None
|
|
165
170
|
|
|
166
171
|
def import_from_file(
|
|
167
|
-
self,
|
|
172
|
+
self,
|
|
173
|
+
graph_file: Path,
|
|
174
|
+
mime_type: MIMETypes = "application/rdf+xml",
|
|
175
|
+
add_base_iri: bool = True,
|
|
168
176
|
) -> None:
|
|
169
177
|
"""Imports graph data from file.
|
|
170
178
|
|
|
@@ -175,7 +183,10 @@ class NeatGraphStoreBase(ABC):
|
|
|
175
183
|
"""
|
|
176
184
|
if add_base_iri:
|
|
177
185
|
self.graph = rdf_file_to_graph(
|
|
178
|
-
self.graph,
|
|
186
|
+
self.graph,
|
|
187
|
+
graph_file,
|
|
188
|
+
base_namespace=self.namespace,
|
|
189
|
+
prefixes=self.prefixes,
|
|
179
190
|
)
|
|
180
191
|
else:
|
|
181
192
|
self.graph = rdf_file_to_graph(self.graph, graph_file, prefixes=self.prefixes)
|
|
@@ -290,7 +301,12 @@ class NeatGraphStoreBase(ABC):
|
|
|
290
301
|
"rdf_store_update_url": self.rdf_store_update_url,
|
|
291
302
|
}
|
|
292
303
|
|
|
293
|
-
def add_triples(
|
|
304
|
+
def add_triples(
|
|
305
|
+
self,
|
|
306
|
+
triples: list[Triple] | set[Triple],
|
|
307
|
+
batch_size: int = 10_000,
|
|
308
|
+
verbose: bool = False,
|
|
309
|
+
):
|
|
294
310
|
"""Adds triples to the graph store in batches.
|
|
295
311
|
|
|
296
312
|
Args:
|
{cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/stores/_graphdb_store.py
RENAMED
|
@@ -4,7 +4,7 @@ import requests
|
|
|
4
4
|
from rdflib import Graph, Namespace
|
|
5
5
|
from rdflib.plugins.stores.sparqlstore import SPARQLUpdateStore
|
|
6
6
|
|
|
7
|
-
from cognite.neat.constants import DEFAULT_NAMESPACE,
|
|
7
|
+
from cognite.neat.constants import DEFAULT_NAMESPACE, get_default_prefixes
|
|
8
8
|
|
|
9
9
|
from ._base import NeatGraphStoreBase
|
|
10
10
|
|
|
@@ -28,8 +28,9 @@ class GraphDBStore(NeatGraphStoreBase):
|
|
|
28
28
|
graph: Graph | None = None,
|
|
29
29
|
base_prefix: str = "", # usually empty
|
|
30
30
|
namespace: Namespace = DEFAULT_NAMESPACE,
|
|
31
|
-
prefixes: dict =
|
|
31
|
+
prefixes: dict[str, Namespace] | None = None,
|
|
32
32
|
):
|
|
33
|
+
prefixes = prefixes if prefixes else get_default_prefixes()
|
|
33
34
|
super().__init__(graph, base_prefix, namespace, prefixes)
|
|
34
35
|
self.graph_db_rest_url: str = "http://localhost:7200"
|
|
35
36
|
|
{cognite_neat-0.86.0 → cognite_neat-0.87.0}/cognite/neat/legacy/graph/stores/_memory_store.py
RENAMED
|
@@ -2,7 +2,7 @@ import logging
|
|
|
2
2
|
|
|
3
3
|
from rdflib import Graph, Namespace
|
|
4
4
|
|
|
5
|
-
from cognite.neat.constants import DEFAULT_NAMESPACE,
|
|
5
|
+
from cognite.neat.constants import DEFAULT_NAMESPACE, get_default_prefixes
|
|
6
6
|
|
|
7
7
|
from ._base import NeatGraphStoreBase
|
|
8
8
|
|
|
@@ -26,9 +26,9 @@ class MemoryStore(NeatGraphStoreBase):
|
|
|
26
26
|
graph: Graph | None = None,
|
|
27
27
|
base_prefix: str = "", # usually empty
|
|
28
28
|
namespace: Namespace = DEFAULT_NAMESPACE,
|
|
29
|
-
prefixes: dict =
|
|
29
|
+
prefixes: dict[str, Namespace] | None = None,
|
|
30
30
|
):
|
|
31
|
-
# Init repeated to get nice docstring
|
|
31
|
+
prefixes = prefixes if prefixes else get_default_prefixes() # Init repeated to get nice docstring
|
|
32
32
|
super().__init__(graph, base_prefix, namespace, prefixes)
|
|
33
33
|
|
|
34
34
|
def _set_graph(self):
|