cognite-neat 0.81.10__tar.gz → 0.81.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/PKG-INFO +1 -1
- cognite_neat-0.81.12/cognite/neat/_version.py +1 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_classic_cdf/_assets.py +4 -3
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_classic_cdf/_labels.py +22 -18
- cognite_neat-0.81.12/cognite/neat/graph/extractors/_classic_cdf/_relationships.py +152 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/stores/_base.py +42 -3
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/transformers/__init__.py +8 -1
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/transformers/_classic_cdf.py +61 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/analysis/_information_rules.py +2 -2
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/information/_rules.py +7 -22
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/pyproject.toml +1 -1
- cognite_neat-0.81.10/cognite/neat/_version.py +0 -1
- cognite_neat-0.81.10/cognite/neat/graph/extractors/_classic_cdf/_relationships.py +0 -152
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/LICENSE +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/README.md +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/asgi/metrics.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/configuration.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/context_manager/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/context_manager/manager.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/data_classes/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/data_classes/rest.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/explorer.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/routers/configuration.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/routers/core.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/routers/crud.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/routers/data_exploration.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/routers/metrics.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/routers/rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/routers/workflows.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/utils/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/utils/data_mapping.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/utils/logging.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/api/utils/query_templates.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/main.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/monitoring/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/monitoring/metrics.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/index.html +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/README.md +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css.map +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.LICENSE.txt +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.map +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/config.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/constants.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/exceptions.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/_shared.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/_tracking/base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/_tracking/log.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/examples/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/exceptions.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_classic_cdf/_sequences.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_mock_graph_generator.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/issues/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/issues/loader.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/loaders/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/loaders/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/loaders/_rdf2dms.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/models.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/stores/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/stores/_oxrdflib.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/stores/_provenance.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/transformers/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/issues.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/examples/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/exceptions.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/extractors/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/extractors/_graph_capturing_sheet.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/loaders/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/loaders/_asset_loader.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/loaders/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/loaders/_exceptions.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/loaders/core/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/loaders/core/labels.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/loaders/core/models.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/loaders/rdf_to_dms.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/loaders/validator.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/models.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/stores/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/stores/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/stores/_graphdb_store.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/stores/_memory_store.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/stores/_oxigraph_store.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/stores/_oxrdflib.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/stores/_rdf_to_graph.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/transformations/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/transformations/entity_matcher.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/transformations/query_generator/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/transformations/query_generator/sparql.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/graph/transformations/transformer.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/analysis.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-TNT.xlsx +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/examples/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/examples/power-grid-containers.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/examples/power-grid-example.xlsx +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/examples/power-grid-model.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/examples/rules-template.xlsx +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/examples/skos-rules.xlsx +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exceptions.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/_core/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/_core/rules2labels.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/_rules2graphql.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/_rules2pydantic_models.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/_rules2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/_rules2triples.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_dict2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_dms2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_graph2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_json2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2classes.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2metadata.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2properties.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_xsd2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/models/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/models/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/models/raw_rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/models/rdfpath.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/models/rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/models/tables.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/rules/models/value_types.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/py.typed +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/_shared.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/analysis/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/analysis/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/examples/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/exceptions.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/exporters/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/exporters/_validation.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_dms2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_inference2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_owl2rules/_owl2classes.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_owl2rules/_owl2properties.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/issues/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/issues/base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/issues/dms.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/issues/fileread.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/issues/formatters.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/issues/importing.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/issues/spreadsheet.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/issues/spreadsheet_file.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/_constants.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/_rdfpath.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/_types/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/_types/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/_types/_field.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/data_types.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/dms/_converter.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/dms/_exporter.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/dms/_rules.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/dms/_rules_input.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/dms/_schema.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/dms/_serializer.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/dms/_validation.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/domain.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/entities.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/information/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/information/_converter.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/information/_rules_input.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/information/_serializer.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/information/_validation.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/wrapped_entities.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/auxiliary.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/cdf.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/cdf_classes.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/cdf_loaders/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/cdf_loaders/_base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/cdf_loaders/_data_modeling.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/cdf_loaders/_ingestion.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/cdf_loaders/data_classes.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/exceptions.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/spreadsheet.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/text.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/upload.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/utils.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/utils/xml.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/_exceptions.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/base.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/cdf_store.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/manager.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/migration/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/migration/steps.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/migration/wf_manifests.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/model.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/data_contracts.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/current/rules_importer.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/legacy/__init__.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/legacy/graph_contextualization.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/legacy/graph_extractor.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/legacy/graph_loader.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/legacy/graph_store.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/legacy/graph_transformer.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/legacy/rules_exporter.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/lib/legacy/rules_importer.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps/step_model.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/steps_registry.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/tasks.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/triggers.py +0 -0
- {cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/workflows/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.81.12"
|
{cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_classic_cdf/_assets.py
RENAMED
|
@@ -2,7 +2,6 @@ from collections.abc import Iterable
|
|
|
2
2
|
from datetime import datetime, timezone
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from typing import cast
|
|
5
|
-
from urllib.parse import quote
|
|
6
5
|
|
|
7
6
|
from cognite.client import CogniteClient
|
|
8
7
|
from cognite.client.data_classes import Asset, AssetList
|
|
@@ -11,7 +10,7 @@ from rdflib import RDF, Literal, Namespace
|
|
|
11
10
|
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
12
11
|
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
13
12
|
from cognite.neat.graph.models import Triple
|
|
14
|
-
from cognite.neat.utils.utils import string_to_ideal_type
|
|
13
|
+
from cognite.neat.utils.utils import create_sha256_hash, string_to_ideal_type
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
class AssetsExtractor(BaseExtractor):
|
|
@@ -86,7 +85,9 @@ class AssetsExtractor(BaseExtractor):
|
|
|
86
85
|
for label in asset.labels:
|
|
87
86
|
# external_id can create ill-formed URIs, so we create websafe URIs
|
|
88
87
|
# since labels do not have internal ids, we use the external_id as the id
|
|
89
|
-
triples.append(
|
|
88
|
+
triples.append(
|
|
89
|
+
(id_, namespace.label, namespace[f"Label_{create_sha256_hash(label.dump()['externalId'])}"])
|
|
90
|
+
)
|
|
90
91
|
|
|
91
92
|
if asset.metadata:
|
|
92
93
|
for key, value in asset.metadata.items():
|
{cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/extractors/_classic_cdf/_labels.py
RENAMED
|
@@ -2,7 +2,6 @@ from collections.abc import Iterable
|
|
|
2
2
|
from datetime import datetime, timezone
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from typing import cast
|
|
5
|
-
from urllib.parse import quote
|
|
6
5
|
|
|
7
6
|
from cognite.client import CogniteClient
|
|
8
7
|
from cognite.client.data_classes import LabelDefinition, LabelDefinitionList
|
|
@@ -11,6 +10,7 @@ from rdflib import RDF, Literal, Namespace
|
|
|
11
10
|
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
12
11
|
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
13
12
|
from cognite.neat.graph.models import Triple
|
|
13
|
+
from cognite.neat.utils.utils import create_sha256_hash
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class LabelsExtractor(BaseExtractor):
|
|
@@ -44,28 +44,32 @@ class LabelsExtractor(BaseExtractor):
|
|
|
44
44
|
|
|
45
45
|
@classmethod
|
|
46
46
|
def _labels2triples(cls, label: LabelDefinition, namespace: Namespace) -> list[Triple]:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# Set rdf type
|
|
50
|
-
triples: list[Triple] = [(id_, RDF.type, namespace.Label)]
|
|
47
|
+
if label.external_id:
|
|
48
|
+
id_ = namespace[f"Label_{create_sha256_hash(label.external_id)}"]
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
# Set rdf type
|
|
51
|
+
triples: list[Triple] = [(id_, RDF.type, namespace.Label)]
|
|
53
52
|
|
|
54
|
-
|
|
53
|
+
# Create attributes
|
|
55
54
|
triples.append((id_, namespace.external_id, Literal(label.external_id)))
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
if label.name:
|
|
57
|
+
triples.append((id_, namespace.name, Literal(label.name)))
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
if label.description:
|
|
60
|
+
triples.append((id_, namespace.description, Literal(label.description)))
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
if label.created_time:
|
|
63
|
+
triples.append(
|
|
64
|
+
(
|
|
65
|
+
id_,
|
|
66
|
+
namespace.created_time,
|
|
67
|
+
Literal(datetime.fromtimestamp(label.created_time / 1000, timezone.utc)),
|
|
68
|
+
)
|
|
69
|
+
)
|
|
67
70
|
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
if label.data_set_id:
|
|
72
|
+
triples.append((id_, namespace.data_set_id, namespace[f"Dataset_{label.data_set_id}"]))
|
|
70
73
|
|
|
71
|
-
|
|
74
|
+
return triples
|
|
75
|
+
return []
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
from collections.abc import Iterable
|
|
2
|
+
from datetime import datetime, timezone
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import cast
|
|
5
|
+
from urllib.parse import quote
|
|
6
|
+
|
|
7
|
+
from cognite.client import CogniteClient
|
|
8
|
+
from cognite.client.data_classes import Relationship, RelationshipList
|
|
9
|
+
from rdflib import RDF, Literal, Namespace
|
|
10
|
+
|
|
11
|
+
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
12
|
+
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
13
|
+
from cognite.neat.graph.models import Triple
|
|
14
|
+
from cognite.neat.utils.utils import create_sha256_hash
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class RelationshipsExtractor(BaseExtractor):
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
relationships: Iterable[Relationship],
|
|
21
|
+
namespace: Namespace | None = None,
|
|
22
|
+
):
|
|
23
|
+
self.namespace = namespace or DEFAULT_NAMESPACE
|
|
24
|
+
self.relationships = relationships
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def from_dataset(
|
|
28
|
+
cls,
|
|
29
|
+
client: CogniteClient,
|
|
30
|
+
data_set_external_id: str,
|
|
31
|
+
namespace: Namespace | None = None,
|
|
32
|
+
):
|
|
33
|
+
return cls(
|
|
34
|
+
cast(Iterable[Relationship], client.relationships(data_set_external_ids=data_set_external_id)), namespace
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
@classmethod
|
|
38
|
+
def from_file(cls, file_path: str, namespace: Namespace | None = None):
|
|
39
|
+
return cls(RelationshipList.load(Path(file_path).read_text()), namespace)
|
|
40
|
+
|
|
41
|
+
def extract(self) -> Iterable[Triple]:
|
|
42
|
+
"""Extracts an asset with the given asset_id."""
|
|
43
|
+
for relationship in self.relationships:
|
|
44
|
+
yield from self._relationship2triples(relationship, self.namespace)
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def _relationship2triples(cls, relationship: Relationship, namespace: Namespace) -> list[Triple]:
|
|
48
|
+
"""Converts an asset to triples."""
|
|
49
|
+
|
|
50
|
+
if relationship.external_id and relationship.source_external_id and relationship.target_external_id:
|
|
51
|
+
# relationships do not have an internal id, so we generate one
|
|
52
|
+
id_ = namespace[f"Relationship_{create_sha256_hash(relationship.external_id)}"]
|
|
53
|
+
|
|
54
|
+
# Set rdf type
|
|
55
|
+
triples: list[Triple] = [(id_, RDF.type, namespace["Relationship"])]
|
|
56
|
+
|
|
57
|
+
# Set source and target types
|
|
58
|
+
if source_type := relationship.source_type:
|
|
59
|
+
triples.append(
|
|
60
|
+
(
|
|
61
|
+
id_,
|
|
62
|
+
namespace.source_type,
|
|
63
|
+
namespace[source_type.title()],
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
if target_type := relationship.target_type:
|
|
68
|
+
triples.append(
|
|
69
|
+
(
|
|
70
|
+
id_,
|
|
71
|
+
namespace.target_type,
|
|
72
|
+
namespace[target_type.title()],
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# Create attributes
|
|
77
|
+
|
|
78
|
+
triples.append((id_, namespace.external_id, Literal(relationship.external_id)))
|
|
79
|
+
|
|
80
|
+
triples.append(
|
|
81
|
+
(
|
|
82
|
+
id_,
|
|
83
|
+
namespace.source_external_id,
|
|
84
|
+
Literal(relationship.source_external_id),
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
triples.append(
|
|
89
|
+
(
|
|
90
|
+
id_,
|
|
91
|
+
namespace.target_external_id,
|
|
92
|
+
Literal(relationship.target_external_id),
|
|
93
|
+
)
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
if relationship.start_time:
|
|
97
|
+
triples.append(
|
|
98
|
+
(
|
|
99
|
+
id_,
|
|
100
|
+
namespace.start_time,
|
|
101
|
+
Literal(datetime.fromtimestamp(relationship.start_time / 1000, timezone.utc)),
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
if relationship.end_time:
|
|
106
|
+
triples.append(
|
|
107
|
+
(
|
|
108
|
+
id_,
|
|
109
|
+
namespace.end_time,
|
|
110
|
+
Literal(datetime.fromtimestamp(relationship.end_time / 1000, timezone.utc)),
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
if relationship.created_time:
|
|
115
|
+
triples.append(
|
|
116
|
+
(
|
|
117
|
+
id_,
|
|
118
|
+
namespace.created_time,
|
|
119
|
+
Literal(datetime.fromtimestamp(relationship.created_time / 1000, timezone.utc)),
|
|
120
|
+
)
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
if relationship.last_updated_time:
|
|
124
|
+
triples.append(
|
|
125
|
+
(
|
|
126
|
+
id_,
|
|
127
|
+
namespace.last_updated_time,
|
|
128
|
+
Literal(datetime.fromtimestamp(relationship.last_updated_time / 1000, timezone.utc)),
|
|
129
|
+
)
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
if relationship.confidence:
|
|
133
|
+
triples.append(
|
|
134
|
+
(
|
|
135
|
+
id_,
|
|
136
|
+
namespace.confidence,
|
|
137
|
+
Literal(relationship.confidence),
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
if relationship.labels:
|
|
142
|
+
for label in relationship.labels:
|
|
143
|
+
# external_id can create ill-formed URIs, so we create websafe URIs
|
|
144
|
+
# since labels do not have internal ids, we use the external_id as the id
|
|
145
|
+
triples.append((id_, namespace.label, namespace[f"Label_{quote(label.dump()['externalId'])}"]))
|
|
146
|
+
|
|
147
|
+
# Create connection
|
|
148
|
+
if relationship.data_set_id:
|
|
149
|
+
triples.append((id_, namespace.dataset, namespace[f"Dataset_{relationship.data_set_id}"]))
|
|
150
|
+
|
|
151
|
+
return triples
|
|
152
|
+
return []
|
|
@@ -14,6 +14,7 @@ from cognite.neat.graph._shared import MIMETypes
|
|
|
14
14
|
from cognite.neat.graph.extractors import RdfFileExtractor, TripleExtractors
|
|
15
15
|
from cognite.neat.graph.models import Triple
|
|
16
16
|
from cognite.neat.graph.transformers import Transformers
|
|
17
|
+
from cognite.neat.rules.models.entities import ClassEntity
|
|
17
18
|
from cognite.neat.rules.models.information import InformationRules
|
|
18
19
|
from cognite.neat.utils import remove_namespace
|
|
19
20
|
from cognite.neat.utils.auxiliary import local_import
|
|
@@ -42,6 +43,8 @@ class NeatGraphStore:
|
|
|
42
43
|
graph: Graph,
|
|
43
44
|
rules: InformationRules | None = None,
|
|
44
45
|
):
|
|
46
|
+
self.rules: InformationRules | None = None
|
|
47
|
+
|
|
45
48
|
_start = datetime.now(timezone.utc)
|
|
46
49
|
self.graph = graph
|
|
47
50
|
self.provenance = Provenance(
|
|
@@ -54,11 +57,30 @@ class NeatGraphStore:
|
|
|
54
57
|
)
|
|
55
58
|
]
|
|
56
59
|
)
|
|
57
|
-
self.rules = rules
|
|
58
60
|
|
|
59
|
-
if
|
|
60
|
-
self.
|
|
61
|
+
if rules:
|
|
62
|
+
self.rules = rules
|
|
61
63
|
self.base_namespace = self.rules.metadata.namespace
|
|
64
|
+
self.provenance.append(
|
|
65
|
+
Change.record(
|
|
66
|
+
activity=f"{type(self)}.rules",
|
|
67
|
+
start=_start,
|
|
68
|
+
end=datetime.now(timezone.utc),
|
|
69
|
+
description=f"Added rules to graph store as {type(self.rules).__name__}",
|
|
70
|
+
)
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
if self.rules.prefixes:
|
|
74
|
+
self._upsert_prefixes(self.rules.prefixes)
|
|
75
|
+
self.provenance.append(
|
|
76
|
+
Change.record(
|
|
77
|
+
activity=f"{type(self).__name__}._upsert_prefixes",
|
|
78
|
+
start=_start,
|
|
79
|
+
end=datetime.now(timezone.utc),
|
|
80
|
+
description="Upsert prefixes to graph store",
|
|
81
|
+
)
|
|
82
|
+
)
|
|
83
|
+
|
|
62
84
|
else:
|
|
63
85
|
self.base_namespace = DEFAULT_NAMESPACE
|
|
64
86
|
|
|
@@ -144,6 +166,23 @@ class NeatGraphStore:
|
|
|
144
166
|
)
|
|
145
167
|
)
|
|
146
168
|
|
|
169
|
+
def read(self, class_: str) -> list[tuple[str, str, str]]:
|
|
170
|
+
"""Read instances for given view from the graph store."""
|
|
171
|
+
# PLACEHOLDER: Implement reading instances for a given view
|
|
172
|
+
# not yet developed
|
|
173
|
+
|
|
174
|
+
if not self.rules:
|
|
175
|
+
warnings.warn("No rules found for the graph store, returning empty list.", stacklevel=2)
|
|
176
|
+
return []
|
|
177
|
+
|
|
178
|
+
class_entity = ClassEntity(prefix=self.rules.metadata.prefix, suffix=class_)
|
|
179
|
+
|
|
180
|
+
if class_entity not in [definition.class_ for definition in self.rules.classes.data]:
|
|
181
|
+
warnings.warn("Desired type not found in graph!", stacklevel=2)
|
|
182
|
+
return []
|
|
183
|
+
|
|
184
|
+
return []
|
|
185
|
+
|
|
147
186
|
def _parse_file(
|
|
148
187
|
self,
|
|
149
188
|
filepath: Path,
|
|
@@ -2,6 +2,7 @@ from ._classic_cdf import (
|
|
|
2
2
|
AddAssetDepth,
|
|
3
3
|
AssetEventConnector,
|
|
4
4
|
AssetFileConnector,
|
|
5
|
+
AssetRelationshipConnector,
|
|
5
6
|
AssetSequenceConnector,
|
|
6
7
|
AssetTimeSeriesConnector,
|
|
7
8
|
)
|
|
@@ -12,8 +13,14 @@ __all__ = [
|
|
|
12
13
|
"AssetSequenceConnector",
|
|
13
14
|
"AssetFileConnector",
|
|
14
15
|
"AssetEventConnector",
|
|
16
|
+
"AssetRelationshipConnector",
|
|
15
17
|
]
|
|
16
18
|
|
|
17
19
|
Transformers = (
|
|
18
|
-
AddAssetDepth
|
|
20
|
+
AddAssetDepth
|
|
21
|
+
| AssetTimeSeriesConnector
|
|
22
|
+
| AssetSequenceConnector
|
|
23
|
+
| AssetFileConnector
|
|
24
|
+
| AssetEventConnector
|
|
25
|
+
| AssetRelationshipConnector
|
|
19
26
|
)
|
{cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/graph/transformers/_classic_cdf.py
RENAMED
|
@@ -205,3 +205,64 @@ class AssetEventConnector(BaseTransformer):
|
|
|
205
205
|
# files can be connected to multiple assets in the graph
|
|
206
206
|
for (asset_id,) in cast(list[tuple], assets_id_res):
|
|
207
207
|
graph.add((asset_id, DEFAULT_NAMESPACE.event, event_id))
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
class AssetRelationshipConnector(BaseTransformer):
|
|
211
|
+
description: str = "Connects assets via relationships"
|
|
212
|
+
_use_only_once: bool = True
|
|
213
|
+
_need_changes = frozenset(
|
|
214
|
+
{str(extractors.AssetsExtractor.__name__), str(extractors.RelationshipsExtractor.__name__)}
|
|
215
|
+
)
|
|
216
|
+
_asset_template: str = """SELECT ?source ?target WHERE {{
|
|
217
|
+
<{relationship_id}> <{relationship_source_xid_prop}> ?source_xid .
|
|
218
|
+
?source <{asset_xid_property}> ?source_xid .
|
|
219
|
+
?source a <{asset_type}> .
|
|
220
|
+
|
|
221
|
+
<{relationship_id}> <{relationship_target_xid_prop}> ?target_xid .
|
|
222
|
+
?target <{asset_xid_property}> ?target_xid .
|
|
223
|
+
?target a <{asset_type}> .}}"""
|
|
224
|
+
|
|
225
|
+
def __init__(
|
|
226
|
+
self,
|
|
227
|
+
asset_type: URIRef | None = None,
|
|
228
|
+
relationship_type: URIRef | None = None,
|
|
229
|
+
relationship_source_xid_prop: URIRef | None = None,
|
|
230
|
+
relationship_target_xid_prop: URIRef | None = None,
|
|
231
|
+
asset_xid_property: URIRef | None = None,
|
|
232
|
+
):
|
|
233
|
+
self.asset_type = asset_type or DEFAULT_NAMESPACE.Asset
|
|
234
|
+
self.relationship_type = relationship_type or DEFAULT_NAMESPACE.Relationship
|
|
235
|
+
self.relationship_source_xid_prop = relationship_source_xid_prop or DEFAULT_NAMESPACE.source_external_id
|
|
236
|
+
self.relationship_target_xid_prop = relationship_target_xid_prop or DEFAULT_NAMESPACE.target_external_id
|
|
237
|
+
self.asset_xid_property = asset_xid_property or DEFAULT_NAMESPACE.external_id
|
|
238
|
+
|
|
239
|
+
def transform(self, graph: Graph) -> None:
|
|
240
|
+
for relationship_id_result in graph.query(
|
|
241
|
+
f"SELECT DISTINCT ?relationship_id WHERE {{?relationship_id a <{self.relationship_type}>}}"
|
|
242
|
+
):
|
|
243
|
+
relationship_id: URIRef = cast(tuple, relationship_id_result)[0]
|
|
244
|
+
|
|
245
|
+
if assets_id_res := list(
|
|
246
|
+
graph.query(
|
|
247
|
+
self._asset_template.format(
|
|
248
|
+
relationship_id=relationship_id,
|
|
249
|
+
asset_xid_property=self.asset_xid_property,
|
|
250
|
+
relationship_source_xid_prop=self.relationship_source_xid_prop,
|
|
251
|
+
relationship_target_xid_prop=self.relationship_target_xid_prop,
|
|
252
|
+
asset_type=self.asset_type,
|
|
253
|
+
)
|
|
254
|
+
)
|
|
255
|
+
):
|
|
256
|
+
# files can be connected to multiple assets in the graph
|
|
257
|
+
for source_asset_id, target_asset_id in cast(list[tuple], assets_id_res):
|
|
258
|
+
# create a relationship between the two assets
|
|
259
|
+
graph.add((source_asset_id, DEFAULT_NAMESPACE.relationship, relationship_id))
|
|
260
|
+
graph.add((target_asset_id, DEFAULT_NAMESPACE.relationship, relationship_id))
|
|
261
|
+
|
|
262
|
+
# add source and target to the relationship
|
|
263
|
+
graph.add((relationship_id, DEFAULT_NAMESPACE.source, source_asset_id))
|
|
264
|
+
graph.add((relationship_id, DEFAULT_NAMESPACE.target, target_asset_id))
|
|
265
|
+
|
|
266
|
+
# remove properties that are not needed, specifically the external ids
|
|
267
|
+
graph.remove((relationship_id, self.relationship_source_xid_prop, None))
|
|
268
|
+
graph.remove((relationship_id, self.relationship_target_xid_prop, None))
|
{cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/analysis/_information_rules.py
RENAMED
|
@@ -8,7 +8,7 @@ import pandas as pd
|
|
|
8
8
|
from pydantic import ValidationError
|
|
9
9
|
|
|
10
10
|
from cognite.neat.rules.models import SchemaCompleteness
|
|
11
|
-
from cognite.neat.rules.models._rdfpath import
|
|
11
|
+
from cognite.neat.rules.models._rdfpath import RDFPath
|
|
12
12
|
from cognite.neat.rules.models.entities import ClassEntity, EntityTypes, ParentClassEntity, ReferenceEntity
|
|
13
13
|
from cognite.neat.rules.models.information import InformationClass, InformationProperty, InformationRules
|
|
14
14
|
from cognite.neat.utils.utils import get_inheritance_path
|
|
@@ -191,7 +191,7 @@ class InformationArchitectRulesAnalysis(BaseAnalysis):
|
|
|
191
191
|
)
|
|
192
192
|
continue
|
|
193
193
|
|
|
194
|
-
if (only_rdfpath and property_.
|
|
194
|
+
if (only_rdfpath and isinstance(property_.transformation, RDFPath)) or not only_rdfpath:
|
|
195
195
|
processed_properties[property_.property_] = property_
|
|
196
196
|
class_property_pairs[class_] = processed_properties
|
|
197
197
|
|
{cognite_neat-0.81.10 → cognite_neat-0.81.12}/cognite/neat/rules/models/information/_rules.py
RENAMED
|
@@ -23,13 +23,8 @@ from cognite.neat.rules.models._base import (
|
|
|
23
23
|
SheetList,
|
|
24
24
|
)
|
|
25
25
|
from cognite.neat.rules.models._rdfpath import (
|
|
26
|
-
|
|
27
|
-
Hop,
|
|
28
|
-
RawLookup,
|
|
29
|
-
SingleProperty,
|
|
30
|
-
SPARQLQuery,
|
|
26
|
+
RDFPath,
|
|
31
27
|
TransformationRuleType,
|
|
32
|
-
Traversal,
|
|
33
28
|
parse_rule,
|
|
34
29
|
)
|
|
35
30
|
from cognite.neat.rules.models._types import (
|
|
@@ -156,9 +151,7 @@ class InformationProperty(SheetEntity):
|
|
|
156
151
|
default: Default value of the property
|
|
157
152
|
reference: Reference to the source of the information, HTTP URI
|
|
158
153
|
match_type: The match type of the resource being described and the source entity.
|
|
159
|
-
|
|
160
|
-
of knowledge graph. Defaults to None (no transformation)
|
|
161
|
-
rule: Actual rule for the transformation from source to target representation of
|
|
154
|
+
transformation: Actual rule for the transformation from source to target representation of
|
|
162
155
|
knowledge graph. Defaults to None (no transformation)
|
|
163
156
|
"""
|
|
164
157
|
|
|
@@ -174,10 +167,7 @@ class InformationProperty(SheetEntity):
|
|
|
174
167
|
default: Any | None = Field(alias="Default", default=None)
|
|
175
168
|
reference: URLEntity | ReferenceEntity | None = Field(alias="Reference", default=None, union_mode="left_to_right")
|
|
176
169
|
match_type: MatchType | None = Field(alias="Match Type", default=None)
|
|
177
|
-
|
|
178
|
-
rule: str | AllReferences | SingleProperty | Hop | RawLookup | SPARQLQuery | Traversal | None = Field(
|
|
179
|
-
alias="Rule", default=None
|
|
180
|
-
)
|
|
170
|
+
transformation: str | RDFPath | None = Field(alias="Transformation", default=None)
|
|
181
171
|
comment: str | None = Field(alias="Comment", default=None)
|
|
182
172
|
|
|
183
173
|
@field_serializer("max_count", when_used="json-unless-none")
|
|
@@ -193,15 +183,10 @@ class InformationProperty(SheetEntity):
|
|
|
193
183
|
return value
|
|
194
184
|
|
|
195
185
|
@model_validator(mode="after")
|
|
196
|
-
def
|
|
197
|
-
# TODO:
|
|
198
|
-
if self.
|
|
199
|
-
self.
|
|
200
|
-
if not self.rule:
|
|
201
|
-
raise exceptions.RuleTypeProvidedButRuleMissing(
|
|
202
|
-
self.property_, self.class_, self.rule_type
|
|
203
|
-
).to_pydantic_custom_error()
|
|
204
|
-
self.rule = parse_rule(self.rule, self.rule_type)
|
|
186
|
+
def generate_valid_transformation(self):
|
|
187
|
+
# TODO: Currently only supporting RDFpath
|
|
188
|
+
if self.transformation:
|
|
189
|
+
self.transformation = parse_rule(self.transformation, TransformationRuleType.rdfpath)
|
|
205
190
|
return self
|
|
206
191
|
|
|
207
192
|
@model_validator(mode="after")
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.81.10"
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import uuid
|
|
2
|
-
from collections.abc import Iterable
|
|
3
|
-
from datetime import datetime, timezone
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
from typing import cast
|
|
6
|
-
from urllib.parse import quote
|
|
7
|
-
|
|
8
|
-
from cognite.client import CogniteClient
|
|
9
|
-
from cognite.client.data_classes import Relationship, RelationshipList
|
|
10
|
-
from rdflib import RDF, Literal, Namespace
|
|
11
|
-
|
|
12
|
-
from cognite.neat.constants import DEFAULT_NAMESPACE
|
|
13
|
-
from cognite.neat.graph.extractors._base import BaseExtractor
|
|
14
|
-
from cognite.neat.graph.models import Triple
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class RelationshipsExtractor(BaseExtractor):
|
|
18
|
-
def __init__(
|
|
19
|
-
self,
|
|
20
|
-
relationships: Iterable[Relationship],
|
|
21
|
-
namespace: Namespace | None = None,
|
|
22
|
-
):
|
|
23
|
-
self.namespace = namespace or DEFAULT_NAMESPACE
|
|
24
|
-
self.relationships = relationships
|
|
25
|
-
|
|
26
|
-
@classmethod
|
|
27
|
-
def from_dataset(
|
|
28
|
-
cls,
|
|
29
|
-
client: CogniteClient,
|
|
30
|
-
data_set_external_id: str,
|
|
31
|
-
namespace: Namespace | None = None,
|
|
32
|
-
):
|
|
33
|
-
return cls(
|
|
34
|
-
cast(Iterable[Relationship], client.relationships(data_set_external_ids=data_set_external_id)), namespace
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
@classmethod
|
|
38
|
-
def from_file(cls, file_path: str, namespace: Namespace | None = None):
|
|
39
|
-
return cls(RelationshipList.load(Path(file_path).read_text()), namespace)
|
|
40
|
-
|
|
41
|
-
def extract(self) -> Iterable[Triple]:
|
|
42
|
-
"""Extracts an asset with the given asset_id."""
|
|
43
|
-
for relationship in self.relationships:
|
|
44
|
-
yield from self._relationship2triples(relationship, self.namespace)
|
|
45
|
-
|
|
46
|
-
@classmethod
|
|
47
|
-
def _relationship2triples(cls, relationship: Relationship, namespace: Namespace) -> list[Triple]:
|
|
48
|
-
"""Converts an asset to triples."""
|
|
49
|
-
|
|
50
|
-
# relationships do not have an internal id, so we generate one
|
|
51
|
-
id_ = namespace[f"Relationship_{uuid.uuid4()}"]
|
|
52
|
-
|
|
53
|
-
# Set rdf type
|
|
54
|
-
triples: list[Triple] = [(id_, RDF.type, namespace["Relationship"])]
|
|
55
|
-
|
|
56
|
-
# Set source and target types
|
|
57
|
-
if source_type := relationship.source_type:
|
|
58
|
-
triples.append(
|
|
59
|
-
(
|
|
60
|
-
id_,
|
|
61
|
-
namespace.source_type,
|
|
62
|
-
namespace[source_type.title()],
|
|
63
|
-
)
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
if target_type := relationship.target_type:
|
|
67
|
-
triples.append(
|
|
68
|
-
(
|
|
69
|
-
id_,
|
|
70
|
-
namespace.target_type,
|
|
71
|
-
namespace[target_type.title()],
|
|
72
|
-
)
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
# Create attributes
|
|
76
|
-
if relationship.external_id:
|
|
77
|
-
triples.append((id_, namespace.external_id, Literal(relationship.external_id)))
|
|
78
|
-
|
|
79
|
-
if relationship.source_external_id:
|
|
80
|
-
triples.append(
|
|
81
|
-
(
|
|
82
|
-
id_,
|
|
83
|
-
namespace.source_external_id,
|
|
84
|
-
Literal(relationship.source_external_id),
|
|
85
|
-
)
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
if relationship.target_external_id:
|
|
89
|
-
triples.append(
|
|
90
|
-
(
|
|
91
|
-
id_,
|
|
92
|
-
namespace.target_external_id,
|
|
93
|
-
Literal(relationship.target_external_id),
|
|
94
|
-
)
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
if relationship.start_time:
|
|
98
|
-
triples.append(
|
|
99
|
-
(
|
|
100
|
-
id_,
|
|
101
|
-
namespace.start_time,
|
|
102
|
-
Literal(datetime.fromtimestamp(relationship.start_time / 1000, timezone.utc)),
|
|
103
|
-
)
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
if relationship.end_time:
|
|
107
|
-
triples.append(
|
|
108
|
-
(
|
|
109
|
-
id_,
|
|
110
|
-
namespace.end_time,
|
|
111
|
-
Literal(datetime.fromtimestamp(relationship.end_time / 1000, timezone.utc)),
|
|
112
|
-
)
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
if relationship.created_time:
|
|
116
|
-
triples.append(
|
|
117
|
-
(
|
|
118
|
-
id_,
|
|
119
|
-
namespace.created_time,
|
|
120
|
-
Literal(datetime.fromtimestamp(relationship.created_time / 1000, timezone.utc)),
|
|
121
|
-
)
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
if relationship.last_updated_time:
|
|
125
|
-
triples.append(
|
|
126
|
-
(
|
|
127
|
-
id_,
|
|
128
|
-
namespace.last_updated_time,
|
|
129
|
-
Literal(datetime.fromtimestamp(relationship.last_updated_time / 1000, timezone.utc)),
|
|
130
|
-
)
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
if relationship.confidence:
|
|
134
|
-
triples.append(
|
|
135
|
-
(
|
|
136
|
-
id_,
|
|
137
|
-
namespace.confidence,
|
|
138
|
-
Literal(relationship.confidence),
|
|
139
|
-
)
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
if relationship.labels:
|
|
143
|
-
for label in relationship.labels:
|
|
144
|
-
# external_id can create ill-formed URIs, so we create websafe URIs
|
|
145
|
-
# since labels do not have internal ids, we use the external_id as the id
|
|
146
|
-
triples.append((id_, namespace.label, namespace[f"Label_{quote(label.dump()['externalId'])}"]))
|
|
147
|
-
|
|
148
|
-
# Create connection
|
|
149
|
-
if relationship.data_set_id:
|
|
150
|
-
triples.append((id_, namespace.dataset, namespace[f"Dataset_{relationship.data_set_id}"]))
|
|
151
|
-
|
|
152
|
-
return triples
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|