cognite-neat 0.123.26__py3-none-any.whl → 1.0.22__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cognite/neat/__init__.py +4 -3
- cognite/neat/_client/__init__.py +5 -0
- cognite/neat/_client/api.py +8 -0
- cognite/neat/_client/client.py +21 -0
- cognite/neat/_client/config.py +40 -0
- cognite/neat/_client/containers_api.py +138 -0
- cognite/neat/_client/data_classes.py +44 -0
- cognite/neat/_client/data_model_api.py +115 -0
- cognite/neat/_client/init/credentials.py +70 -0
- cognite/neat/_client/init/env_vars.py +131 -0
- cognite/neat/_client/init/main.py +51 -0
- cognite/neat/_client/spaces_api.py +115 -0
- cognite/neat/_client/statistics_api.py +24 -0
- cognite/neat/_client/views_api.py +144 -0
- cognite/neat/_config.py +266 -0
- cognite/neat/_data_model/_analysis.py +571 -0
- cognite/neat/_data_model/_constants.py +74 -0
- cognite/neat/_data_model/_identifiers.py +61 -0
- cognite/neat/_data_model/_shared.py +41 -0
- cognite/neat/_data_model/_snapshot.py +134 -0
- cognite/neat/_data_model/deployer/_differ.py +140 -0
- cognite/neat/_data_model/deployer/_differ_container.py +360 -0
- cognite/neat/_data_model/deployer/_differ_data_model.py +54 -0
- cognite/neat/_data_model/deployer/_differ_space.py +9 -0
- cognite/neat/_data_model/deployer/_differ_view.py +299 -0
- cognite/neat/_data_model/deployer/data_classes.py +644 -0
- cognite/neat/_data_model/deployer/deployer.py +431 -0
- cognite/neat/_data_model/exporters/__init__.py +15 -0
- cognite/neat/_data_model/exporters/_api_exporter.py +37 -0
- cognite/neat/_data_model/exporters/_base.py +24 -0
- cognite/neat/_data_model/exporters/_table_exporter/exporter.py +128 -0
- cognite/neat/_data_model/exporters/_table_exporter/workbook.py +409 -0
- cognite/neat/_data_model/exporters/_table_exporter/writer.py +480 -0
- cognite/neat/_data_model/importers/__init__.py +5 -0
- cognite/neat/_data_model/importers/_api_importer.py +166 -0
- cognite/neat/_data_model/importers/_base.py +16 -0
- cognite/neat/_data_model/importers/_table_importer/data_classes.py +344 -0
- cognite/neat/_data_model/importers/_table_importer/importer.py +192 -0
- cognite/neat/_data_model/importers/_table_importer/reader.py +1102 -0
- cognite/neat/_data_model/importers/_table_importer/source.py +94 -0
- cognite/neat/_data_model/models/conceptual/_base.py +18 -0
- cognite/neat/_data_model/models/conceptual/_concept.py +67 -0
- cognite/neat/_data_model/models/conceptual/_data_model.py +51 -0
- cognite/neat/_data_model/models/conceptual/_properties.py +104 -0
- cognite/neat/_data_model/models/conceptual/_property.py +105 -0
- cognite/neat/_data_model/models/dms/__init__.py +206 -0
- cognite/neat/_data_model/models/dms/_base.py +31 -0
- cognite/neat/_data_model/models/dms/_constants.py +48 -0
- cognite/neat/_data_model/models/dms/_constraints.py +42 -0
- cognite/neat/_data_model/models/dms/_container.py +159 -0
- cognite/neat/_data_model/models/dms/_data_model.py +95 -0
- cognite/neat/_data_model/models/dms/_data_types.py +195 -0
- cognite/neat/_data_model/models/dms/_http.py +28 -0
- cognite/neat/_data_model/models/dms/_indexes.py +30 -0
- cognite/neat/_data_model/models/dms/_limits.py +96 -0
- cognite/neat/_data_model/models/dms/_references.py +141 -0
- cognite/neat/_data_model/models/dms/_schema.py +18 -0
- cognite/neat/_data_model/models/dms/_space.py +48 -0
- cognite/neat/_data_model/models/dms/_types.py +17 -0
- cognite/neat/_data_model/models/dms/_view_filter.py +310 -0
- cognite/neat/_data_model/models/dms/_view_property.py +235 -0
- cognite/neat/_data_model/models/dms/_views.py +216 -0
- cognite/neat/_data_model/models/entities/__init__.py +50 -0
- cognite/neat/_data_model/models/entities/_base.py +101 -0
- cognite/neat/_data_model/models/entities/_constants.py +22 -0
- cognite/neat/_data_model/models/entities/_data_types.py +144 -0
- cognite/neat/_data_model/models/entities/_identifiers.py +61 -0
- cognite/neat/_data_model/models/entities/_parser.py +226 -0
- cognite/neat/_data_model/validation/dms/__init__.py +75 -0
- cognite/neat/_data_model/validation/dms/_ai_readiness.py +381 -0
- cognite/neat/_data_model/validation/dms/_base.py +25 -0
- cognite/neat/_data_model/validation/dms/_connections.py +681 -0
- cognite/neat/_data_model/validation/dms/_consistency.py +58 -0
- cognite/neat/_data_model/validation/dms/_containers.py +199 -0
- cognite/neat/_data_model/validation/dms/_limits.py +368 -0
- cognite/neat/_data_model/validation/dms/_orchestrator.py +70 -0
- cognite/neat/_data_model/validation/dms/_views.py +164 -0
- cognite/neat/_exceptions.py +68 -0
- cognite/neat/_issues.py +68 -0
- cognite/neat/_session/__init__.py +3 -0
- cognite/neat/_session/_html/_render.py +30 -0
- cognite/neat/_session/_html/static/__init__.py +8 -0
- cognite/neat/_session/_html/static/deployment.css +476 -0
- cognite/neat/_session/_html/static/deployment.js +181 -0
- cognite/neat/_session/_html/static/issues.css +211 -0
- cognite/neat/_session/_html/static/issues.js +168 -0
- cognite/neat/_session/_html/static/shared.css +186 -0
- cognite/neat/_session/_html/templates/__init__.py +4 -0
- cognite/neat/_session/_html/templates/deployment.html +80 -0
- cognite/neat/_session/_html/templates/issues.html +45 -0
- cognite/neat/_session/_issues.py +81 -0
- cognite/neat/_session/_physical.py +294 -0
- cognite/neat/_session/_result/__init__.py +3 -0
- cognite/neat/_session/_result/_deployment/__init__.py +0 -0
- cognite/neat/_session/_result/_deployment/_physical/__init__.py +0 -0
- cognite/neat/_session/_result/_deployment/_physical/_changes.py +196 -0
- cognite/neat/_session/_result/_deployment/_physical/_statistics.py +180 -0
- cognite/neat/_session/_result/_deployment/_physical/serializer.py +35 -0
- cognite/neat/_session/_result/_result.py +31 -0
- cognite/neat/_session/_session.py +81 -0
- cognite/neat/_session/_usage_analytics/__init__.py +0 -0
- cognite/neat/_session/_usage_analytics/_collector.py +131 -0
- cognite/neat/_session/_usage_analytics/_constants.py +23 -0
- cognite/neat/_session/_usage_analytics/_storage.py +240 -0
- cognite/neat/_session/_wrappers.py +101 -0
- cognite/neat/_state_machine/__init__.py +10 -0
- cognite/neat/_state_machine/_base.py +37 -0
- cognite/neat/_state_machine/_states.py +52 -0
- cognite/neat/_store/__init__.py +3 -0
- cognite/neat/_store/_provenance.py +88 -0
- cognite/neat/_store/_store.py +220 -0
- cognite/neat/_utils/__init__.py +0 -0
- cognite/neat/_utils/_reader.py +194 -0
- cognite/neat/_utils/auxiliary.py +49 -0
- cognite/neat/_utils/collection.py +11 -0
- cognite/neat/_utils/http_client/__init__.py +39 -0
- cognite/neat/_utils/http_client/_client.py +245 -0
- cognite/neat/_utils/http_client/_config.py +19 -0
- cognite/neat/_utils/http_client/_data_classes.py +294 -0
- cognite/neat/_utils/http_client/_tracker.py +31 -0
- cognite/neat/_utils/repo.py +19 -0
- cognite/neat/_utils/text.py +71 -0
- cognite/neat/_utils/useful_types.py +37 -0
- cognite/neat/_utils/validation.py +154 -0
- cognite/neat/_v0/__init__.py +0 -0
- cognite/neat/_v0/core/__init__.py +0 -0
- cognite/neat/_v0/core/_client/_api/__init__.py +0 -0
- cognite/neat/{core → _v0/core}/_client/_api/data_modeling_loaders.py +8 -7
- cognite/neat/{core → _v0/core}/_client/_api/neat_instances.py +5 -5
- cognite/neat/{core → _v0/core}/_client/_api/schema.py +5 -5
- cognite/neat/{core → _v0/core}/_client/_api/statistics.py +3 -3
- cognite/neat/{core → _v0/core}/_client/_api_client.py +1 -1
- cognite/neat/_v0/core/_client/data_classes/__init__.py +0 -0
- cognite/neat/{core → _v0/core}/_client/data_classes/schema.py +4 -4
- cognite/neat/{core → _v0/core}/_client/testing.py +1 -1
- cognite/neat/{core → _v0/core}/_constants.py +5 -3
- cognite/neat/_v0/core/_data_model/__init__.py +0 -0
- cognite/neat/{core → _v0/core}/_data_model/_constants.py +7 -0
- cognite/neat/{core → _v0/core}/_data_model/_shared.py +4 -4
- cognite/neat/{core → _v0/core}/_data_model/analysis/_base.py +8 -8
- cognite/neat/{core → _v0/core}/_data_model/exporters/__init__.py +1 -2
- cognite/neat/{core → _v0/core}/_data_model/exporters/_base.py +7 -7
- cognite/neat/{core → _v0/core}/_data_model/exporters/_data_model2dms.py +9 -9
- cognite/neat/{core → _v0/core}/_data_model/exporters/_data_model2excel.py +12 -12
- cognite/neat/{core → _v0/core}/_data_model/exporters/_data_model2instance_template.py +4 -4
- cognite/neat/{core/_data_model/exporters/_data_model2ontology.py → _v0/core/_data_model/exporters/_data_model2semantic_model.py} +126 -116
- cognite/neat/{core → _v0/core}/_data_model/exporters/_data_model2yaml.py +1 -1
- cognite/neat/{core → _v0/core}/_data_model/importers/_base.py +5 -5
- cognite/neat/{core → _v0/core}/_data_model/importers/_base_file_reader.py +2 -2
- cognite/neat/{core → _v0/core}/_data_model/importers/_dict2data_model.py +5 -5
- cognite/neat/{core → _v0/core}/_data_model/importers/_dms2data_model.py +18 -15
- cognite/neat/{core → _v0/core}/_data_model/importers/_graph2data_model.py +12 -12
- cognite/neat/{core → _v0/core}/_data_model/importers/_rdf/_base.py +12 -12
- cognite/neat/{core → _v0/core}/_data_model/importers/_rdf/_inference2rdata_model.py +14 -14
- cognite/neat/{core → _v0/core}/_data_model/importers/_rdf/_owl2data_model.py +41 -21
- cognite/neat/{core → _v0/core}/_data_model/importers/_rdf/_shared.py +9 -9
- cognite/neat/{core → _v0/core}/_data_model/importers/_spreadsheet2data_model.py +92 -12
- cognite/neat/{core → _v0/core}/_data_model/models/__init__.py +3 -3
- cognite/neat/{core → _v0/core}/_data_model/models/_base_verified.py +5 -5
- cognite/neat/{core → _v0/core}/_data_model/models/_import_contexts.py +1 -1
- cognite/neat/{core → _v0/core}/_data_model/models/_types.py +5 -5
- cognite/neat/{core → _v0/core}/_data_model/models/conceptual/_unverified.py +16 -10
- cognite/neat/{core → _v0/core}/_data_model/models/conceptual/_validation.py +12 -12
- cognite/neat/{core → _v0/core}/_data_model/models/conceptual/_verified.py +9 -9
- cognite/neat/{core → _v0/core}/_data_model/models/data_types.py +14 -4
- cognite/neat/{core → _v0/core}/_data_model/models/entities/__init__.py +6 -0
- cognite/neat/_v0/core/_data_model/models/entities/_loaders.py +155 -0
- cognite/neat/{core → _v0/core}/_data_model/models/entities/_multi_value.py +2 -2
- cognite/neat/_v0/core/_data_model/models/entities/_restrictions.py +230 -0
- cognite/neat/{core → _v0/core}/_data_model/models/entities/_single_value.py +121 -16
- cognite/neat/{core → _v0/core}/_data_model/models/entities/_types.py +10 -0
- cognite/neat/{core → _v0/core}/_data_model/models/mapping/_classic2core.py +5 -5
- cognite/neat/{core → _v0/core}/_data_model/models/physical/__init__.py +1 -1
- cognite/neat/{core → _v0/core}/_data_model/models/physical/_exporter.py +26 -19
- cognite/neat/{core → _v0/core}/_data_model/models/physical/_unverified.py +133 -37
- cognite/neat/{core → _v0/core}/_data_model/models/physical/_validation.py +24 -20
- cognite/neat/{core → _v0/core}/_data_model/models/physical/_verified.py +95 -24
- cognite/neat/{core → _v0/core}/_data_model/transformers/_base.py +4 -4
- cognite/neat/{core → _v0/core}/_data_model/transformers/_converters.py +35 -28
- cognite/neat/{core → _v0/core}/_data_model/transformers/_mapping.py +7 -7
- cognite/neat/{core → _v0/core}/_data_model/transformers/_union_conceptual.py +5 -5
- cognite/neat/{core → _v0/core}/_data_model/transformers/_verification.py +7 -7
- cognite/neat/_v0/core/_instances/__init__.py +0 -0
- cognite/neat/{core → _v0/core}/_instances/_tracking/base.py +1 -1
- cognite/neat/{core → _v0/core}/_instances/_tracking/log.py +1 -1
- cognite/neat/{core → _v0/core}/_instances/extractors/__init__.py +3 -2
- cognite/neat/{core → _v0/core}/_instances/extractors/_base.py +6 -6
- cognite/neat/_v0/core/_instances/extractors/_classic_cdf/__init__.py +0 -0
- cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_base.py +7 -7
- cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_classic.py +12 -12
- cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_relationships.py +3 -3
- cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_sequences.py +2 -2
- cognite/neat/{core → _v0/core}/_instances/extractors/_dict.py +6 -3
- cognite/neat/{core → _v0/core}/_instances/extractors/_dms.py +6 -6
- cognite/neat/{core → _v0/core}/_instances/extractors/_dms_graph.py +11 -11
- cognite/neat/{core → _v0/core}/_instances/extractors/_mock_graph_generator.py +10 -10
- cognite/neat/{core → _v0/core}/_instances/extractors/_raw.py +3 -3
- cognite/neat/{core → _v0/core}/_instances/extractors/_rdf_file.py +7 -7
- cognite/neat/{core → _v0/core}/_instances/loaders/_base.py +5 -5
- cognite/neat/{core → _v0/core}/_instances/loaders/_rdf2dms.py +17 -17
- cognite/neat/{core → _v0/core}/_instances/loaders/_rdf_to_instance_space.py +11 -11
- cognite/neat/{core → _v0/core}/_instances/queries/_select.py +29 -3
- cognite/neat/{core → _v0/core}/_instances/queries/_update.py +1 -1
- cognite/neat/{core → _v0/core}/_instances/transformers/_base.py +4 -4
- cognite/neat/{core → _v0/core}/_instances/transformers/_classic_cdf.py +6 -6
- cognite/neat/{core → _v0/core}/_instances/transformers/_prune_graph.py +4 -4
- cognite/neat/{core → _v0/core}/_instances/transformers/_rdfpath.py +1 -1
- cognite/neat/{core → _v0/core}/_instances/transformers/_value_type.py +4 -4
- cognite/neat/{core → _v0/core}/_issues/_base.py +5 -5
- cognite/neat/{core → _v0/core}/_issues/_contextmanagers.py +1 -1
- cognite/neat/{core → _v0/core}/_issues/_factory.py +3 -3
- cognite/neat/{core → _v0/core}/_issues/errors/__init__.py +1 -1
- cognite/neat/{core → _v0/core}/_issues/errors/_external.py +1 -1
- cognite/neat/{core → _v0/core}/_issues/errors/_general.py +1 -1
- cognite/neat/{core → _v0/core}/_issues/errors/_properties.py +1 -1
- cognite/neat/{core → _v0/core}/_issues/errors/_resources.py +2 -2
- cognite/neat/{core → _v0/core}/_issues/errors/_wrapper.py +7 -3
- cognite/neat/{core → _v0/core}/_issues/warnings/__init__.py +1 -1
- cognite/neat/{core → _v0/core}/_issues/warnings/_external.py +1 -1
- cognite/neat/{core → _v0/core}/_issues/warnings/_general.py +1 -1
- cognite/neat/{core → _v0/core}/_issues/warnings/_models.py +2 -2
- cognite/neat/{core → _v0/core}/_issues/warnings/_properties.py +2 -2
- cognite/neat/{core → _v0/core}/_issues/warnings/_resources.py +1 -1
- cognite/neat/{core → _v0/core}/_issues/warnings/user_modeling.py +1 -1
- cognite/neat/{core → _v0/core}/_store/_data_model.py +12 -12
- cognite/neat/{core → _v0/core}/_store/_instance.py +43 -10
- cognite/neat/{core → _v0/core}/_store/_provenance.py +3 -3
- cognite/neat/{core → _v0/core}/_store/exceptions.py +4 -4
- cognite/neat/_v0/core/_utils/__init__.py +0 -0
- cognite/neat/{core → _v0/core}/_utils/auth.py +22 -12
- cognite/neat/{core → _v0/core}/_utils/auxiliary.py +1 -1
- cognite/neat/{core → _v0/core}/_utils/collection_.py +2 -2
- cognite/neat/{core → _v0/core}/_utils/graph_transformations_report.py +1 -1
- cognite/neat/{core → _v0/core}/_utils/rdf_.py +1 -1
- cognite/neat/{core → _v0/core}/_utils/reader/_base.py +1 -1
- cognite/neat/{core → _v0/core}/_utils/spreadsheet.py +18 -4
- cognite/neat/{core → _v0/core}/_utils/text.py +1 -1
- cognite/neat/{core → _v0/core}/_utils/upload.py +3 -3
- cognite/neat/{session → _v0}/engine/_load.py +1 -1
- cognite/neat/_v0/plugins/__init__.py +4 -0
- cognite/neat/_v0/plugins/_base.py +9 -0
- cognite/neat/_v0/plugins/_data_model.py +48 -0
- cognite/neat/{plugins → _v0/plugins}/_issues.py +1 -1
- cognite/neat/{plugins → _v0/plugins}/_manager.py +7 -16
- cognite/neat/{session → _v0/session}/_base.py +13 -15
- cognite/neat/{session → _v0/session}/_collector.py +1 -1
- cognite/neat/_v0/session/_diff.py +51 -0
- cognite/neat/{session → _v0/session}/_drop.py +3 -3
- cognite/neat/{session → _v0/session}/_explore.py +2 -2
- cognite/neat/{session → _v0/session}/_fix.py +2 -2
- cognite/neat/{session → _v0/session}/_inspect.py +3 -3
- cognite/neat/{session → _v0/session}/_mapping.py +3 -3
- cognite/neat/{session → _v0/session}/_plugin.py +4 -5
- cognite/neat/{session → _v0/session}/_prepare.py +8 -8
- cognite/neat/{session → _v0/session}/_read.py +34 -21
- cognite/neat/{session → _v0/session}/_set.py +8 -8
- cognite/neat/{session → _v0/session}/_show.py +5 -5
- cognite/neat/{session → _v0/session}/_state.py +10 -10
- cognite/neat/{session → _v0/session}/_subset.py +4 -4
- cognite/neat/{session → _v0/session}/_template.py +11 -11
- cognite/neat/{session → _v0/session}/_to.py +12 -12
- cognite/neat/{session → _v0/session}/_wizard.py +1 -1
- cognite/neat/{session → _v0/session}/exceptions.py +5 -5
- cognite/neat/_version.py +1 -1
- cognite/neat/legacy.py +6 -0
- cognite_neat-1.0.22.dist-info/METADATA +123 -0
- cognite_neat-1.0.22.dist-info/RECORD +329 -0
- cognite_neat-1.0.22.dist-info/WHEEL +4 -0
- cognite/neat/core/_data_model/models/entities/_loaders.py +0 -75
- cognite/neat/plugins/__init__.py +0 -3
- cognite/neat/plugins/data_model/importers/__init__.py +0 -5
- cognite/neat/plugins/data_model/importers/_base.py +0 -28
- cognite/neat/session/_session/_data_model/__init__.py +0 -3
- cognite/neat/session/_session/_data_model/_read.py +0 -193
- cognite/neat/session/_session/_data_model/_routes.py +0 -45
- cognite/neat/session/_session/_data_model/_show.py +0 -147
- cognite/neat/session/_session/_data_model/_write.py +0 -335
- cognite_neat-0.123.26.dist-info/METADATA +0 -144
- cognite_neat-0.123.26.dist-info/RECORD +0 -201
- cognite_neat-0.123.26.dist-info/WHEEL +0 -4
- cognite_neat-0.123.26.dist-info/licenses/LICENSE +0 -201
- /cognite/neat/{core → _client/init}/__init__.py +0 -0
- /cognite/neat/{core/_client/_api → _data_model}/__init__.py +0 -0
- /cognite/neat/{core/_client/data_classes → _data_model/deployer}/__init__.py +0 -0
- /cognite/neat/{core/_data_model → _data_model/exporters/_table_exporter}/__init__.py +0 -0
- /cognite/neat/{core/_instances → _data_model/importers/_table_importer}/__init__.py +0 -0
- /cognite/neat/{core/_instances/extractors/_classic_cdf → _data_model/models}/__init__.py +0 -0
- /cognite/neat/{core/_utils → _data_model/models/conceptual}/__init__.py +0 -0
- /cognite/neat/{plugins/data_model → _data_model/validation}/__init__.py +0 -0
- /cognite/neat/{session/_session → _session/_html}/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_client/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_client/data_classes/data_modeling.py +0 -0
- /cognite/neat/{core → _v0/core}/_client/data_classes/neat_sequence.py +0 -0
- /cognite/neat/{core → _v0/core}/_client/data_classes/statistics.py +0 -0
- /cognite/neat/{core → _v0/core}/_config.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/analysis/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/catalog/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/catalog/classic_model.xlsx +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/catalog/conceptual-imf-data-model.xlsx +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/catalog/hello_world_pump.xlsx +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/importers/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/importers/_rdf/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/_base_unverified.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/conceptual/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/entities/_constants.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/entities/_wrapped.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/mapping/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/mapping/_classic2core.yaml +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/transformers/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/_shared.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/_tracking/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- /cognite/neat/{core → _v0/core}/_instances/examples/Knowledge-Graph-Nordic44.xml +0 -0
- /cognite/neat/{core → _v0/core}/_instances/examples/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_assets.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_data_sets.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_events.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_files.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_labels.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_timeseries.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/loaders/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/queries/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/queries/_base.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/queries/_queries.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/transformers/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_issues/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_issues/formatters.py +0 -0
- /cognite/neat/{core → _v0/core}/_shared.py +0 -0
- /cognite/neat/{core → _v0/core}/_store/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_utils/io_.py +0 -0
- /cognite/neat/{core → _v0/core}/_utils/reader/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_utils/tarjan.py +0 -0
- /cognite/neat/{core → _v0/core}/_utils/time_.py +0 -0
- /cognite/neat/{core → _v0/core}/_utils/xml_.py +0 -0
- /cognite/neat/{session → _v0}/engine/__init__.py +0 -0
- /cognite/neat/{session → _v0}/engine/_import.py +0 -0
- /cognite/neat/{session → _v0}/engine/_interface.py +0 -0
- /cognite/neat/{session → _v0/session}/__init__.py +0 -0
- /cognite/neat/{session → _v0/session}/_experimental.py +0 -0
- /cognite/neat/{session → _v0/session}/_state/README.md +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from datetime import datetime, timezone
|
|
3
|
+
|
|
4
|
+
from cognite.neat._data_model._analysis import ValidationResources
|
|
5
|
+
from cognite.neat._data_model._shared import OnSuccessIssuesChecker
|
|
6
|
+
from cognite.neat._data_model._snapshot import SchemaSnapshot
|
|
7
|
+
from cognite.neat._data_model.models.dms._limits import SchemaLimits
|
|
8
|
+
from cognite.neat._data_model.models.dms._schema import RequestSchema
|
|
9
|
+
from cognite.neat._utils.auxiliary import get_concrete_subclasses
|
|
10
|
+
from cognite.neat._utils.useful_types import ModusOperandi
|
|
11
|
+
|
|
12
|
+
from ._base import DataModelValidator
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class DmsDataModelValidation(OnSuccessIssuesChecker):
|
|
16
|
+
"""Placeholder for DMS Quality Assessment functionality."""
|
|
17
|
+
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
cdf_snapshot: SchemaSnapshot,
|
|
21
|
+
limits: SchemaLimits,
|
|
22
|
+
modus_operandi: ModusOperandi = "additive",
|
|
23
|
+
can_run_validator: Callable[[str, type], bool] | None = None,
|
|
24
|
+
enable_alpha_validators: bool = False,
|
|
25
|
+
) -> None:
|
|
26
|
+
super().__init__()
|
|
27
|
+
self._cdf_snapshot = cdf_snapshot
|
|
28
|
+
self._limits = limits
|
|
29
|
+
self._modus_operandi = modus_operandi
|
|
30
|
+
self._can_run_validator = can_run_validator or (lambda code, issue_type: True) # type: ignore
|
|
31
|
+
self._has_run = False
|
|
32
|
+
self._enable_alpha_validators = enable_alpha_validators
|
|
33
|
+
|
|
34
|
+
def run(self, request_schema: RequestSchema) -> None:
|
|
35
|
+
"""Run quality assessment on the DMS data model."""
|
|
36
|
+
|
|
37
|
+
validation_resources = self._gather_validation_resources(request_schema)
|
|
38
|
+
|
|
39
|
+
# Initialize all validators
|
|
40
|
+
validators: list[DataModelValidator] = [
|
|
41
|
+
validator(validation_resources) for validator in get_concrete_subclasses(DataModelValidator)
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
# Run validators
|
|
45
|
+
for validator in validators:
|
|
46
|
+
if validator.alpha and not self._enable_alpha_validators:
|
|
47
|
+
continue
|
|
48
|
+
if self._can_run_validator(validator.code, validator.issue_type):
|
|
49
|
+
self._issues.extend(validator.run())
|
|
50
|
+
|
|
51
|
+
self._has_run = True
|
|
52
|
+
|
|
53
|
+
def _gather_validation_resources(self, request_schema: RequestSchema) -> ValidationResources:
|
|
54
|
+
# we do not want to modify the original request schema during validation
|
|
55
|
+
copy = request_schema.model_copy(deep=True)
|
|
56
|
+
local = SchemaSnapshot(
|
|
57
|
+
data_model={request_schema.data_model.as_reference(): copy.data_model},
|
|
58
|
+
views={view.as_reference(): view for view in copy.views},
|
|
59
|
+
containers={container.as_reference(): container for container in copy.containers},
|
|
60
|
+
spaces={space.as_reference(): space for space in copy.spaces},
|
|
61
|
+
node_types={node_type: node_type for node_type in copy.node_types},
|
|
62
|
+
timestamp=datetime.now(timezone.utc),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
return ValidationResources(
|
|
66
|
+
cdf=self._cdf_snapshot,
|
|
67
|
+
local=local,
|
|
68
|
+
limits=self._limits,
|
|
69
|
+
modus_operandi=self._modus_operandi,
|
|
70
|
+
)
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"""Validators for checking containers in the data model."""
|
|
2
|
+
|
|
3
|
+
from cognite.neat._data_model.models.dms._view_property import ViewCorePropertyRequest
|
|
4
|
+
from cognite.neat._data_model.validation.dms._base import DataModelValidator
|
|
5
|
+
from cognite.neat._issues import ConsistencyError
|
|
6
|
+
|
|
7
|
+
BASE_CODE = "NEAT-DMS-VIEW"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ViewToContainerMappingNotPossible(DataModelValidator):
|
|
11
|
+
"""Validates that container and container property referenced by view property exist.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
Validates that for each view property that maps to a container and container property,
|
|
15
|
+
the referenced container and container property exist.
|
|
16
|
+
|
|
17
|
+
## Why is this bad?
|
|
18
|
+
If a view property references a container or container property that does not exist,
|
|
19
|
+
the data model cannot be deployed to CDF. This means that view property will not be able to function.
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
View WindTurbine has property location that maps to container WindTurbineContainer and property gpsCoordinates.
|
|
23
|
+
If WindTurbineContainer and/or property gpsCoordinates does not exist, the data model cannot be deployed to CDF.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
code = f"{BASE_CODE}-001"
|
|
27
|
+
issue_type = ConsistencyError
|
|
28
|
+
|
|
29
|
+
def run(self) -> list[ConsistencyError]:
|
|
30
|
+
errors: list[ConsistencyError] = []
|
|
31
|
+
|
|
32
|
+
if not self.validation_resources.merged_data_model.views:
|
|
33
|
+
return errors
|
|
34
|
+
|
|
35
|
+
for view_ref in self.validation_resources.merged_data_model.views:
|
|
36
|
+
view = self.validation_resources.select_view(view_ref)
|
|
37
|
+
|
|
38
|
+
if not view:
|
|
39
|
+
raise RuntimeError(
|
|
40
|
+
f"{type(self).__name__}: View {view_ref!s} not found in local resources. This is a bug in NEAT."
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
if view.properties is None:
|
|
44
|
+
continue
|
|
45
|
+
|
|
46
|
+
for property_ref, property_ in view.properties.items():
|
|
47
|
+
if not isinstance(property_, ViewCorePropertyRequest):
|
|
48
|
+
continue
|
|
49
|
+
|
|
50
|
+
container_ref = property_.container
|
|
51
|
+
container_property = property_.container_property_identifier
|
|
52
|
+
|
|
53
|
+
container = self.validation_resources.select_container(container_ref, container_property)
|
|
54
|
+
|
|
55
|
+
if not container:
|
|
56
|
+
errors.append(
|
|
57
|
+
ConsistencyError(
|
|
58
|
+
message=(
|
|
59
|
+
f"View {view_ref!s} property {property_ref!s} maps to "
|
|
60
|
+
f"container {container_ref!s} which does not exist."
|
|
61
|
+
),
|
|
62
|
+
fix="Define necessary container",
|
|
63
|
+
code=self.code,
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
elif container_property not in container.properties:
|
|
67
|
+
errors.append(
|
|
68
|
+
ConsistencyError(
|
|
69
|
+
message=(
|
|
70
|
+
f"View {view_ref!s} property {property_ref!s} maps to "
|
|
71
|
+
f"container {container_ref!s} which does not have "
|
|
72
|
+
f"property '{container_property}'."
|
|
73
|
+
),
|
|
74
|
+
fix="Define necessary container property",
|
|
75
|
+
code=self.code,
|
|
76
|
+
)
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
return errors
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class ImplementedViewNotExisting(DataModelValidator):
|
|
83
|
+
"""Validates that implemented (inherited) view exists.
|
|
84
|
+
|
|
85
|
+
## What it does
|
|
86
|
+
Validates that all views which are implemented (inherited) in the data model actually exist either locally
|
|
87
|
+
or in CDF.
|
|
88
|
+
|
|
89
|
+
## Why is this bad?
|
|
90
|
+
If a view being implemented (inherited) does not exist, the data model cannot be deployed to CDF.
|
|
91
|
+
|
|
92
|
+
## Example
|
|
93
|
+
If view WindTurbine implements (inherits) view Asset, but Asset view does not exist in the data model
|
|
94
|
+
or in CDF, the data model cannot be deployed to CDF.
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
code = f"{BASE_CODE}-002"
|
|
98
|
+
issue_type = ConsistencyError
|
|
99
|
+
|
|
100
|
+
def run(self) -> list[ConsistencyError]:
|
|
101
|
+
errors: list[ConsistencyError] = []
|
|
102
|
+
|
|
103
|
+
if not self.validation_resources.merged_data_model.views:
|
|
104
|
+
return errors
|
|
105
|
+
|
|
106
|
+
for view_ref in self.validation_resources.merged_data_model.views:
|
|
107
|
+
view = self.validation_resources.select_view(view_ref)
|
|
108
|
+
|
|
109
|
+
if not view:
|
|
110
|
+
raise RuntimeError(
|
|
111
|
+
f"{type(self).__name__}: View {view_ref!s} not found in local resources. This is a bug in NEAT."
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
if view.implements is None:
|
|
115
|
+
continue
|
|
116
|
+
for implement in view.implements:
|
|
117
|
+
if self.validation_resources.select_view(implement) is None:
|
|
118
|
+
errors.append(
|
|
119
|
+
ConsistencyError(
|
|
120
|
+
message=f"View {view_ref!s} implements {implement!s} which is not defined.",
|
|
121
|
+
fix="Define the missing view or remove it from the implemented views list",
|
|
122
|
+
code=self.code,
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
return errors
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class CyclicImplements(DataModelValidator):
|
|
130
|
+
"""Validates that view implements are not forming a cycle (i.e. cyclic graph of implements)
|
|
131
|
+
|
|
132
|
+
## What it does
|
|
133
|
+
Runs graph analysis of the implements graph finding every cycle within the graph
|
|
134
|
+
|
|
135
|
+
## Why is this bad?
|
|
136
|
+
You will not be able to deploy the data model to CDF, since cyclic implements are impossible to resolve
|
|
137
|
+
in terms of inheritance of properties.
|
|
138
|
+
|
|
139
|
+
## Example
|
|
140
|
+
Say we have following views: A, B, and C, where A implements B, B implements C, and C implements A. This forms
|
|
141
|
+
the cyclic graph of implements A->B->C->A.
|
|
142
|
+
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
code = f"{BASE_CODE}-003"
|
|
146
|
+
issue_type = ConsistencyError
|
|
147
|
+
alpha = True
|
|
148
|
+
|
|
149
|
+
def run(self) -> list[ConsistencyError]:
|
|
150
|
+
errors: list[ConsistencyError] = []
|
|
151
|
+
|
|
152
|
+
for cycle in self.validation_resources.implements_cycles:
|
|
153
|
+
errors.append(
|
|
154
|
+
ConsistencyError(
|
|
155
|
+
message=(
|
|
156
|
+
"Detected cycle of view implements "
|
|
157
|
+
f"{'->'.join([str(view) for view in cycle]) + f'->{cycle[0]}'}"
|
|
158
|
+
),
|
|
159
|
+
fix="Inspect involved views and make necessary fix",
|
|
160
|
+
code=self.code,
|
|
161
|
+
)
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
return errors
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from abc import ABC
|
|
2
|
+
from typing import TYPE_CHECKING
|
|
3
|
+
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from cognite.neat._issues import ModelSyntaxError
|
|
6
|
+
from cognite.neat._utils.http_client import HTTPMessage
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class NeatException(Exception, ABC):
|
|
10
|
+
"""Base class for all exceptions raised by Neat."""
|
|
11
|
+
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class DataModelImportException(NeatException):
|
|
16
|
+
"""Raised when there is an error importing a model."""
|
|
17
|
+
|
|
18
|
+
def __init__(self, errors: "list[ModelSyntaxError]") -> None:
|
|
19
|
+
super().__init__(errors)
|
|
20
|
+
self.errors = errors
|
|
21
|
+
|
|
22
|
+
def __str__(self) -> str:
|
|
23
|
+
return f"Model import failed with {len(self.errors)} errors: " + "; ".join(map(str, self.errors))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class CDFAPIException(NeatException):
|
|
27
|
+
"""Raised when there is an error in an API call."""
|
|
28
|
+
|
|
29
|
+
def __init__(self, messages: "list[HTTPMessage]") -> None:
|
|
30
|
+
self.messages = messages
|
|
31
|
+
|
|
32
|
+
def __str__(self) -> str:
|
|
33
|
+
return f"{type(self).__name__}: " + "; ".join(map(str, self.messages))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class FileReadException(NeatException):
|
|
37
|
+
"""Raised when there is an error reading a file."""
|
|
38
|
+
|
|
39
|
+
def __init__(self, filepath: str, message: str) -> None:
|
|
40
|
+
super().__init__(f"Error reading file {filepath}: {message}")
|
|
41
|
+
self.filepath = filepath
|
|
42
|
+
self.message = message
|
|
43
|
+
|
|
44
|
+
def __str__(self) -> str:
|
|
45
|
+
return f"Error reading file {self.filepath}: {self.message}"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class UserInputError(NeatException):
|
|
49
|
+
"""Raised when there is an error in user input."""
|
|
50
|
+
|
|
51
|
+
def __init__(self, message: str) -> None:
|
|
52
|
+
super().__init__(message)
|
|
53
|
+
self.message = message
|
|
54
|
+
|
|
55
|
+
def __str__(self) -> str:
|
|
56
|
+
return f"User input error: {self.message}"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class NeatImportError(NeatException, ImportError):
|
|
60
|
+
def __init__(self, module: str, neat_extra: str, functionality: str = "functionality") -> None:
|
|
61
|
+
message = (
|
|
62
|
+
f"The {functionality} requires {module}. You can include it in your neat "
|
|
63
|
+
f'installation with `pip install "cognite-neat[{neat_extra}]"`.'
|
|
64
|
+
)
|
|
65
|
+
super().__init__(message)
|
|
66
|
+
|
|
67
|
+
def __str__(self) -> str:
|
|
68
|
+
return self.args[0]
|
cognite/neat/_issues.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from collections import UserList, defaultdict
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Issue(BaseModel):
|
|
7
|
+
"""Base class for all issues"""
|
|
8
|
+
|
|
9
|
+
message: str
|
|
10
|
+
code: str | None = None
|
|
11
|
+
fix: str | None = None
|
|
12
|
+
|
|
13
|
+
@classmethod
|
|
14
|
+
def issue_type(cls) -> str:
|
|
15
|
+
return cls.__name__
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ModelSyntaxError(Issue):
|
|
19
|
+
"""If any syntax error is found. Stop validation
|
|
20
|
+
and ask user to fix the syntax error first."""
|
|
21
|
+
|
|
22
|
+
...
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ImplementationWarning(Issue):
|
|
26
|
+
"""This is only for conceptual data model. It means that conversion to DMS
|
|
27
|
+
will fail unless user implements the missing part."""
|
|
28
|
+
|
|
29
|
+
...
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ConsistencyError(Issue):
|
|
33
|
+
"""If any consistency error is found, the deployment of the data model will fail. For example,
|
|
34
|
+
if a reverse direct relations points to a non-existing direct relation. This is only relevant for
|
|
35
|
+
DMS model.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
...
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class Recommendation(Issue):
|
|
42
|
+
"""Best practice recommendation."""
|
|
43
|
+
|
|
44
|
+
...
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class IssueList(UserList[Issue]):
|
|
48
|
+
"""A list of issues that can be sorted by type and message."""
|
|
49
|
+
|
|
50
|
+
def by_type(self) -> dict[type[Issue], list[Issue]]:
|
|
51
|
+
"""Returns a dictionary of issues sorted by their type."""
|
|
52
|
+
result: dict[type[Issue], list[Issue]] = defaultdict(list)
|
|
53
|
+
for issue in self.data:
|
|
54
|
+
issue_type = type(issue)
|
|
55
|
+
if issue_type not in result:
|
|
56
|
+
result[issue_type] = []
|
|
57
|
+
result[issue_type].append(issue)
|
|
58
|
+
return result
|
|
59
|
+
|
|
60
|
+
def by_code(self) -> dict[str, list[Issue]]:
|
|
61
|
+
"""Returns a dictionary of issues sorted by their code."""
|
|
62
|
+
result: dict[str, list[Issue]] = defaultdict(list)
|
|
63
|
+
for issue in self.data:
|
|
64
|
+
if issue.code is not None:
|
|
65
|
+
result[issue.code].append(issue)
|
|
66
|
+
else:
|
|
67
|
+
result["UNDEFINED"].append(issue)
|
|
68
|
+
return dict(result)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from typing import Any, Literal, TypeAlias
|
|
2
|
+
|
|
3
|
+
from . import static, templates
|
|
4
|
+
|
|
5
|
+
ENCODING = "utf-8"
|
|
6
|
+
|
|
7
|
+
Template: TypeAlias = Literal["issues", "deployment"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def render(template_name: Literal["issues", "deployment"], variables: dict[str, Any]) -> str:
|
|
11
|
+
"""Generate HTML content from a template and variables."""
|
|
12
|
+
|
|
13
|
+
if template_name not in ["issues", "deployment"]:
|
|
14
|
+
raise ValueError(f"Unknown template name: {template_name}")
|
|
15
|
+
|
|
16
|
+
variables["SHARED_CSS"] = static.shared_style.read_text(encoding=ENCODING)
|
|
17
|
+
|
|
18
|
+
if template_name == "issues":
|
|
19
|
+
template = templates.issues.read_text(encoding=ENCODING)
|
|
20
|
+
variables["SCRIPTS"] = static.issues_scripts.read_text(encoding=ENCODING)
|
|
21
|
+
variables["SPECIFIC_CSS"] = static.issues_style.read_text(encoding=ENCODING)
|
|
22
|
+
|
|
23
|
+
elif template_name == "deployment":
|
|
24
|
+
template = templates.deployment.read_text(encoding=ENCODING)
|
|
25
|
+
variables["SCRIPTS"] = static.deployment_scripts.read_text(encoding=ENCODING)
|
|
26
|
+
variables["SPECIFIC_CSS"] = static.deployment_style.read_text(encoding=ENCODING)
|
|
27
|
+
|
|
28
|
+
for key, value in variables.items():
|
|
29
|
+
template = template.replace(f"{{{{{key}}}}}", str(value))
|
|
30
|
+
return template
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
shared_style = Path(__file__).parent / "shared.css"
|
|
4
|
+
issues_style = Path(__file__).parent / "issues.css"
|
|
5
|
+
issues_scripts = Path(__file__).parent / "issues.js"
|
|
6
|
+
|
|
7
|
+
deployment_style = Path(__file__).parent / "deployment.css"
|
|
8
|
+
deployment_scripts = Path(__file__).parent / "deployment.js"
|