cognite-neat 0.123.24__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/_v0/core/_data_model/importers/_rdf/_owl2data_model.py +144 -0
- cognite/neat/{core → _v0/core}/_data_model/importers/_rdf/_shared.py +17 -13
- 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/importers/_rdf/_owl2data_model.py +0 -91
- 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.24.dist-info/METADATA +0 -144
- cognite_neat-0.123.24.dist-info/RECORD +0 -201
- cognite_neat-0.123.24.dist-info/WHEEL +0 -4
- cognite_neat-0.123.24.dist-info/licenses/LICENSE +0 -201
- /cognite/neat/{core → _client/init}/__init__.py +0 -0
- /cognite/neat/{core/_client/_api → _data_model}/__init__.py +0 -0
- /cognite/neat/{core/_client/data_classes → _data_model/deployer}/__init__.py +0 -0
- /cognite/neat/{core/_data_model → _data_model/exporters/_table_exporter}/__init__.py +0 -0
- /cognite/neat/{core/_instances → _data_model/importers/_table_importer}/__init__.py +0 -0
- /cognite/neat/{core/_instances/extractors/_classic_cdf → _data_model/models}/__init__.py +0 -0
- /cognite/neat/{core/_utils → _data_model/models/conceptual}/__init__.py +0 -0
- /cognite/neat/{plugins/data_model → _data_model/validation}/__init__.py +0 -0
- /cognite/neat/{session/_session → _session/_html}/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_client/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_client/data_classes/data_modeling.py +0 -0
- /cognite/neat/{core → _v0/core}/_client/data_classes/neat_sequence.py +0 -0
- /cognite/neat/{core → _v0/core}/_client/data_classes/statistics.py +0 -0
- /cognite/neat/{core → _v0/core}/_config.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/analysis/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/catalog/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/catalog/classic_model.xlsx +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/catalog/conceptual-imf-data-model.xlsx +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/catalog/hello_world_pump.xlsx +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/importers/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/importers/_rdf/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/_base_unverified.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/conceptual/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/entities/_constants.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/entities/_wrapped.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/mapping/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/models/mapping/_classic2core.yaml +0 -0
- /cognite/neat/{core → _v0/core}/_data_model/transformers/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/_shared.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/_tracking/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- /cognite/neat/{core → _v0/core}/_instances/examples/Knowledge-Graph-Nordic44.xml +0 -0
- /cognite/neat/{core → _v0/core}/_instances/examples/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_assets.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_data_sets.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_events.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_files.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_labels.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/extractors/_classic_cdf/_timeseries.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/loaders/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/queries/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/queries/_base.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/queries/_queries.py +0 -0
- /cognite/neat/{core → _v0/core}/_instances/transformers/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_issues/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_issues/formatters.py +0 -0
- /cognite/neat/{core → _v0/core}/_shared.py +0 -0
- /cognite/neat/{core → _v0/core}/_store/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_utils/io_.py +0 -0
- /cognite/neat/{core → _v0/core}/_utils/reader/__init__.py +0 -0
- /cognite/neat/{core → _v0/core}/_utils/tarjan.py +0 -0
- /cognite/neat/{core → _v0/core}/_utils/time_.py +0 -0
- /cognite/neat/{core → _v0/core}/_utils/xml_.py +0 -0
- /cognite/neat/{session → _v0}/engine/__init__.py +0 -0
- /cognite/neat/{session → _v0}/engine/_import.py +0 -0
- /cognite/neat/{session → _v0}/engine/_interface.py +0 -0
- /cognite/neat/{session → _v0/session}/__init__.py +0 -0
- /cognite/neat/{session → _v0/session}/_experimental.py +0 -0
- /cognite/neat/{session → _v0/session}/_state/README.md +0 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"""This module performs importing of various formats to one of serializations for which
|
|
2
|
+
there are loaders to data model pydantic class."""
|
|
3
|
+
|
|
4
|
+
from cognite.neat._v0.core._data_model.importers._rdf._base import BaseRDFImporter
|
|
5
|
+
from cognite.neat._v0.core._data_model.importers._rdf._shared import (
|
|
6
|
+
parse_concepts,
|
|
7
|
+
parse_properties,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
CLASSES_QUERY = """SELECT ?concept ?name ?description ?implements
|
|
11
|
+
WHERE {{
|
|
12
|
+
|
|
13
|
+
?concept a owl:Class .
|
|
14
|
+
OPTIONAL {{?concept rdfs:subClassOf ?implements }}.
|
|
15
|
+
OPTIONAL {{?concept rdfs:label|skos:prefLabel ?name }}.
|
|
16
|
+
OPTIONAL {{?concept rdfs:comment|skos:definition ?description}} .
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
FILTER (!isBlank(?concept ))
|
|
20
|
+
FILTER (!bound(?implements) || !isBlank(?implements))
|
|
21
|
+
|
|
22
|
+
FILTER (!bound(?name) || LANG(?name) = "" || LANGMATCHES(LANG(?name), "{language}"))
|
|
23
|
+
FILTER (!bound(?description) || LANG(?description) = "" || LANGMATCHES(LANG(?description), "{language}"))
|
|
24
|
+
|
|
25
|
+
}}
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
CLASSES_QUERY_PARAMETERS = {"concept", "name", "description", "implements"}
|
|
29
|
+
|
|
30
|
+
PROPERTIES_QUERY = """ SELECT ?concept ?property_ ?name ?description ?value_type ?min_count ?max_count ?default
|
|
31
|
+
WHERE {{
|
|
32
|
+
?property_ a ?property_Type.
|
|
33
|
+
FILTER (?property_Type IN (owl:ObjectProperty, owl:DatatypeProperty ) )
|
|
34
|
+
|
|
35
|
+
# --- 1. Explicit Domain Discovery ---
|
|
36
|
+
|
|
37
|
+
# A. Handling owl:domain when it is expressed as owl restriction
|
|
38
|
+
OPTIONAL {{
|
|
39
|
+
?property_ rdfs:domain ?domain_exp_node .
|
|
40
|
+
FILTER(isBlank(?domain_exp_node))
|
|
41
|
+
?domain_exp_node owl:unionOf|owl:intersectionOf ?exp_concepts_list .
|
|
42
|
+
?exp_concepts_list rdf:rest*/rdf:first ?explicit_concept.
|
|
43
|
+
}}
|
|
44
|
+
|
|
45
|
+
# B. Handling the domain when it is a single concept
|
|
46
|
+
OPTIONAL {{
|
|
47
|
+
?property_ rdfs:domain ?domain_exp_node .
|
|
48
|
+
FILTER(!isBlank(?domain_exp_node))
|
|
49
|
+
BIND(?domain_exp_node AS ?explicit_concept)
|
|
50
|
+
}}
|
|
51
|
+
|
|
52
|
+
# --- 2. Inherited Domain Discovery (Fallback) ---
|
|
53
|
+
|
|
54
|
+
# C. Handling inherited domain when parent domain is a restriction
|
|
55
|
+
OPTIONAL {{
|
|
56
|
+
?property_ rdfs:subPropertyOf ?parent_property .
|
|
57
|
+
?parent_property rdfs:domain ?parent_domain_node .
|
|
58
|
+
FILTER(isBlank(?parent_domain_node))
|
|
59
|
+
?parent_domain_node owl:unionOf|owl:intersectionOf ?parent_concepts_list .
|
|
60
|
+
?parent_concepts_list rdf:rest*/rdf:first ?inherited_concept.
|
|
61
|
+
}}
|
|
62
|
+
|
|
63
|
+
# D. Handling inherited domain when parent domain is a single concept
|
|
64
|
+
OPTIONAL {{
|
|
65
|
+
?property_ rdfs:subPropertyOf ?parent_property .
|
|
66
|
+
?parent_property rdfs:domain ?parent_domain_node .
|
|
67
|
+
FILTER(!isBlank(?parent_domain_node))
|
|
68
|
+
BIND(?parent_domain_node AS ?inherited_concept)
|
|
69
|
+
}}
|
|
70
|
+
|
|
71
|
+
# Final Concept Assignment with Priority ---
|
|
72
|
+
# COALESCE prioritizes ?explicit_concept over ?inherited_concept
|
|
73
|
+
BIND(COALESCE(?explicit_concept, ?inherited_concept) AS ?concept)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# Handling owl:range when it is expressed as owl restriction
|
|
77
|
+
OPTIONAL {{
|
|
78
|
+
?property_ rdfs:range ?range .
|
|
79
|
+
FILTER(isBlank(?range))
|
|
80
|
+
?range owl:unionOf|owl:intersectionOf ?value_types .
|
|
81
|
+
?value_types rdf:rest*/rdf:first ?value_type.
|
|
82
|
+
}}
|
|
83
|
+
|
|
84
|
+
# Handling the range when it is a single concept
|
|
85
|
+
OPTIONAL {{
|
|
86
|
+
?property_ rdfs:range ?range .
|
|
87
|
+
FILTER(!isBlank(?range))
|
|
88
|
+
BIND(?range AS ?value_type)
|
|
89
|
+
}}
|
|
90
|
+
|
|
91
|
+
OPTIONAL {{?property_ rdfs:label|skos:prefLabel ?name }}.
|
|
92
|
+
OPTIONAL {{?property_ rdfs:comment|skos:definition ?description}}.
|
|
93
|
+
OPTIONAL {{?property_ owl:maxCardinality ?max_count}}.
|
|
94
|
+
OPTIONAL {{?property_ owl:minCardinality ?min_count}}.
|
|
95
|
+
|
|
96
|
+
# FILTERS
|
|
97
|
+
FILTER (!isBlank(?property_))
|
|
98
|
+
FILTER (!bound(?name) || LANG(?name) = "" || LANGMATCHES(LANG(?name), "{language}"))
|
|
99
|
+
FILTER (!bound(?description) || LANG(?description) = "" || LANGMATCHES(LANG(?description), "{language}"))
|
|
100
|
+
}}
|
|
101
|
+
"""
|
|
102
|
+
PROPERTIES_QUERY_PARAMETERS = {
|
|
103
|
+
"concept",
|
|
104
|
+
"property_",
|
|
105
|
+
"name",
|
|
106
|
+
"description",
|
|
107
|
+
"value_type",
|
|
108
|
+
"min_count",
|
|
109
|
+
"max_count",
|
|
110
|
+
"default",
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class OWLImporter(BaseRDFImporter):
|
|
115
|
+
"""Convert OWL ontology to unverified data model.
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
filepath: Path to OWL ontology
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
def _to_data_model_components(
|
|
122
|
+
self,
|
|
123
|
+
) -> dict:
|
|
124
|
+
concepts, issue_list = parse_concepts(
|
|
125
|
+
self.graph, CLASSES_QUERY, CLASSES_QUERY_PARAMETERS, self.language, self.issue_list
|
|
126
|
+
)
|
|
127
|
+
self.issue_list = issue_list
|
|
128
|
+
|
|
129
|
+
properties, issue_list = parse_properties(
|
|
130
|
+
self.graph, PROPERTIES_QUERY, PROPERTIES_QUERY_PARAMETERS, self.language, self.issue_list
|
|
131
|
+
)
|
|
132
|
+
self.issue_list = issue_list
|
|
133
|
+
|
|
134
|
+
components = {
|
|
135
|
+
"Metadata": self._metadata,
|
|
136
|
+
"Concepts": list(concepts.values()) if concepts else [],
|
|
137
|
+
"Properties": list(properties.values()) if properties else [],
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return components
|
|
141
|
+
|
|
142
|
+
@property
|
|
143
|
+
def description(self) -> str:
|
|
144
|
+
return f"Ontology {self.source_name} read as unverified data model"
|
|
@@ -6,16 +6,16 @@ from rdflib import Literal as RdfLiteral
|
|
|
6
6
|
from rdflib.plugins.sparql import prepareQuery
|
|
7
7
|
from rdflib.query import ResultRow
|
|
8
8
|
|
|
9
|
-
from cognite.neat.core._constants import cognite_prefixes
|
|
10
|
-
from cognite.neat.core._data_model.models.entities._constants import Unknown
|
|
11
|
-
from cognite.neat.core._data_model.models.entities._single_value import ConceptEntity
|
|
12
|
-
from cognite.neat.core._issues._base import IssueList
|
|
13
|
-
from cognite.neat.core._issues.errors._general import NeatValueError
|
|
14
|
-
from cognite.neat.core._issues.warnings._resources import (
|
|
9
|
+
from cognite.neat._v0.core._constants import cognite_prefixes
|
|
10
|
+
from cognite.neat._v0.core._data_model.models.entities._constants import Unknown
|
|
11
|
+
from cognite.neat._v0.core._data_model.models.entities._single_value import ConceptEntity
|
|
12
|
+
from cognite.neat._v0.core._issues._base import IssueList
|
|
13
|
+
from cognite.neat._v0.core._issues.errors._general import NeatValueError
|
|
14
|
+
from cognite.neat._v0.core._issues.warnings._resources import (
|
|
15
15
|
ResourceRedefinedWarning,
|
|
16
16
|
ResourceRetrievalWarning,
|
|
17
17
|
)
|
|
18
|
-
from cognite.neat.core._utils.rdf_ import remove_namespace_from_uri, uri_to_entity_components
|
|
18
|
+
from cognite.neat._v0.core._utils.rdf_ import remove_namespace_from_uri, uri_to_entity_components
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def parse_concepts(
|
|
@@ -67,13 +67,13 @@ def parse_concepts(
|
|
|
67
67
|
else:
|
|
68
68
|
# Handling implements
|
|
69
69
|
if concepts[concept_id]["implements"] and isinstance(concepts[concept_id]["implements"], list):
|
|
70
|
-
if res["implements"] not in concepts[concept_id]["implements"]:
|
|
70
|
+
if res["implements"] and res["implements"] not in concepts[concept_id]["implements"]:
|
|
71
71
|
concepts[concept_id]["implements"].append(res["implements"])
|
|
72
72
|
|
|
73
73
|
elif concepts[concept_id]["implements"] and isinstance(concepts[concept_id]["implements"], str):
|
|
74
74
|
concepts[concept_id]["implements"] = [concepts[concept_id]["implements"]]
|
|
75
75
|
|
|
76
|
-
if res["implements"] not in concepts[concept_id]["implements"]:
|
|
76
|
+
if res["implements"] and res["implements"] not in concepts[concept_id]["implements"]:
|
|
77
77
|
concepts[concept_id]["implements"].append(res["implements"])
|
|
78
78
|
elif res["implements"]:
|
|
79
79
|
concepts[concept_id]["implements"] = [res["implements"]]
|
|
@@ -183,15 +183,19 @@ def handle_meta(
|
|
|
183
183
|
if not resources[resource_id][feature] and res[feature]:
|
|
184
184
|
resources[resource_id][feature] = res[feature]
|
|
185
185
|
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
current_value = resources[resource_id][feature]
|
|
187
|
+
new_value = res[feature]
|
|
188
|
+
|
|
189
|
+
if not current_value and new_value:
|
|
190
|
+
resources[resource_id][feature] = new_value
|
|
191
|
+
elif current_value and new_value and current_value != new_value:
|
|
188
192
|
issue_list.append(
|
|
189
193
|
ResourceRedefinedWarning(
|
|
190
194
|
identifier=resource_id,
|
|
191
195
|
resource_type=resource_type,
|
|
192
196
|
feature=feature,
|
|
193
|
-
current_value=
|
|
194
|
-
new_value=
|
|
197
|
+
current_value=current_value,
|
|
198
|
+
new_value=new_value,
|
|
195
199
|
)
|
|
196
200
|
)
|
|
197
201
|
|
|
@@ -10,28 +10,35 @@ import pandas as pd
|
|
|
10
10
|
from openpyxl import load_workbook
|
|
11
11
|
from openpyxl.worksheet.worksheet import Worksheet
|
|
12
12
|
from pandas import ExcelFile
|
|
13
|
+
from pydantic import ValidationError
|
|
13
14
|
from rdflib import Namespace, URIRef
|
|
14
15
|
|
|
15
|
-
from cognite.neat.core._data_model.
|
|
16
|
+
from cognite.neat._v0.core._data_model._constants import SPLIT_ON_COMMA_PATTERN
|
|
17
|
+
from cognite.neat._v0.core._data_model._shared import (
|
|
16
18
|
ImportedDataModel,
|
|
17
19
|
T_UnverifiedDataModel,
|
|
18
20
|
)
|
|
19
|
-
from cognite.neat.core._data_model.models import (
|
|
21
|
+
from cognite.neat._v0.core._data_model.models import (
|
|
20
22
|
UNVERIFIED_DATA_MODEL_BY_ROLE,
|
|
21
23
|
VERIFIED_DATA_MODEL_BY_ROLE,
|
|
22
24
|
RoleTypes,
|
|
23
25
|
SchemaCompleteness,
|
|
24
26
|
)
|
|
25
|
-
from cognite.neat.core._data_model.models._import_contexts import SpreadsheetContext
|
|
26
|
-
from cognite.neat.core.
|
|
27
|
-
from cognite.neat.core._issues
|
|
27
|
+
from cognite.neat._v0.core._data_model.models._import_contexts import SpreadsheetContext
|
|
28
|
+
from cognite.neat._v0.core._data_model.models.entities._single_value import ContainerConstraintEntity, ContainerEntity
|
|
29
|
+
from cognite.neat._v0.core._issues import IssueList, MultiValueError
|
|
30
|
+
from cognite.neat._v0.core._issues.errors import (
|
|
28
31
|
FileMissingRequiredFieldError,
|
|
29
32
|
FileNotFoundNeatError,
|
|
30
33
|
FileReadError,
|
|
31
34
|
)
|
|
32
|
-
from cognite.neat.core._issues.warnings import FileMissingRequiredFieldWarning
|
|
33
|
-
from cognite.neat.core._utils.spreadsheet import
|
|
34
|
-
|
|
35
|
+
from cognite.neat._v0.core._issues.warnings import FileMissingRequiredFieldWarning
|
|
36
|
+
from cognite.neat._v0.core._utils.spreadsheet import (
|
|
37
|
+
SpreadsheetRead,
|
|
38
|
+
find_column_and_row_with_value,
|
|
39
|
+
read_individual_sheet,
|
|
40
|
+
)
|
|
41
|
+
from cognite.neat._v0.core._utils.text import humanize_collection
|
|
35
42
|
|
|
36
43
|
from ._base import BaseImporter
|
|
37
44
|
|
|
@@ -306,7 +313,7 @@ class ExcelImporter(BaseImporter[T_UnverifiedDataModel]):
|
|
|
306
313
|
|
|
307
314
|
"""
|
|
308
315
|
|
|
309
|
-
workbook = load_workbook(filepath)
|
|
316
|
+
workbook = load_workbook(filepath, data_only=True)
|
|
310
317
|
|
|
311
318
|
if "Classes" in workbook.sheetnames:
|
|
312
319
|
print(
|
|
@@ -323,13 +330,17 @@ class ExcelImporter(BaseImporter[T_UnverifiedDataModel]):
|
|
|
323
330
|
if "Properties" in workbook.sheetnames:
|
|
324
331
|
_replace_class_with_concept_cell(workbook["Properties"])
|
|
325
332
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
333
|
+
elif "Containers" in workbook.sheetnames:
|
|
334
|
+
_replace_legacy_constraint_form(workbook["Containers"])
|
|
335
|
+
_replace_legacy_constraint_form(workbook["Properties"])
|
|
329
336
|
|
|
330
337
|
else:
|
|
331
338
|
return filepath
|
|
332
339
|
|
|
340
|
+
with tempfile.NamedTemporaryFile(prefix="temp_neat_file", suffix=".xlsx", delete=False) as temp_file:
|
|
341
|
+
workbook.save(temp_file.name)
|
|
342
|
+
return Path(temp_file.name)
|
|
343
|
+
|
|
333
344
|
|
|
334
345
|
def _replace_class_with_concept_cell(sheet: Worksheet) -> None:
|
|
335
346
|
"""
|
|
@@ -342,3 +353,72 @@ def _replace_class_with_concept_cell(sheet: Worksheet) -> None:
|
|
|
342
353
|
for cell in row:
|
|
343
354
|
if cell.value == "Class":
|
|
344
355
|
cell.value = "Concept"
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def _replace_legacy_constraint_form(sheet: Worksheet) -> None:
|
|
359
|
+
"""
|
|
360
|
+
Replaces the legacy form of container constraints with the new form in the given sheet.
|
|
361
|
+
|
|
362
|
+
Args:
|
|
363
|
+
sheet (Worksheet): The sheet in which to replace the old form of container constraints.
|
|
364
|
+
"""
|
|
365
|
+
column, row = find_column_and_row_with_value(sheet, "Constraint", False)
|
|
366
|
+
|
|
367
|
+
if not column or not row:
|
|
368
|
+
return None
|
|
369
|
+
|
|
370
|
+
# Iterate over values in the constraint column and replace old form with new form
|
|
371
|
+
replaced: bool = False
|
|
372
|
+
for cell_row in sheet.iter_rows(min_row=row + 1, min_col=column, max_col=column):
|
|
373
|
+
cell = cell_row[0]
|
|
374
|
+
if cell.value is not None: # Skip empty cells
|
|
375
|
+
# Container sheet update
|
|
376
|
+
if sheet.title.lower() == "containers":
|
|
377
|
+
constraints = []
|
|
378
|
+
for constraint in SPLIT_ON_COMMA_PATTERN.split(str(cell.value)):
|
|
379
|
+
# latest format, do nothing
|
|
380
|
+
if "require" in constraint.lower():
|
|
381
|
+
constraints.append(constraint)
|
|
382
|
+
continue
|
|
383
|
+
|
|
384
|
+
try:
|
|
385
|
+
container = ContainerEntity.load(constraint, space="default")
|
|
386
|
+
container_str = container.external_id if container.space == "default" else str(container)
|
|
387
|
+
constraints.append(
|
|
388
|
+
f"requires:{container.space}_{container.external_id}(require={container_str})"
|
|
389
|
+
)
|
|
390
|
+
replaced = True
|
|
391
|
+
except ValidationError:
|
|
392
|
+
constraints.append(constraint)
|
|
393
|
+
|
|
394
|
+
cell.value = ",".join(constraints)
|
|
395
|
+
|
|
396
|
+
# Properties sheet update
|
|
397
|
+
elif sheet.title.lower() == "properties":
|
|
398
|
+
constraints = []
|
|
399
|
+
for constraint in SPLIT_ON_COMMA_PATTERN.split(str(cell.value)):
|
|
400
|
+
try:
|
|
401
|
+
constraint_entity = ContainerConstraintEntity.load(constraint)
|
|
402
|
+
|
|
403
|
+
if constraint_entity.prefix in ["uniqueness", "requires"]:
|
|
404
|
+
constraints.append(constraint)
|
|
405
|
+
|
|
406
|
+
# Replace old format with new format
|
|
407
|
+
else:
|
|
408
|
+
constraints.append(f"uniqueness:{constraint}")
|
|
409
|
+
replaced = True
|
|
410
|
+
|
|
411
|
+
# If the constraint is not valid, we keep it as is
|
|
412
|
+
# to be caught by validation later
|
|
413
|
+
except ValidationError:
|
|
414
|
+
constraints.append(constraint)
|
|
415
|
+
|
|
416
|
+
cell.value = ",".join(constraints)
|
|
417
|
+
|
|
418
|
+
if replaced:
|
|
419
|
+
print(
|
|
420
|
+
(
|
|
421
|
+
"You are using a legacy container constraints format "
|
|
422
|
+
f"in the {sheet.title} sheet. Please update to the latest format."
|
|
423
|
+
),
|
|
424
|
+
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
2
|
-
from cognite.neat.core._data_model.models.conceptual._unverified import (
|
|
1
|
+
from cognite.neat._v0.core._client.data_classes.schema import DMSSchema
|
|
2
|
+
from cognite.neat._v0.core._data_model.models.conceptual._unverified import (
|
|
3
3
|
UnverifiedConceptualDataModel,
|
|
4
4
|
)
|
|
5
|
-
from cognite.neat.core._data_model.models.conceptual._verified import (
|
|
5
|
+
from cognite.neat._v0.core._data_model.models.conceptual._verified import (
|
|
6
6
|
ConceptualDataModel,
|
|
7
7
|
)
|
|
8
8
|
|
|
@@ -26,8 +26,8 @@ from pydantic.main import IncEx
|
|
|
26
26
|
from pydantic_core import core_schema
|
|
27
27
|
from rdflib import Namespace, URIRef
|
|
28
28
|
|
|
29
|
-
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
30
|
-
from cognite.neat.core._data_model.models._types import (
|
|
29
|
+
from cognite.neat._v0.core._constants import DEFAULT_NAMESPACE
|
|
30
|
+
from cognite.neat._v0.core._data_model.models._types import (
|
|
31
31
|
ContainerEntityType,
|
|
32
32
|
DataModelExternalIdType,
|
|
33
33
|
PhysicalPropertyType,
|
|
@@ -37,13 +37,13 @@ from cognite.neat.core._data_model.models._types import (
|
|
|
37
37
|
VersionType,
|
|
38
38
|
ViewEntityType,
|
|
39
39
|
)
|
|
40
|
-
from cognite.neat.core._data_model.models.data_types import DataType
|
|
41
|
-
from cognite.neat.core._data_model.models.entities import (
|
|
40
|
+
from cognite.neat._v0.core._data_model.models.data_types import DataType
|
|
41
|
+
from cognite.neat._v0.core._data_model.models.entities import (
|
|
42
42
|
EdgeEntity,
|
|
43
43
|
ReverseConnectionEntity,
|
|
44
44
|
ViewEntity,
|
|
45
45
|
)
|
|
46
|
-
from cognite.neat.core._utils.rdf_ import uri_display_name
|
|
46
|
+
from cognite.neat._v0.core._utils.rdf_ import uri_display_name
|
|
47
47
|
|
|
48
48
|
if sys.version_info >= (3, 11):
|
|
49
49
|
from enum import StrEnum
|
|
@@ -3,7 +3,7 @@ from typing import TypeVar
|
|
|
3
3
|
|
|
4
4
|
from rdflib import URIRef
|
|
5
5
|
|
|
6
|
-
from cognite.neat.core._utils.spreadsheet import SpreadsheetRead
|
|
6
|
+
from cognite.neat._v0.core._utils.spreadsheet import SpreadsheetRead
|
|
7
7
|
|
|
8
8
|
T_Key = TypeVar("T_Key", bound=Hashable)
|
|
9
9
|
T_Value = TypeVar("T_Value")
|
|
@@ -14,21 +14,21 @@ from pydantic import (
|
|
|
14
14
|
)
|
|
15
15
|
from pydantic.functional_serializers import PlainSerializer
|
|
16
16
|
|
|
17
|
-
from cognite.neat.core._data_model._constants import (
|
|
17
|
+
from cognite.neat._v0.core._data_model._constants import (
|
|
18
18
|
DATA_MODEL_COMPLIANCE_REGEX,
|
|
19
19
|
PATTERNS,
|
|
20
20
|
PREFIX_COMPLIANCE_REGEX,
|
|
21
21
|
VERSION_COMPLIANCE_REGEX,
|
|
22
22
|
EntityTypes,
|
|
23
23
|
)
|
|
24
|
-
from cognite.neat.core._data_model.models.entities._multi_value import MultiValueTypeInfo
|
|
25
|
-
from cognite.neat.core._data_model.models.entities._single_value import (
|
|
24
|
+
from cognite.neat._v0.core._data_model.models.entities._multi_value import MultiValueTypeInfo
|
|
25
|
+
from cognite.neat._v0.core._data_model.models.entities._single_value import (
|
|
26
26
|
ConceptEntity,
|
|
27
27
|
ContainerEntity,
|
|
28
28
|
ViewEntity,
|
|
29
29
|
)
|
|
30
|
-
from cognite.neat.core._issues.errors import RegexViolationError
|
|
31
|
-
from cognite.neat.core._issues.warnings import RegexViolationWarning
|
|
30
|
+
from cognite.neat._v0.core._issues.errors import RegexViolationError
|
|
31
|
+
from cognite.neat._v0.core._issues.warnings import RegexViolationWarning
|
|
32
32
|
|
|
33
33
|
Entities: TypeAlias = ConceptEntity | ViewEntity | ContainerEntity
|
|
34
34
|
T_Entities = TypeVar("T_Entities", bound=Entities)
|
|
@@ -6,19 +6,19 @@ import pandas as pd
|
|
|
6
6
|
from cognite.client import data_modeling as dm
|
|
7
7
|
from rdflib import Namespace, URIRef
|
|
8
8
|
|
|
9
|
-
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
10
|
-
from cognite.neat.core._data_model.models._base_unverified import (
|
|
9
|
+
from cognite.neat._v0.core._constants import DEFAULT_NAMESPACE
|
|
10
|
+
from cognite.neat._v0.core._data_model.models._base_unverified import (
|
|
11
11
|
UnverifiedComponent,
|
|
12
12
|
UnverifiedDataModel,
|
|
13
13
|
)
|
|
14
|
-
from cognite.neat.core._data_model.models.data_types import DataType
|
|
15
|
-
from cognite.neat.core._data_model.models.entities import (
|
|
14
|
+
from cognite.neat._v0.core._data_model.models.data_types import DataType
|
|
15
|
+
from cognite.neat._v0.core._data_model.models.entities import (
|
|
16
16
|
ConceptEntity,
|
|
17
17
|
MultiValueTypeInfo,
|
|
18
18
|
UnknownEntity,
|
|
19
19
|
load_value_type,
|
|
20
20
|
)
|
|
21
|
-
from cognite.neat.core._utils.rdf_ import uri_display_name
|
|
21
|
+
from cognite.neat._v0.core._utils.rdf_ import uri_display_name
|
|
22
22
|
|
|
23
23
|
from ._verified import (
|
|
24
24
|
Concept,
|
|
@@ -100,8 +100,8 @@ class UnverifiedConceptualProperty(UnverifiedComponent[ConceptualProperty]):
|
|
|
100
100
|
|
|
101
101
|
def dump(self, default_prefix: str, **kwargs) -> dict[str, Any]: # type: ignore
|
|
102
102
|
output = super().dump()
|
|
103
|
-
output["Concept"] = ConceptEntity.load(self.concept, prefix=default_prefix)
|
|
104
|
-
output["Value Type"] = load_value_type(self.value_type, default_prefix)
|
|
103
|
+
output["Concept"] = ConceptEntity.load(self.concept, prefix=default_prefix, return_on_failure=True)
|
|
104
|
+
output["Value Type"] = load_value_type(self.value_type, default_prefix, return_on_failure=True)
|
|
105
105
|
return output
|
|
106
106
|
|
|
107
107
|
def copy(self, update: dict[str, Any], default_prefix: str) -> "UnverifiedConceptualProperty":
|
|
@@ -135,10 +135,16 @@ class UnverifiedConcept(UnverifiedComponent[Concept]):
|
|
|
135
135
|
parent: list[ConceptEntity] | None = None
|
|
136
136
|
if isinstance(self.implements, str):
|
|
137
137
|
self.implements = self.implements.strip()
|
|
138
|
-
parent = [
|
|
138
|
+
parent = [
|
|
139
|
+
ConceptEntity.load(parent_str, prefix=default_prefix, return_on_failure=True)
|
|
140
|
+
for parent_str in self.implements.split(",")
|
|
141
|
+
]
|
|
139
142
|
elif isinstance(self.implements, list):
|
|
140
|
-
parent = [
|
|
141
|
-
|
|
143
|
+
parent = [
|
|
144
|
+
ConceptEntity.load(parent_str, prefix=default_prefix, return_on_failure=True)
|
|
145
|
+
for parent_str in self.implements
|
|
146
|
+
]
|
|
147
|
+
output["Concept"] = ConceptEntity.load(self.concept, prefix=default_prefix, return_on_failure=True)
|
|
142
148
|
output["Implements"] = parent
|
|
143
149
|
return output
|
|
144
150
|
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import itertools
|
|
2
2
|
from collections import Counter, defaultdict
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core._constants import get_base_concepts
|
|
5
|
-
from cognite.neat.core._data_model._constants import PATTERNS, EntityTypes
|
|
6
|
-
from cognite.neat.core._data_model.models._import_contexts import ImportContext, SpreadsheetContext
|
|
7
|
-
from cognite.neat.core._data_model.models.entities import ConceptEntity, UnknownEntity
|
|
8
|
-
from cognite.neat.core._data_model.models.entities._multi_value import MultiValueTypeInfo
|
|
9
|
-
from cognite.neat.core._issues import IssueList
|
|
10
|
-
from cognite.neat.core._issues.errors import NeatValueError
|
|
11
|
-
from cognite.neat.core._issues.errors._resources import (
|
|
4
|
+
from cognite.neat._v0.core._constants import get_base_concepts
|
|
5
|
+
from cognite.neat._v0.core._data_model._constants import PATTERNS, EntityTypes
|
|
6
|
+
from cognite.neat._v0.core._data_model.models._import_contexts import ImportContext, SpreadsheetContext
|
|
7
|
+
from cognite.neat._v0.core._data_model.models.entities import ConceptEntity, UnknownEntity
|
|
8
|
+
from cognite.neat._v0.core._data_model.models.entities._multi_value import MultiValueTypeInfo
|
|
9
|
+
from cognite.neat._v0.core._issues import IssueList
|
|
10
|
+
from cognite.neat._v0.core._issues.errors import NeatValueError
|
|
11
|
+
from cognite.neat._v0.core._issues.errors._resources import (
|
|
12
12
|
ResourceDuplicatedError,
|
|
13
13
|
ResourceNotDefinedError,
|
|
14
14
|
)
|
|
15
|
-
from cognite.neat.core._issues.warnings._models import (
|
|
15
|
+
from cognite.neat._v0.core._issues.warnings._models import (
|
|
16
16
|
ConceptOnlyDataModelWarning,
|
|
17
17
|
ConversionToPhysicalModelImpossibleWarning,
|
|
18
18
|
DanglingPropertyWarning,
|
|
19
19
|
UndefinedConceptWarning,
|
|
20
20
|
)
|
|
21
|
-
from cognite.neat.core._issues.warnings._resources import (
|
|
21
|
+
from cognite.neat._v0.core._issues.warnings._resources import (
|
|
22
22
|
ResourceNotDefinedWarning,
|
|
23
23
|
ResourceRegexViolationWarning,
|
|
24
24
|
)
|
|
25
|
-
from cognite.neat.core._utils.text import humanize_collection
|
|
25
|
+
from cognite.neat._v0.core._utils.text import humanize_collection
|
|
26
26
|
|
|
27
27
|
from ._verified import ConceptualDataModel
|
|
28
28
|
|
|
@@ -37,7 +37,7 @@ class ConceptualValidation:
|
|
|
37
37
|
context: ImportContext | None = None,
|
|
38
38
|
):
|
|
39
39
|
# import here to avoid circular import issues
|
|
40
|
-
from cognite.neat.core._data_model.analysis._base import DataModelAnalysis
|
|
40
|
+
from cognite.neat._v0.core._data_model.analysis._base import DataModelAnalysis
|
|
41
41
|
|
|
42
42
|
self.data_model = data_model
|
|
43
43
|
self.analysis = DataModelAnalysis(self.data_model)
|
|
@@ -7,9 +7,9 @@ from pydantic import Field, field_serializer, field_validator, model_validator
|
|
|
7
7
|
from pydantic_core.core_schema import SerializationInfo
|
|
8
8
|
from rdflib import Namespace, URIRef
|
|
9
9
|
|
|
10
|
-
from cognite.neat.core._constants import get_default_prefixes_and_namespaces
|
|
11
|
-
from cognite.neat.core._data_model._constants import EntityTypes
|
|
12
|
-
from cognite.neat.core._data_model.models._base_verified import (
|
|
10
|
+
from cognite.neat._v0.core._constants import get_default_prefixes_and_namespaces
|
|
11
|
+
from cognite.neat._v0.core._data_model._constants import EntityTypes
|
|
12
|
+
from cognite.neat._v0.core._data_model.models._base_verified import (
|
|
13
13
|
BaseVerifiedDataModel,
|
|
14
14
|
BaseVerifiedMetadata,
|
|
15
15
|
DataModelLevel,
|
|
@@ -17,7 +17,7 @@ from cognite.neat.core._data_model.models._base_verified import (
|
|
|
17
17
|
SheetList,
|
|
18
18
|
SheetRow,
|
|
19
19
|
)
|
|
20
|
-
from cognite.neat.core._data_model.models._types import (
|
|
20
|
+
from cognite.neat._v0.core._data_model.models._types import (
|
|
21
21
|
ConceptEntityType,
|
|
22
22
|
ConceptualPropertyType,
|
|
23
23
|
MultiValueTypeType,
|
|
@@ -25,17 +25,17 @@ from cognite.neat.core._data_model.models._types import (
|
|
|
25
25
|
)
|
|
26
26
|
|
|
27
27
|
# NeatIdType,
|
|
28
|
-
from cognite.neat.core._data_model.models.data_types import DataType
|
|
29
|
-
from cognite.neat.core._data_model.models.entities import (
|
|
28
|
+
from cognite.neat._v0.core._data_model.models.data_types import DataType
|
|
29
|
+
from cognite.neat._v0.core._data_model.models.entities import (
|
|
30
30
|
ClassEntityList,
|
|
31
31
|
ConceptEntity,
|
|
32
32
|
ConceptualEntity,
|
|
33
33
|
UnknownEntity,
|
|
34
34
|
)
|
|
35
|
-
from cognite.neat.core._issues.errors import PropertyDefinitionError
|
|
35
|
+
from cognite.neat._v0.core._issues.errors import PropertyDefinitionError
|
|
36
36
|
|
|
37
37
|
if TYPE_CHECKING:
|
|
38
|
-
from cognite.neat.core._data_model.models import PhysicalDataModel
|
|
38
|
+
from cognite.neat._v0.core._data_model.models import PhysicalDataModel
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
class ConceptualMetadata(BaseVerifiedMetadata):
|
|
@@ -303,7 +303,7 @@ class ConceptualDataModel(BaseVerifiedDataModel):
|
|
|
303
303
|
classes_by_neat_id[view.conceptual].physical = neat_id
|
|
304
304
|
|
|
305
305
|
def as_physical_data_model(self) -> "PhysicalDataModel":
|
|
306
|
-
from cognite.neat.core._data_model.transformers._converters import (
|
|
306
|
+
from cognite.neat._v0.core._data_model.transformers._converters import (
|
|
307
307
|
_ConceptualDataModelConverter,
|
|
308
308
|
)
|
|
309
309
|
|
|
@@ -10,12 +10,12 @@ from pydantic import BaseModel, Field, model_serializer, model_validator
|
|
|
10
10
|
from pydantic.functional_validators import ModelWrapValidatorHandler
|
|
11
11
|
from rdflib import URIRef
|
|
12
12
|
|
|
13
|
-
from cognite.neat.core._constants import XML_SCHEMA_NAMESPACE
|
|
14
|
-
from cognite.neat.core._data_model._constants import (
|
|
13
|
+
from cognite.neat._v0.core._constants import XML_SCHEMA_NAMESPACE
|
|
14
|
+
from cognite.neat._v0.core._data_model._constants import (
|
|
15
15
|
SPLIT_ON_COMMA_PATTERN,
|
|
16
16
|
SPLIT_ON_EQUAL_PATTERN,
|
|
17
17
|
)
|
|
18
|
-
from cognite.neat.core._data_model.models.entities._single_value import (
|
|
18
|
+
from cognite.neat._v0.core._data_model.models.entities._single_value import (
|
|
19
19
|
ConceptEntity,
|
|
20
20
|
UnitEntity,
|
|
21
21
|
)
|
|
@@ -246,6 +246,11 @@ class String(DataType):
|
|
|
246
246
|
sql = "STRING"
|
|
247
247
|
|
|
248
248
|
name: typing.Literal["string"] = "string"
|
|
249
|
+
max_text_size: int | None = Field(
|
|
250
|
+
None,
|
|
251
|
+
alias="maxTextSize",
|
|
252
|
+
description="Specifies the maximum size in bytes of the text property, when encoded with utf-8.",
|
|
253
|
+
)
|
|
249
254
|
|
|
250
255
|
|
|
251
256
|
class LangString(DataType):
|
|
@@ -256,6 +261,11 @@ class LangString(DataType):
|
|
|
256
261
|
sql = "STRING"
|
|
257
262
|
|
|
258
263
|
name: typing.Literal["langString"] = "langString"
|
|
264
|
+
max_text_size: int | None = Field(
|
|
265
|
+
None,
|
|
266
|
+
alias="maxTextSize",
|
|
267
|
+
description="Specifies the maximum size in bytes of the text property, when encoded with utf-8.",
|
|
268
|
+
)
|
|
259
269
|
|
|
260
270
|
|
|
261
271
|
class AnyURI(DataType):
|
|
@@ -292,7 +302,7 @@ class DateTime(DataType):
|
|
|
292
302
|
python = datetime
|
|
293
303
|
dms = dms.Timestamp
|
|
294
304
|
graphql = "Timestamp"
|
|
295
|
-
xsd = "
|
|
305
|
+
xsd = "dateTime"
|
|
296
306
|
sql = "TIMESTAMP"
|
|
297
307
|
|
|
298
308
|
name: typing.Literal["dateTime"] = "dateTime"
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
from ._constants import Undefined, Unknown
|
|
2
2
|
from ._loaders import load_connection, load_dms_value_type, load_value_type
|
|
3
3
|
from ._multi_value import MultiValueTypeInfo
|
|
4
|
+
from ._restrictions import ConceptPropertyCardinalityConstraint, ConceptPropertyValueConstraint, parse_restriction
|
|
4
5
|
from ._single_value import (
|
|
5
6
|
AssetEntity,
|
|
6
7
|
AssetFields,
|
|
7
8
|
ConceptEntity,
|
|
8
9
|
ConceptualEntity,
|
|
10
|
+
ContainerConstraintEntity,
|
|
9
11
|
ContainerEntity,
|
|
10
12
|
ContainerIndexEntity,
|
|
11
13
|
DataModelEntity,
|
|
@@ -31,7 +33,10 @@ __all__ = [
|
|
|
31
33
|
"CdfResourceEntityList",
|
|
32
34
|
"ClassEntityList",
|
|
33
35
|
"ConceptEntity",
|
|
36
|
+
"ConceptPropertyCardinalityConstraint",
|
|
37
|
+
"ConceptPropertyValueConstraint",
|
|
34
38
|
"ConceptualEntity",
|
|
39
|
+
"ContainerConstraintEntity",
|
|
35
40
|
"ContainerEntity",
|
|
36
41
|
"ContainerEntityList",
|
|
37
42
|
"ContainerIndexEntity",
|
|
@@ -61,4 +66,5 @@ __all__ = [
|
|
|
61
66
|
"load_connection",
|
|
62
67
|
"load_dms_value_type",
|
|
63
68
|
"load_value_type",
|
|
69
|
+
"parse_restriction",
|
|
64
70
|
]
|