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
|
@@ -8,22 +8,22 @@ from pydantic import BaseModel, ConfigDict, ValidationInfo, field_validator
|
|
|
8
8
|
from rdflib import DCTERMS, OWL, RDF, RDFS, XSD, BNode, Graph, Literal, Namespace, URIRef
|
|
9
9
|
from rdflib.collection import Collection as GraphCollection
|
|
10
10
|
|
|
11
|
-
from cognite.neat.core._constants import DEFAULT_NAMESPACE as NEAT_NAMESPACE
|
|
12
|
-
from cognite.neat.core._data_model._constants import EntityTypes
|
|
13
|
-
from cognite.neat.core._data_model.analysis import DataModelAnalysis
|
|
14
|
-
from cognite.neat.core._data_model.models.conceptual import (
|
|
11
|
+
from cognite.neat._v0.core._constants import DEFAULT_NAMESPACE as NEAT_NAMESPACE
|
|
12
|
+
from cognite.neat._v0.core._data_model._constants import EntityTypes
|
|
13
|
+
from cognite.neat._v0.core._data_model.analysis import DataModelAnalysis
|
|
14
|
+
from cognite.neat._v0.core._data_model.models.conceptual import (
|
|
15
15
|
Concept,
|
|
16
16
|
ConceptualDataModel,
|
|
17
17
|
ConceptualMetadata,
|
|
18
18
|
ConceptualProperty,
|
|
19
19
|
)
|
|
20
|
-
from cognite.neat.core._data_model.models.data_types import DataType
|
|
21
|
-
from cognite.neat.core._data_model.models.entities import ConceptEntity
|
|
22
|
-
from cognite.neat.core._issues.errors import (
|
|
20
|
+
from cognite.neat._v0.core._data_model.models.data_types import DataType
|
|
21
|
+
from cognite.neat._v0.core._data_model.models.entities import ConceptEntity
|
|
22
|
+
from cognite.neat._v0.core._issues.errors import (
|
|
23
23
|
PropertyDefinitionDuplicatedError,
|
|
24
24
|
)
|
|
25
|
-
from cognite.neat.core._issues.warnings import PropertyDefinitionDuplicatedWarning
|
|
26
|
-
from cognite.neat.core._utils.rdf_ import remove_namespace_from_uri
|
|
25
|
+
from cognite.neat._v0.core._issues.warnings import PropertyDefinitionDuplicatedWarning
|
|
26
|
+
from cognite.neat._v0.core._utils.rdf_ import remove_namespace_from_uri
|
|
27
27
|
|
|
28
28
|
from ._base import BaseExporter
|
|
29
29
|
|
|
@@ -32,6 +32,8 @@ if sys.version_info >= (3, 11):
|
|
|
32
32
|
else:
|
|
33
33
|
from typing_extensions import Self
|
|
34
34
|
|
|
35
|
+
SHACL = Namespace("http://www.w3.org/ns/shacl#")
|
|
36
|
+
|
|
35
37
|
|
|
36
38
|
class GraphExporter(BaseExporter[ConceptualDataModel, Graph], ABC):
|
|
37
39
|
def export_to_file(self, data_model: ConceptualDataModel, filepath: Path) -> None:
|
|
@@ -42,7 +44,7 @@ class OWLExporter(GraphExporter):
|
|
|
42
44
|
"""Exports verified conceptual data model to an OWL ontology."""
|
|
43
45
|
|
|
44
46
|
def export(self, data_model: ConceptualDataModel) -> Graph:
|
|
45
|
-
return Ontology.from_data_model(data_model).
|
|
47
|
+
return Ontology.from_data_model(data_model).graph
|
|
46
48
|
|
|
47
49
|
@property
|
|
48
50
|
def description(self) -> str:
|
|
@@ -53,44 +55,31 @@ class SHACLExporter(GraphExporter):
|
|
|
53
55
|
"""Exports data_model to a SHACL graph."""
|
|
54
56
|
|
|
55
57
|
def export(self, data_model: ConceptualDataModel) -> Graph:
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
@property
|
|
59
|
-
def description(self) -> str:
|
|
60
|
-
return "Export verified information model to SHACL."
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
class SemanticDataModelExporter(GraphExporter):
|
|
64
|
-
"""Exports verified information model to a semantic data model."""
|
|
65
|
-
|
|
66
|
-
def export(self, data_model: ConceptualDataModel) -> Graph:
|
|
67
|
-
return Ontology.from_data_model(data_model).as_semantic_data_model()
|
|
58
|
+
return ShaclShapes.from_data_model(data_model).graph
|
|
68
59
|
|
|
69
60
|
@property
|
|
70
61
|
def description(self) -> str:
|
|
71
|
-
return "Export verified
|
|
62
|
+
return "Export verified conceptual data model to SHACL."
|
|
72
63
|
|
|
73
64
|
|
|
74
|
-
class
|
|
65
|
+
class _ModelConfig(BaseModel):
|
|
75
66
|
model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True, strict=False, extra="allow")
|
|
76
67
|
|
|
77
68
|
|
|
78
|
-
class Ontology(
|
|
69
|
+
class Ontology(_ModelConfig):
|
|
79
70
|
"""
|
|
80
71
|
Represents an ontology. This class is used to generate an OWL ontology from conceptual data model.
|
|
81
72
|
|
|
82
73
|
Args:
|
|
83
74
|
properties: A list of OWL properties.
|
|
84
75
|
classes: A list of OWL classes.
|
|
85
|
-
shapes: A list of SHACL node shapes.
|
|
86
76
|
metadata: Metadata about the ontology.
|
|
87
77
|
prefixes: A dictionary of prefixes and namespaces.
|
|
88
78
|
"""
|
|
89
79
|
|
|
80
|
+
metadata: "OWLMetadata"
|
|
90
81
|
properties: list["OWLProperty"]
|
|
91
82
|
classes: list["OWLClass"]
|
|
92
|
-
shapes: list["SHACLNodeShape"]
|
|
93
|
-
metadata: "OWLMetadata"
|
|
94
83
|
prefixes: dict[str, Namespace]
|
|
95
84
|
|
|
96
85
|
@classmethod
|
|
@@ -105,7 +94,6 @@ class Ontology(OntologyModel):
|
|
|
105
94
|
An instance of Ontology.
|
|
106
95
|
"""
|
|
107
96
|
analysis = DataModelAnalysis(data_model)
|
|
108
|
-
concept_by_suffix = analysis.concept_by_suffix()
|
|
109
97
|
return cls(
|
|
110
98
|
properties=[
|
|
111
99
|
OWLProperty.from_list_of_properties(definition, data_model.metadata.namespace)
|
|
@@ -115,46 +103,12 @@ class Ontology(OntologyModel):
|
|
|
115
103
|
OWLClass.from_concept(definition, data_model.metadata.namespace, data_model.prefixes)
|
|
116
104
|
for definition in data_model.concepts
|
|
117
105
|
],
|
|
118
|
-
shapes=[
|
|
119
|
-
SHACLNodeShape.from_data_model(
|
|
120
|
-
concept_by_suffix[str(concept.suffix)],
|
|
121
|
-
list(properties.values()),
|
|
122
|
-
data_model.metadata.namespace,
|
|
123
|
-
)
|
|
124
|
-
for concept, properties in analysis.properties_by_id_by_concept().items()
|
|
125
|
-
]
|
|
126
|
-
+ [
|
|
127
|
-
SHACLNodeShape.from_data_model(
|
|
128
|
-
concept,
|
|
129
|
-
[],
|
|
130
|
-
data_model.metadata.namespace,
|
|
131
|
-
)
|
|
132
|
-
for concept in concept_by_suffix.values()
|
|
133
|
-
],
|
|
134
106
|
metadata=OWLMetadata(**data_model.metadata.model_dump()),
|
|
135
107
|
prefixes=data_model.prefixes,
|
|
136
108
|
)
|
|
137
109
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
Generates a SHACL graph from the ontology.
|
|
141
|
-
|
|
142
|
-
Returns:
|
|
143
|
-
A SHACL graph.
|
|
144
|
-
"""
|
|
145
|
-
|
|
146
|
-
shacl = Graph()
|
|
147
|
-
shacl.bind(self.metadata.prefix, self.metadata.namespace)
|
|
148
|
-
for prefix, namespace in self.prefixes.items():
|
|
149
|
-
shacl.bind(prefix, namespace)
|
|
150
|
-
|
|
151
|
-
for shape in self.shapes:
|
|
152
|
-
for triple in shape.triples:
|
|
153
|
-
shacl.add(triple) # type: ignore[arg-type]
|
|
154
|
-
|
|
155
|
-
return shacl
|
|
156
|
-
|
|
157
|
-
def as_owl(self) -> Graph:
|
|
110
|
+
@property
|
|
111
|
+
def graph(self) -> Graph:
|
|
158
112
|
"""
|
|
159
113
|
Generates an OWL graph from the ontology.
|
|
160
114
|
|
|
@@ -180,33 +134,6 @@ class Ontology(OntologyModel):
|
|
|
180
134
|
|
|
181
135
|
return owl
|
|
182
136
|
|
|
183
|
-
def as_semantic_data_model(self) -> Graph:
|
|
184
|
-
return self.as_owl() + self.as_shacl()
|
|
185
|
-
|
|
186
|
-
@property
|
|
187
|
-
def owl_triples(self) -> list[tuple]:
|
|
188
|
-
return list(self.as_owl())
|
|
189
|
-
|
|
190
|
-
@property
|
|
191
|
-
def shacl_triples(self) -> list[tuple]:
|
|
192
|
-
return list(self.as_shacl())
|
|
193
|
-
|
|
194
|
-
@property
|
|
195
|
-
def triples(self) -> list[tuple]:
|
|
196
|
-
return self.owl_triples + self.shacl_triples
|
|
197
|
-
|
|
198
|
-
@property
|
|
199
|
-
def ontology(self) -> str:
|
|
200
|
-
return self.as_owl().serialize()
|
|
201
|
-
|
|
202
|
-
@property
|
|
203
|
-
def constraints(self) -> str:
|
|
204
|
-
return self.as_shacl().serialize()
|
|
205
|
-
|
|
206
|
-
@property
|
|
207
|
-
def semantic_data_model(self) -> str:
|
|
208
|
-
return (self.as_owl() + self.as_shacl()).serialize()
|
|
209
|
-
|
|
210
137
|
|
|
211
138
|
class OWLMetadata(ConceptualMetadata):
|
|
212
139
|
@property
|
|
@@ -233,7 +160,7 @@ class OWLMetadata(ConceptualMetadata):
|
|
|
233
160
|
return triples
|
|
234
161
|
|
|
235
162
|
|
|
236
|
-
class OWLClass(
|
|
163
|
+
class OWLClass(_ModelConfig):
|
|
237
164
|
id_: URIRef
|
|
238
165
|
type_: URIRef = OWL.Class
|
|
239
166
|
label: str | None
|
|
@@ -306,7 +233,7 @@ class OWLClass(OntologyModel):
|
|
|
306
233
|
)
|
|
307
234
|
|
|
308
235
|
|
|
309
|
-
class OWLProperty(
|
|
236
|
+
class OWLProperty(_ModelConfig):
|
|
310
237
|
id_: URIRef
|
|
311
238
|
type_: set[URIRef]
|
|
312
239
|
label: set[str]
|
|
@@ -510,10 +437,78 @@ class OWLProperty(OntologyModel):
|
|
|
510
437
|
)
|
|
511
438
|
|
|
512
439
|
|
|
513
|
-
|
|
440
|
+
class ShaclShapes(_ModelConfig):
|
|
441
|
+
"""
|
|
442
|
+
Represents a SHACL shapes. This class is used to generate a SHACL graph from conceptual data model.
|
|
443
|
+
|
|
444
|
+
Args:
|
|
445
|
+
shapes: A list of SHACL node shapes.
|
|
446
|
+
prefixes: A dictionary of prefixes and namespaces.
|
|
447
|
+
"""
|
|
514
448
|
|
|
449
|
+
shapes: list["SHACLNodeShape"]
|
|
450
|
+
prefixes: dict[str, Namespace]
|
|
515
451
|
|
|
516
|
-
|
|
452
|
+
@classmethod
|
|
453
|
+
def from_data_model(cls, data_model: ConceptualDataModel) -> Self:
|
|
454
|
+
"""
|
|
455
|
+
Generates shacl shapes from a conceptual data model.
|
|
456
|
+
|
|
457
|
+
Args:
|
|
458
|
+
data_model: The data_model to generate the shacl shapes from.
|
|
459
|
+
|
|
460
|
+
Returns:
|
|
461
|
+
An instance of ShaclShapes.
|
|
462
|
+
"""
|
|
463
|
+
analysis = DataModelAnalysis(data_model)
|
|
464
|
+
concepts_by_concept_entity = analysis.concept_by_concept_entity
|
|
465
|
+
properties_by_concept_entity = analysis.properties_by_concepts()
|
|
466
|
+
return cls(
|
|
467
|
+
shapes=[
|
|
468
|
+
# shapes that have property shapes as well
|
|
469
|
+
SHACLNodeShape.from_concept(
|
|
470
|
+
concept_entity,
|
|
471
|
+
concepts_by_concept_entity,
|
|
472
|
+
properties,
|
|
473
|
+
data_model.metadata.namespace,
|
|
474
|
+
)
|
|
475
|
+
for concept_entity, properties in properties_by_concept_entity.items()
|
|
476
|
+
]
|
|
477
|
+
+ [
|
|
478
|
+
# shapes without any property shapes
|
|
479
|
+
SHACLNodeShape.from_concept(
|
|
480
|
+
concept_entity,
|
|
481
|
+
concepts_by_concept_entity,
|
|
482
|
+
[],
|
|
483
|
+
data_model.metadata.namespace,
|
|
484
|
+
)
|
|
485
|
+
for concept_entity in concepts_by_concept_entity.keys()
|
|
486
|
+
if concept_entity not in properties_by_concept_entity
|
|
487
|
+
],
|
|
488
|
+
prefixes=data_model.prefixes,
|
|
489
|
+
)
|
|
490
|
+
|
|
491
|
+
@property
|
|
492
|
+
def graph(self) -> Graph:
|
|
493
|
+
"""
|
|
494
|
+
Generates a SHACL graph from the class instance.
|
|
495
|
+
|
|
496
|
+
Returns:
|
|
497
|
+
A SHACL graph.
|
|
498
|
+
"""
|
|
499
|
+
|
|
500
|
+
shacl = Graph()
|
|
501
|
+
for prefix, namespace in self.prefixes.items():
|
|
502
|
+
shacl.bind(prefix, namespace)
|
|
503
|
+
|
|
504
|
+
for shape in self.shapes:
|
|
505
|
+
for triple in shape.triples:
|
|
506
|
+
shacl.add(triple) # type: ignore[arg-type]
|
|
507
|
+
|
|
508
|
+
return shacl
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
class SHACLNodeShape(_ModelConfig):
|
|
517
512
|
id_: URIRef
|
|
518
513
|
type_: URIRef = SHACL.NodeShape
|
|
519
514
|
target_class: URIRef
|
|
@@ -555,26 +550,33 @@ class SHACLNodeShape(OntologyModel):
|
|
|
555
550
|
)
|
|
556
551
|
|
|
557
552
|
@classmethod
|
|
558
|
-
def
|
|
553
|
+
def from_concept(
|
|
559
554
|
cls,
|
|
560
|
-
|
|
561
|
-
|
|
555
|
+
concept_entity: ConceptEntity,
|
|
556
|
+
concepts_by_concept_entity: dict[ConceptEntity, Concept],
|
|
557
|
+
properties: list[ConceptualProperty],
|
|
562
558
|
namespace: Namespace,
|
|
563
559
|
) -> "SHACLNodeShape":
|
|
564
|
-
if
|
|
565
|
-
|
|
560
|
+
if not (concept := concepts_by_concept_entity.get(concept_entity)):
|
|
561
|
+
raise ValueError(f"Concept {concept_entity} not found in data model!")
|
|
562
|
+
|
|
563
|
+
if concept.implements:
|
|
564
|
+
parent = [namespace[str(parent.suffix) + "Shape"] for parent in concept.implements]
|
|
566
565
|
else:
|
|
567
566
|
parent = None
|
|
568
567
|
return cls(
|
|
569
|
-
id_=namespace[f"{
|
|
570
|
-
target_class=namespace[str(
|
|
568
|
+
id_=namespace[f"{concept.concept.suffix!s}Shape"],
|
|
569
|
+
target_class=concept.instance_source or namespace[str(concept.concept.suffix)],
|
|
571
570
|
parent=parent,
|
|
572
|
-
property_shapes=[
|
|
571
|
+
property_shapes=[
|
|
572
|
+
SHACLPropertyShape.from_property(property_, concepts_by_concept_entity, namespace)
|
|
573
|
+
for property_ in properties
|
|
574
|
+
],
|
|
573
575
|
namespace=namespace,
|
|
574
576
|
)
|
|
575
577
|
|
|
576
578
|
|
|
577
|
-
class SHACLPropertyShape(
|
|
579
|
+
class SHACLPropertyShape(_ModelConfig):
|
|
578
580
|
id_: BNode
|
|
579
581
|
type_: URIRef = SHACL.property
|
|
580
582
|
path: URIRef # URIRef to property in OWL
|
|
@@ -614,23 +616,31 @@ class SHACLPropertyShape(OntologyModel):
|
|
|
614
616
|
return self.path_triples + self.node_kind_triples + self.cardinality_triples
|
|
615
617
|
|
|
616
618
|
@classmethod
|
|
617
|
-
def from_property(
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
619
|
+
def from_property(
|
|
620
|
+
cls,
|
|
621
|
+
property_: ConceptualProperty,
|
|
622
|
+
concepts_by_concept_entity: dict[ConceptEntity, Concept],
|
|
623
|
+
namespace: Namespace,
|
|
624
|
+
) -> "SHACLPropertyShape":
|
|
625
|
+
if isinstance(property_.value_type, ConceptEntity):
|
|
626
|
+
concept = concepts_by_concept_entity.get(property_.value_type)
|
|
627
|
+
value_type_uri = concept.instance_source if concept else None
|
|
628
|
+
expected_value_type = value_type_uri or namespace[f"{property_.value_type.suffix}"]
|
|
629
|
+
elif isinstance(property_.value_type, DataType):
|
|
630
|
+
expected_value_type = XSD[property_.value_type.xsd]
|
|
623
631
|
else:
|
|
624
|
-
raise
|
|
632
|
+
raise NotImplementedError(f"Value type {property_.value_type.type_} is not supported yet")
|
|
625
633
|
|
|
626
634
|
return cls(
|
|
627
635
|
id_=BNode(),
|
|
628
|
-
path=
|
|
629
|
-
|
|
636
|
+
path=property_.instance_source[0]
|
|
637
|
+
if property_.instance_source and len(property_.instance_source) == 1
|
|
638
|
+
else namespace[property_.property_],
|
|
639
|
+
node_kind=SHACL.IRI if property_.type_ == EntityTypes.object_property else SHACL.Literal,
|
|
630
640
|
expected_value_type=expected_value_type,
|
|
631
|
-
min_count=
|
|
641
|
+
min_count=property_.min_count,
|
|
632
642
|
max_count=(
|
|
633
|
-
int(
|
|
643
|
+
int(property_.max_count) if property_.max_count and property_.max_count != float("inf") else None
|
|
634
644
|
),
|
|
635
645
|
namespace=namespace,
|
|
636
646
|
)
|
|
@@ -5,15 +5,15 @@ from typing import TYPE_CHECKING, Any, Generic
|
|
|
5
5
|
|
|
6
6
|
from rdflib import URIRef
|
|
7
7
|
|
|
8
|
-
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
9
|
-
from cognite.neat.core._data_model._shared import (
|
|
8
|
+
from cognite.neat._v0.core._constants import DEFAULT_NAMESPACE
|
|
9
|
+
from cognite.neat._v0.core._data_model._shared import (
|
|
10
10
|
ImportedDataModel,
|
|
11
11
|
T_UnverifiedDataModel,
|
|
12
12
|
)
|
|
13
|
-
from cognite.neat.core._utils.auxiliary import class_html_doc
|
|
13
|
+
from cognite.neat._v0.core._utils.auxiliary import class_html_doc
|
|
14
14
|
|
|
15
15
|
if TYPE_CHECKING:
|
|
16
|
-
from cognite.neat.core._store._provenance import Agent as ProvenanceAgent
|
|
16
|
+
from cognite.neat._v0.core._store._provenance import Agent as ProvenanceAgent
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class BaseImporter(ABC, Generic[T_UnverifiedDataModel]):
|
|
@@ -51,7 +51,7 @@ class BaseImporter(ABC, Generic[T_UnverifiedDataModel]):
|
|
|
51
51
|
@property
|
|
52
52
|
def agent(self) -> "ProvenanceAgent":
|
|
53
53
|
"""Provenance agent for the importer."""
|
|
54
|
-
from cognite.neat.core._store._provenance import Agent as ProvenanceAgent
|
|
54
|
+
from cognite.neat._v0.core._store._provenance import Agent as ProvenanceAgent
|
|
55
55
|
|
|
56
56
|
return ProvenanceAgent(id_=DEFAULT_NAMESPACE[f"agent/{type(self).__name__}"])
|
|
57
57
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
from typing import Protocol, TypeVar
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core._issues import NeatIssue
|
|
5
|
-
from cognite.neat.core._issues.errors import (
|
|
4
|
+
from cognite.neat._v0.core._issues import NeatIssue
|
|
5
|
+
from cognite.neat._v0.core._issues.errors import (
|
|
6
6
|
FileNotAFileError,
|
|
7
7
|
FileNotFoundNeatError,
|
|
8
8
|
FileTypeUnexpectedError,
|
|
@@ -3,20 +3,20 @@ from typing import Any, cast
|
|
|
3
3
|
|
|
4
4
|
import yaml
|
|
5
5
|
|
|
6
|
-
from cognite.neat.core._data_model._shared import (
|
|
6
|
+
from cognite.neat._v0.core._data_model._shared import (
|
|
7
7
|
ImportedDataModel,
|
|
8
8
|
T_UnverifiedDataModel,
|
|
9
9
|
)
|
|
10
|
-
from cognite.neat.core._data_model.models import (
|
|
10
|
+
from cognite.neat._v0.core._data_model.models import (
|
|
11
11
|
UNVERIFIED_DATA_MODEL_BY_ROLE,
|
|
12
12
|
RoleTypes,
|
|
13
13
|
)
|
|
14
|
-
from cognite.neat.core._issues import IssueList, MultiValueError, NeatIssue
|
|
15
|
-
from cognite.neat.core._issues.errors import (
|
|
14
|
+
from cognite.neat._v0.core._issues import IssueList, MultiValueError, NeatIssue
|
|
15
|
+
from cognite.neat._v0.core._issues.errors import (
|
|
16
16
|
FileMissingRequiredFieldError,
|
|
17
17
|
FileReadError,
|
|
18
18
|
)
|
|
19
|
-
from cognite.neat.core._issues.warnings import NeatValueWarning
|
|
19
|
+
from cognite.neat._v0.core._issues.warnings import NeatValueWarning
|
|
20
20
|
|
|
21
21
|
from ._base import BaseImporter
|
|
22
22
|
from ._base_file_reader import BaseFileReader
|
|
@@ -28,23 +28,23 @@ from cognite.client.data_classes.data_modeling.views import (
|
|
|
28
28
|
)
|
|
29
29
|
from cognite.client.utils import ms_to_datetime
|
|
30
30
|
|
|
31
|
-
from cognite.neat.core._client import NeatClient
|
|
32
|
-
from cognite.neat.core._constants import (
|
|
31
|
+
from cognite.neat._v0.core._client import NeatClient
|
|
32
|
+
from cognite.neat._v0.core._constants import (
|
|
33
33
|
DMS_DIRECT_RELATION_LIST_DEFAULT_LIMIT,
|
|
34
34
|
DMS_PRIMITIVE_LIST_DEFAULT_LIMIT,
|
|
35
35
|
)
|
|
36
|
-
from cognite.neat.core._data_model._shared import ImportedDataModel
|
|
37
|
-
from cognite.neat.core._data_model.importers._base import BaseImporter
|
|
38
|
-
from cognite.neat.core._data_model.models import (
|
|
36
|
+
from cognite.neat._v0.core._data_model._shared import ImportedDataModel
|
|
37
|
+
from cognite.neat._v0.core._data_model.importers._base import BaseImporter
|
|
38
|
+
from cognite.neat._v0.core._data_model.models import (
|
|
39
39
|
DMSSchema,
|
|
40
40
|
UnverifiedPhysicalDataModel,
|
|
41
41
|
)
|
|
42
|
-
from cognite.neat.core._data_model.models.conceptual import (
|
|
42
|
+
from cognite.neat._v0.core._data_model.models.conceptual import (
|
|
43
43
|
UnverifiedConcept,
|
|
44
44
|
UnverifiedConceptualProperty,
|
|
45
45
|
)
|
|
46
|
-
from cognite.neat.core._data_model.models.data_types import DataType, Enum, String
|
|
47
|
-
from cognite.neat.core._data_model.models.entities import (
|
|
46
|
+
from cognite.neat._v0.core._data_model.models.data_types import DataType, Enum, String
|
|
47
|
+
from cognite.neat._v0.core._data_model.models.entities import (
|
|
48
48
|
ConceptEntity,
|
|
49
49
|
ContainerEntity,
|
|
50
50
|
ContainerIndexEntity,
|
|
@@ -54,7 +54,8 @@ from cognite.neat.core._data_model.models.entities import (
|
|
|
54
54
|
ReverseConnectionEntity,
|
|
55
55
|
ViewEntity,
|
|
56
56
|
)
|
|
57
|
-
from cognite.neat.core._data_model.models.
|
|
57
|
+
from cognite.neat._v0.core._data_model.models.entities._single_value import ContainerConstraintEntity
|
|
58
|
+
from cognite.neat._v0.core._data_model.models.physical import (
|
|
58
59
|
UnverifiedPhysicalContainer,
|
|
59
60
|
UnverifiedPhysicalEnum,
|
|
60
61
|
UnverifiedPhysicalMetadata,
|
|
@@ -62,13 +63,13 @@ from cognite.neat.core._data_model.models.physical import (
|
|
|
62
63
|
UnverifiedPhysicalProperty,
|
|
63
64
|
UnverifiedPhysicalView,
|
|
64
65
|
)
|
|
65
|
-
from cognite.neat.core._issues import (
|
|
66
|
+
from cognite.neat._v0.core._issues import (
|
|
66
67
|
IssueList,
|
|
67
68
|
MultiValueError,
|
|
68
69
|
NeatIssue,
|
|
69
70
|
catch_issues,
|
|
70
71
|
)
|
|
71
|
-
from cognite.neat.core._issues.errors import (
|
|
72
|
+
from cognite.neat._v0.core._issues.errors import (
|
|
72
73
|
FileNotFoundNeatError,
|
|
73
74
|
FileTypeUnexpectedError,
|
|
74
75
|
NeatValueError,
|
|
@@ -76,7 +77,7 @@ from cognite.neat.core._issues.errors import (
|
|
|
76
77
|
ResourceMissingIdentifierError,
|
|
77
78
|
ResourceRetrievalError,
|
|
78
79
|
)
|
|
79
|
-
from cognite.neat.core._issues.warnings import (
|
|
80
|
+
from cognite.neat._v0.core._issues.warnings import (
|
|
80
81
|
MissingCogniteClientWarning,
|
|
81
82
|
NeatValueWarning,
|
|
82
83
|
PropertyNotFoundWarning,
|
|
@@ -446,6 +447,8 @@ class DMSImporter(BaseImporter[UnverifiedPhysicalDataModel]):
|
|
|
446
447
|
return ViewEntity.from_id(prop.source)
|
|
447
448
|
elif isinstance(prop_type, PropertyTypeWithUnit) and prop_type.unit:
|
|
448
449
|
return DataType.load(f"{prop_type._type}(unit={prop_type.unit.external_id})")
|
|
450
|
+
elif isinstance(prop_type, dm.Text) and prop_type.max_text_size is not None:
|
|
451
|
+
return DataType.load(f"{prop_type._type}(maxTextSize={prop_type.max_text_size})")
|
|
449
452
|
elif isinstance(prop_type, DMSEnum):
|
|
450
453
|
if enum_collection_by_container_property is None:
|
|
451
454
|
return String()
|
|
@@ -569,17 +572,17 @@ class DMSImporter(BaseImporter[UnverifiedPhysicalDataModel]):
|
|
|
569
572
|
index.append(ContainerIndexEntity(prefix="inverted", suffix=index_name, order=order))
|
|
570
573
|
return index or None
|
|
571
574
|
|
|
572
|
-
def _get_constraint(self, prop: ViewPropertyApply, prop_id: str) -> list[
|
|
575
|
+
def _get_constraint(self, prop: ViewPropertyApply, prop_id: str) -> list[ContainerConstraintEntity] | None:
|
|
573
576
|
if not isinstance(prop, dm.MappedPropertyApply):
|
|
574
577
|
return None
|
|
575
578
|
container = self._all_containers_by_id[prop.container]
|
|
576
|
-
unique_constraints: list[
|
|
579
|
+
unique_constraints: list[ContainerConstraintEntity] = []
|
|
577
580
|
for constraint_name, constraint_obj in (container.constraints or {}).items():
|
|
578
581
|
if isinstance(constraint_obj, dm.RequiresConstraint):
|
|
579
582
|
# This is handled in the .from_container method of DMSContainer
|
|
580
583
|
continue
|
|
581
584
|
elif isinstance(constraint_obj, dm.UniquenessConstraint) and prop_id in constraint_obj.properties:
|
|
582
|
-
unique_constraints.append(constraint_name)
|
|
585
|
+
unique_constraints.append(ContainerConstraintEntity(prefix="uniqueness", suffix=constraint_name))
|
|
583
586
|
elif isinstance(constraint_obj, dm.UniquenessConstraint):
|
|
584
587
|
# This does not apply to this property
|
|
585
588
|
continue
|
|
@@ -12,22 +12,22 @@ from rdflib import RDF, RDFS, Namespace, URIRef
|
|
|
12
12
|
from rdflib import Literal as RdfLiteral
|
|
13
13
|
from rdflib.query import ResultRow
|
|
14
14
|
|
|
15
|
-
from cognite.neat.core._config import GLOBAL_CONFIG
|
|
16
|
-
from cognite.neat.core._constants import NEAT
|
|
17
|
-
from cognite.neat.core._data_model._shared import ImportedDataModel
|
|
18
|
-
from cognite.neat.core._data_model.models import UnverifiedConceptualDataModel
|
|
19
|
-
from cognite.neat.core._data_model.models._import_contexts import GraphContext
|
|
20
|
-
from cognite.neat.core._data_model.models.conceptual import (
|
|
15
|
+
from cognite.neat._v0.core._config import GLOBAL_CONFIG
|
|
16
|
+
from cognite.neat._v0.core._constants import NEAT
|
|
17
|
+
from cognite.neat._v0.core._data_model._shared import ImportedDataModel
|
|
18
|
+
from cognite.neat._v0.core._data_model.models import UnverifiedConceptualDataModel
|
|
19
|
+
from cognite.neat._v0.core._data_model.models._import_contexts import GraphContext
|
|
20
|
+
from cognite.neat._v0.core._data_model.models.conceptual import (
|
|
21
21
|
UnverifiedConcept,
|
|
22
22
|
UnverifiedConceptualMetadata,
|
|
23
23
|
UnverifiedConceptualProperty,
|
|
24
24
|
)
|
|
25
|
-
from cognite.neat.core._data_model.models.entities import UnknownEntity
|
|
26
|
-
from cognite.neat.core._issues.errors import NeatValueError
|
|
27
|
-
from cognite.neat.core._issues.warnings import NeatValueWarning
|
|
28
|
-
from cognite.neat.core._store import NeatInstanceStore
|
|
29
|
-
from cognite.neat.core._utils.collection_ import iterate_progress_bar
|
|
30
|
-
from cognite.neat.core._utils.rdf_ import split_uri
|
|
25
|
+
from cognite.neat._v0.core._data_model.models.entities import UnknownEntity
|
|
26
|
+
from cognite.neat._v0.core._issues.errors import NeatValueError
|
|
27
|
+
from cognite.neat._v0.core._issues.warnings import NeatValueWarning
|
|
28
|
+
from cognite.neat._v0.core._store import NeatInstanceStore
|
|
29
|
+
from cognite.neat._v0.core._utils.collection_ import iterate_progress_bar
|
|
30
|
+
from cognite.neat._v0.core._utils.rdf_ import split_uri
|
|
31
31
|
|
|
32
32
|
from ._base import BaseImporter
|
|
33
33
|
|
|
@@ -6,20 +6,20 @@ from cognite.client import data_modeling as dm
|
|
|
6
6
|
from rdflib import Graph, Namespace, URIRef
|
|
7
7
|
from typing_extensions import Self
|
|
8
8
|
|
|
9
|
-
from cognite.neat.core._constants import get_default_prefixes_and_namespaces
|
|
10
|
-
from cognite.neat.core._data_model._shared import ImportedDataModel
|
|
11
|
-
from cognite.neat.core._data_model.importers._base import BaseImporter
|
|
12
|
-
from cognite.neat.core._data_model.models._base_verified import RoleTypes
|
|
13
|
-
from cognite.neat.core._data_model.models.conceptual import (
|
|
9
|
+
from cognite.neat._v0.core._constants import get_default_prefixes_and_namespaces
|
|
10
|
+
from cognite.neat._v0.core._data_model._shared import ImportedDataModel
|
|
11
|
+
from cognite.neat._v0.core._data_model.importers._base import BaseImporter
|
|
12
|
+
from cognite.neat._v0.core._data_model.models._base_verified import RoleTypes
|
|
13
|
+
from cognite.neat._v0.core._data_model.models.conceptual import (
|
|
14
14
|
UnverifiedConceptualDataModel,
|
|
15
15
|
)
|
|
16
|
-
from cognite.neat.core._data_model.models.data_types import AnyURI
|
|
17
|
-
from cognite.neat.core._data_model.models.entities import UnknownEntity
|
|
18
|
-
from cognite.neat.core._issues import IssueList, MultiValueError
|
|
19
|
-
from cognite.neat.core._issues.errors import FileReadError
|
|
20
|
-
from cognite.neat.core._issues.errors._general import NeatValueError
|
|
21
|
-
from cognite.neat.core._store import NeatInstanceStore
|
|
22
|
-
from cognite.neat.core._utils.rdf_ import get_namespace
|
|
16
|
+
from cognite.neat._v0.core._data_model.models.data_types import AnyURI
|
|
17
|
+
from cognite.neat._v0.core._data_model.models.entities import UnknownEntity
|
|
18
|
+
from cognite.neat._v0.core._issues import IssueList, MultiValueError
|
|
19
|
+
from cognite.neat._v0.core._issues.errors import FileReadError
|
|
20
|
+
from cognite.neat._v0.core._issues.errors._general import NeatValueError
|
|
21
|
+
from cognite.neat._v0.core._store import NeatInstanceStore
|
|
22
|
+
from cognite.neat._v0.core._utils.rdf_ import get_namespace
|
|
23
23
|
|
|
24
24
|
DEFAULT_NON_EXISTING_NODE_TYPE = AnyURI()
|
|
25
25
|
|
|
@@ -10,25 +10,25 @@ from cognite.client import data_modeling as dm
|
|
|
10
10
|
from rdflib import RDF, RDFS, Graph, Namespace, URIRef
|
|
11
11
|
from rdflib import Literal as RdfLiteral
|
|
12
12
|
|
|
13
|
-
from cognite.neat.core._config import GLOBAL_CONFIG
|
|
14
|
-
from cognite.neat.core._constants import NEAT, get_default_prefixes_and_namespaces
|
|
15
|
-
from cognite.neat.core._data_model.analysis import DataModelAnalysis
|
|
16
|
-
from cognite.neat.core._data_model.models import ConceptualDataModel, data_types
|
|
17
|
-
from cognite.neat.core._data_model.models.conceptual import (
|
|
13
|
+
from cognite.neat._v0.core._config import GLOBAL_CONFIG
|
|
14
|
+
from cognite.neat._v0.core._constants import NEAT, get_default_prefixes_and_namespaces
|
|
15
|
+
from cognite.neat._v0.core._data_model.analysis import DataModelAnalysis
|
|
16
|
+
from cognite.neat._v0.core._data_model.models import ConceptualDataModel, data_types
|
|
17
|
+
from cognite.neat._v0.core._data_model.models.conceptual import (
|
|
18
18
|
Concept,
|
|
19
19
|
ConceptualMetadata,
|
|
20
20
|
UnverifiedConcept,
|
|
21
21
|
UnverifiedConceptualProperty,
|
|
22
22
|
)
|
|
23
|
-
from cognite.neat.core._data_model.models.data_types import AnyURI
|
|
24
|
-
from cognite.neat.core._data_model.models.entities._single_value import UnknownEntity
|
|
25
|
-
from cognite.neat.core._issues import IssueList
|
|
26
|
-
from cognite.neat.core._issues.warnings import PropertyValueTypeUndefinedWarning
|
|
27
|
-
from cognite.neat.core._store import NeatInstanceStore
|
|
28
|
-
from cognite.neat.core._store._provenance import INSTANCES_ENTITY
|
|
29
|
-
from cognite.neat.core._utils.collection_ import iterate_progress_bar
|
|
30
|
-
from cognite.neat.core._utils.rdf_ import remove_namespace_from_uri, uri_to_short_form
|
|
31
|
-
from cognite.neat.core._utils.text import NamingStandardization
|
|
23
|
+
from cognite.neat._v0.core._data_model.models.data_types import AnyURI
|
|
24
|
+
from cognite.neat._v0.core._data_model.models.entities._single_value import UnknownEntity
|
|
25
|
+
from cognite.neat._v0.core._issues import IssueList
|
|
26
|
+
from cognite.neat._v0.core._issues.warnings import PropertyValueTypeUndefinedWarning
|
|
27
|
+
from cognite.neat._v0.core._store import NeatInstanceStore
|
|
28
|
+
from cognite.neat._v0.core._store._provenance import INSTANCES_ENTITY
|
|
29
|
+
from cognite.neat._v0.core._utils.collection_ import iterate_progress_bar
|
|
30
|
+
from cognite.neat._v0.core._utils.rdf_ import remove_namespace_from_uri, uri_to_short_form
|
|
31
|
+
from cognite.neat._v0.core._utils.text import NamingStandardization
|
|
32
32
|
|
|
33
33
|
from ._base import DEFAULT_NON_EXISTING_NODE_TYPE, BaseRDFImporter
|
|
34
34
|
|