cognite-neat 0.95.0__tar.gz → 0.96.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.95.0 → cognite_neat-0.96.0}/PKG-INFO +3 -5
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_constants.py +16 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/_base.py +24 -8
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/errors/_resources.py +2 -2
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/warnings/_models.py +20 -2
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/exporters/_rules2excel.py +8 -2
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/transformers/__init__.py +2 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/transformers/_converters.py +206 -37
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_session/_base.py +14 -2
- cognite_neat-0.96.0/cognite/neat/_session/_inspect.py +89 -0
- cognite_neat-0.96.0/cognite/neat/_session/_prepare.py +118 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_session/_read.py +27 -4
- cognite_neat-0.96.0/cognite/neat/_session/_set.py +23 -0
- cognite_neat-0.96.0/cognite/neat/_session/_show.py +228 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_session/_state.py +24 -4
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_store/_base.py +11 -8
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/collection_.py +4 -0
- cognite_neat-0.96.0/cognite/neat/_version.py +1 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/pyproject.toml +3 -6
- cognite_neat-0.95.0/cognite/neat/_session/_prepare.py +0 -64
- cognite_neat-0.95.0/cognite/neat/_session/_show.py +0 -278
- cognite_neat-0.95.0/cognite/neat/_version.py +0 -1
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/LICENSE +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/README.md +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/asgi/metrics.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/configuration.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/context_manager/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/context_manager/manager.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/data_classes/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/data_classes/rest.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/explorer.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/routers/configuration.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/routers/crud.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/routers/metrics.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/routers/workflows.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/utils/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/utils/data_mapping.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/utils/logging.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/api/utils/query_templates.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/main.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/monitoring/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/monitoring/metrics.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/index.html +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/.gitignore +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/README.md +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/asset-manifest.json +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/favicon.ico +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/img/architect-icon.svg +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/img/developer-icon.svg +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/img/sme-icon.svg +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/index.html +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/logo192.png +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/manifest.json +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/robots.txt +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/package-lock.json +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/package.json +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/public/index.html +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/public/manifest.json +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/public/robots.txt +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/App.css +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/App.js +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/App.test.js +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/index.css +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/index.js +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/logo.svg +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/setupTests.js +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_app/ui/neat-app/tsconfig.json +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_config.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/_shared.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/_tracking/base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/_tracking/log.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/examples/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_classic_cdf/_assets.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_classic_cdf/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_classic_cdf/_classic.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_classic_cdf/_data_sets.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_classic_cdf/_labels.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_dms.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_iodd.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_mock_graph_generator.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/loaders/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/loaders/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/loaders/_rdf2asset.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/loaders/_rdf2dms.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/models.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/queries/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/queries/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/queries/_construct.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/queries/_shared.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/transformers/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/transformers/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/transformers/_classic_cdf.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/transformers/_iodd.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/transformers/_prune_graph.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/transformers/_rdfpath.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_graph/transformers/_value_type.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/errors/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/errors/_external.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/errors/_general.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/errors/_properties.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/errors/_workflow.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/formatters.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/warnings/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/warnings/_external.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/warnings/_general.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/warnings/_properties.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/warnings/_resources.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_issues/warnings/user_modeling.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/_constants.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/_shared.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/analysis/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/analysis/_asset.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/analysis/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/analysis/_dms.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/analysis/_information.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/catalog/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/exporters/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/exporters/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/exporters/_rules2dms.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/exporters/_rules2instance_template.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/exporters/_validation.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_dms2rules.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_imf2rules/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2classes.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2metadata.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2properties.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2rules.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_inference2rules.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2classes.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2metadata.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2properties.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2rules.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_rdf/_shared.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_spreadsheet2rules.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/importers/_yaml2rules.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/_base_input.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/_base_rules.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/_rdfpath.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/_types.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/asset/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/asset/_rules.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/asset/_rules_input.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/asset/_validation.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/data_types.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/dms/_exporter.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/dms/_rules.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/dms/_rules_input.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/dms/_schema.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/dms/_validation.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/domain.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/entities/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/entities/_constants.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/entities/_loaders.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/entities/_multi_value.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/entities/_single_value.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/entities/_types.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/entities/_wrapped.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/information/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/information/_rules.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/information/_rules_input.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/information/_validation.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/mapping/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/mapping/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/models/mapping/_classic2core.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/transformers/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/transformers/_mapping.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/transformers/_pipelines.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_rules/transformers/_verification.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_session/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_session/_to.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_session/_wizard.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_session/exceptions.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_shared.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_store/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_store/_provenance.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/auth.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/auxiliary.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/cdf/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/cdf/data_classes.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/cdf/loaders/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/cdf/loaders/_base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/cdf/loaders/_data_modeling.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/cdf/loaders/_ingestion.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/rdf_.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/spreadsheet.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/text.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/time_.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/upload.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_utils/xml_.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/base.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/cdf_store.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/manager.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/model.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/data_contracts.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/lib/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/lib/current/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/lib/current/graph_extractor.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/lib/current/graph_loader.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/lib/current/graph_store.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/lib/current/rules_exporter.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/lib/current/rules_importer.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/lib/current/rules_validator.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/lib/io/__init__.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/lib/io/io_steps.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps/step_model.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/steps_registry.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/tasks.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/triggers.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/_workflows/utils.py +0 -0
- {cognite_neat-0.95.0 → cognite_neat-0.96.0}/cognite/neat/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cognite-neat
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.96.0
|
|
4
4
|
Summary: Knowledge graph transformation
|
|
5
5
|
Home-page: https://cognite-neat.readthedocs-hosted.com/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -17,7 +17,6 @@ Provides-Extra: all
|
|
|
17
17
|
Provides-Extra: docs
|
|
18
18
|
Provides-Extra: google
|
|
19
19
|
Provides-Extra: graphql
|
|
20
|
-
Provides-Extra: jupyter
|
|
21
20
|
Provides-Extra: oxi
|
|
22
21
|
Provides-Extra: service
|
|
23
22
|
Requires-Dist: PyYAML
|
|
@@ -28,9 +27,7 @@ Requires-Dist: fastapi (>=0,<1) ; extra == "service" or extra == "all"
|
|
|
28
27
|
Requires-Dist: google-api-python-client ; extra == "google"
|
|
29
28
|
Requires-Dist: google-auth-oauthlib ; extra == "google"
|
|
30
29
|
Requires-Dist: gspread ; extra == "google"
|
|
31
|
-
Requires-Dist: ipycytoscape (>=1.3.3,<2.0.0)
|
|
32
30
|
Requires-Dist: jinja2 (>=3.1.2,<4.0.0) ; extra == "graphql" or extra == "all"
|
|
33
|
-
Requires-Dist: matplotlib (==3.5.2)
|
|
34
31
|
Requires-Dist: mkdocs ; extra == "docs"
|
|
35
32
|
Requires-Dist: mkdocs-autorefs (>=0.5.0,<0.6.0) ; extra == "docs"
|
|
36
33
|
Requires-Dist: mkdocs-git-authors-plugin ; extra == "docs"
|
|
@@ -49,9 +46,10 @@ Requires-Dist: pydantic (>=2,<3)
|
|
|
49
46
|
Requires-Dist: pymdown-extensions ; extra == "docs"
|
|
50
47
|
Requires-Dist: pyoxigraph (==0.3.19) ; extra == "oxi" or extra == "all"
|
|
51
48
|
Requires-Dist: python-multipart (==0.0.9) ; extra == "service" or extra == "all"
|
|
49
|
+
Requires-Dist: pyvis (>=0.3.2,<0.4.0)
|
|
52
50
|
Requires-Dist: rdflib
|
|
53
51
|
Requires-Dist: requests
|
|
54
|
-
Requires-Dist: rich[jupyter] (>=13.7.1,<14.0.0)
|
|
52
|
+
Requires-Dist: rich[jupyter] (>=13.7.1,<14.0.0)
|
|
55
53
|
Requires-Dist: schedule (>=1,<2) ; extra == "service" or extra == "all"
|
|
56
54
|
Requires-Dist: tomli (>=2.0.1,<3.0.0) ; python_version < "3.11"
|
|
57
55
|
Requires-Dist: typing_extensions (>=4.8,<5.0) ; python_version < "3.11"
|
|
@@ -5,6 +5,22 @@ from rdflib import DCTERMS, OWL, RDF, RDFS, SKOS, XSD, Namespace, URIRef
|
|
|
5
5
|
|
|
6
6
|
from cognite import neat
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
def _is_in_notebook() -> bool:
|
|
10
|
+
try:
|
|
11
|
+
from IPython import get_ipython
|
|
12
|
+
|
|
13
|
+
if "IPKernelApp" not in get_ipython().config: # pragma: no cover
|
|
14
|
+
return False
|
|
15
|
+
except ImportError:
|
|
16
|
+
return False
|
|
17
|
+
except AttributeError:
|
|
18
|
+
return False
|
|
19
|
+
return True
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
IN_NOTEBOOK = _is_in_notebook()
|
|
23
|
+
|
|
8
24
|
PACKAGE_DIRECTORY = Path(neat.__file__).parent
|
|
9
25
|
COGNITE_MODELS = (
|
|
10
26
|
DataModelId("cdf_cdm", "CogniteCore", "v1"),
|
|
@@ -11,7 +11,12 @@ from typing import Any, ClassVar, Literal, TypeAlias, TypeVar, get_args, get_ori
|
|
|
11
11
|
from warnings import WarningMessage
|
|
12
12
|
|
|
13
13
|
import pandas as pd
|
|
14
|
-
from cognite.client.data_classes.data_modeling import
|
|
14
|
+
from cognite.client.data_classes.data_modeling import (
|
|
15
|
+
ContainerId,
|
|
16
|
+
DataModelId,
|
|
17
|
+
PropertyId,
|
|
18
|
+
ViewId,
|
|
19
|
+
)
|
|
15
20
|
from pydantic_core import ErrorDetails
|
|
16
21
|
|
|
17
22
|
from cognite.neat._utils.spreadsheet import SpreadsheetRead
|
|
@@ -67,7 +72,7 @@ class NeatIssue:
|
|
|
67
72
|
extra: ClassVar[str | None] = None
|
|
68
73
|
fix: ClassVar[str | None] = None
|
|
69
74
|
|
|
70
|
-
def as_message(self) -> str:
|
|
75
|
+
def as_message(self, include_type: bool = True) -> str:
|
|
71
76
|
"""Return a human-readable message for the issue."""
|
|
72
77
|
template = self.__doc__
|
|
73
78
|
if not template:
|
|
@@ -79,8 +84,10 @@ class NeatIssue:
|
|
|
79
84
|
msg += "\n" + self.extra.format(**variables)
|
|
80
85
|
if self.fix:
|
|
81
86
|
msg += f"\nFix: {self.fix.format(**variables)}"
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
if include_type:
|
|
88
|
+
name = type(self).__name__
|
|
89
|
+
msg = f"{name}: {msg}"
|
|
90
|
+
return msg
|
|
84
91
|
|
|
85
92
|
def _get_variables(self) -> tuple[dict[str, str], bool]:
|
|
86
93
|
variables: dict[str, str] = {}
|
|
@@ -123,6 +130,8 @@ class NeatIssue:
|
|
|
123
130
|
return value.dump()
|
|
124
131
|
elif isinstance(value, PropertyId):
|
|
125
132
|
return value.dump(camel_case=True)
|
|
133
|
+
elif isinstance(value, DataModelId):
|
|
134
|
+
return value.dump(camel_case=True, include_type=False)
|
|
126
135
|
raise ValueError(f"Unsupported type: {type(value)}")
|
|
127
136
|
|
|
128
137
|
@classmethod
|
|
@@ -169,6 +178,8 @@ class NeatIssue:
|
|
|
169
178
|
return tuple(cls._load_value(subtype, item) for item in value)
|
|
170
179
|
elif type_ is ViewId:
|
|
171
180
|
return ViewId.load(value)
|
|
181
|
+
elif type_ is DataModelId:
|
|
182
|
+
return DataModelId.load(value)
|
|
172
183
|
elif type_ is PropertyId:
|
|
173
184
|
return PropertyId.load(value)
|
|
174
185
|
elif type_ is ContainerId:
|
|
@@ -266,7 +277,7 @@ class DefaultPydanticError(NeatError, ValueError):
|
|
|
266
277
|
msg=error["msg"],
|
|
267
278
|
)
|
|
268
279
|
|
|
269
|
-
def as_message(self) -> str:
|
|
280
|
+
def as_message(self, include_type: bool = True) -> str:
|
|
270
281
|
if self.loc and len(self.loc) == 1:
|
|
271
282
|
return f"{self.loc[0]} sheet: {self.msg}"
|
|
272
283
|
elif self.loc and len(self.loc) == 2:
|
|
@@ -307,7 +318,7 @@ class RowError(NeatError, ValueError):
|
|
|
307
318
|
url=str(url) if (url := error.get("url")) else None,
|
|
308
319
|
)
|
|
309
320
|
|
|
310
|
-
def as_message(self) -> str:
|
|
321
|
+
def as_message(self, include_type: bool = True) -> str:
|
|
311
322
|
input_str = str(self.input) if self.input is not None else ""
|
|
312
323
|
input_str = input_str[:50] + "..." if len(input_str) > 50 else input_str
|
|
313
324
|
output = (
|
|
@@ -350,7 +361,7 @@ class DefaultWarning(NeatWarning):
|
|
|
350
361
|
source=warning.source,
|
|
351
362
|
)
|
|
352
363
|
|
|
353
|
-
def as_message(self) -> str:
|
|
364
|
+
def as_message(self, include_type: bool = True) -> str:
|
|
354
365
|
return str(self.warning)
|
|
355
366
|
|
|
356
367
|
|
|
@@ -421,7 +432,12 @@ class IssueList(NeatIssueList[NeatIssue]):
|
|
|
421
432
|
def _repr_html_(self) -> str | None:
|
|
422
433
|
if not self:
|
|
423
434
|
return "<p>'No issues found'</p>"
|
|
424
|
-
|
|
435
|
+
df = self.to_pandas()
|
|
436
|
+
agg_df = df["NeatIssue"].value_counts().to_frame()
|
|
437
|
+
if len(agg_df) < 10:
|
|
438
|
+
return agg_df._repr_html_() # type: ignore[operator]
|
|
439
|
+
else:
|
|
440
|
+
return agg_df.head()._repr_html_() # type: ignore[operator]
|
|
425
441
|
|
|
426
442
|
|
|
427
443
|
T_Cls = TypeVar("T_Cls")
|
|
@@ -40,7 +40,7 @@ class ResourceNotFoundError(ResourceError, Generic[T_Identifier, T_ReferenceIden
|
|
|
40
40
|
referred_type: ResourceType | None = None
|
|
41
41
|
more: str | None = None
|
|
42
42
|
|
|
43
|
-
def as_message(self) -> str:
|
|
43
|
+
def as_message(self, include_type: bool = True) -> str:
|
|
44
44
|
msg = (self.__doc__ or "").format(resource_type=self.resource_type, identifier=self.identifier)
|
|
45
45
|
if self.referred_by and self.referred_type:
|
|
46
46
|
msg += self.extra.format(referred_type=self.referred_type, referred_by=self.referred_by)
|
|
@@ -99,7 +99,7 @@ class ResourceChangedError(ResourceError[T_Identifier]):
|
|
|
99
99
|
changed_properties: frozenset[str]
|
|
100
100
|
changed_attributes: frozenset[str]
|
|
101
101
|
|
|
102
|
-
def as_message(self) -> str:
|
|
102
|
+
def as_message(self, include_type: bool = True) -> str:
|
|
103
103
|
if self.changed_properties:
|
|
104
104
|
changed = f" properties {humanize_collection(self.changed_properties)}."
|
|
105
105
|
elif self.changed_attributes:
|
|
@@ -2,7 +2,7 @@ from abc import ABC
|
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
from typing import ClassVar
|
|
4
4
|
|
|
5
|
-
from cognite.client.data_classes.data_modeling import ViewId
|
|
5
|
+
from cognite.client.data_classes.data_modeling import DataModelId, ViewId
|
|
6
6
|
|
|
7
7
|
from cognite.neat._constants import DMS_VIEW_CONTAINER_SIZE_LIMIT
|
|
8
8
|
from cognite.neat._issues import NeatWarning
|
|
@@ -18,7 +18,7 @@ class BreakingModelingPrincipleWarning(NeatWarning, ABC):
|
|
|
18
18
|
url: ClassVar[str]
|
|
19
19
|
specific: str
|
|
20
20
|
|
|
21
|
-
def as_message(self) -> str:
|
|
21
|
+
def as_message(self, include_type: bool = True) -> str:
|
|
22
22
|
principle = type(self).__name__.removesuffix("Warning")
|
|
23
23
|
url = f"{_BASE_URL}#{self.url}"
|
|
24
24
|
return (self.__doc__ or "").format(
|
|
@@ -90,3 +90,21 @@ class NotSupportedHasDataFilterLimitWarning(CDFNotSupportedWarning):
|
|
|
90
90
|
view_id: ViewId
|
|
91
91
|
count: int
|
|
92
92
|
limit: int = DMS_VIEW_CONTAINER_SIZE_LIMIT
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@dataclass(unsafe_hash=True)
|
|
96
|
+
class EnterpriseModelNotBuildOnTopOfCDMWarning(UserModelingWarning):
|
|
97
|
+
"""Enterprise data model being build on top {reference_model_id}. This is not recommended."""
|
|
98
|
+
|
|
99
|
+
fix = "Always build Enterprise Data Model on top of Cognite Data Model such as Core Data Model."
|
|
100
|
+
|
|
101
|
+
reference_model_id: DataModelId
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@dataclass(unsafe_hash=True)
|
|
105
|
+
class SolutionModelBuildOnTopOfCDMWarning(UserModelingWarning):
|
|
106
|
+
"""Solution data model being build on top Cognite Data Model {reference_model_id}. This is not recommended."""
|
|
107
|
+
|
|
108
|
+
fix = "Always build solution data model on top of enterprise data model."
|
|
109
|
+
|
|
110
|
+
reference_model_id: DataModelId
|
|
@@ -13,6 +13,7 @@ from openpyxl.styles import Alignment, Border, Font, PatternFill, Side
|
|
|
13
13
|
from openpyxl.worksheet.worksheet import Worksheet
|
|
14
14
|
from rdflib import Namespace
|
|
15
15
|
|
|
16
|
+
from cognite.neat._constants import COGNITE_MODELS
|
|
16
17
|
from cognite.neat._rules._shared import VerifiedRules
|
|
17
18
|
from cognite.neat._rules.models import (
|
|
18
19
|
DataModelType,
|
|
@@ -21,6 +22,7 @@ from cognite.neat._rules.models import (
|
|
|
21
22
|
SheetRow,
|
|
22
23
|
)
|
|
23
24
|
from cognite.neat._rules.models.dms import DMSMetadata
|
|
25
|
+
from cognite.neat._rules.models.dms._rules import DMSRules
|
|
24
26
|
from cognite.neat._rules.models.domain import DomainMetadata
|
|
25
27
|
from cognite.neat._rules.models.information import InformationMetadata
|
|
26
28
|
from cognite.neat._rules.models.information._rules import InformationRules
|
|
@@ -134,8 +136,12 @@ class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
|
|
|
134
136
|
self._write_metadata_sheet(workbook, dumped_last_rules["Metadata"], sheet_prefix="Last")
|
|
135
137
|
|
|
136
138
|
if dumped_reference_rules:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
if isinstance(rules.reference, DMSRules):
|
|
140
|
+
sheet_prefix = "CDM" if rules.reference.metadata.as_data_model_id() in COGNITE_MODELS else "Ref"
|
|
141
|
+
else:
|
|
142
|
+
sheet_prefix = "Ref"
|
|
143
|
+
self._write_sheets(workbook, dumped_reference_rules, rules, sheet_prefix=sheet_prefix)
|
|
144
|
+
self._write_metadata_sheet(workbook, dumped_reference_rules["Metadata"], sheet_prefix=sheet_prefix)
|
|
139
145
|
|
|
140
146
|
if isinstance(rules, InformationRules) and rules.prefixes:
|
|
141
147
|
self._write_prefixes_sheet(workbook, rules.prefixes)
|
|
@@ -6,6 +6,7 @@ from ._converters import (
|
|
|
6
6
|
InformationToAsset,
|
|
7
7
|
InformationToDMS,
|
|
8
8
|
ReduceCogniteModel,
|
|
9
|
+
SetIDDMSModel,
|
|
9
10
|
ToCompliantEntities,
|
|
10
11
|
ToExtension,
|
|
11
12
|
)
|
|
@@ -31,4 +32,5 @@ __all__ = [
|
|
|
31
32
|
"RuleMapper",
|
|
32
33
|
"ToExtension",
|
|
33
34
|
"ReduceCogniteModel",
|
|
35
|
+
"SetIDDMSModel",
|
|
34
36
|
]
|
|
@@ -12,6 +12,10 @@ from rdflib import Namespace
|
|
|
12
12
|
|
|
13
13
|
from cognite.neat._constants import COGNITE_MODELS, DMS_CONTAINER_PROPERTY_SIZE_LIMIT
|
|
14
14
|
from cognite.neat._issues.errors import NeatValueError
|
|
15
|
+
from cognite.neat._issues.warnings._models import (
|
|
16
|
+
EnterpriseModelNotBuildOnTopOfCDMWarning,
|
|
17
|
+
SolutionModelBuildOnTopOfCDMWarning,
|
|
18
|
+
)
|
|
15
19
|
from cognite.neat._issues.warnings.user_modeling import ParentInDifferentSpaceWarning
|
|
16
20
|
from cognite.neat._rules._constants import EntityTypes
|
|
17
21
|
from cognite.neat._rules._shared import InputRules, JustRules, OutRules, VerifiedRules
|
|
@@ -29,6 +33,7 @@ from cognite.neat._rules.models import (
|
|
|
29
33
|
)
|
|
30
34
|
from cognite.neat._rules.models.data_types import DataType, String
|
|
31
35
|
from cognite.neat._rules.models.dms import DMSMetadata, DMSProperty, DMSView
|
|
36
|
+
from cognite.neat._rules.models.dms._rules import DMSContainer
|
|
32
37
|
from cognite.neat._rules.models.entities import (
|
|
33
38
|
AssetEntity,
|
|
34
39
|
AssetFields,
|
|
@@ -49,6 +54,8 @@ from cognite.neat._rules.models.information._rules_input import (
|
|
|
49
54
|
InformationInputProperty,
|
|
50
55
|
InformationInputRules,
|
|
51
56
|
)
|
|
57
|
+
from cognite.neat._utils.collection_ import remove_list_elements
|
|
58
|
+
from cognite.neat._utils.text import to_camel
|
|
52
59
|
|
|
53
60
|
from ._base import RulesTransformer
|
|
54
61
|
|
|
@@ -227,61 +234,173 @@ class ConvertToRules(ConversionTransformer[VerifiedRules, VerifiedRules]):
|
|
|
227
234
|
_T_Entity = TypeVar("_T_Entity", bound=ClassEntity | ViewEntity)
|
|
228
235
|
|
|
229
236
|
|
|
237
|
+
class SetIDDMSModel(RulesTransformer[DMSRules, DMSRules]):
|
|
238
|
+
def __init__(self, new_id: DataModelId | tuple[str, str, str]):
|
|
239
|
+
self.new_id = DataModelId.load(new_id)
|
|
240
|
+
|
|
241
|
+
def transform(self, rules: DMSRules | OutRules[DMSRules]) -> JustRules[DMSRules]:
|
|
242
|
+
if self.new_id.version is None:
|
|
243
|
+
raise NeatValueError("Version is required when setting a new Data Model ID")
|
|
244
|
+
dump = self._to_rules(rules).dump()
|
|
245
|
+
dump["metadata"]["space"] = self.new_id.space
|
|
246
|
+
dump["metadata"]["external_id"] = self.new_id.external_id
|
|
247
|
+
dump["metadata"]["version"] = self.new_id.version
|
|
248
|
+
# Serialize and deserialize to set the new space and external_id
|
|
249
|
+
# as the default values for the new model.
|
|
250
|
+
return JustRules(DMSRules.model_validate(DMSInputRules.load(dump).dump()))
|
|
251
|
+
|
|
252
|
+
|
|
230
253
|
class ToExtension(RulesTransformer[DMSRules, DMSRules]):
|
|
231
254
|
def __init__(
|
|
232
255
|
self,
|
|
233
256
|
new_model_id: DataModelIdentifier,
|
|
234
|
-
org_name: str
|
|
235
|
-
|
|
257
|
+
org_name: str = "My",
|
|
258
|
+
type_: Literal["enterprise", "solution"] = "enterprise",
|
|
259
|
+
mode: Literal["read", "write"] = "read",
|
|
260
|
+
dummy_property: str = "GUID",
|
|
236
261
|
):
|
|
237
262
|
self.new_model_id = DataModelId.load(new_model_id)
|
|
263
|
+
if not self.new_model_id.version:
|
|
264
|
+
raise NeatValueError("Version is required for the new model.")
|
|
265
|
+
|
|
238
266
|
self.org_name = org_name
|
|
239
267
|
self.mode = mode
|
|
268
|
+
self.type_ = type_
|
|
269
|
+
self.dummy_property = dummy_property
|
|
240
270
|
|
|
241
271
|
def transform(self, rules: DMSRules | OutRules[DMSRules]) -> JustRules[DMSRules]:
|
|
242
272
|
# Copy to ensure immutability
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
273
|
+
reference_model = self._to_rules(rules)
|
|
274
|
+
reference_model_id = reference_model.metadata.as_data_model_id()
|
|
275
|
+
|
|
276
|
+
# if model is solution then we need to get correct space for views and containers
|
|
277
|
+
if self.type_ == "solution":
|
|
278
|
+
if self.mode not in ["read", "write"]:
|
|
279
|
+
raise NeatValueError(f"Unsupported mode: {self.mode}")
|
|
280
|
+
|
|
281
|
+
if reference_model_id in COGNITE_MODELS:
|
|
282
|
+
warnings.warn(
|
|
283
|
+
SolutionModelBuildOnTopOfCDMWarning(reference_model_id=reference_model_id),
|
|
284
|
+
stacklevel=2,
|
|
285
|
+
)
|
|
247
286
|
|
|
248
|
-
|
|
287
|
+
return self._to_solution(reference_model)
|
|
288
|
+
|
|
289
|
+
elif self.type_ == "enterprise":
|
|
290
|
+
if reference_model_id not in COGNITE_MODELS:
|
|
291
|
+
warnings.warn(
|
|
292
|
+
EnterpriseModelNotBuildOnTopOfCDMWarning(reference_model_id=reference_model_id).as_message(),
|
|
293
|
+
stacklevel=2,
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
return self._to_enterprise(reference_model)
|
|
297
|
+
|
|
298
|
+
else:
|
|
299
|
+
raise NeatValueError(f"Unsupported data model type: {self.type_}")
|
|
300
|
+
|
|
301
|
+
def _has_views_in_multiple_space(self, rules: DMSRules) -> bool:
|
|
302
|
+
return any(view.view.space != rules.metadata.space for view in rules.views)
|
|
303
|
+
|
|
304
|
+
def _to_solution(self, reference_rules: DMSRules) -> JustRules[DMSRules]:
|
|
305
|
+
"""For creation of solution data model / rules specifically for mapping over existing containers."""
|
|
306
|
+
|
|
307
|
+
dump = reference_rules.dump()
|
|
308
|
+
|
|
309
|
+
# Prepare new model metadata prior validation
|
|
249
310
|
dump["metadata"]["schema_"] = SchemaCompleteness.partial.value
|
|
311
|
+
dump["metadata"]["data_model_type"] = self.type_
|
|
312
|
+
dump["metadata"]["name"] = f"{self.org_name} {self.type_} data model"
|
|
250
313
|
dump["metadata"]["space"] = self.new_model_id.space
|
|
251
314
|
dump["metadata"]["external_id"] = self.new_model_id.external_id
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
#
|
|
255
|
-
#
|
|
256
|
-
|
|
315
|
+
dump["metadata"]["version"] = self.new_model_id.version
|
|
316
|
+
|
|
317
|
+
# dropping reference and last from the dump as they can cause validation
|
|
318
|
+
# issues especially if reference is enterprise model build on top of CDM
|
|
319
|
+
dump.pop("reference", None)
|
|
320
|
+
dump.pop("last", None)
|
|
257
321
|
|
|
258
|
-
#
|
|
259
|
-
for
|
|
322
|
+
# Set implement to NONE for all views
|
|
323
|
+
for view in dump["views"]:
|
|
324
|
+
view["implements"] = None
|
|
325
|
+
|
|
326
|
+
if self._has_views_in_multiple_space(reference_rules):
|
|
327
|
+
views_to_remove = []
|
|
328
|
+
for view in dump["views"]:
|
|
329
|
+
if ":" in view["view"]:
|
|
330
|
+
views_to_remove.append(view)
|
|
331
|
+
|
|
332
|
+
dump["views"] = remove_list_elements(dump["views"], views_to_remove)
|
|
333
|
+
|
|
334
|
+
solution_model = DMSRules.model_validate(DMSInputRules.load(dump).dump())
|
|
335
|
+
|
|
336
|
+
# Dropping containers coming from reference model
|
|
337
|
+
solution_model.containers = SheetList[DMSContainer]()
|
|
338
|
+
|
|
339
|
+
# We want to map properties to existing containers allowing extension
|
|
340
|
+
for prop in solution_model.properties:
|
|
260
341
|
if prop.container and prop.container.space == self.new_model_id.space:
|
|
261
342
|
prop.container = ContainerEntity(
|
|
262
|
-
space=
|
|
343
|
+
space=reference_rules.metadata.space,
|
|
263
344
|
externalId=prop.container.suffix,
|
|
264
345
|
)
|
|
265
346
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
for prop in new_model.properties:
|
|
274
|
-
prop.view = self._remove_cognite_prefix(prop.view)
|
|
275
|
-
prop.class_ = self._remove_cognite_prefix(prop.class_)
|
|
347
|
+
# If reference model on which we are mapping one of Cognite Data Models
|
|
348
|
+
# since we want to affix these with the organization name
|
|
349
|
+
if reference_rules.metadata.as_data_model_id() in COGNITE_MODELS:
|
|
350
|
+
# Remove Cognite affix in view external_id / suffix.
|
|
351
|
+
for prop in solution_model.properties:
|
|
352
|
+
prop.view = self._remove_cognite_affix(prop.view)
|
|
353
|
+
prop.class_ = self._remove_cognite_affix(prop.class_)
|
|
276
354
|
if isinstance(prop.value_type, ViewEntity):
|
|
277
|
-
prop.value_type = self.
|
|
278
|
-
for view in
|
|
279
|
-
view.view = self.
|
|
280
|
-
view.class_ = self.
|
|
355
|
+
prop.value_type = self._remove_cognite_affix(prop.value_type)
|
|
356
|
+
for view in solution_model.views:
|
|
357
|
+
view.view = self._remove_cognite_affix(view.view)
|
|
358
|
+
view.class_ = self._remove_cognite_affix(view.class_)
|
|
281
359
|
|
|
282
|
-
|
|
360
|
+
if self.mode == "write":
|
|
361
|
+
_, new_containers, new_properties = self._get_new_components(solution_model)
|
|
283
362
|
|
|
284
|
-
|
|
363
|
+
# Here we add ONLY dummy properties of the solution model and
|
|
364
|
+
# corresponding solution model space containers to hold them
|
|
365
|
+
solution_model.containers.extend(new_containers)
|
|
366
|
+
solution_model.properties.extend(new_properties)
|
|
367
|
+
|
|
368
|
+
return JustRules(solution_model)
|
|
369
|
+
|
|
370
|
+
def _to_enterprise(self, reference_model: DMSRules) -> JustRules[DMSRules]:
|
|
371
|
+
dump = reference_model.dump()
|
|
372
|
+
|
|
373
|
+
# This is must prior model validation to avoid validation issues
|
|
374
|
+
dump["metadata"]["schema_"] = SchemaCompleteness.partial.value
|
|
375
|
+
|
|
376
|
+
# This will create reference model components in the enterprise model space
|
|
377
|
+
enterprise_model = DMSRules.model_validate(DMSInputRules.load(dump).dump())
|
|
378
|
+
|
|
379
|
+
# Post validation metadata update:
|
|
380
|
+
enterprise_model.metadata.name = self.type_
|
|
381
|
+
enterprise_model.metadata.name = f"{self.org_name} {self.type_} data model"
|
|
382
|
+
enterprise_model.metadata.space = self.new_model_id.space
|
|
383
|
+
enterprise_model.metadata.external_id = self.new_model_id.external_id
|
|
384
|
+
enterprise_model.metadata.version = cast(str, self.new_model_id.version)
|
|
385
|
+
|
|
386
|
+
if reference_model.metadata.as_data_model_id() in COGNITE_MODELS:
|
|
387
|
+
enterprise_model.reference = reference_model
|
|
388
|
+
|
|
389
|
+
# Here we are creating enterprise specific components
|
|
390
|
+
enterprise_views, enterprise_containers, enterprise_properties = self._get_new_components(enterprise_model)
|
|
391
|
+
|
|
392
|
+
# And we are adding them to the enterprise model
|
|
393
|
+
# extending reference views with new ones
|
|
394
|
+
enterprise_model.views.extend(enterprise_views)
|
|
395
|
+
|
|
396
|
+
# while overwriting containers and properties with new ones
|
|
397
|
+
enterprise_model.containers = enterprise_containers
|
|
398
|
+
enterprise_model.properties = enterprise_properties
|
|
399
|
+
|
|
400
|
+
return JustRules(enterprise_model)
|
|
401
|
+
|
|
402
|
+
def _remove_cognite_affix(self, entity: _T_Entity) -> _T_Entity:
|
|
403
|
+
"""This method removes `Cognite` affix from the entity."""
|
|
285
404
|
new_suffix = entity.suffix.replace("Cognite", self.org_name or "")
|
|
286
405
|
if isinstance(entity, ViewEntity):
|
|
287
406
|
return ViewEntity(space=entity.space, externalId=new_suffix, version=entity.version) # type: ignore[return-value]
|
|
@@ -289,6 +408,53 @@ class ToExtension(RulesTransformer[DMSRules, DMSRules]):
|
|
|
289
408
|
return ClassEntity(prefix=entity.prefix, suffix=new_suffix, version=entity.version) # type: ignore[return-value]
|
|
290
409
|
raise ValueError(f"Unsupported entity type: {type(entity)}")
|
|
291
410
|
|
|
411
|
+
def _get_new_components(
|
|
412
|
+
self, rules: DMSRules
|
|
413
|
+
) -> tuple[SheetList[DMSView], SheetList[DMSContainer], SheetList[DMSProperty]]:
|
|
414
|
+
new_views = SheetList[DMSView]()
|
|
415
|
+
new_containers = SheetList[DMSContainer]()
|
|
416
|
+
new_properties = SheetList[DMSProperty]()
|
|
417
|
+
|
|
418
|
+
for definition in rules.views:
|
|
419
|
+
view_entity = self._remove_cognite_affix(definition.view)
|
|
420
|
+
|
|
421
|
+
view_entity.version = cast(str, self.new_model_id.version)
|
|
422
|
+
view_entity.prefix = self.new_model_id.space
|
|
423
|
+
container_entity = ContainerEntity(space=view_entity.prefix, externalId=view_entity.external_id)
|
|
424
|
+
class_entity = ClassEntity(prefix=view_entity.prefix, suffix=view_entity.suffix)
|
|
425
|
+
|
|
426
|
+
view = DMSView(
|
|
427
|
+
view=view_entity,
|
|
428
|
+
implements=[definition.view],
|
|
429
|
+
in_model=True,
|
|
430
|
+
class_=class_entity,
|
|
431
|
+
name=definition.name,
|
|
432
|
+
)
|
|
433
|
+
|
|
434
|
+
container = DMSContainer(
|
|
435
|
+
container=container_entity,
|
|
436
|
+
class_=class_entity,
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
property_ = DMSProperty(
|
|
440
|
+
view=view_entity,
|
|
441
|
+
view_property=f"{to_camel(view_entity.suffix)}{self.dummy_property}",
|
|
442
|
+
value_type=String(),
|
|
443
|
+
nullable=True,
|
|
444
|
+
immutable=False,
|
|
445
|
+
is_list=False,
|
|
446
|
+
container=container_entity,
|
|
447
|
+
container_property=f"{to_camel(view_entity.suffix)}{self.dummy_property}",
|
|
448
|
+
class_=class_entity,
|
|
449
|
+
property_=f"{to_camel(view_entity.suffix)}{self.dummy_property}",
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
new_properties.append(property_)
|
|
453
|
+
new_views.append(view)
|
|
454
|
+
new_containers.append(container)
|
|
455
|
+
|
|
456
|
+
return new_views, new_containers, new_properties
|
|
457
|
+
|
|
292
458
|
|
|
293
459
|
class ReduceCogniteModel(RulesTransformer[DMSRules, DMSRules]):
|
|
294
460
|
_ASSET_VIEW = ViewId("cdf_cdm", "CogniteAsset", "v1")
|
|
@@ -329,17 +495,20 @@ class ReduceCogniteModel(RulesTransformer[DMSRules, DMSRules]):
|
|
|
329
495
|
),
|
|
330
496
|
}
|
|
331
497
|
|
|
332
|
-
def __init__(self, drop: Collection[Literal["3D", "Annotation", "BaseViews"]]):
|
|
333
|
-
self.
|
|
498
|
+
def __init__(self, drop: Collection[Literal["3D", "Annotation", "BaseViews"] | str]):
|
|
499
|
+
self.drop_collection = cast(
|
|
500
|
+
list[Literal["3D", "Annotation", "BaseViews"]],
|
|
501
|
+
[collection for collection in drop if collection in self._VIEW_BY_COLLECTION],
|
|
502
|
+
)
|
|
503
|
+
self.drop_external_ids = {external_id for external_id in drop if external_id not in self._VIEW_BY_COLLECTION}
|
|
334
504
|
|
|
335
505
|
def transform(self, rules: DMSRules | OutRules[DMSRules]) -> JustRules[DMSRules]:
|
|
336
506
|
verified = self._to_rules(rules)
|
|
337
507
|
if verified.metadata.as_data_model_id() not in COGNITE_MODELS:
|
|
338
508
|
raise NeatValueError(f"Can only reduce Cognite Data Models, not {verified.metadata.as_data_model_id()}")
|
|
339
|
-
if invalid := (set(self.drop) - set(self._VIEW_BY_COLLECTION.keys())):
|
|
340
|
-
raise NeatValueError(f"Invalid drop values: {invalid}. Expected {set(self._VIEW_BY_COLLECTION)}")
|
|
341
509
|
|
|
342
|
-
exclude_views = {view for collection in self.
|
|
510
|
+
exclude_views = {view for collection in self.drop_collection for view in self._VIEW_BY_COLLECTION[collection]}
|
|
511
|
+
exclude_views |= {view.view.as_id() for view in verified.views if view.view.suffix in self.drop_external_ids}
|
|
343
512
|
new_model = verified.model_copy(deep=True)
|
|
344
513
|
|
|
345
514
|
properties_by_view = DMSAnalysis(new_model).classes_with_properties(consider_inheritance=True)
|
|
@@ -359,7 +528,7 @@ class ReduceCogniteModel(RulesTransformer[DMSRules, DMSRules]):
|
|
|
359
528
|
return JustRules(new_model)
|
|
360
529
|
|
|
361
530
|
def _is_asset_3D_property(self, prop: DMSProperty) -> bool:
|
|
362
|
-
if "3D" not in self.
|
|
531
|
+
if "3D" not in self.drop_collection:
|
|
363
532
|
return False
|
|
364
533
|
return prop.view.as_id() == self._ASSET_VIEW and prop.property_ == "object3D"
|
|
365
534
|
|
|
@@ -2,6 +2,7 @@ from typing import Literal, cast
|
|
|
2
2
|
|
|
3
3
|
from cognite.client import CogniteClient
|
|
4
4
|
|
|
5
|
+
from cognite.neat import _version
|
|
5
6
|
from cognite.neat._issues import IssueList
|
|
6
7
|
from cognite.neat._rules import importers
|
|
7
8
|
from cognite.neat._rules._shared import ReadRules
|
|
@@ -10,8 +11,10 @@ from cognite.neat._rules.models.information._rules import InformationRules
|
|
|
10
11
|
from cognite.neat._rules.models.information._rules_input import InformationInputRules
|
|
11
12
|
from cognite.neat._rules.transformers import ConvertToRules, VerifyAnyRules
|
|
12
13
|
|
|
14
|
+
from ._inspect import InspectAPI
|
|
13
15
|
from ._prepare import PrepareAPI
|
|
14
16
|
from ._read import ReadAPI
|
|
17
|
+
from ._set import SetAPI
|
|
15
18
|
from ._show import ShowAPI
|
|
16
19
|
from ._state import SessionState
|
|
17
20
|
from ._to import ToAPI
|
|
@@ -33,6 +36,12 @@ class NeatSession:
|
|
|
33
36
|
self.to = ToAPI(self._state, client, verbose)
|
|
34
37
|
self.prepare = PrepareAPI(self._state, verbose)
|
|
35
38
|
self.show = ShowAPI(self._state)
|
|
39
|
+
self.set = SetAPI(self._state, verbose)
|
|
40
|
+
self.inspect = InspectAPI(self._state)
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def version(self) -> str:
|
|
44
|
+
return _version.__version__
|
|
36
45
|
|
|
37
46
|
def verify(self) -> IssueList:
|
|
38
47
|
output = VerifyAnyRules("continue").try_transform(self._state.input_rule)
|
|
@@ -40,6 +49,9 @@ class NeatSession:
|
|
|
40
49
|
self._state.verified_rules.append(output.rules)
|
|
41
50
|
if isinstance(output.rules, InformationRules):
|
|
42
51
|
self._state.store.add_rules(output.rules)
|
|
52
|
+
self._state.issue_lists.append(output.issues)
|
|
53
|
+
if output.issues:
|
|
54
|
+
print("You can inspect the issues with the .inspect attribute.")
|
|
43
55
|
return output.issues
|
|
44
56
|
|
|
45
57
|
def convert(self, target: Literal["dms"]) -> None:
|
|
@@ -70,10 +82,10 @@ class NeatSession:
|
|
|
70
82
|
|
|
71
83
|
output = []
|
|
72
84
|
if state.input_rules and not state.verified_rules:
|
|
73
|
-
output.append(f"<H2>
|
|
85
|
+
output.append(f"<H2>Unverified Data Model</H2><br />{state.input_rule.rules._repr_html_()}") # type: ignore
|
|
74
86
|
|
|
75
87
|
if state.verified_rules:
|
|
76
|
-
output.append(f"<H2>Data Model</H2><br />{state.last_verified_rule._repr_html_()}") # type: ignore
|
|
88
|
+
output.append(f"<H2>Verified Data Model</H2><br />{state.last_verified_rule._repr_html_()}") # type: ignore
|
|
77
89
|
|
|
78
90
|
if state.has_store:
|
|
79
91
|
output.append(f"<H2>Instances</H2> {state.store._repr_html_()}")
|