cognite-neat 0.103.1__tar.gz → 0.105.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.103.1 → cognite_neat-0.105.0}/PKG-INFO +3 -2
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_client/_api/data_modeling_loaders.py +83 -23
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_client/_api/schema.py +2 -1
- cognite_neat-0.105.0/cognite/neat/_client/data_classes/neat_sequence.py +261 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_client/data_classes/schema.py +5 -1
- cognite_neat-0.105.0/cognite/neat/_client/testing.py +33 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_constants.py +56 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_classic_cdf/_base.py +6 -5
- cognite_neat-0.105.0/cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +251 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_mock_graph_generator.py +2 -2
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/loaders/_rdf2dms.py +13 -2
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/transformers/__init__.py +3 -1
- cognite_neat-0.105.0/cognite/neat/_graph/transformers/_base.py +122 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/transformers/_classic_cdf.py +6 -1
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/transformers/_prune_graph.py +103 -47
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/transformers/_rdfpath.py +41 -17
- cognite_neat-0.105.0/cognite/neat/_graph/transformers/_value_type.py +297 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/__init__.py +0 -2
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/_base.py +54 -43
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/warnings/__init__.py +4 -1
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/warnings/_general.py +7 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/warnings/_resources.py +12 -1
- cognite_neat-0.105.0/cognite/neat/_rules/_shared.py +40 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/exporters/_base.py +28 -2
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/exporters/_rules2dms.py +39 -1
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/exporters/_rules2excel.py +13 -2
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/exporters/_rules2instance_template.py +4 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/exporters/_rules2ontology.py +13 -1
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/exporters/_rules2yaml.py +4 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_base.py +9 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_dms2rules.py +80 -57
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +5 -2
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_rdf/_base.py +10 -8
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_rdf/_imf2rules.py +4 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_rdf/_inference2rules.py +7 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_rdf/_owl2rules.py +4 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_spreadsheet2rules.py +17 -8
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_yaml2rules.py +21 -7
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/_base_input.py +1 -1
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/_base_rules.py +9 -1
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/dms/_rules.py +4 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/dms/_rules_input.py +9 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/entities/_wrapped.py +10 -5
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/information/_rules.py +4 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/information/_rules_input.py +9 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/mapping/_classic2core.py +2 -5
- cognite_neat-0.105.0/cognite/neat/_rules/models/mapping/_classic2core.yaml +590 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/transformers/__init__.py +13 -6
- cognite_neat-0.105.0/cognite/neat/_rules/transformers/_base.py +64 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/transformers/_converters.py +404 -234
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/transformers/_mapping.py +93 -72
- cognite_neat-0.105.0/cognite/neat/_rules/transformers/_verification.py +116 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/_base.py +32 -121
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/_inspect.py +5 -3
- cognite_neat-0.105.0/cognite/neat/_session/_mapping.py +56 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/_prepare.py +138 -268
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/_read.py +39 -195
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/_set.py +6 -30
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/_show.py +40 -21
- cognite_neat-0.105.0/cognite/neat/_session/_state.py +90 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/_to.py +44 -33
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_shared.py +23 -2
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_store/_provenance.py +3 -82
- cognite_neat-0.105.0/cognite/neat/_store/_rules_store.py +378 -0
- cognite_neat-0.105.0/cognite/neat/_store/exceptions.py +23 -0
- cognite_neat-0.105.0/cognite/neat/_utils/graph_transformations_report.py +36 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/rdf_.py +8 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/reader/_base.py +27 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/spreadsheet.py +5 -4
- cognite_neat-0.105.0/cognite/neat/_version.py +2 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/pyproject.toml +6 -2
- cognite_neat-0.103.1/cognite/neat/_app/api/asgi/metrics.py +0 -4
- cognite_neat-0.103.1/cognite/neat/_app/api/configuration.py +0 -98
- cognite_neat-0.103.1/cognite/neat/_app/api/context_manager/__init__.py +0 -3
- cognite_neat-0.103.1/cognite/neat/_app/api/context_manager/manager.py +0 -16
- cognite_neat-0.103.1/cognite/neat/_app/api/data_classes/rest.py +0 -59
- cognite_neat-0.103.1/cognite/neat/_app/api/explorer.py +0 -66
- cognite_neat-0.103.1/cognite/neat/_app/api/routers/configuration.py +0 -25
- cognite_neat-0.103.1/cognite/neat/_app/api/routers/crud.py +0 -102
- cognite_neat-0.103.1/cognite/neat/_app/api/routers/metrics.py +0 -10
- cognite_neat-0.103.1/cognite/neat/_app/api/routers/workflows.py +0 -224
- cognite_neat-0.103.1/cognite/neat/_app/api/utils/data_mapping.py +0 -17
- cognite_neat-0.103.1/cognite/neat/_app/api/utils/logging.py +0 -26
- cognite_neat-0.103.1/cognite/neat/_app/api/utils/query_templates.py +0 -92
- cognite_neat-0.103.1/cognite/neat/_app/main.py +0 -17
- cognite_neat-0.103.1/cognite/neat/_app/monitoring/metrics.py +0 -69
- cognite_neat-0.103.1/cognite/neat/_app/ui/index.html +0 -1
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/.gitignore +0 -23
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/README.md +0 -70
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/asset-manifest.json +0 -14
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/favicon.ico +0 -0
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/img/architect-icon.svg +0 -116
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/img/developer-icon.svg +0 -112
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/img/sme-icon.svg +0 -34
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/index.html +0 -1
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/logo192.png +0 -0
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/manifest.json +0 -25
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/robots.txt +0 -3
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -2
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -1
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -3
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -88
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -1
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -1
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/package-lock.json +0 -18306
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/package.json +0 -62
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +0 -116
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +0 -112
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +0 -34
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/public/index.html +0 -43
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/public/manifest.json +0 -25
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/public/robots.txt +0 -3
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/App.css +0 -38
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/App.js +0 -17
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/App.test.js +0 -8
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +0 -70
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +0 -43
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +0 -124
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +0 -63
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +0 -511
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +0 -36
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +0 -56
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +0 -60
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +0 -112
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +0 -67
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +0 -79
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/index.css +0 -13
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/index.js +0 -13
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/logo.svg +0 -1
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +0 -13
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/setupTests.js +0 -5
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +0 -388
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +0 -61
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +0 -184
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +0 -180
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +0 -570
- cognite_neat-0.103.1/cognite/neat/_app/ui/neat-app/tsconfig.json +0 -27
- cognite_neat-0.103.1/cognite/neat/_graph/__init__.py +0 -0
- cognite_neat-0.103.1/cognite/neat/_graph/extractors/_classic_cdf/__init__.py +0 -0
- cognite_neat-0.103.1/cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +0 -37
- cognite_neat-0.103.1/cognite/neat/_graph/transformers/_base.py +0 -14
- cognite_neat-0.103.1/cognite/neat/_graph/transformers/_value_type.py +0 -260
- cognite_neat-0.103.1/cognite/neat/_rules/__init__.py +0 -0
- cognite_neat-0.103.1/cognite/neat/_rules/_shared.py +0 -56
- cognite_neat-0.103.1/cognite/neat/_rules/models/mapping/_classic2core.yaml +0 -389
- cognite_neat-0.103.1/cognite/neat/_rules/transformers/_base.py +0 -88
- cognite_neat-0.103.1/cognite/neat/_rules/transformers/_pipelines.py +0 -70
- cognite_neat-0.103.1/cognite/neat/_rules/transformers/_verification.py +0 -104
- cognite_neat-0.103.1/cognite/neat/_session/_mapping.py +0 -144
- cognite_neat-0.103.1/cognite/neat/_session/_state.py +0 -148
- cognite_neat-0.103.1/cognite/neat/_store/_rules_store.py +0 -20
- cognite_neat-0.103.1/cognite/neat/_utils/__init__.py +0 -0
- cognite_neat-0.103.1/cognite/neat/_version.py +0 -2
- cognite_neat-0.103.1/cognite/neat/_workflows/__init__.py +0 -17
- cognite_neat-0.103.1/cognite/neat/_workflows/base.py +0 -590
- cognite_neat-0.103.1/cognite/neat/_workflows/cdf_store.py +0 -393
- cognite_neat-0.103.1/cognite/neat/_workflows/examples/Export_DMS/workflow.yaml +0 -89
- cognite_neat-0.103.1/cognite/neat/_workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -66
- cognite_neat-0.103.1/cognite/neat/_workflows/examples/Import_DMS/workflow.yaml +0 -65
- cognite_neat-0.103.1/cognite/neat/_workflows/examples/Validate_Rules/workflow.yaml +0 -67
- cognite_neat-0.103.1/cognite/neat/_workflows/examples/Validate_Solution_Model/workflow.yaml +0 -64
- cognite_neat-0.103.1/cognite/neat/_workflows/manager.py +0 -292
- cognite_neat-0.103.1/cognite/neat/_workflows/model.py +0 -203
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/__init__.py +0 -0
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/data_contracts.py +0 -109
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/lib/__init__.py +0 -0
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/lib/current/__init__.py +0 -6
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/lib/current/graph_extractor.py +0 -100
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/lib/current/graph_loader.py +0 -51
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/lib/current/graph_store.py +0 -48
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/lib/current/rules_exporter.py +0 -537
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/lib/current/rules_importer.py +0 -398
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/lib/current/rules_validator.py +0 -106
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/lib/io/__init__.py +0 -1
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/lib/io/io_steps.py +0 -393
- cognite_neat-0.103.1/cognite/neat/_workflows/steps/step_model.py +0 -79
- cognite_neat-0.103.1/cognite/neat/_workflows/steps_registry.py +0 -218
- cognite_neat-0.103.1/cognite/neat/_workflows/tasks.py +0 -18
- cognite_neat-0.103.1/cognite/neat/_workflows/triggers.py +0 -169
- cognite_neat-0.103.1/cognite/neat/_workflows/utils.py +0 -19
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/LICENSE +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/README.md +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_client/__init__.py +0 -0
- {cognite_neat-0.103.1/cognite/neat/_app/api → cognite_neat-0.105.0/cognite/neat/_client/_api}/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_client/_api_client.py +0 -0
- {cognite_neat-0.103.1/cognite/neat/_app/api → cognite_neat-0.105.0/cognite/neat/_client}/data_classes/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_client/data_classes/data_modeling.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_config.py +0 -0
- {cognite_neat-0.103.1/cognite/neat/_app/api/utils → cognite_neat-0.105.0/cognite/neat/_graph}/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/_shared.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/_tracking/base.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/_tracking/log.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/examples/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_base.py +0 -0
- {cognite_neat-0.103.1/cognite/neat/_app/monitoring → cognite_neat-0.105.0/cognite/neat/_graph/extractors/_classic_cdf}/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_classic_cdf/_assets.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_classic_cdf/_classic.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_classic_cdf/_data_sets.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_classic_cdf/_labels.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_dms.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_iodd.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/loaders/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/loaders/_base.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/queries/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/queries/_base.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/queries/_construct.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/queries/_shared.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/transformers/_iodd.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/errors/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/errors/_external.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/errors/_general.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/errors/_properties.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/errors/_resources.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/errors/_workflow.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/formatters.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/warnings/_external.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/warnings/_models.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/warnings/_properties.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_issues/warnings/user_modeling.py +0 -0
- {cognite_neat-0.103.1/cognite/neat/_client/_api → cognite_neat-0.105.0/cognite/neat/_rules}/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/_constants.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/analysis/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/analysis/_base.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/analysis/_dms.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/analysis/_information.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/catalog/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/catalog/hello_world_pump.xlsx +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/exporters/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/exporters/_validation.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_rdf/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/importers/_rdf/_shared.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/_rdfpath.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/_types.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/data_types.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/dms/_exporter.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/dms/_validation.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/entities/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/entities/_constants.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/entities/_loaders.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/entities/_multi_value.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/entities/_single_value.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/entities/_types.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/information/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/information/_validation.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_rules/models/mapping/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/_collector.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/_drop.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/_wizard.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/engine/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/engine/_import.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/engine/_interface.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/engine/_load.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_session/exceptions.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_store/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_store/_graph_store.py +0 -0
- {cognite_neat-0.103.1/cognite/neat/_client/data_classes → cognite_neat-0.105.0/cognite/neat/_utils}/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/auth.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/auxiliary.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/collection_.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/io_.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/reader/__init__.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/text.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/time_.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/upload.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_utils/xml_.py +0 -0
- {cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: cognite-neat
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.105.0
|
|
4
4
|
Summary: Knowledge graph transformation
|
|
5
5
|
Home-page: https://cognite-neat.readthedocs-hosted.com/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -29,6 +29,7 @@ Requires-Dist: google-auth-oauthlib ; extra == "google"
|
|
|
29
29
|
Requires-Dist: gspread ; extra == "google"
|
|
30
30
|
Requires-Dist: jsonpath-python (>=1.0.6,<2.0.0)
|
|
31
31
|
Requires-Dist: lxml (>=5.3.0,<6.0.0) ; extra == "all"
|
|
32
|
+
Requires-Dist: mistune (==3.0.2) ; extra == "docs"
|
|
32
33
|
Requires-Dist: mixpanel (>=4.10.1,<5.0.0)
|
|
33
34
|
Requires-Dist: mkdocs ; extra == "docs"
|
|
34
35
|
Requires-Dist: mkdocs-autorefs (>=0.5.0,<0.6.0) ; extra == "docs"
|
{cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_client/_api/data_modeling_loaders.py
RENAMED
|
@@ -3,7 +3,7 @@ from abc import ABC, abstractmethod
|
|
|
3
3
|
from collections.abc import Callable, Collection, Iterable, Sequence
|
|
4
4
|
from dataclasses import dataclass, field
|
|
5
5
|
from graphlib import TopologicalSorter
|
|
6
|
-
from typing import TYPE_CHECKING, Any, ClassVar, Generic, Literal, TypeVar, cast
|
|
6
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Generic, Literal, TypeVar, cast, overload
|
|
7
7
|
|
|
8
8
|
from cognite.client.data_classes import filters
|
|
9
9
|
from cognite.client.data_classes._base import (
|
|
@@ -124,23 +124,37 @@ class ResourceLoader(
|
|
|
124
124
|
|
|
125
125
|
return created
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
@overload
|
|
128
|
+
def retrieve(
|
|
129
|
+
self, ids: SequenceNotStr[T_ID], format: Literal["read"] = "read"
|
|
130
|
+
) -> T_WritableCogniteResourceList: ...
|
|
131
|
+
|
|
132
|
+
@overload
|
|
133
|
+
def retrieve(self, ids: SequenceNotStr[T_ID], format: Literal["write"] = "write") -> T_CogniteResourceList: ...
|
|
134
|
+
|
|
135
|
+
def retrieve(
|
|
136
|
+
self, ids: SequenceNotStr[T_ID], format: Literal["read", "write"] = "read"
|
|
137
|
+
) -> T_WritableCogniteResourceList | T_CogniteResourceList:
|
|
128
138
|
if not self.cache:
|
|
129
139
|
# We now that SequenceNotStr = Sequence
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
output = self._fallback_one_by_one(self._retrieve, ids) # type: ignore[arg-type]
|
|
141
|
+
else:
|
|
142
|
+
exception: MultiCogniteAPIError[T_ID, T_WritableCogniteResourceList] | None = None
|
|
143
|
+
missing_ids = [id for id in ids if id not in self._items_by_id.keys()]
|
|
144
|
+
if missing_ids:
|
|
145
|
+
try:
|
|
146
|
+
retrieved = self._retrieve(missing_ids)
|
|
147
|
+
except MultiCogniteAPIError as e:
|
|
148
|
+
retrieved = e.success
|
|
149
|
+
exception = e
|
|
150
|
+
self._items_by_id.update({self.get_id(item): item for item in retrieved})
|
|
151
|
+
if exception is not None:
|
|
152
|
+
raise exception
|
|
153
|
+
# We need to check the cache again, in case we didn't retrieve all the items.
|
|
154
|
+
output = self._create_list([self._items_by_id[id] for id in ids if id in self._items_by_id])
|
|
155
|
+
if format == "write":
|
|
156
|
+
return cast(T_CogniteResourceList, output.as_write())
|
|
157
|
+
return output
|
|
144
158
|
|
|
145
159
|
def update(
|
|
146
160
|
self, items: Sequence[T_WriteClass], force: bool = False, drop_data: bool = False
|
|
@@ -404,11 +418,30 @@ class ContainerLoader(DataModelingLoader[ContainerId, ContainerApply, Container,
|
|
|
404
418
|
def _create(self, items: Sequence[ContainerApply]) -> ContainerList:
|
|
405
419
|
return self._client.data_modeling.containers.apply(items)
|
|
406
420
|
|
|
407
|
-
|
|
421
|
+
@overload
|
|
422
|
+
def retrieve(
|
|
423
|
+
self, ids: SequenceNotStr[ContainerId], format: Literal["read"] = "read", include_connected: bool = False
|
|
424
|
+
) -> ContainerList: ...
|
|
425
|
+
|
|
426
|
+
@overload
|
|
427
|
+
def retrieve(
|
|
428
|
+
self, ids: SequenceNotStr[ContainerId], format: Literal["write"] = "write", include_connected: bool = False
|
|
429
|
+
) -> ContainerApplyList: ...
|
|
430
|
+
|
|
431
|
+
def retrieve(
|
|
432
|
+
self,
|
|
433
|
+
ids: SequenceNotStr[ContainerId],
|
|
434
|
+
format: Literal["read", "write"] = "read",
|
|
435
|
+
include_connected: bool = False,
|
|
436
|
+
) -> ContainerList | ContainerApplyList:
|
|
408
437
|
if not include_connected:
|
|
409
438
|
return super().retrieve(ids)
|
|
439
|
+
|
|
410
440
|
# Retrieve recursively updates the cache.
|
|
411
|
-
|
|
441
|
+
output = self._retrieve_recursive(ids)
|
|
442
|
+
if format == "write":
|
|
443
|
+
return output.as_write()
|
|
444
|
+
return output
|
|
412
445
|
|
|
413
446
|
def _retrieve(self, ids: SequenceNotStr[ContainerId]) -> ContainerList:
|
|
414
447
|
return self._client.data_modeling.containers.retrieve(cast(Sequence, ids))
|
|
@@ -531,13 +564,40 @@ class ViewLoader(DataModelingLoader[ViewId, ViewApply, View, ViewApplyList, View
|
|
|
531
564
|
def _create(self, items: Sequence[ViewApply]) -> ViewList:
|
|
532
565
|
return self._client.data_modeling.views.apply(items)
|
|
533
566
|
|
|
567
|
+
@overload
|
|
534
568
|
def retrieve(
|
|
535
|
-
self,
|
|
536
|
-
|
|
569
|
+
self,
|
|
570
|
+
ids: SequenceNotStr[ViewId],
|
|
571
|
+
format: Literal["read"] = "read",
|
|
572
|
+
include_connected: bool = False,
|
|
573
|
+
include_ancestor: bool = False,
|
|
574
|
+
) -> ViewList: ...
|
|
575
|
+
|
|
576
|
+
@overload
|
|
577
|
+
def retrieve(
|
|
578
|
+
self,
|
|
579
|
+
ids: SequenceNotStr[ViewId],
|
|
580
|
+
format: Literal["write"] = "write",
|
|
581
|
+
include_connected: bool = False,
|
|
582
|
+
include_ancestor: bool = False,
|
|
583
|
+
) -> ViewApplyList: ...
|
|
584
|
+
|
|
585
|
+
def retrieve(
|
|
586
|
+
self,
|
|
587
|
+
ids: SequenceNotStr[ViewId],
|
|
588
|
+
format: Literal["read", "write"] = "read",
|
|
589
|
+
include_connected: bool = False,
|
|
590
|
+
include_ancestor: bool = False,
|
|
591
|
+
) -> ViewList | ViewApplyList:
|
|
537
592
|
if not include_connected and not include_ancestor:
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
593
|
+
# Default .as_write() method does not work for views as they include parent properties.
|
|
594
|
+
output = super().retrieve(ids)
|
|
595
|
+
else:
|
|
596
|
+
# Retrieve recursively updates the cache.
|
|
597
|
+
output = self._retrieve_recursive(ids, include_connected, include_ancestor)
|
|
598
|
+
if format == "write":
|
|
599
|
+
return ViewApplyList([self.as_write(view) for view in output])
|
|
600
|
+
return output
|
|
541
601
|
|
|
542
602
|
def _retrieve(self, ids: SequenceNotStr[ViewId]) -> ViewList:
|
|
543
603
|
return self._client.data_modeling.views.retrieve(cast(Sequence, ids))
|
|
@@ -27,7 +27,8 @@ class SchemaAPI:
|
|
|
27
27
|
if data_model_id.version is None:
|
|
28
28
|
raise NeatValueError("Data model version must be specified")
|
|
29
29
|
read_views = self._client.loaders.views.retrieve(
|
|
30
|
-
view_ids,
|
|
30
|
+
list(view_ids),
|
|
31
|
+
format="read",
|
|
31
32
|
include_connected=include_connections,
|
|
32
33
|
include_ancestor=include_ancestors,
|
|
33
34
|
)
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"""Neat sequence combines the CogniteClient sequence and the SequenceRows"""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
import warnings
|
|
5
|
+
from abc import ABC
|
|
6
|
+
from collections.abc import Sequence
|
|
7
|
+
from typing import Any, cast
|
|
8
|
+
|
|
9
|
+
import cognite.client.data_classes as cdc
|
|
10
|
+
from cognite.client import CogniteClient
|
|
11
|
+
from cognite.client.data_classes import (
|
|
12
|
+
SequenceColumn,
|
|
13
|
+
SequenceColumnList,
|
|
14
|
+
SequenceColumnWrite,
|
|
15
|
+
SequenceColumnWriteList,
|
|
16
|
+
SequenceRow,
|
|
17
|
+
)
|
|
18
|
+
from cognite.client.data_classes._base import (
|
|
19
|
+
CogniteResourceList,
|
|
20
|
+
ExternalIDTransformerMixin,
|
|
21
|
+
IdTransformerMixin,
|
|
22
|
+
WriteableCogniteResource,
|
|
23
|
+
WriteableCogniteResourceList,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if sys.version_info >= (3, 11):
|
|
27
|
+
from typing import Self
|
|
28
|
+
else:
|
|
29
|
+
from typing_extensions import Self
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class NeatSequenceCore(WriteableCogniteResource["NeatSequenceWrite"], ABC):
|
|
33
|
+
"""Information about the sequence stored in the database
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
name (str | None): Name of the sequence
|
|
37
|
+
description (str | None): Description of the sequence
|
|
38
|
+
asset_id (int | None): Optional asset this sequence is associated with
|
|
39
|
+
external_id (str | None): The external ID provided by the client. Must be unique for the resource type.
|
|
40
|
+
metadata (dict[str, Any] | None): Custom, application-specific metadata. String key -> String value.
|
|
41
|
+
The maximum length of the key is 32 bytes, the value 512 bytes, with up to 16 key-value pairs.
|
|
42
|
+
data_set_id (int | None): Data set that this sequence belongs to
|
|
43
|
+
rows (typing.Sequence[SequenceRow] | None): The rows in the sequence.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
def __init__(
|
|
47
|
+
self,
|
|
48
|
+
name: str | None = None,
|
|
49
|
+
description: str | None = None,
|
|
50
|
+
asset_id: int | None = None,
|
|
51
|
+
external_id: str | None = None,
|
|
52
|
+
metadata: dict[str, Any] | None = None,
|
|
53
|
+
data_set_id: int | None = None,
|
|
54
|
+
rows: Sequence[SequenceRow] | None = None,
|
|
55
|
+
) -> None:
|
|
56
|
+
self.name = name
|
|
57
|
+
self.description = description
|
|
58
|
+
self.asset_id = asset_id
|
|
59
|
+
self.external_id = external_id
|
|
60
|
+
self.metadata = metadata
|
|
61
|
+
self.data_set_id = data_set_id
|
|
62
|
+
self.rows = rows
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class NeatSequenceWrite(NeatSequenceCore):
|
|
66
|
+
"""Information about the sequence stored in the database.
|
|
67
|
+
This is the writing version of the class, it is used for inserting data into the CDF.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
columns (typing.Sequence[SequenceColumnWrite]): List of column definitions
|
|
71
|
+
name (str | None): Name of the sequence
|
|
72
|
+
description (str | None): Description of the sequence
|
|
73
|
+
asset_id (int | None): Optional asset this sequence is associated with
|
|
74
|
+
external_id (str | None): The external ID provided by the client. Must be unique for the resource type.
|
|
75
|
+
metadata (dict[str, Any] | None): Custom, application-specific metadata. String key -> String value.
|
|
76
|
+
The maximum length of key is 32 bytes, value 512 bytes, up to 16 key-value pairs.
|
|
77
|
+
data_set_id (int | None): Data set that this sequence belongs to
|
|
78
|
+
rows (typing.Sequence[SequenceRow] | None): The rows in the sequence.
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
def __init__(
|
|
82
|
+
self,
|
|
83
|
+
columns: Sequence[SequenceColumnWrite],
|
|
84
|
+
name: str | None = None,
|
|
85
|
+
description: str | None = None,
|
|
86
|
+
asset_id: int | None = None,
|
|
87
|
+
external_id: str | None = None,
|
|
88
|
+
metadata: dict[str, Any] | None = None,
|
|
89
|
+
data_set_id: int | None = None,
|
|
90
|
+
rows: Sequence[SequenceRow] | None = None,
|
|
91
|
+
) -> None:
|
|
92
|
+
super().__init__(
|
|
93
|
+
name=name,
|
|
94
|
+
description=description,
|
|
95
|
+
asset_id=asset_id,
|
|
96
|
+
external_id=external_id,
|
|
97
|
+
metadata=metadata,
|
|
98
|
+
data_set_id=data_set_id,
|
|
99
|
+
rows=rows,
|
|
100
|
+
)
|
|
101
|
+
self.columns: SequenceColumnWriteList
|
|
102
|
+
if isinstance(columns, SequenceColumnWriteList):
|
|
103
|
+
self.columns = columns
|
|
104
|
+
elif isinstance(columns, Sequence) and all(isinstance(col, SequenceColumnWrite) for col in columns):
|
|
105
|
+
self.columns = SequenceColumnWriteList(columns)
|
|
106
|
+
else:
|
|
107
|
+
raise ValueError(f"columns must be a sequence of SequenceColumnWrite objects not {type(columns)}")
|
|
108
|
+
|
|
109
|
+
@classmethod
|
|
110
|
+
def _load(cls, resource: dict, cognite_client: CogniteClient | None = None) -> Self:
|
|
111
|
+
return cls(
|
|
112
|
+
columns=SequenceColumnWriteList._load(resource["columns"]),
|
|
113
|
+
name=resource.get("name"),
|
|
114
|
+
description=resource.get("description"),
|
|
115
|
+
asset_id=resource.get("assetId"),
|
|
116
|
+
external_id=resource.get("externalId"),
|
|
117
|
+
metadata=resource.get("metadata"),
|
|
118
|
+
data_set_id=resource.get("dataSetId"),
|
|
119
|
+
rows=[SequenceRow._load(row) for row in resource.get("rows", [])],
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
def dump(self, camel_case: bool = True) -> dict[str, Any]:
|
|
123
|
+
dumped = super().dump(camel_case)
|
|
124
|
+
dumped["columns"] = self.columns.dump(camel_case)
|
|
125
|
+
if self.rows is not None:
|
|
126
|
+
dumped["rows"] = [row.dump(camel_case) for row in self.rows]
|
|
127
|
+
return dumped
|
|
128
|
+
|
|
129
|
+
def as_write(self) -> "NeatSequenceWrite":
|
|
130
|
+
"""Returns this NeatSequenceWrite."""
|
|
131
|
+
return self
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class NeatSequence(NeatSequenceCore):
|
|
135
|
+
"""Information about the sequence stored in the database.
|
|
136
|
+
This is the reading version of the class, it is used for retrieving data from the CDF.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
id (int): Unique cognite-provided identifier for the sequence
|
|
140
|
+
name (str | None): Name of the sequence
|
|
141
|
+
created_time (int | None): Time when this sequence was created in CDF in milliseconds since Jan 1, 1970.
|
|
142
|
+
last_updated_time (int | None): The last time this sequence was updated in CDF,
|
|
143
|
+
in milliseconds since Jan 1, 1970.
|
|
144
|
+
description (str | None): Description of the sequence
|
|
145
|
+
asset_id (int | None): Optional asset this sequence is associated with
|
|
146
|
+
external_id (str | None): The external ID provided by the client. Must be unique for the resource type.
|
|
147
|
+
metadata (dict[str, Any] | None): Custom, application-specific metadata. String key -> String value.
|
|
148
|
+
The maximum length of the key is 32 bytes, the value 512 bytes, with up to 16 key-value pairs.
|
|
149
|
+
columns (Sequence[SequenceColumn] | None): List of column definitions
|
|
150
|
+
|
|
151
|
+
data_set_id (int | None): Data set that this sequence belongs to
|
|
152
|
+
rows (Sequence[SequenceRow] | None): The rows in the sequence.
|
|
153
|
+
cognite_client (CogniteClient | None): The client to associate with this object.
|
|
154
|
+
"""
|
|
155
|
+
|
|
156
|
+
def __init__(
|
|
157
|
+
self,
|
|
158
|
+
id: int,
|
|
159
|
+
created_time: int,
|
|
160
|
+
last_updated_time: int,
|
|
161
|
+
name: str | None = None,
|
|
162
|
+
description: str | None = None,
|
|
163
|
+
asset_id: int | None = None,
|
|
164
|
+
external_id: str | None = None,
|
|
165
|
+
metadata: dict[str, Any] | None = None,
|
|
166
|
+
columns: Sequence[SequenceColumn] | None = None,
|
|
167
|
+
data_set_id: int | None = None,
|
|
168
|
+
rows: Sequence[SequenceRow] | None = None,
|
|
169
|
+
cognite_client: CogniteClient | None = None,
|
|
170
|
+
) -> None:
|
|
171
|
+
super().__init__(
|
|
172
|
+
name=name,
|
|
173
|
+
description=description,
|
|
174
|
+
asset_id=asset_id,
|
|
175
|
+
external_id=external_id,
|
|
176
|
+
metadata=metadata,
|
|
177
|
+
data_set_id=data_set_id,
|
|
178
|
+
rows=rows,
|
|
179
|
+
)
|
|
180
|
+
self.id = id
|
|
181
|
+
self.created_time = created_time
|
|
182
|
+
self.last_updated_time = last_updated_time
|
|
183
|
+
|
|
184
|
+
self.columns: SequenceColumnList | None
|
|
185
|
+
if columns is None or isinstance(columns, SequenceColumnList):
|
|
186
|
+
self.columns = columns
|
|
187
|
+
elif isinstance(columns, Sequence) and all(isinstance(col, SequenceColumn) for col in columns):
|
|
188
|
+
self.columns = SequenceColumnList(columns)
|
|
189
|
+
elif isinstance(columns, list):
|
|
190
|
+
warnings.warn(
|
|
191
|
+
"Columns is no longer a dict, you should first load the list of dictionaries using "
|
|
192
|
+
"SequenceColumnList.load([{...}, {...}])",
|
|
193
|
+
DeprecationWarning,
|
|
194
|
+
stacklevel=2,
|
|
195
|
+
)
|
|
196
|
+
self.columns = SequenceColumnList._load(columns)
|
|
197
|
+
else:
|
|
198
|
+
raise ValueError(f"columns must be a sequence of SequenceColumn objects not {type(columns)}")
|
|
199
|
+
self._cognite_client = cast("CogniteClient", cognite_client)
|
|
200
|
+
|
|
201
|
+
@classmethod
|
|
202
|
+
def from_cognite_sequence(
|
|
203
|
+
cls, sequence: cdc.Sequence, rows: Sequence[cdc.SequenceRow] | None = None
|
|
204
|
+
) -> "NeatSequence":
|
|
205
|
+
"""Create a NeatSequence from a Cognite Sequence object."""
|
|
206
|
+
args = sequence.dump(camel_case=True)
|
|
207
|
+
if rows is not None:
|
|
208
|
+
args["rows"] = [row.dump(camel_case=True) for row in rows]
|
|
209
|
+
return cls._load(args)
|
|
210
|
+
|
|
211
|
+
@classmethod
|
|
212
|
+
def _load(cls, resource: dict, cognite_client: CogniteClient | None = None) -> Self:
|
|
213
|
+
return cls(
|
|
214
|
+
id=resource["id"],
|
|
215
|
+
created_time=resource["createdTime"],
|
|
216
|
+
last_updated_time=resource["lastUpdatedTime"],
|
|
217
|
+
name=resource.get("name"),
|
|
218
|
+
description=resource.get("description"),
|
|
219
|
+
asset_id=resource.get("assetId"),
|
|
220
|
+
external_id=resource.get("externalId"),
|
|
221
|
+
metadata=resource.get("metadata"),
|
|
222
|
+
columns=SequenceColumnList._load(resource["columns"]) if "columns" in resource else None,
|
|
223
|
+
data_set_id=resource.get("dataSetId"),
|
|
224
|
+
rows=[SequenceRow._load(row) for row in resource.get("rows", [])] or None,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
def as_write(self) -> "NeatSequenceWrite":
|
|
228
|
+
"""Returns a writeable version of this sequence."""
|
|
229
|
+
if self.columns is None:
|
|
230
|
+
raise ValueError("Columns must be set for the writing version of the sequence")
|
|
231
|
+
|
|
232
|
+
return NeatSequenceWrite(
|
|
233
|
+
external_id=self.external_id,
|
|
234
|
+
name=self.name,
|
|
235
|
+
description=self.description,
|
|
236
|
+
asset_id=self.asset_id,
|
|
237
|
+
metadata=self.metadata,
|
|
238
|
+
data_set_id=self.data_set_id,
|
|
239
|
+
columns=self.columns.as_write(),
|
|
240
|
+
rows=self.rows,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
def dump(self, camel_case: bool = True) -> dict[str, Any]:
|
|
244
|
+
dumped = super().dump(camel_case)
|
|
245
|
+
if self.columns is not None:
|
|
246
|
+
dumped["columns"] = self.columns.dump(camel_case)
|
|
247
|
+
if self.rows is not None:
|
|
248
|
+
dumped["rows"] = [row.dump(camel_case) for row in self.rows]
|
|
249
|
+
return dumped
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class NeatSequenceWriteList(CogniteResourceList[NeatSequenceWrite], ExternalIDTransformerMixin):
|
|
253
|
+
_RESOURCE = NeatSequenceWrite
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
class NeatSequenceList(WriteableCogniteResourceList[NeatSequenceWrite, NeatSequence], IdTransformerMixin):
|
|
257
|
+
_RESOURCE = NeatSequence
|
|
258
|
+
|
|
259
|
+
def as_write(self) -> NeatSequenceWriteList:
|
|
260
|
+
"""Returns a writeable version of this sequence list."""
|
|
261
|
+
return NeatSequenceWriteList([item.as_write() for item in self], cognite_client=self._get_cognite_client())
|
|
@@ -207,7 +207,7 @@ class DMSSchema:
|
|
|
207
207
|
if "containers" not in exclude_set:
|
|
208
208
|
for container in self.containers.values():
|
|
209
209
|
zip_ref.writestr(
|
|
210
|
-
f"data_models/containers{container.external_id}.container.yaml", container.dump_yaml()
|
|
210
|
+
f"data_models/containers/{container.external_id}.container.yaml", container.dump_yaml()
|
|
211
211
|
)
|
|
212
212
|
if "node_types" not in exclude_set:
|
|
213
213
|
for node in self.node_types.values():
|
|
@@ -378,6 +378,10 @@ class DMSSchema:
|
|
|
378
378
|
referenced_containers |= set(self.containers.keys())
|
|
379
379
|
return referenced_containers
|
|
380
380
|
|
|
381
|
+
def externally_referenced_containers(self) -> set[dm.ContainerId]:
|
|
382
|
+
"""Get the containers referenced by the schema that are not defined in the schema."""
|
|
383
|
+
return {container for container in self.referenced_container() if container not in self.containers}
|
|
384
|
+
|
|
381
385
|
def as_read_model(self) -> dm.DataModel[dm.View]:
|
|
382
386
|
if self.data_model is None:
|
|
383
387
|
raise ValueError("Data model is not defined")
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from collections.abc import Iterator
|
|
2
|
+
from contextlib import contextmanager
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from cognite.client.testing import CogniteClientMock
|
|
6
|
+
|
|
7
|
+
from cognite.neat._client._api_client import NeatClient
|
|
8
|
+
|
|
9
|
+
from ._api.data_modeling_loaders import DataModelLoaderAPI
|
|
10
|
+
from ._api.schema import SchemaAPI
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class NeatClientMock(CogniteClientMock):
|
|
14
|
+
"""Mock for ToolkitClient object
|
|
15
|
+
|
|
16
|
+
All APIs are replaced with specked MagicMock objects.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
20
|
+
if "parent" in kwargs:
|
|
21
|
+
super().__init__(*args, **kwargs)
|
|
22
|
+
return None
|
|
23
|
+
super().__init__(*args, **kwargs)
|
|
24
|
+
self.schema = SchemaAPI(self)
|
|
25
|
+
self.loaders = DataModelLoaderAPI(self)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@contextmanager
|
|
29
|
+
def monkeypatch_neat_client() -> Iterator[NeatClient]:
|
|
30
|
+
neat_client_mock = NeatClientMock()
|
|
31
|
+
NeatClient.__new__ = lambda *args, **kwargs: neat_client_mock # type: ignore[method-assign]
|
|
32
|
+
yield neat_client_mock
|
|
33
|
+
NeatClient.__new__ = lambda cls, *args, **kwargs: object.__new__(cls) # type: ignore[method-assign]
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
1
2
|
from pathlib import Path
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
2
4
|
|
|
5
|
+
from cognite.client import data_modeling as dm
|
|
3
6
|
from cognite.client.data_classes.data_modeling.ids import DataModelId
|
|
4
7
|
from rdflib import DC, DCTERMS, FOAF, OWL, RDF, RDFS, SH, SKOS, XSD, Namespace, URIRef
|
|
5
8
|
|
|
6
9
|
from cognite import neat
|
|
7
10
|
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from cognite.neat._rules.models.dms import DMSProperty
|
|
13
|
+
|
|
8
14
|
|
|
9
15
|
def _is_in_notebook() -> bool:
|
|
10
16
|
try:
|
|
@@ -97,3 +103,53 @@ DEFAULT_DOCS_URL = "https://cognite-neat.readthedocs-hosted.com/en/latest/"
|
|
|
97
103
|
|
|
98
104
|
DMS_CONTAINER_PROPERTY_SIZE_LIMIT = 100
|
|
99
105
|
DMS_VIEW_CONTAINER_SIZE_LIMIT = 10
|
|
106
|
+
|
|
107
|
+
_ASSET_ROOT_PROPERTY = {
|
|
108
|
+
"connection": "direct",
|
|
109
|
+
"container": "cdf_cdm:CogniteAsset",
|
|
110
|
+
"container_property": "assetHierarchy_root",
|
|
111
|
+
"description": "An automatically updated reference to the top-level asset of the hierarchy.",
|
|
112
|
+
"immutable": False,
|
|
113
|
+
"is_list": False,
|
|
114
|
+
"name": "Root",
|
|
115
|
+
"nullable": True,
|
|
116
|
+
"value_type": "cdf_cdm:CogniteAsset(version=v1)",
|
|
117
|
+
"view": "cdf_cdm:CogniteAsset(version=v1)",
|
|
118
|
+
"view_property": "root",
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
_ASSET_PATH_PROPERTY = {
|
|
122
|
+
"connection": "direct",
|
|
123
|
+
"container": "cdf_cdm:CogniteAsset",
|
|
124
|
+
"container_property": "assetHierarchy_path",
|
|
125
|
+
"description": (
|
|
126
|
+
"An automatically updated ordered list of this asset's ancestors, starting with the root asset. "
|
|
127
|
+
"Enables subtree filtering to find all assets under a parent."
|
|
128
|
+
),
|
|
129
|
+
"immutable": False,
|
|
130
|
+
"is_list": True,
|
|
131
|
+
"name": "Path",
|
|
132
|
+
"nullable": True,
|
|
133
|
+
"value_type": "cdf_cdm:CogniteAsset(version=v1)",
|
|
134
|
+
"view": "cdf_cdm:CogniteAsset(version=v1)",
|
|
135
|
+
"view_property": "path",
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def get_asset_read_only_properties_with_connection() -> "list[DMSProperty]":
|
|
140
|
+
"""Gets the asset read-only properties with connection, i.e. Root and Path."""
|
|
141
|
+
from cognite.neat._rules.models.dms import DMSProperty
|
|
142
|
+
|
|
143
|
+
return [DMSProperty.model_validate(item) for item in (_ASSET_ROOT_PROPERTY, _ASSET_PATH_PROPERTY)]
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
READONLY_PROPERTIES_BY_CONTAINER: Mapping[dm.ContainerId, frozenset[str]] = {
|
|
147
|
+
dm.ContainerId("cdf_cdm", "CogniteAsset"): frozenset(
|
|
148
|
+
{"assetHierarchy_root", "assetHierarchy_path", "assetHierarchy_path_last_updated_time"}
|
|
149
|
+
),
|
|
150
|
+
dm.ContainerId("cdf_cdm", "CogniteFile"): frozenset({"isUploaded", "uploadedTime"}),
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def is_readonly_property(container: dm.ContainerId, property_: str) -> bool:
|
|
155
|
+
return container in READONLY_PROPERTIES_BY_CONTAINER and property_ in READONLY_PROPERTIES_BY_CONTAINER[container]
|
{cognite_neat-0.103.1 → cognite_neat-0.105.0}/cognite/neat/_graph/extractors/_classic_cdf/_base.py
RENAMED
|
@@ -139,11 +139,8 @@ class ClassicCDFBaseExtractor(BaseExtractor, ABC, Generic[T_CogniteResource]):
|
|
|
139
139
|
dumped.pop("parentExternalId", None)
|
|
140
140
|
if "metadata" in dumped:
|
|
141
141
|
triples.extend(self._metadata_to_triples(id_, dumped.pop("metadata")))
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
triples.append(
|
|
145
|
-
(id_, self.namespace.columns, Literal(json.dumps({"columns": columns}), datatype=XSD._NS["json"]))
|
|
146
|
-
)
|
|
142
|
+
|
|
143
|
+
triples.extend(self._item2triples_special_cases(id_, dumped))
|
|
147
144
|
|
|
148
145
|
for key, value in dumped.items():
|
|
149
146
|
if value is None or value == []:
|
|
@@ -153,6 +150,10 @@ class ClassicCDFBaseExtractor(BaseExtractor, ABC, Generic[T_CogniteResource]):
|
|
|
153
150
|
triples.append((id_, self.namespace[key], self._as_object(raw, key)))
|
|
154
151
|
return triples
|
|
155
152
|
|
|
153
|
+
def _item2triples_special_cases(self, id_: URIRef, dumped: dict[str, Any]) -> list[Triple]:
|
|
154
|
+
"""This can be overridden to handle special cases for the item."""
|
|
155
|
+
return []
|
|
156
|
+
|
|
156
157
|
def _fallback_id(self, item: T_CogniteResource) -> str | None:
|
|
157
158
|
raise AttributeError(
|
|
158
159
|
f"Item of type {type(item)} does not have an id attribute. "
|