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
|
@@ -13,20 +13,20 @@ from cognite.client.data_classes.data_modeling.views import (
|
|
|
13
13
|
ViewPropertyApply,
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
-
from cognite.neat.core._client.data_classes.data_modeling import (
|
|
16
|
+
from cognite.neat._v0.core._client.data_classes.data_modeling import (
|
|
17
17
|
ContainerApplyDict,
|
|
18
18
|
NodeApplyDict,
|
|
19
19
|
SpaceApplyDict,
|
|
20
20
|
ViewApplyDict,
|
|
21
21
|
)
|
|
22
|
-
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
23
|
-
from cognite.neat.core._constants import (
|
|
22
|
+
from cognite.neat._v0.core._client.data_classes.schema import DMSSchema
|
|
23
|
+
from cognite.neat._v0.core._constants import (
|
|
24
24
|
COGNITE_SPACES,
|
|
25
25
|
DMS_DIRECT_RELATION_LIST_DEFAULT_LIMIT,
|
|
26
26
|
DMS_PRIMITIVE_LIST_DEFAULT_LIMIT,
|
|
27
27
|
)
|
|
28
|
-
from cognite.neat.core._data_model.models.data_types import DataType, Double, Enum, Float
|
|
29
|
-
from cognite.neat.core._data_model.models.entities import (
|
|
28
|
+
from cognite.neat._v0.core._data_model.models.data_types import DataType, Double, Enum, Float, LangString, String
|
|
29
|
+
from cognite.neat._v0.core._data_model.models.entities import (
|
|
30
30
|
ConceptEntity,
|
|
31
31
|
ContainerEntity,
|
|
32
32
|
ContainerIndexEntity,
|
|
@@ -41,16 +41,16 @@ from cognite.neat.core._data_model.models.entities import (
|
|
|
41
41
|
UnitEntity,
|
|
42
42
|
ViewEntity,
|
|
43
43
|
)
|
|
44
|
-
from cognite.neat.core._issues.errors import (
|
|
44
|
+
from cognite.neat._v0.core._issues.errors import (
|
|
45
45
|
NeatTypeError,
|
|
46
46
|
NeatValueError,
|
|
47
47
|
ResourceNotFoundError,
|
|
48
48
|
)
|
|
49
|
-
from cognite.neat.core._issues.warnings import (
|
|
49
|
+
from cognite.neat._v0.core._issues.warnings import (
|
|
50
50
|
NotSupportedWarning,
|
|
51
51
|
PropertyNotFoundWarning,
|
|
52
52
|
)
|
|
53
|
-
from cognite.neat.core._issues.warnings.user_modeling import (
|
|
53
|
+
from cognite.neat._v0.core._issues.warnings.user_modeling import (
|
|
54
54
|
EmptyContainerWarning,
|
|
55
55
|
HasDataFilterOnNoPropertiesViewWarning,
|
|
56
56
|
)
|
|
@@ -243,17 +243,21 @@ class _DMSExporter:
|
|
|
243
243
|
connection = cast(EdgeEntity, prop.connection)
|
|
244
244
|
|
|
245
245
|
if connection.direction == "inwards" and isinstance(prop.value_type, ViewEntity):
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
# Warning in validation, should not have an inwards connection without an outwards connection
|
|
249
|
-
edge_type = cls._default_edge_type_from_view_id(prop.view.as_id(), prop_id)
|
|
250
|
-
elif len(edge_type_candidates) == 1:
|
|
251
|
-
edge_type = edge_type_candidates[0]
|
|
246
|
+
if connection.edge_type is not None:
|
|
247
|
+
edge_type = connection.edge_type.as_reference()
|
|
252
248
|
else:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
249
|
+
edge_type_candidates = outwards_type_by_view_value_type.get((prop.view, prop.value_type), [])
|
|
250
|
+
if len(edge_type_candidates) == 0:
|
|
251
|
+
# Warning in validation, should not have an inwards connection without an outwards connection
|
|
252
|
+
edge_type = cls._default_edge_type_from_view_id(prop.view.as_id(), prop_id)
|
|
253
|
+
elif len(edge_type_candidates) == 1:
|
|
254
|
+
edge_type = edge_type_candidates[0]
|
|
255
|
+
else:
|
|
256
|
+
raise NeatValueError(
|
|
257
|
+
f"Cannot infer edge type for {view_id}.{prop_id}, multiple candidates: "
|
|
258
|
+
f"{edge_type_candidates}. "
|
|
259
|
+
"Please specify edge type explicitly, i.e., edge(type=<YOUR_TYPE>)."
|
|
260
|
+
)
|
|
257
261
|
view_property_id = (prop.view, prop.view_property)
|
|
258
262
|
edge_types_by_view_property_id[view_property_id] = edge_type
|
|
259
263
|
|
|
@@ -347,6 +351,8 @@ class _DMSExporter:
|
|
|
347
351
|
args["max_list_size"] = prop.max_count
|
|
348
352
|
if isinstance(prop.value_type, Double | Float) and isinstance(prop.value_type.unit, UnitEntity):
|
|
349
353
|
args["unit"] = prop.value_type.unit.as_reference()
|
|
354
|
+
if isinstance(prop.value_type, String | LangString) and prop.value_type.max_text_size is not None:
|
|
355
|
+
args["max_text_size"] = prop.value_type.max_text_size
|
|
350
356
|
if isinstance(prop.value_type, Enum):
|
|
351
357
|
if prop.value_type.collection not in enum_values_by_collection:
|
|
352
358
|
raise ResourceNotFoundError(
|
|
@@ -377,7 +383,8 @@ class _DMSExporter:
|
|
|
377
383
|
for prop in container_properties:
|
|
378
384
|
if prop.container_property is not None:
|
|
379
385
|
for constraint in prop.constraint or []:
|
|
380
|
-
uniqueness_properties[constraint].add(prop.container_property)
|
|
386
|
+
uniqueness_properties[cast(str, constraint.suffix)].add(prop.container_property)
|
|
387
|
+
|
|
381
388
|
for constraint_name, properties in uniqueness_properties.items():
|
|
382
389
|
container.constraints = container.constraints or {}
|
|
383
390
|
container.constraints[constraint_name] = dm.UniquenessConstraint(properties=list(properties))
|
|
@@ -3,24 +3,25 @@ import sys
|
|
|
3
3
|
import warnings
|
|
4
4
|
from dataclasses import dataclass
|
|
5
5
|
from datetime import datetime
|
|
6
|
-
from typing import Any, Literal
|
|
6
|
+
from typing import Any, Literal, overload
|
|
7
7
|
|
|
8
8
|
import pandas as pd
|
|
9
9
|
from cognite.client import data_modeling as dm
|
|
10
10
|
from cognite.client.data_classes.data_modeling import ContainerId, ViewId
|
|
11
11
|
from rdflib import Namespace, URIRef
|
|
12
12
|
|
|
13
|
-
from cognite.neat.core._constants import (
|
|
13
|
+
from cognite.neat._v0.core._constants import (
|
|
14
14
|
DEFAULT_NAMESPACE,
|
|
15
15
|
DMS_DIRECT_RELATION_LIST_DEFAULT_LIMIT,
|
|
16
16
|
)
|
|
17
|
-
from cognite.neat.core._data_model._constants import SPLIT_ON_COMMA_PATTERN
|
|
18
|
-
from cognite.neat.core._data_model.models._base_unverified import (
|
|
17
|
+
from cognite.neat._v0.core._data_model._constants import SPLIT_ON_COMMA_PATTERN
|
|
18
|
+
from cognite.neat._v0.core._data_model.models._base_unverified import (
|
|
19
19
|
UnverifiedComponent,
|
|
20
20
|
UnverifiedDataModel,
|
|
21
21
|
)
|
|
22
|
-
from cognite.neat.core._data_model.models.data_types import DataType
|
|
23
|
-
from cognite.neat.core._data_model.models.entities import (
|
|
22
|
+
from cognite.neat._v0.core._data_model.models.data_types import DataType
|
|
23
|
+
from cognite.neat._v0.core._data_model.models.entities import (
|
|
24
|
+
ContainerConstraintEntity,
|
|
24
25
|
ContainerEntity,
|
|
25
26
|
ContainerIndexEntity,
|
|
26
27
|
DMSNodeEntity,
|
|
@@ -31,9 +32,9 @@ from cognite.neat.core._data_model.models.entities import (
|
|
|
31
32
|
load_connection,
|
|
32
33
|
load_dms_value_type,
|
|
33
34
|
)
|
|
34
|
-
from cognite.neat.core._data_model.models.entities._wrapped import DMSFilter
|
|
35
|
-
from cognite.neat.core._issues.warnings import DeprecatedWarning
|
|
36
|
-
from cognite.neat.core._utils.rdf_ import uri_display_name
|
|
35
|
+
from cognite.neat._v0.core._data_model.models.entities._wrapped import DMSFilter
|
|
36
|
+
from cognite.neat._v0.core._issues.warnings import DeprecatedWarning
|
|
37
|
+
from cognite.neat._v0.core._utils.rdf_ import uri_display_name
|
|
37
38
|
|
|
38
39
|
from ._verified import (
|
|
39
40
|
_DEFAULT_VERSION,
|
|
@@ -138,7 +139,7 @@ class UnverifiedPhysicalProperty(UnverifiedComponent[PhysicalProperty]):
|
|
|
138
139
|
container: str | None = None
|
|
139
140
|
container_property: str | None = None
|
|
140
141
|
index: str | list[str | ContainerIndexEntity] | ContainerIndexEntity | None = None
|
|
141
|
-
constraint: str | list[str] | None = None
|
|
142
|
+
constraint: str | list[str] | list[ContainerConstraintEntity] | ContainerConstraintEntity | None = None
|
|
142
143
|
neatId: str | URIRef | None = None
|
|
143
144
|
conceptual: str | URIRef | None = None
|
|
144
145
|
|
|
@@ -161,19 +162,23 @@ class UnverifiedPhysicalProperty(UnverifiedComponent[PhysicalProperty]):
|
|
|
161
162
|
|
|
162
163
|
def dump(self, default_space: str, default_version: str) -> dict[str, Any]: # type: ignore[override]
|
|
163
164
|
output = super().dump()
|
|
164
|
-
output["View"] = ViewEntity.load(
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
output["View"] = ViewEntity.load(
|
|
166
|
+
self.view, space=default_space, version=default_version, return_on_failure=True
|
|
167
|
+
)
|
|
168
|
+
output["Value Type"] = load_dms_value_type(
|
|
169
|
+
self.value_type, default_space, default_version, return_on_failure=True
|
|
170
|
+
)
|
|
171
|
+
output["Connection"] = load_connection(self.connection, default_space, default_version, return_on_failure=True)
|
|
167
172
|
output["Container"] = (
|
|
168
|
-
ContainerEntity.load(self.container, space=default_space, version=default_version)
|
|
173
|
+
ContainerEntity.load(self.container, space=default_space, version=default_version, return_on_failure=True)
|
|
169
174
|
if self.container
|
|
170
175
|
else None
|
|
171
176
|
)
|
|
172
177
|
if isinstance(self.index, ContainerIndexEntity) or (isinstance(self.index, str) and "," not in self.index):
|
|
173
|
-
output["Index"] = [ContainerIndexEntity.load(self.index)]
|
|
178
|
+
output["Index"] = [ContainerIndexEntity.load(self.index, return_on_failure=True)]
|
|
174
179
|
elif isinstance(self.index, str):
|
|
175
180
|
output["Index"] = [
|
|
176
|
-
ContainerIndexEntity.load(index.strip())
|
|
181
|
+
ContainerIndexEntity.load(index.strip(), return_on_failure=True)
|
|
177
182
|
for index in SPLIT_ON_COMMA_PATTERN.split(self.index)
|
|
178
183
|
if index.strip()
|
|
179
184
|
]
|
|
@@ -185,16 +190,16 @@ class UnverifiedPhysicalProperty(UnverifiedComponent[PhysicalProperty]):
|
|
|
185
190
|
elif isinstance(index, str):
|
|
186
191
|
index_list.extend(
|
|
187
192
|
[
|
|
188
|
-
ContainerIndexEntity.load(idx.strip())
|
|
193
|
+
ContainerIndexEntity.load(idx.strip(), return_on_failure=True)
|
|
189
194
|
for idx in SPLIT_ON_COMMA_PATTERN.split(index)
|
|
190
195
|
if idx.strip()
|
|
191
196
|
]
|
|
192
197
|
)
|
|
193
|
-
elif isinstance(index, str):
|
|
194
|
-
index_list.append(ContainerIndexEntity.load(index.strip()))
|
|
195
198
|
else:
|
|
196
199
|
raise TypeError(f"Unexpected type for index: {type(index)}")
|
|
197
200
|
output["Index"] = index_list
|
|
201
|
+
|
|
202
|
+
output["Constraint"] = _parse_constraints(self.constraint, default_space)
|
|
198
203
|
return output
|
|
199
204
|
|
|
200
205
|
def referenced_view(self, default_space: str, default_version: str) -> ViewEntity:
|
|
@@ -247,7 +252,7 @@ class UnverifiedPhysicalContainer(UnverifiedComponent[PhysicalContainer]):
|
|
|
247
252
|
container: str
|
|
248
253
|
name: str | None = None
|
|
249
254
|
description: str | None = None
|
|
250
|
-
constraint: str | None = None
|
|
255
|
+
constraint: str | list[str] | list[ContainerConstraintEntity] | ContainerConstraintEntity | None = None
|
|
251
256
|
neatId: str | URIRef | None = None
|
|
252
257
|
used_for: Literal["node", "edge", "all"] | None = None
|
|
253
258
|
|
|
@@ -257,23 +262,33 @@ class UnverifiedPhysicalContainer(UnverifiedComponent[PhysicalContainer]):
|
|
|
257
262
|
|
|
258
263
|
def dump(self, default_space: str) -> dict[str, Any]: # type: ignore[override]
|
|
259
264
|
output = super().dump()
|
|
260
|
-
output["Container"] = self.as_entity_id(default_space)
|
|
261
|
-
output["Constraint"] = (
|
|
262
|
-
[ContainerEntity.load(constraint.strip(), space=default_space) for constraint in self.constraint.split(",")]
|
|
263
|
-
if self.constraint
|
|
264
|
-
else None
|
|
265
|
-
)
|
|
265
|
+
output["Container"] = self.as_entity_id(default_space, return_on_failure=True)
|
|
266
|
+
output["Constraint"] = _parse_constraints(self.constraint, default_space)
|
|
266
267
|
return output
|
|
267
268
|
|
|
268
|
-
|
|
269
|
-
|
|
269
|
+
@overload
|
|
270
|
+
def as_entity_id(self, default_space: str, return_on_failure: Literal[False] = False) -> ContainerEntity: ...
|
|
271
|
+
|
|
272
|
+
@overload
|
|
273
|
+
def as_entity_id(self, default_space: str, return_on_failure: Literal[True]) -> ContainerEntity | str: ...
|
|
274
|
+
|
|
275
|
+
def as_entity_id(
|
|
276
|
+
self, default_space: str, return_on_failure: Literal[True, False] = False
|
|
277
|
+
) -> ContainerEntity | str:
|
|
278
|
+
return ContainerEntity.load(
|
|
279
|
+
self.container, strict=True, space=default_space, return_on_failure=return_on_failure
|
|
280
|
+
)
|
|
270
281
|
|
|
271
282
|
@classmethod
|
|
272
283
|
def from_container(cls, container: dm.ContainerApply) -> "UnverifiedPhysicalContainer":
|
|
273
284
|
constraints: list[str] = []
|
|
274
|
-
for
|
|
285
|
+
for constraint_name, constraint_obj in (container.constraints or {}).items():
|
|
275
286
|
if isinstance(constraint_obj, dm.RequiresConstraint):
|
|
276
|
-
|
|
287
|
+
constraint = ContainerConstraintEntity(
|
|
288
|
+
prefix="requires", suffix=constraint_name, require=ContainerEntity.from_id(constraint_obj.require)
|
|
289
|
+
)
|
|
290
|
+
constraints.append(str(constraint))
|
|
291
|
+
|
|
277
292
|
# UniquenessConstraint it handled in the properties
|
|
278
293
|
container_entity = ContainerEntity.from_id(container.as_id())
|
|
279
294
|
return cls(
|
|
@@ -306,19 +321,51 @@ class UnverifiedPhysicalView(UnverifiedComponent[PhysicalView]):
|
|
|
306
321
|
|
|
307
322
|
def dump(self, default_space: str, default_version: str) -> dict[str, Any]: # type: ignore[override]
|
|
308
323
|
output = super().dump()
|
|
309
|
-
output["View"] = self.as_entity_id(default_space, default_version)
|
|
310
|
-
output["Implements"] = self._load_implements(default_space, default_version)
|
|
324
|
+
output["View"] = self.as_entity_id(default_space, default_version, return_on_failure=True)
|
|
325
|
+
output["Implements"] = self._load_implements(default_space, default_version, return_on_failure=True)
|
|
311
326
|
return output
|
|
312
327
|
|
|
313
|
-
|
|
314
|
-
|
|
328
|
+
@overload
|
|
329
|
+
def as_entity_id(
|
|
330
|
+
self, default_space: str, default_version: str, return_on_failure: Literal[False] = False
|
|
331
|
+
) -> ViewEntity: ...
|
|
332
|
+
|
|
333
|
+
@overload
|
|
334
|
+
def as_entity_id(
|
|
335
|
+
self, default_space: str, default_version: str, return_on_failure: Literal[True]
|
|
336
|
+
) -> ViewEntity | str: ...
|
|
337
|
+
|
|
338
|
+
def as_entity_id(
|
|
339
|
+
self, default_space: str, default_version: str, return_on_failure: Literal[True, False] = False
|
|
340
|
+
) -> ViewEntity | str:
|
|
341
|
+
return ViewEntity.load(
|
|
342
|
+
self.view, strict=True, space=default_space, version=default_version, return_on_failure=return_on_failure
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
@overload
|
|
346
|
+
def _load_implements(
|
|
347
|
+
self, default_space: str, default_version: str, return_on_failure: Literal[False] = False
|
|
348
|
+
) -> list[ViewEntity] | None: ...
|
|
315
349
|
|
|
316
|
-
|
|
350
|
+
@overload
|
|
351
|
+
def _load_implements(
|
|
352
|
+
self, default_space: str, default_version: str, return_on_failure: Literal[True]
|
|
353
|
+
) -> list[ViewEntity | str] | None: ...
|
|
354
|
+
|
|
355
|
+
def _load_implements(
|
|
356
|
+
self, default_space: str, default_version: str, return_on_failure: Literal[True, False] = False
|
|
357
|
+
) -> list[ViewEntity] | list[ViewEntity | str] | None:
|
|
317
358
|
self.implements = self.implements.strip() if self.implements else None
|
|
318
359
|
|
|
319
360
|
return (
|
|
320
361
|
[
|
|
321
|
-
ViewEntity.load(
|
|
362
|
+
ViewEntity.load(
|
|
363
|
+
implement,
|
|
364
|
+
strict=True,
|
|
365
|
+
space=default_space,
|
|
366
|
+
version=default_version,
|
|
367
|
+
return_on_failure=return_on_failure,
|
|
368
|
+
)
|
|
322
369
|
for implement in self.implements.split(",")
|
|
323
370
|
]
|
|
324
371
|
if self.implements
|
|
@@ -361,7 +408,7 @@ class UnverifiedPhysicalNodeType(UnverifiedComponent[PhysicalNodeType]):
|
|
|
361
408
|
|
|
362
409
|
def dump(self, default_space: str, **_) -> dict[str, Any]: # type: ignore
|
|
363
410
|
output = super().dump()
|
|
364
|
-
output["Node"] = DMSNodeEntity.load(self.node, space=default_space)
|
|
411
|
+
output["Node"] = DMSNodeEntity.load(self.node, space=default_space, return_on_failure=True)
|
|
365
412
|
return output
|
|
366
413
|
|
|
367
414
|
|
|
@@ -459,3 +506,52 @@ class UnverifiedPhysicalDataModel(UnverifiedDataModel[PhysicalDataModel]):
|
|
|
459
506
|
def imported_views_and_containers_ids(self) -> tuple[set[ViewId], set[ContainerId]]:
|
|
460
507
|
views, containers = self.imported_views_and_containers()
|
|
461
508
|
return {view.as_id() for view in views}, {container.as_id() for container in containers}
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
def _parse_constraints(
|
|
512
|
+
constraint: str | list[str] | list[ContainerConstraintEntity] | ContainerConstraintEntity | None,
|
|
513
|
+
default_space: str | None = None,
|
|
514
|
+
) -> list[ContainerConstraintEntity | PhysicalUnknownEntity] | None:
|
|
515
|
+
"""Parse constraint input into a standardized list of ContainerConstraintEntity objects.
|
|
516
|
+
|
|
517
|
+
Args:
|
|
518
|
+
constraint: The constraint input in various formats
|
|
519
|
+
default_space: Default space to use when loading constraint entities
|
|
520
|
+
|
|
521
|
+
Returns:
|
|
522
|
+
List of parsed constraint entities, or None if no constraints
|
|
523
|
+
"""
|
|
524
|
+
if constraint is None:
|
|
525
|
+
return None
|
|
526
|
+
|
|
527
|
+
if isinstance(constraint, ContainerConstraintEntity):
|
|
528
|
+
return [constraint]
|
|
529
|
+
|
|
530
|
+
if isinstance(constraint, str) and "," not in constraint:
|
|
531
|
+
return [ContainerConstraintEntity.load(constraint, return_on_failure=True, space=default_space)]
|
|
532
|
+
|
|
533
|
+
if isinstance(constraint, str):
|
|
534
|
+
return [
|
|
535
|
+
ContainerConstraintEntity.load(constraint_item.strip(), return_on_failure=True, space=default_space)
|
|
536
|
+
for constraint_item in SPLIT_ON_COMMA_PATTERN.split(constraint)
|
|
537
|
+
if constraint_item.strip()
|
|
538
|
+
]
|
|
539
|
+
|
|
540
|
+
if isinstance(constraint, list):
|
|
541
|
+
constraint_list: list[ContainerConstraintEntity | PhysicalUnknownEntity] = []
|
|
542
|
+
for constraint_item in constraint:
|
|
543
|
+
if isinstance(constraint_item, ContainerConstraintEntity):
|
|
544
|
+
constraint_list.append(constraint_item)
|
|
545
|
+
elif isinstance(constraint_item, str):
|
|
546
|
+
constraint_list.extend(
|
|
547
|
+
[
|
|
548
|
+
ContainerConstraintEntity.load(idx.strip(), return_on_failure=True, space=default_space)
|
|
549
|
+
for idx in SPLIT_ON_COMMA_PATTERN.split(constraint_item)
|
|
550
|
+
if idx.strip()
|
|
551
|
+
]
|
|
552
|
+
)
|
|
553
|
+
else:
|
|
554
|
+
raise TypeError(f"Unexpected type for constraint: {type(constraint_item)}")
|
|
555
|
+
return constraint_list
|
|
556
|
+
|
|
557
|
+
raise TypeError(f"Unexpected type for constraint: {type(constraint)}")
|
|
@@ -3,6 +3,7 @@ from collections import Counter, defaultdict
|
|
|
3
3
|
from collections.abc import Mapping
|
|
4
4
|
from dataclasses import dataclass
|
|
5
5
|
from functools import lru_cache
|
|
6
|
+
from typing import cast
|
|
6
7
|
|
|
7
8
|
from cognite.client import data_modeling as dm
|
|
8
9
|
from cognite.client.data_classes.data_modeling import ContainerList, ViewId, ViewList
|
|
@@ -13,25 +14,25 @@ from cognite.client.data_classes.data_modeling.views import (
|
|
|
13
14
|
ViewPropertyApply,
|
|
14
15
|
)
|
|
15
16
|
|
|
16
|
-
from cognite.neat.core._client import NeatClient
|
|
17
|
-
from cognite.neat.core._client.data_classes.data_modeling import ViewApplyDict
|
|
18
|
-
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
19
|
-
from cognite.neat.core._constants import (
|
|
17
|
+
from cognite.neat._v0.core._client import NeatClient
|
|
18
|
+
from cognite.neat._v0.core._client.data_classes.data_modeling import ViewApplyDict
|
|
19
|
+
from cognite.neat._v0.core._client.data_classes.schema import DMSSchema
|
|
20
|
+
from cognite.neat._v0.core._constants import (
|
|
20
21
|
COGNITE_MODELS,
|
|
21
22
|
COGNITE_SPACES,
|
|
22
23
|
DMS_CONTAINER_PROPERTY_SIZE_LIMIT,
|
|
23
24
|
DMS_VIEW_CONTAINER_SIZE_LIMIT,
|
|
24
25
|
get_base_concepts,
|
|
25
26
|
)
|
|
26
|
-
from cognite.neat.core._data_model.models._import_contexts import ImportContext, SpreadsheetContext
|
|
27
|
-
from cognite.neat.core._data_model.models.data_types import DataType
|
|
28
|
-
from cognite.neat.core._data_model.models.entities import ContainerEntity, RawFilter
|
|
29
|
-
from cognite.neat.core._data_model.models.entities._single_value import (
|
|
27
|
+
from cognite.neat._v0.core._data_model.models._import_contexts import ImportContext, SpreadsheetContext
|
|
28
|
+
from cognite.neat._v0.core._data_model.models.data_types import DataType
|
|
29
|
+
from cognite.neat._v0.core._data_model.models.entities import ContainerEntity, RawFilter
|
|
30
|
+
from cognite.neat._v0.core._data_model.models.entities._single_value import (
|
|
30
31
|
ContainerIndexEntity,
|
|
31
32
|
ViewEntity,
|
|
32
33
|
)
|
|
33
|
-
from cognite.neat.core._issues import IssueList, NeatError
|
|
34
|
-
from cognite.neat.core._issues.errors import (
|
|
34
|
+
from cognite.neat._v0.core._issues import IssueList, NeatError
|
|
35
|
+
from cognite.neat._v0.core._issues.errors import (
|
|
35
36
|
CDFMissingClientError,
|
|
36
37
|
PropertyDefinitionDuplicatedError,
|
|
37
38
|
PropertyInvalidDefinitionError,
|
|
@@ -41,21 +42,21 @@ from cognite.neat.core._issues.errors import (
|
|
|
41
42
|
ResourceNotFoundError,
|
|
42
43
|
ReversedConnectionNotFeasibleError,
|
|
43
44
|
)
|
|
44
|
-
from cognite.neat.core._issues.errors._external import CDFMissingResourcesError
|
|
45
|
-
from cognite.neat.core._issues.warnings import (
|
|
45
|
+
from cognite.neat._v0.core._issues.errors._external import CDFMissingResourcesError
|
|
46
|
+
from cognite.neat._v0.core._issues.warnings import (
|
|
46
47
|
NotSupportedHasDataFilterLimitWarning,
|
|
47
48
|
NotSupportedViewContainerLimitWarning,
|
|
48
49
|
ReversedConnectionNotFeasibleWarning,
|
|
49
50
|
UndefinedViewWarning,
|
|
50
51
|
user_modeling,
|
|
51
52
|
)
|
|
52
|
-
from cognite.neat.core._issues.warnings._models import ViewWithoutPropertiesWarning
|
|
53
|
-
from cognite.neat.core._issues.warnings.user_modeling import (
|
|
53
|
+
from cognite.neat._v0.core._issues.warnings._models import ViewWithoutPropertiesWarning
|
|
54
|
+
from cognite.neat._v0.core._issues.warnings.user_modeling import (
|
|
54
55
|
ContainerPropertyLimitWarning,
|
|
55
56
|
DirectRelationMissingSourceWarning,
|
|
56
57
|
NotNeatSupportedFilterWarning,
|
|
57
58
|
)
|
|
58
|
-
from cognite.neat.core._utils.text import humanize_collection
|
|
59
|
+
from cognite.neat._v0.core._utils.text import humanize_collection
|
|
59
60
|
|
|
60
61
|
from ._verified import PhysicalDataModel, PhysicalProperty
|
|
61
62
|
|
|
@@ -86,7 +87,7 @@ class PhysicalValidation:
|
|
|
86
87
|
context: ImportContext | None = None,
|
|
87
88
|
) -> None:
|
|
88
89
|
# import here to avoid circular import issues
|
|
89
|
-
from cognite.neat.core._data_model.analysis._base import DataModelAnalysis
|
|
90
|
+
from cognite.neat._v0.core._data_model.analysis._base import DataModelAnalysis
|
|
90
91
|
|
|
91
92
|
self._data_model = data_model
|
|
92
93
|
self._client = client
|
|
@@ -121,9 +122,9 @@ class PhysicalValidation:
|
|
|
121
122
|
view_with_properties.add(prop.view)
|
|
122
123
|
|
|
123
124
|
for container in self._containers or []:
|
|
124
|
-
for
|
|
125
|
-
if
|
|
126
|
-
imported_containers.add(
|
|
125
|
+
for constraint in container.constraint or []:
|
|
126
|
+
if constraint.require not in existing_containers:
|
|
127
|
+
imported_containers.add(cast(ContainerEntity, constraint.require))
|
|
127
128
|
|
|
128
129
|
if include_views_with_no_properties:
|
|
129
130
|
extra_views = existing_views - view_with_properties
|
|
@@ -470,8 +471,11 @@ class PhysicalValidation:
|
|
|
470
471
|
)
|
|
471
472
|
)
|
|
472
473
|
constraint_definitions = {
|
|
473
|
-
",".join(
|
|
474
|
+
",".join([str(constraint) for constraint in prop.constraint])
|
|
475
|
+
for _, prop in properties
|
|
476
|
+
if prop.constraint is not None
|
|
474
477
|
}
|
|
478
|
+
|
|
475
479
|
if len(constraint_definitions) > 1:
|
|
476
480
|
errors.append(
|
|
477
481
|
PropertyDefinitionDuplicatedError[dm.ContainerId](
|