cognite-neat 0.102.0__tar.gz → 0.103.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.102.0 → cognite_neat-0.103.0}/PKG-INFO +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/__init__.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/routers/crud.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_client/__init__.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_client/_api/data_modeling_loaders.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_client/_api/schema.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/_tracking/__init__.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_mock_graph_generator.py +2 -3
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/loaders/_base.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/loaders/_rdf2dms.py +165 -47
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/transformers/__init__.py +13 -9
- cognite_neat-0.103.0/cognite/neat/_graph/transformers/_value_type.py +260 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/formatters.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/warnings/__init__.py +20 -18
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/warnings/_properties.py +7 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/analysis/__init__.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/catalog/__init__.py +1 -0
- cognite_neat-0.103.0/cognite/neat/_rules/catalog/hello_world_pump.xlsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/exporters/_rules2excel.py +5 -4
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_base.py +7 -3
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_rdf/__init__.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/_base_rules.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/dms/_validation.py +16 -10
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/mapping/_classic2core.yaml +54 -8
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/transformers/_pipelines.py +10 -5
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_base.py +71 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_collector.py +3 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_drop.py +10 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_inspect.py +35 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_mapping.py +5 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_prepare.py +121 -15
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_read.py +180 -20
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_set.py +11 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_show.py +41 -2
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_to.py +58 -10
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/engine/__init__.py +1 -1
- cognite_neat-0.103.0/cognite/neat/_store/__init__.py +4 -0
- cognite_neat-0.102.0/cognite/neat/_store/_base.py → cognite_neat-0.103.0/cognite/neat/_store/_graph_store.py +33 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_store/_provenance.py +11 -1
- cognite_neat-0.103.0/cognite/neat/_store/_rules_store.py +20 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/auth.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/reader/__init__.py +1 -1
- cognite_neat-0.103.0/cognite/neat/_version.py +2 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/lib/current/graph_extractor.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/pyproject.toml +1 -1
- cognite_neat-0.102.0/cognite/neat/_graph/transformers/_value_type.py +0 -66
- cognite_neat-0.102.0/cognite/neat/_store/__init__.py +0 -3
- cognite_neat-0.102.0/cognite/neat/_version.py +0 -2
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/LICENSE +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/README.md +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/asgi/metrics.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/configuration.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/context_manager/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/context_manager/manager.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/data_classes/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/data_classes/rest.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/explorer.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/routers/configuration.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/routers/metrics.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/routers/workflows.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/utils/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/utils/data_mapping.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/utils/logging.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/api/utils/query_templates.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/main.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/monitoring/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/monitoring/metrics.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/index.html +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/.gitignore +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/README.md +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/asset-manifest.json +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/favicon.ico +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/img/architect-icon.svg +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/img/developer-icon.svg +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/img/sme-icon.svg +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/index.html +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/logo192.png +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/manifest.json +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/robots.txt +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/package-lock.json +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/package.json +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/public/index.html +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/public/manifest.json +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/public/robots.txt +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/App.css +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/App.js +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/App.test.js +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/index.css +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/index.js +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/logo.svg +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/setupTests.js +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_app/ui/neat-app/tsconfig.json +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_client/_api/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_client/_api_client.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_client/data_classes/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_client/data_classes/data_modeling.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_client/data_classes/schema.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_config.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_constants.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/_shared.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/_tracking/base.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/_tracking/log.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/examples/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/__init__.py +8 -8
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_base.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_classic_cdf/_assets.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_classic_cdf/_base.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_classic_cdf/_classic.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_classic_cdf/_data_sets.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_classic_cdf/_labels.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_dms.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_iodd.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/loaders/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/queries/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/queries/_base.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/queries/_construct.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/queries/_shared.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/transformers/_base.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/transformers/_classic_cdf.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/transformers/_iodd.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/transformers/_prune_graph.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_graph/transformers/_rdfpath.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/__init__.py +6 -6
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/_base.py +4 -4
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/errors/__init__.py +22 -22
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/errors/_external.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/errors/_general.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/errors/_properties.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/errors/_resources.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/errors/_workflow.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/warnings/_external.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/warnings/_general.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/warnings/_models.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/warnings/_resources.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_issues/warnings/user_modeling.py +2 -2
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/_constants.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/_shared.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/analysis/_base.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/analysis/_dms.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/analysis/_information.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/exporters/__init__.py +5 -5
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/exporters/_base.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/exporters/_rules2instance_template.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/exporters/_validation.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/__init__.py +4 -4
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_dms2rules.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_rdf/_base.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_rdf/_imf2rules.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_rdf/_inference2rules.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_rdf/_owl2rules.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_rdf/_shared.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/__init__.py +5 -5
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/_base_input.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/_rdfpath.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/_types.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/data_types.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/dms/__init__.py +11 -11
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/dms/_exporter.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/dms/_rules.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/dms/_rules_input.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/entities/__init__.py +26 -26
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/entities/_constants.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/entities/_loaders.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/entities/_multi_value.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/entities/_single_value.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/entities/_types.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/entities/_wrapped.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/information/__init__.py +5 -5
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/information/_rules.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/information/_rules_input.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/information/_validation.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/mapping/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/models/mapping/_classic2core.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/transformers/__init__.py +12 -12
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/transformers/_base.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/transformers/_converters.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/transformers/_mapping.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_rules/transformers/_verification.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_state.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/_wizard.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/engine/_import.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/engine/_interface.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/engine/_load.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_session/exceptions.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_shared.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/auxiliary.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/collection_.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/rdf_.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/reader/_base.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/spreadsheet.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/text.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/time_.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/upload.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_utils/xml_.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/__init__.py +3 -3
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/base.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/cdf_store.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/manager.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/model.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/data_contracts.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/lib/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/lib/current/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/lib/current/graph_loader.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/lib/current/graph_store.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/lib/current/rules_exporter.py +1 -1
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/lib/current/rules_importer.py +2 -2
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/lib/current/rules_validator.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/lib/io/__init__.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/lib/io/io_steps.py +3 -3
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps/step_model.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/steps_registry.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/tasks.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/triggers.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_workflows/utils.py +0 -0
- {cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/py.typed +0 -0
|
@@ -70,7 +70,7 @@ async def file_upload_handler(
|
|
|
70
70
|
|
|
71
71
|
NEAT_APP.workflow_manager.save_workflow_to_storage(workflow_name)
|
|
72
72
|
|
|
73
|
-
if "start_workflow" in action and file_type == "rules" or file_type == "staging":
|
|
73
|
+
if ("start_workflow" in action and file_type == "rules") or file_type == "staging":
|
|
74
74
|
logging.info("Starting workflow after file upload")
|
|
75
75
|
workflow = NEAT_APP.workflow_manager.get_workflow(workflow_name)
|
|
76
76
|
if workflow is None:
|
{cognite_neat-0.102.0 → cognite_neat-0.103.0}/cognite/neat/_client/_api/data_modeling_loaders.py
RENAMED
|
@@ -609,6 +609,7 @@ class ViewLoader(DataModelingLoader[ViewId, ViewApply, View, ViewApplyList, View
|
|
|
609
609
|
elif view_id in self._items_by_id:
|
|
610
610
|
view = self._items_by_id[view_id]
|
|
611
611
|
found.append(view)
|
|
612
|
+
found_ids.add(view_id)
|
|
612
613
|
batch_ids.update(self.get_connected_views(view, include_ancestors, include_connections, found_ids))
|
|
613
614
|
else:
|
|
614
615
|
to_retrieve_from_cdf.add(view_id)
|
|
@@ -620,7 +621,6 @@ class ViewLoader(DataModelingLoader[ViewId, ViewApply, View, ViewApplyList, View
|
|
|
620
621
|
found_ids.update({view.as_id() for view in retrieved_batch})
|
|
621
622
|
for view in retrieved_batch:
|
|
622
623
|
batch_ids.update(self.get_connected_views(view, include_ancestors, include_connections, found_ids))
|
|
623
|
-
|
|
624
624
|
last_batch = batch_ids
|
|
625
625
|
|
|
626
626
|
if self.cache is False:
|
|
@@ -20,7 +20,7 @@ class SchemaAPI:
|
|
|
20
20
|
view_ids: Sequence[dm.ViewId],
|
|
21
21
|
container_ids: Sequence[dm.ContainerId],
|
|
22
22
|
include_ancestors: bool = True,
|
|
23
|
-
include_connections=True,
|
|
23
|
+
include_connections: bool = True,
|
|
24
24
|
data_model_id: dm.DataModelId | None = None,
|
|
25
25
|
) -> DMSSchema:
|
|
26
26
|
data_model_id = data_model_id or dm.DataModelId("NEAT_LOOKUP", "NEAT_LOOKUP", "NEAT_LOOKUP")
|
|
@@ -232,9 +232,8 @@ def _remove_higher_occurring_sym_pair(
|
|
|
232
232
|
index = class_linkage[
|
|
233
233
|
(class_linkage.source_class == source) & (class_linkage.target_class == target)
|
|
234
234
|
].index.values[0]
|
|
235
|
-
elif (
|
|
236
|
-
|
|
237
|
-
or first_sym_property_occurrence <= second_sym_property_occurrence
|
|
235
|
+
elif second_sym_property_occurrence is None or (
|
|
236
|
+
first_sym_property_occurrence <= second_sym_property_occurrence
|
|
238
237
|
and second_sym_property_occurrence > first_sym_property_occurrence
|
|
239
238
|
):
|
|
240
239
|
# this means that target occurrence is unbounded
|
|
@@ -81,7 +81,7 @@ class CDFLoader(BaseLoader[T_Output]):
|
|
|
81
81
|
elif result is _END_OF_CLASS:
|
|
82
82
|
...
|
|
83
83
|
else:
|
|
84
|
-
# MyPy does not understand else means the item will be of type T_Output
|
|
84
|
+
# MyPy does not understand that 'else' means the item will be of type T_Output
|
|
85
85
|
items.append(result) # type: ignore[arg-type]
|
|
86
86
|
|
|
87
87
|
if len(items) >= self._UPLOAD_BATCH_SIZE or result is _END_OF_CLASS:
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import itertools
|
|
2
2
|
import json
|
|
3
|
+
from collections import defaultdict
|
|
3
4
|
from collections.abc import Iterable, Sequence
|
|
5
|
+
from graphlib import TopologicalSorter
|
|
4
6
|
from pathlib import Path
|
|
5
7
|
from typing import Any, get_args
|
|
6
8
|
|
|
@@ -16,6 +18,7 @@ from cognite.client.exceptions import CogniteAPIError
|
|
|
16
18
|
from pydantic import BaseModel, ValidationInfo, create_model, field_validator
|
|
17
19
|
from rdflib import RDF, URIRef
|
|
18
20
|
|
|
21
|
+
from cognite.neat._client import NeatClient
|
|
19
22
|
from cognite.neat._graph._tracking import LogTracker, Tracker
|
|
20
23
|
from cognite.neat._issues import IssueList, NeatIssue, NeatIssueList
|
|
21
24
|
from cognite.neat._issues.errors import (
|
|
@@ -32,9 +35,10 @@ from cognite.neat._rules.models.entities._single_value import ViewEntity
|
|
|
32
35
|
from cognite.neat._shared import InstanceType
|
|
33
36
|
from cognite.neat._store import NeatGraphStore
|
|
34
37
|
from cognite.neat._utils.auxiliary import create_sha256_hash
|
|
38
|
+
from cognite.neat._utils.rdf_ import remove_namespace_from_uri
|
|
35
39
|
from cognite.neat._utils.upload import UploadResult
|
|
36
40
|
|
|
37
|
-
from ._base import CDFLoader
|
|
41
|
+
from ._base import _END_OF_CLASS, CDFLoader
|
|
38
42
|
|
|
39
43
|
|
|
40
44
|
class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
@@ -44,9 +48,13 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
44
48
|
graph_store (NeatGraphStore): The graph store to load the data into.
|
|
45
49
|
data_model (dm.DataModel[dm.View] | None): The data model to load.
|
|
46
50
|
instance_space (str): The instance space to load the data into.
|
|
47
|
-
|
|
51
|
+
class_neat_id_by_view_id (dict[ViewId, URIRef] | None): A mapping from view id to class name. Defaults to None.
|
|
48
52
|
create_issues (Sequence[NeatIssue] | None): A list of issues that occurred during reading. Defaults to None.
|
|
49
53
|
tracker (type[Tracker] | None): The tracker to use. Defaults to None.
|
|
54
|
+
rules (DMSRules | None): The DMS rules used by the data model. This is used to lookup the
|
|
55
|
+
instances in the store. Defaults to None.
|
|
56
|
+
client (NeatClient | None): This is used to lookup containers such that the loader
|
|
57
|
+
creates instances in accordance with required constraints. Defaults to None.
|
|
50
58
|
"""
|
|
51
59
|
|
|
52
60
|
def __init__(
|
|
@@ -58,6 +66,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
58
66
|
create_issues: Sequence[NeatIssue] | None = None,
|
|
59
67
|
tracker: type[Tracker] | None = None,
|
|
60
68
|
rules: DMSRules | None = None,
|
|
69
|
+
client: NeatClient | None = None,
|
|
61
70
|
):
|
|
62
71
|
super().__init__(graph_store)
|
|
63
72
|
self.data_model = data_model
|
|
@@ -66,11 +75,12 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
66
75
|
self._issues = IssueList(create_issues or [])
|
|
67
76
|
self._tracker: type[Tracker] = tracker or LogTracker
|
|
68
77
|
self.rules = rules
|
|
78
|
+
self._client = client
|
|
69
79
|
|
|
70
80
|
@classmethod
|
|
71
81
|
def from_data_model_id(
|
|
72
82
|
cls,
|
|
73
|
-
client:
|
|
83
|
+
client: NeatClient,
|
|
74
84
|
data_model_id: dm.DataModelId,
|
|
75
85
|
graph_store: NeatGraphStore,
|
|
76
86
|
instance_space: str,
|
|
@@ -82,10 +92,12 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
82
92
|
except Exception as e:
|
|
83
93
|
issues.append(ResourceRetrievalError(data_model_id, "data model", str(e)))
|
|
84
94
|
|
|
85
|
-
return cls(graph_store, data_model, instance_space, {}, issues)
|
|
95
|
+
return cls(graph_store, data_model, instance_space, {}, issues, client=client)
|
|
86
96
|
|
|
87
97
|
@classmethod
|
|
88
|
-
def from_rules(
|
|
98
|
+
def from_rules(
|
|
99
|
+
cls, rules: DMSRules, graph_store: NeatGraphStore, instance_space: str, client: NeatClient | None = None
|
|
100
|
+
) -> "DMSLoader":
|
|
89
101
|
issues: list[NeatIssue] = []
|
|
90
102
|
data_model: dm.DataModel[dm.View] | None = None
|
|
91
103
|
try:
|
|
@@ -109,9 +121,10 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
109
121
|
class_neat_id_by_view_id,
|
|
110
122
|
issues,
|
|
111
123
|
rules=rules,
|
|
124
|
+
client=client,
|
|
112
125
|
)
|
|
113
126
|
|
|
114
|
-
def _load(self, stop_on_exception: bool = False) -> Iterable[dm.InstanceApply | NeatIssue]:
|
|
127
|
+
def _load(self, stop_on_exception: bool = False) -> Iterable[dm.InstanceApply | NeatIssue | type[_END_OF_CLASS]]:
|
|
115
128
|
if self._issues.has_errors and stop_on_exception:
|
|
116
129
|
raise self._issues.as_exception()
|
|
117
130
|
elif self._issues.has_errors:
|
|
@@ -126,45 +139,73 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
126
139
|
if self.rules and self.rules.metadata.logical
|
|
127
140
|
else None
|
|
128
141
|
)
|
|
142
|
+
view_and_count_by_id = self._select_views_with_instances(self.data_model.views)
|
|
143
|
+
if self._client:
|
|
144
|
+
view_and_count_by_id, properties_point_to_self = self._sort_by_direct_relation_dependencies(
|
|
145
|
+
view_and_count_by_id
|
|
146
|
+
)
|
|
147
|
+
else:
|
|
148
|
+
properties_point_to_self = {}
|
|
149
|
+
|
|
150
|
+
view_ids: list[str] = []
|
|
151
|
+
for view_id in view_and_count_by_id.keys():
|
|
152
|
+
view_ids.append(repr(view_id))
|
|
153
|
+
if view_id in properties_point_to_self:
|
|
154
|
+
# If the views have a dependency on themselves, we need to run it twice.
|
|
155
|
+
view_ids.append(f"{view_id!r} (self)")
|
|
129
156
|
|
|
130
|
-
view_ids = [repr(v.as_id()) for v in self.data_model.views]
|
|
131
157
|
tracker = self._tracker(type(self).__name__, view_ids, "views")
|
|
132
|
-
for view in
|
|
133
|
-
view_id = view.as_id()
|
|
134
|
-
tracker.start(repr(view_id))
|
|
158
|
+
for view_id, (view, _) in view_and_count_by_id.items():
|
|
135
159
|
pydantic_cls, edge_by_type, issues = self._create_validation_classes(view) # type: ignore[var-annotated]
|
|
136
160
|
yield from issues
|
|
137
161
|
tracker.issue(issues)
|
|
138
162
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
#
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if class_neat_id := self.class_neat_id_by_view_id.get(view_id):
|
|
146
|
-
reader = self.graph_store._read_via_rules_linkage(class_neat_id, property_link_pairs)
|
|
147
|
-
else:
|
|
148
|
-
error_view = ResourceRetrievalError(view_id, "view", "View not linked to class")
|
|
149
|
-
tracker.issue(error_view)
|
|
150
|
-
if stop_on_exception:
|
|
151
|
-
raise error_view
|
|
152
|
-
yield error_view
|
|
153
|
-
|
|
163
|
+
if view_id in properties_point_to_self:
|
|
164
|
+
# If the view has a dependency on itself, we need to run it twice.
|
|
165
|
+
# First, to ensure that all nodes are created, and then to add the direct relations.
|
|
166
|
+
# This only applies if there is a require constraint on the container, if not
|
|
167
|
+
# we can create an empty node on the fly.
|
|
168
|
+
iterations = [properties_point_to_self[view_id], set()]
|
|
154
169
|
else:
|
|
155
|
-
|
|
170
|
+
iterations = [set()]
|
|
156
171
|
|
|
157
|
-
for
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
172
|
+
for skip_properties in iterations:
|
|
173
|
+
if skip_properties:
|
|
174
|
+
track_id = f"{view_id} (self)"
|
|
175
|
+
else:
|
|
176
|
+
track_id = repr(view_id)
|
|
177
|
+
tracker.start(track_id)
|
|
178
|
+
if views_with_linked_properties:
|
|
179
|
+
# we need graceful exit if the view is not in the view_property_pairs
|
|
180
|
+
property_link_pairs = views_with_linked_properties.get(ViewEntity.from_id(view_id))
|
|
181
|
+
|
|
182
|
+
if class_neat_id := self.class_neat_id_by_view_id.get(view_id):
|
|
183
|
+
reader = self.graph_store._read_via_rules_linkage(class_neat_id, property_link_pairs)
|
|
184
|
+
else:
|
|
185
|
+
error_view = ResourceRetrievalError(view_id, "view", "View not linked to class")
|
|
186
|
+
tracker.issue(error_view)
|
|
187
|
+
if stop_on_exception:
|
|
188
|
+
raise error_view
|
|
189
|
+
yield error_view
|
|
190
|
+
continue
|
|
191
|
+
else:
|
|
192
|
+
# this assumes no changes in the suffix of view and class
|
|
193
|
+
reader = self.graph_store.read(view.external_id)
|
|
194
|
+
|
|
195
|
+
for identifier, properties in reader:
|
|
196
|
+
if skip_properties:
|
|
197
|
+
properties = {k: v for k, v in properties.items() if k not in skip_properties}
|
|
198
|
+
try:
|
|
199
|
+
yield self._create_node(identifier, properties, pydantic_cls, view_id)
|
|
200
|
+
except ValueError as e:
|
|
201
|
+
error_node = ResourceCreationError(identifier, "node", error=str(e))
|
|
202
|
+
tracker.issue(error_node)
|
|
203
|
+
if stop_on_exception:
|
|
204
|
+
raise error_node from e
|
|
205
|
+
yield error_node
|
|
206
|
+
yield from self._create_edges(identifier, properties, edge_by_type, tracker)
|
|
207
|
+
tracker.finish(track_id)
|
|
208
|
+
yield _END_OF_CLASS
|
|
168
209
|
|
|
169
210
|
def write_to_file(self, filepath: Path) -> None:
|
|
170
211
|
if filepath.suffix not in [".json", ".yaml", ".yml"]:
|
|
@@ -186,6 +227,68 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
186
227
|
else:
|
|
187
228
|
yaml.safe_dump(dumped, f, sort_keys=False)
|
|
188
229
|
|
|
230
|
+
def _select_views_with_instances(self, views: list[dm.View]) -> dict[dm.ViewId, tuple[dm.View, int]]:
|
|
231
|
+
"""Selects the views with data."""
|
|
232
|
+
view_and_count_by_id: dict[dm.ViewId, tuple[dm.View, int]] = {}
|
|
233
|
+
uri_by_type: dict[str, URIRef] = {
|
|
234
|
+
remove_namespace_from_uri(uri[0]): uri[0] # type: ignore[misc]
|
|
235
|
+
for uri in self.graph_store.queries.list_types()
|
|
236
|
+
}
|
|
237
|
+
for view in views:
|
|
238
|
+
view_id = view.as_id()
|
|
239
|
+
neat_id = self.class_neat_id_by_view_id.get(view_id)
|
|
240
|
+
if neat_id is not None:
|
|
241
|
+
count = self.graph_store.count_of_id(neat_id)
|
|
242
|
+
elif view.external_id in uri_by_type:
|
|
243
|
+
count = self.graph_store.count_of_type(uri_by_type[view.external_id])
|
|
244
|
+
else:
|
|
245
|
+
continue
|
|
246
|
+
if count > 0:
|
|
247
|
+
view_and_count_by_id[view_id] = view, count
|
|
248
|
+
|
|
249
|
+
return view_and_count_by_id
|
|
250
|
+
|
|
251
|
+
def _sort_by_direct_relation_dependencies(
|
|
252
|
+
self, view_and_count_by_id: dict[dm.ViewId, tuple[dm.View, int]]
|
|
253
|
+
) -> tuple[dict[dm.ViewId, tuple[dm.View, int]], dict[dm.ViewId, set[str]]]:
|
|
254
|
+
"""Sorts the views by container constraints."""
|
|
255
|
+
if not self._client:
|
|
256
|
+
return view_and_count_by_id, {}
|
|
257
|
+
# We need to retrieve the views to ensure we get all properties, such that we can find all
|
|
258
|
+
# the containers that the view is linked to.
|
|
259
|
+
views = self._client.data_modeling.views.retrieve(
|
|
260
|
+
list(view_and_count_by_id.keys()), include_inherited_properties=True
|
|
261
|
+
)
|
|
262
|
+
container_ids_by_view_id = {view.as_id(): view.referenced_containers() for view in views}
|
|
263
|
+
referenced_containers = {
|
|
264
|
+
container for containers in container_ids_by_view_id.values() for container in containers
|
|
265
|
+
}
|
|
266
|
+
containers = self._client.data_modeling.containers.retrieve(list(referenced_containers))
|
|
267
|
+
container_by_id = {container.as_id(): container for container in containers}
|
|
268
|
+
|
|
269
|
+
dependency_on_self: dict[dm.ViewId, set[str]] = defaultdict(set)
|
|
270
|
+
view_id_by_dependencies: dict[dm.ViewId, set[dm.ViewId]] = {}
|
|
271
|
+
for view in views:
|
|
272
|
+
view_id = view.as_id()
|
|
273
|
+
dependencies = set()
|
|
274
|
+
for prop_id, prop in view.properties.items():
|
|
275
|
+
if isinstance(prop, dm.MappedProperty) and isinstance(prop.type, dm.DirectRelation) and prop.source:
|
|
276
|
+
container = container_by_id[prop.container]
|
|
277
|
+
has_require_constraint = any(
|
|
278
|
+
isinstance(constraint, dm.RequiresConstraint) for constraint in container.constraints.values()
|
|
279
|
+
)
|
|
280
|
+
if has_require_constraint and prop.source == view_id:
|
|
281
|
+
dependency_on_self[view_id].add(prop_id)
|
|
282
|
+
elif has_require_constraint:
|
|
283
|
+
dependencies.add(prop.source)
|
|
284
|
+
view_id_by_dependencies[view_id] = dependencies
|
|
285
|
+
|
|
286
|
+
ordered_view_ids = TopologicalSorter(view_id_by_dependencies).static_order()
|
|
287
|
+
|
|
288
|
+
return {
|
|
289
|
+
view_id: view_and_count_by_id[view_id] for view_id in ordered_view_ids if view_id in view_and_count_by_id
|
|
290
|
+
}, dict(dependency_on_self)
|
|
291
|
+
|
|
189
292
|
def _create_validation_classes(
|
|
190
293
|
self, view: dm.View
|
|
191
294
|
) -> tuple[type[BaseModel], dict[str, tuple[str, dm.EdgeConnection]], NeatIssueList]:
|
|
@@ -194,13 +297,17 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
194
297
|
edge_by_property: dict[str, tuple[str, dm.EdgeConnection]] = {}
|
|
195
298
|
validators: dict[str, classmethod] = {}
|
|
196
299
|
direct_relation_by_property: dict[str, dm.DirectRelation] = {}
|
|
300
|
+
unit_properties: list[str] = []
|
|
197
301
|
json_fields: list[str] = []
|
|
198
|
-
for
|
|
302
|
+
for prop_id, prop in view.properties.items():
|
|
199
303
|
if isinstance(prop, dm.EdgeConnection):
|
|
200
|
-
edge_by_property[
|
|
304
|
+
edge_by_property[prop_id] = prop_id, prop
|
|
201
305
|
if isinstance(prop, dm.MappedProperty):
|
|
202
306
|
if isinstance(prop.type, dm.DirectRelation):
|
|
203
|
-
|
|
307
|
+
if prop.container == dm.ContainerId("cdf_cdm", "CogniteTimeSeries") and prop_id == "unit":
|
|
308
|
+
unit_properties.append(prop_id)
|
|
309
|
+
else:
|
|
310
|
+
direct_relation_by_property[prop_id] = prop.type
|
|
204
311
|
python_type: Any = dict
|
|
205
312
|
else:
|
|
206
313
|
data_type = _DATA_TYPE_BY_DMS_TYPE.get(prop.type._type)
|
|
@@ -209,14 +316,14 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
209
316
|
PropertyTypeNotSupportedWarning(
|
|
210
317
|
view.as_id(),
|
|
211
318
|
"view",
|
|
212
|
-
|
|
319
|
+
prop_id,
|
|
213
320
|
prop.type._type,
|
|
214
321
|
)
|
|
215
322
|
)
|
|
216
323
|
continue
|
|
217
324
|
|
|
218
325
|
if data_type == Json:
|
|
219
|
-
json_fields.append(
|
|
326
|
+
json_fields.append(prop_id)
|
|
220
327
|
python_type = data_type.python
|
|
221
328
|
if isinstance(prop.type, ListablePropertyType) and prop.type.is_list:
|
|
222
329
|
python_type = list[python_type]
|
|
@@ -226,7 +333,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
226
333
|
else:
|
|
227
334
|
default_value = ...
|
|
228
335
|
|
|
229
|
-
field_definitions[
|
|
336
|
+
field_definitions[prop_id] = (python_type, default_value)
|
|
230
337
|
|
|
231
338
|
def parse_list(cls, value: Any, info: ValidationInfo) -> list[str]:
|
|
232
339
|
if isinstance(value, list) and list.__name__ not in _get_field_value_types(cls, info):
|
|
@@ -257,15 +364,26 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
257
364
|
def parse_direct_relation(cls, value: list, info: ValidationInfo) -> dict | list[dict]:
|
|
258
365
|
# We validate above that we only get one value for single direct relations.
|
|
259
366
|
if list.__name__ in _get_field_value_types(cls, info):
|
|
260
|
-
return [{"space": self.instance_space, "externalId": v} for v in value]
|
|
367
|
+
return [{"space": self.instance_space, "externalId": remove_namespace_from_uri(v)} for v in value]
|
|
261
368
|
elif value:
|
|
262
|
-
return {"space": self.instance_space, "externalId": value[0]}
|
|
369
|
+
return {"space": self.instance_space, "externalId": remove_namespace_from_uri(value[0])}
|
|
263
370
|
return {}
|
|
264
371
|
|
|
265
372
|
validators["parse_direct_relation"] = field_validator(*direct_relation_by_property.keys(), mode="before")( # type: ignore[assignment]
|
|
266
373
|
parse_direct_relation # type: ignore[arg-type]
|
|
267
374
|
)
|
|
268
375
|
|
|
376
|
+
if unit_properties:
|
|
377
|
+
|
|
378
|
+
def parse_direct_relation_to_unit(cls, value: Any, info: ValidationInfo) -> dict | list[dict]:
|
|
379
|
+
if value:
|
|
380
|
+
return {"space": "cdf_cdm_units", "externalId": remove_namespace_from_uri(value[0])}
|
|
381
|
+
return {}
|
|
382
|
+
|
|
383
|
+
validators["parse_direct_relation_to_unit"] = field_validator(*unit_properties, mode="before")( # type: ignore[assignment]
|
|
384
|
+
parse_direct_relation_to_unit # type: ignore[arg-type]
|
|
385
|
+
)
|
|
386
|
+
|
|
269
387
|
pydantic_cls = create_model(view.external_id, __validators__=validators, **field_definitions) # type: ignore[arg-type, call-overload]
|
|
270
388
|
return pydantic_cls, edge_by_property, issues
|
|
271
389
|
|
|
@@ -371,8 +489,8 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
371
489
|
(upserted.edges, source_by_edge_id),
|
|
372
490
|
]:
|
|
373
491
|
for name, subinstances in itertools.groupby(
|
|
374
|
-
sorted(instances, key=lambda i: ids_by_source
|
|
375
|
-
key=lambda i: ids_by_source
|
|
492
|
+
sorted(instances, key=lambda i: ids_by_source.get(i.as_id(), "")), # type: ignore[call-overload, index, attr-defined]
|
|
493
|
+
key=lambda i: ids_by_source.get(i.as_id(), ""), # type: ignore[index, attr-defined]
|
|
376
494
|
):
|
|
377
495
|
result = UploadResult(name=name, issues=read_issues)
|
|
378
496
|
for instance in subinstances: # type: ignore[attr-defined]
|
|
@@ -15,24 +15,26 @@ from ._prune_graph import (
|
|
|
15
15
|
PruneTypes,
|
|
16
16
|
)
|
|
17
17
|
from ._rdfpath import AddSelfReferenceProperty, MakeConnectionOnExactMatch
|
|
18
|
-
from ._value_type import SplitMultiValueProperty
|
|
18
|
+
from ._value_type import ConvertLiteral, LiteralToEntity, SplitMultiValueProperty
|
|
19
19
|
|
|
20
20
|
__all__ = [
|
|
21
21
|
"AddAssetDepth",
|
|
22
|
-
"
|
|
23
|
-
"AssetSequenceConnector",
|
|
24
|
-
"AssetFileConnector",
|
|
22
|
+
"AddSelfReferenceProperty",
|
|
25
23
|
"AssetEventConnector",
|
|
24
|
+
"AssetFileConnector",
|
|
26
25
|
"AssetRelationshipConnector",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"RelationshipAsEdgeTransformer",
|
|
30
|
-
"MakeConnectionOnExactMatch",
|
|
26
|
+
"AssetSequenceConnector",
|
|
27
|
+
"AssetTimeSeriesConnector",
|
|
31
28
|
"AttachPropertyFromTargetToSource",
|
|
29
|
+
"ConvertLiteral",
|
|
30
|
+
"LiteralToEntity",
|
|
31
|
+
"MakeConnectionOnExactMatch",
|
|
32
32
|
"PruneDanglingNodes",
|
|
33
|
-
"PruneTypes",
|
|
34
33
|
"PruneDeadEndEdges",
|
|
35
34
|
"PruneInstancesOfUnknownType",
|
|
35
|
+
"PruneTypes",
|
|
36
|
+
"RelationshipAsEdgeTransformer",
|
|
37
|
+
"SplitMultiValueProperty",
|
|
36
38
|
]
|
|
37
39
|
|
|
38
40
|
Transformers = (
|
|
@@ -51,4 +53,6 @@ Transformers = (
|
|
|
51
53
|
| PruneTypes
|
|
52
54
|
| PruneDeadEndEdges
|
|
53
55
|
| PruneInstancesOfUnknownType
|
|
56
|
+
| ConvertLiteral
|
|
57
|
+
| LiteralToEntity
|
|
54
58
|
)
|