cognite-neat 0.123.2__py3-none-any.whl → 0.127.30__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 +2 -2
- cognite/neat/_client/__init__.py +4 -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 +125 -0
- cognite/neat/_client/data_classes.py +44 -0
- cognite/neat/_client/data_model_api.py +115 -0
- cognite/neat/_client/spaces_api.py +115 -0
- cognite/neat/_client/statistics_api.py +24 -0
- cognite/neat/_client/views_api.py +129 -0
- cognite/neat/_config.py +185 -0
- cognite/neat/_data_model/_analysis.py +196 -0
- cognite/neat/_data_model/_constants.py +67 -0
- cognite/neat/_data_model/_identifiers.py +61 -0
- cognite/neat/_data_model/_shared.py +41 -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 +529 -0
- cognite/neat/_data_model/deployer/deployer.py +401 -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 +421 -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 +295 -0
- cognite/neat/_data_model/importers/_table_importer/importer.py +192 -0
- cognite/neat/_data_model/importers/_table_importer/reader.py +1063 -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 +135 -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 +282 -0
- cognite/neat/_data_model/models/dms/_view_property.py +235 -0
- cognite/neat/_data_model/models/dms/_views.py +210 -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 +364 -0
- cognite/neat/_data_model/validation/dms/_base.py +307 -0
- cognite/neat/_data_model/validation/dms/_connections.py +638 -0
- cognite/neat/_data_model/validation/dms/_consistency.py +57 -0
- cognite/neat/_data_model/validation/dms/_containers.py +174 -0
- cognite/neat/_data_model/validation/dms/_limits.py +420 -0
- cognite/neat/_data_model/validation/dms/_orchestrator.py +222 -0
- cognite/neat/_data_model/validation/dms/_views.py +103 -0
- cognite/neat/_exceptions.py +56 -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 +303 -0
- cognite/neat/_session/_html/static/deployment.js +150 -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 +75 -0
- cognite/neat/_session/_html/templates/issues.html +45 -0
- cognite/neat/_session/_issues.py +81 -0
- cognite/neat/_session/_opt.py +35 -0
- cognite/neat/_session/_physical.py +261 -0
- cognite/neat/_session/_result.py +236 -0
- cognite/neat/_session/_session.py +88 -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 +82 -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 +81 -0
- cognite/neat/_store/_store.py +156 -0
- cognite/neat/_utils/__init__.py +0 -0
- cognite/neat/_utils/_reader.py +194 -0
- cognite/neat/_utils/auxiliary.py +39 -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/text.py +71 -0
- cognite/neat/_utils/useful_types.py +37 -0
- cognite/neat/_utils/validation.py +154 -0
- cognite/neat/_version.py +1 -1
- 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 +86 -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 +10 -3
- cognite/neat/v0/core/_data_model/__init__.py +0 -0
- cognite/neat/{core → v0/core}/_data_model/_constants.py +9 -6
- cognite/neat/{core → v0/core}/_data_model/_shared.py +5 -5
- cognite/neat/{core → v0/core}/_data_model/analysis/_base.py +12 -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 +13 -13
- 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 -133
- cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2yaml.py +1 -1
- cognite/neat/{core → v0/core}/_data_model/importers/__init__.py +4 -6
- 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 +6 -6
- cognite/neat/{core → v0/core}/_data_model/importers/_dms2data_model.py +19 -16
- cognite/neat/v0/core/_data_model/importers/_graph2data_model.py +299 -0
- cognite/neat/v0/core/_data_model/importers/_rdf/__init__.py +4 -0
- cognite/neat/{core → v0/core}/_data_model/importers/_rdf/_base.py +13 -13
- 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/v0/core/_data_model/importers/_rdf/_shared.py +255 -0
- cognite/neat/{core → v0/core}/_data_model/importers/_spreadsheet2data_model.py +94 -13
- 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/v0/core/_data_model/models/_import_contexts.py +82 -0
- cognite/neat/{core → v0/core}/_data_model/models/_types.py +5 -5
- cognite/neat/{core → v0/core}/_data_model/models/conceptual/_unverified.py +18 -12
- cognite/neat/v0/core/_data_model/models/conceptual/_validation.py +308 -0
- cognite/neat/{core → v0/core}/_data_model/models/conceptual/_verified.py +13 -11
- 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 +28 -21
- cognite/neat/{core → v0/core}/_data_model/models/physical/_unverified.py +141 -38
- cognite/neat/{core → v0/core}/_data_model/models/physical/_validation.py +190 -24
- cognite/neat/{core → v0/core}/_data_model/models/physical/_verified.py +135 -15
- cognite/neat/{core → v0/core}/_data_model/transformers/__init__.py +2 -0
- cognite/neat/{core → v0/core}/_data_model/transformers/_base.py +4 -4
- cognite/neat/{core → v0/core}/_data_model/transformers/_converters.py +39 -32
- cognite/neat/{core → v0/core}/_data_model/transformers/_mapping.py +7 -7
- cognite/neat/v0/core/_data_model/transformers/_union_conceptual.py +208 -0
- 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 +1 -1
- 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 +11 -6
- cognite/neat/{core → v0/core}/_issues/_contextmanagers.py +8 -6
- cognite/neat/{core → v0/core}/_issues/_factory.py +11 -8
- cognite/neat/{core → v0/core}/_issues/errors/__init__.py +3 -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 +12 -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 +5 -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 +39 -4
- cognite/neat/{core → v0/core}/_issues/warnings/_properties.py +13 -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 +13 -12
- cognite/neat/{core → v0/core}/_store/_instance.py +45 -12
- 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 +1 -1
- cognite/neat/{core → v0/core}/_utils/auxiliary.py +7 -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 +38 -14
- cognite/neat/{core → v0/core}/_utils/reader/_base.py +1 -1
- cognite/neat/{core → v0/core}/_utils/spreadsheet.py +22 -4
- cognite/neat/v0/core/_utils/tarjan.py +44 -0
- cognite/neat/{core → v0/core}/_utils/text.py +1 -1
- cognite/neat/{core → v0/core}/_utils/upload.py +3 -3
- 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 -10
- 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 +33 -43
- 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 +22 -8
- 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}/engine/_load.py +1 -1
- cognite/neat/{session → v0/session}/exceptions.py +5 -5
- cognite/neat/v1.py +3 -0
- {cognite_neat-0.123.2.dist-info → cognite_neat-0.127.30.dist-info}/METADATA +9 -8
- cognite_neat-0.127.30.dist-info/RECORD +319 -0
- {cognite_neat-0.123.2.dist-info → cognite_neat-0.127.30.dist-info}/WHEEL +1 -1
- cognite/neat/core/_data_model/importers/_dtdl2data_model/__init__.py +0 -3
- cognite/neat/core/_data_model/importers/_dtdl2data_model/_unit_lookup.py +0 -224
- cognite/neat/core/_data_model/importers/_dtdl2data_model/dtdl_converter.py +0 -320
- cognite/neat/core/_data_model/importers/_dtdl2data_model/dtdl_importer.py +0 -155
- cognite/neat/core/_data_model/importers/_dtdl2data_model/spec.py +0 -363
- cognite/neat/core/_data_model/importers/_rdf/__init__.py +0 -5
- cognite/neat/core/_data_model/importers/_rdf/_imf2data_model.py +0 -98
- cognite/neat/core/_data_model/importers/_rdf/_owl2data_model.py +0 -87
- cognite/neat/core/_data_model/importers/_rdf/_shared.py +0 -168
- cognite/neat/core/_data_model/models/conceptual/_validation.py +0 -294
- 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-0.123.2.dist-info/RECORD +0 -197
- /cognite/neat/{core → _data_model}/__init__.py +0 -0
- /cognite/neat/{core/_client/_api → _data_model/deployer}/__init__.py +0 -0
- /cognite/neat/{core/_client/data_classes → _data_model/exporters/_table_exporter}/__init__.py +0 -0
- /cognite/neat/{core/_data_model → _data_model/importers/_table_importer}/__init__.py +0 -0
- /cognite/neat/{core/_instances → _data_model/models}/__init__.py +0 -0
- /cognite/neat/{core/_instances/extractors/_classic_cdf → _data_model/models/conceptual}/__init__.py +0 -0
- /cognite/neat/{core/_utils → _data_model/validation}/__init__.py +0 -0
- /cognite/neat/{plugins/data_model → _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/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}/_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/time_.py +0 -0
- /cognite/neat/{core → v0/core}/_utils/xml_.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
- /cognite/neat/{session → v0/session}/engine/__init__.py +0 -0
- /cognite/neat/{session → v0/session}/engine/_import.py +0 -0
- /cognite/neat/{session → v0/session}/engine/_interface.py +0 -0
- {cognite_neat-0.123.2.dist-info → cognite_neat-0.127.30.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import itertools
|
|
2
|
+
import re
|
|
1
3
|
import warnings
|
|
2
4
|
from abc import ABC, abstractmethod
|
|
5
|
+
from collections import defaultdict
|
|
3
6
|
from collections.abc import Callable, Collection, Iterable, Sequence
|
|
4
7
|
from dataclasses import dataclass, field
|
|
5
|
-
from graphlib import TopologicalSorter
|
|
8
|
+
from graphlib import CycleError, TopologicalSorter
|
|
6
9
|
from typing import TYPE_CHECKING, Any, ClassVar, Generic, Literal, TypeVar, cast, overload
|
|
7
10
|
|
|
8
11
|
from cognite.client.data_classes import filters
|
|
@@ -52,13 +55,14 @@ from cognite.client.data_classes.data_modeling.views import (
|
|
|
52
55
|
from cognite.client.exceptions import CogniteAPIError
|
|
53
56
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
54
57
|
|
|
55
|
-
from cognite.neat.core._client.data_classes.data_modeling import Component
|
|
56
|
-
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
57
|
-
from cognite.neat.core._issues.warnings import CDFMaxIterationsWarning
|
|
58
|
-
from cognite.neat.core._shared import T_ID
|
|
58
|
+
from cognite.neat.v0.core._client.data_classes.data_modeling import Component
|
|
59
|
+
from cognite.neat.v0.core._client.data_classes.schema import DMSSchema
|
|
60
|
+
from cognite.neat.v0.core._issues.warnings import CDFMaxIterationsWarning
|
|
61
|
+
from cognite.neat.v0.core._shared import T_ID
|
|
62
|
+
from cognite.neat.v0.core._utils.tarjan import tarjan
|
|
59
63
|
|
|
60
64
|
if TYPE_CHECKING:
|
|
61
|
-
from cognite.neat.core._client._api_client import NeatClient
|
|
65
|
+
from cognite.neat.v0.core._client._api_client import NeatClient
|
|
62
66
|
|
|
63
67
|
T_WritableCogniteResourceList = TypeVar("T_WritableCogniteResourceList", bound=WriteableCogniteResourceList)
|
|
64
68
|
|
|
@@ -235,7 +239,7 @@ class ResourceLoader(
|
|
|
235
239
|
try:
|
|
236
240
|
return self._update(items)
|
|
237
241
|
except CogniteAPIError as e:
|
|
238
|
-
failed_ids = {self.get_id(failed) for failed in e.failed
|
|
242
|
+
failed_ids = {self.get_id(failed) for failed in itertools.chain(e.failed, e.unknown)}
|
|
239
243
|
success_ids = [self.get_id(success) for success in e.successful]
|
|
240
244
|
success_ = self.retrieve(success_ids)
|
|
241
245
|
if success is None:
|
|
@@ -620,6 +624,81 @@ class ViewLoader(DataModelingLoader[ViewId, ViewApply, View, ViewApplyList, View
|
|
|
620
624
|
def _create(self, items: Sequence[ViewApply]) -> ViewList:
|
|
621
625
|
return self._client.data_modeling.views.apply(items)
|
|
622
626
|
|
|
627
|
+
def create(self, items: Sequence[ViewApply]) -> ViewList:
|
|
628
|
+
try:
|
|
629
|
+
return self._create(items)
|
|
630
|
+
except CogniteAPIError as e1:
|
|
631
|
+
if self._is_auto_retryable(e1):
|
|
632
|
+
# Fallback to creating one by one if the error is auto-retryable.
|
|
633
|
+
return self._fallback_one_by_one(self._create, items)
|
|
634
|
+
elif self._is_false_not_exists(e1, {item.as_id() for item in items}):
|
|
635
|
+
return self._try_to_recover_coupled(items, e1)
|
|
636
|
+
raise
|
|
637
|
+
|
|
638
|
+
def _try_to_recover_coupled(self, items: Sequence[ViewApply], original_error: CogniteAPIError) -> ViewList:
|
|
639
|
+
"""The /models/views endpoint can give faulty 400 about missing views that are part of the request.
|
|
640
|
+
|
|
641
|
+
This method tries to recover from such errors by identifying the strongly connected components in the graph
|
|
642
|
+
defined by the implements and through properties of the views. We then create the components in topological
|
|
643
|
+
order.
|
|
644
|
+
|
|
645
|
+
Args:
|
|
646
|
+
items: The items that failed to create.
|
|
647
|
+
original_error: The original error that was raised. If the problem is not recoverable, this error is raised.
|
|
648
|
+
|
|
649
|
+
Returns:
|
|
650
|
+
The views that were created.
|
|
651
|
+
|
|
652
|
+
"""
|
|
653
|
+
views_by_id = {self.get_id(item): item for item in items}
|
|
654
|
+
parents_by_child: dict[ViewId, set[ViewId]] = {
|
|
655
|
+
view_id: {parent for parent in view.implements or [] if parent in views_by_id}
|
|
656
|
+
for view_id, view in views_by_id.items()
|
|
657
|
+
}
|
|
658
|
+
# Check for cycles in the implements graph
|
|
659
|
+
try:
|
|
660
|
+
TopologicalSorter(parents_by_child).static_order()
|
|
661
|
+
except CycleError as e:
|
|
662
|
+
raise CycleError(f"Failed to deploy views. This likely due to a cycle in implements. {e.args[1]}") from None
|
|
663
|
+
|
|
664
|
+
dependencies_by_id: dict[ViewId, set[ViewId]] = defaultdict(set)
|
|
665
|
+
for view_id, view in views_by_id.items():
|
|
666
|
+
dependencies_by_id[view_id].update([parent for parent in view.implements or [] if parent in views_by_id])
|
|
667
|
+
for properties in (view.properties or {}).values():
|
|
668
|
+
if isinstance(properties, ReverseDirectRelationApply):
|
|
669
|
+
if isinstance(properties.through.source, ViewId) and properties.through.source in views_by_id:
|
|
670
|
+
dependencies_by_id[view_id].add(properties.through.source)
|
|
671
|
+
|
|
672
|
+
created = ViewList([])
|
|
673
|
+
for strongly_connected in tarjan(dependencies_by_id):
|
|
674
|
+
to_create = [views_by_id[view_id] for view_id in strongly_connected]
|
|
675
|
+
try:
|
|
676
|
+
created_set = self._client.data_modeling.views.apply(to_create)
|
|
677
|
+
except CogniteAPIError:
|
|
678
|
+
self._client.data_modeling.views.delete(created.as_ids())
|
|
679
|
+
raise original_error from None
|
|
680
|
+
created.extend(created_set)
|
|
681
|
+
return created
|
|
682
|
+
|
|
683
|
+
@staticmethod
|
|
684
|
+
def _is_auto_retryable(e: CogniteAPIError) -> bool:
|
|
685
|
+
return isinstance(e.extra, dict) and "isAutoRetryable" in e.extra and e.extra["isAutoRetryable"]
|
|
686
|
+
|
|
687
|
+
@staticmethod
|
|
688
|
+
def _is_false_not_exists(e: CogniteAPIError, request_views: set[ViewId]) -> bool:
|
|
689
|
+
"""This is a bug in the API where it returns a 400 status complaining that a views does not exist,
|
|
690
|
+
even though they are part of the request. This bug is reported to Cognite. The workaround is to do a
|
|
691
|
+
topological sort of the strongly connected views and retry the request.
|
|
692
|
+
"""
|
|
693
|
+
if "not exist" not in e.message and 400 <= e.code < 500:
|
|
694
|
+
return False
|
|
695
|
+
results = re.findall(r"'([a-zA-Z0-9_-]+):([a-zA-Z0-9_]+)/([.a-zA-Z0-9_-]+)'", e.message)
|
|
696
|
+
if not results:
|
|
697
|
+
# No view references in the message
|
|
698
|
+
return False
|
|
699
|
+
error_message_views = {ViewId(*result) for result in results}
|
|
700
|
+
return error_message_views.issubset(request_views)
|
|
701
|
+
|
|
623
702
|
@overload
|
|
624
703
|
def retrieve(
|
|
625
704
|
self,
|
|
@@ -7,13 +7,13 @@ from cognite.client.data_classes.filters import Filter
|
|
|
7
7
|
from cognite.client.exceptions import CogniteAPIError
|
|
8
8
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
9
9
|
|
|
10
|
-
from cognite.neat.core._constants import DMS_INSTANCE_LIMIT_MARGIN
|
|
11
|
-
from cognite.neat.core._issues import NeatIssue
|
|
12
|
-
from cognite.neat.core._issues.errors import WillExceedLimitError
|
|
13
|
-
from cognite.neat.core._issues.warnings import NeatValueWarning
|
|
10
|
+
from cognite.neat.v0.core._constants import DMS_INSTANCE_LIMIT_MARGIN
|
|
11
|
+
from cognite.neat.v0.core._issues import NeatIssue
|
|
12
|
+
from cognite.neat.v0.core._issues.errors import WillExceedLimitError
|
|
13
|
+
from cognite.neat.v0.core._issues.warnings import NeatValueWarning
|
|
14
14
|
|
|
15
15
|
if TYPE_CHECKING:
|
|
16
|
-
from cognite.neat.core._client._api_client import NeatClient
|
|
16
|
+
from cognite.neat.v0.core._client._api_client import NeatClient
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class NeatInstancesAPI:
|
|
@@ -5,17 +5,17 @@ from typing import TYPE_CHECKING
|
|
|
5
5
|
|
|
6
6
|
from cognite.client import data_modeling as dm
|
|
7
7
|
|
|
8
|
-
from cognite.neat.core._client.data_classes.data_modeling import (
|
|
8
|
+
from cognite.neat.v0.core._client.data_classes.data_modeling import (
|
|
9
9
|
ContainerApplyDict,
|
|
10
10
|
SpaceApplyDict,
|
|
11
11
|
ViewApplyDict,
|
|
12
12
|
)
|
|
13
|
-
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
14
|
-
from cognite.neat.core._constants import is_hierarchy_property
|
|
15
|
-
from cognite.neat.core._issues.errors import NeatValueError
|
|
13
|
+
from cognite.neat.v0.core._client.data_classes.schema import DMSSchema
|
|
14
|
+
from cognite.neat.v0.core._constants import is_hierarchy_property
|
|
15
|
+
from cognite.neat.v0.core._issues.errors import NeatValueError
|
|
16
16
|
|
|
17
17
|
if TYPE_CHECKING:
|
|
18
|
-
from cognite.neat.core._client._api_client import NeatClient
|
|
18
|
+
from cognite.neat.v0.core._client._api_client import NeatClient
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class SchemaAPI:
|
|
@@ -7,7 +7,7 @@ from cognite.client.config import ClientConfig
|
|
|
7
7
|
from cognite.client.data_classes.data_modeling.ids import _load_space_identifier
|
|
8
8
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
9
9
|
|
|
10
|
-
from cognite.neat.core._client.data_classes.statistics import (
|
|
10
|
+
from cognite.neat.v0.core._client.data_classes.statistics import (
|
|
11
11
|
ProjectStatsAndLimits,
|
|
12
12
|
SpaceInstanceCounts,
|
|
13
13
|
SpaceInstanceCountsList,
|
|
@@ -34,7 +34,7 @@ class StatisticsAPI(APIClient):
|
|
|
34
34
|
Examples:
|
|
35
35
|
Fetch project statistics (and limits) and check the current number of data models vs.
|
|
36
36
|
and how many more can be created:
|
|
37
|
-
>>> from cognite.neat.core._client import NeatClient
|
|
37
|
+
>>> from cognite.neat.v0.core._client import NeatClient
|
|
38
38
|
>>> client = NeatClient()
|
|
39
39
|
>>> stats = client.instance_statistics.project()
|
|
40
40
|
>>> num_dm = stats.data_models.current
|
|
@@ -64,7 +64,7 @@ class StatisticsAPI(APIClient):
|
|
|
64
64
|
|
|
65
65
|
Examples:
|
|
66
66
|
Fetch statistics for a single space:
|
|
67
|
-
>>> from cognite.neat.core._client import NeatClient
|
|
67
|
+
>>> from cognite.neat.v0.core._client import NeatClient
|
|
68
68
|
>>> client = NeatClient()
|
|
69
69
|
>>> res = client.instance_statistics.list("my-space")
|
|
70
70
|
Fetch statistics for multiple spaces:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from cognite.client import ClientConfig, CogniteClient
|
|
2
2
|
|
|
3
|
-
from cognite.neat.core._utils.auth import _CLIENT_NAME
|
|
3
|
+
from cognite.neat.v0.core._utils.auth import _CLIENT_NAME
|
|
4
4
|
|
|
5
5
|
from ._api.data_modeling_loaders import DataModelLoaderAPI
|
|
6
6
|
from ._api.neat_instances import NeatInstancesAPI
|
|
File without changes
|
|
@@ -20,21 +20,21 @@ from cognite.client.data_classes.data_modeling.views import (
|
|
|
20
20
|
ViewPropertyApply,
|
|
21
21
|
)
|
|
22
22
|
|
|
23
|
-
from cognite.neat.core._client.data_classes.data_modeling import (
|
|
23
|
+
from cognite.neat.v0.core._client.data_classes.data_modeling import (
|
|
24
24
|
CogniteResourceDict,
|
|
25
25
|
ContainerApplyDict,
|
|
26
26
|
NodeApplyDict,
|
|
27
27
|
SpaceApplyDict,
|
|
28
28
|
ViewApplyDict,
|
|
29
29
|
)
|
|
30
|
-
from cognite.neat.core._issues.errors import (
|
|
30
|
+
from cognite.neat.v0.core._issues.errors import (
|
|
31
31
|
NeatYamlError,
|
|
32
32
|
)
|
|
33
|
-
from cognite.neat.core._issues.warnings import (
|
|
33
|
+
from cognite.neat.v0.core._issues.warnings import (
|
|
34
34
|
FileTypeUnexpectedWarning,
|
|
35
35
|
ResourcesDuplicatedWarning,
|
|
36
36
|
)
|
|
37
|
-
from cognite.neat.core._utils.text import to_camel_case
|
|
37
|
+
from cognite.neat.v0.core._utils.text import to_camel_case
|
|
38
38
|
|
|
39
39
|
if sys.version_info >= (3, 11):
|
|
40
40
|
from typing import Self
|
|
@@ -5,7 +5,7 @@ from unittest.mock import MagicMock
|
|
|
5
5
|
|
|
6
6
|
from cognite.client.testing import CogniteClientMock
|
|
7
7
|
|
|
8
|
-
from cognite.neat.core._client._api_client import NeatClient
|
|
8
|
+
from cognite.neat.v0.core._client._api_client import NeatClient
|
|
9
9
|
|
|
10
10
|
from ._api.data_modeling_loaders import DataModelLoaderAPI
|
|
11
11
|
from ._api.neat_instances import NeatInstancesAPI
|
|
@@ -11,7 +11,7 @@ from rdflib.namespace import DefinedNamespace
|
|
|
11
11
|
from cognite import neat
|
|
12
12
|
|
|
13
13
|
if TYPE_CHECKING:
|
|
14
|
-
from cognite.neat.core._data_model.models.physical import PhysicalProperty
|
|
14
|
+
from cognite.neat.v0.core._data_model.models.physical import PhysicalProperty
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def _is_in_notebook() -> bool:
|
|
@@ -204,7 +204,7 @@ BASE_MODEL = Literal["CogniteCore"]
|
|
|
204
204
|
|
|
205
205
|
def get_asset_read_only_properties_with_connection() -> "list[PhysicalProperty]":
|
|
206
206
|
"""Gets the asset read-only properties with connection, i.e. Root and Path."""
|
|
207
|
-
from cognite.neat.core._data_model.models.physical import PhysicalProperty
|
|
207
|
+
from cognite.neat.v0.core._data_model.models.physical import PhysicalProperty
|
|
208
208
|
|
|
209
209
|
return [PhysicalProperty.model_validate(item) for item in (_ASSET_ROOT_PROPERTY, _ASSET_PATH_PROPERTY)]
|
|
210
210
|
|
|
@@ -219,7 +219,7 @@ def get_base_concepts(
|
|
|
219
219
|
total_concepts: The number of concepts to get. If None, all concepts are returned.
|
|
220
220
|
"""
|
|
221
221
|
# Local import to avoid circular dependency issues
|
|
222
|
-
from cognite.neat.core._issues.errors._general import NeatValueError
|
|
222
|
+
from cognite.neat.v0.core._issues.errors._general import NeatValueError
|
|
223
223
|
|
|
224
224
|
if base_model == "CogniteCore":
|
|
225
225
|
return [f"cdf_cdm:{concept}(version=v1)" for concept in COGNITE_CONCEPTS][:total_concepts]
|
|
@@ -250,6 +250,11 @@ def is_hierarchy_property(container: dm.ContainerId, property_: str) -> bool:
|
|
|
250
250
|
)
|
|
251
251
|
|
|
252
252
|
|
|
253
|
+
def cognite_prefixes() -> dict[str, Namespace]:
|
|
254
|
+
"""Returns the Cognite prefixes and namespaces."""
|
|
255
|
+
return {space: Namespace(CDF_NAMESPACE[space] + "/") for space in COGNITE_SPACES}
|
|
256
|
+
|
|
257
|
+
|
|
253
258
|
DMS_RESERVED_PROPERTIES = frozenset(
|
|
254
259
|
{
|
|
255
260
|
"createdTime",
|
|
@@ -269,3 +274,5 @@ DMS_RESERVED_PROPERTIES = frozenset(
|
|
|
269
274
|
"endNode",
|
|
270
275
|
}
|
|
271
276
|
)
|
|
277
|
+
|
|
278
|
+
NAMED_GRAPH_NAMESPACE = Namespace("http://thisisneat.io/namedgraph/")
|
|
File without changes
|
|
@@ -43,6 +43,11 @@ class EntityTypes(StrEnum):
|
|
|
43
43
|
prefix = "prefix"
|
|
44
44
|
space = "space"
|
|
45
45
|
container_index = "container_index"
|
|
46
|
+
container_constraint = "container_constraint"
|
|
47
|
+
concept_restriction = "conceptRestriction"
|
|
48
|
+
value_constraint = "valueConstraint"
|
|
49
|
+
cardinality_constraint = "cardinalityConstraint"
|
|
50
|
+
named_individual = "named_individual"
|
|
46
51
|
|
|
47
52
|
|
|
48
53
|
def get_reserved_words(
|
|
@@ -111,12 +116,8 @@ PHYSICAL_PROPERTY_ID_COMPLIANCE_REGEX = (
|
|
|
111
116
|
rf"(?!^({'|'.join(get_reserved_words('property'))})$)"
|
|
112
117
|
r"(^[a-zA-Z][a-zA-Z0-9_]{0,253}[a-zA-Z0-9]?$)"
|
|
113
118
|
)
|
|
114
|
-
CONCEPT_ID_COMPLIANCE_REGEX =
|
|
115
|
-
rf"(?!^({'|'.join(get_reserved_words('concept'))})$)"
|
|
116
|
-
r"(^[a-zA-Z0-9._-]{0,253}[a-zA-Z0-9]?$)"
|
|
117
|
-
)
|
|
119
|
+
CONCEPT_ID_COMPLIANCE_REGEX = r"^[a-zA-Z0-9._~?@!$&'*+,;=%-]+$"
|
|
118
120
|
|
|
119
|
-
INFORMATION_PROPERTY_ID_COMPLIANCE_REGEX = r"^(\*)|(?!^(Property|property)$)(^[a-zA-Z0-9._-]{0,253}[a-zA-Z0-9]?$)"
|
|
120
121
|
VERSION_COMPLIANCE_REGEX = r"^[a-zA-Z0-9]([.a-zA-Z0-9_-]{0,41}[a-zA-Z0-9])?$"
|
|
121
122
|
|
|
122
123
|
|
|
@@ -128,6 +129,8 @@ SPLIT_ON_EQUAL_PATTERN = re.compile(r"=(?![^(]*\))")
|
|
|
128
129
|
# Very special Edge Entity parsing
|
|
129
130
|
SPLIT_ON_EDGE_ENTITY_ARGS_PATTERN = re.compile(r"(\btype\b|\bproperties\b|\bdirection\b)\s*=\s*([^,]+)")
|
|
130
131
|
|
|
132
|
+
CONSTRAINT_ID_MAX_LENGTH = 43
|
|
133
|
+
|
|
131
134
|
|
|
132
135
|
class _Patterns:
|
|
133
136
|
@cached_property
|
|
@@ -156,7 +159,7 @@ class _Patterns:
|
|
|
156
159
|
|
|
157
160
|
@cached_property
|
|
158
161
|
def conceptual_property_id_compliance(self) -> re.Pattern[str]:
|
|
159
|
-
return re.compile(
|
|
162
|
+
return re.compile(CONCEPT_ID_COMPLIANCE_REGEX)
|
|
160
163
|
|
|
161
164
|
@cached_property
|
|
162
165
|
def version_compliance(self) -> re.Pattern[str]:
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Generic, TypeAlias, TypeVar
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core._data_model.models import (
|
|
4
|
+
from cognite.neat.v0.core._data_model.models import (
|
|
5
5
|
ConceptualDataModel,
|
|
6
6
|
PhysicalDataModel,
|
|
7
7
|
)
|
|
8
|
-
from cognite.neat.core._data_model.models.
|
|
8
|
+
from cognite.neat.v0.core._data_model.models._import_contexts import ImportContext
|
|
9
|
+
from cognite.neat.v0.core._data_model.models.conceptual._unverified import (
|
|
9
10
|
UnverifiedConceptualDataModel,
|
|
10
11
|
)
|
|
11
|
-
from cognite.neat.core._data_model.models.physical._unverified import (
|
|
12
|
+
from cognite.neat.v0.core._data_model.models.physical._unverified import (
|
|
12
13
|
UnverifiedPhysicalDataModel,
|
|
13
14
|
)
|
|
14
|
-
from cognite.neat.core._utils.spreadsheet import SpreadsheetRead
|
|
15
15
|
|
|
16
16
|
VerifiedDataModel: TypeAlias = ConceptualDataModel | PhysicalDataModel
|
|
17
17
|
|
|
@@ -32,7 +32,7 @@ class ImportedDataModel(Generic[T_UnverifiedDataModel]):
|
|
|
32
32
|
"""
|
|
33
33
|
|
|
34
34
|
unverified_data_model: T_UnverifiedDataModel | None
|
|
35
|
-
context:
|
|
35
|
+
context: ImportContext | None = None
|
|
36
36
|
|
|
37
37
|
@classmethod
|
|
38
38
|
def display_type_name(cls) -> str:
|
|
@@ -11,23 +11,23 @@ import pandas as pd
|
|
|
11
11
|
from cognite.client import data_modeling as dm
|
|
12
12
|
from rdflib import URIRef
|
|
13
13
|
|
|
14
|
-
from cognite.neat.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
15
|
-
from cognite.neat.core._data_model.models.conceptual import (
|
|
14
|
+
from cognite.neat.v0.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
15
|
+
from cognite.neat.v0.core._data_model.models.conceptual import (
|
|
16
16
|
Concept,
|
|
17
17
|
ConceptualProperty,
|
|
18
18
|
)
|
|
19
|
-
from cognite.neat.core._data_model.models.entities import (
|
|
19
|
+
from cognite.neat.v0.core._data_model.models.entities import (
|
|
20
20
|
ConceptEntity,
|
|
21
21
|
MultiValueTypeInfo,
|
|
22
22
|
ViewEntity,
|
|
23
23
|
)
|
|
24
|
-
from cognite.neat.core._data_model.models.entities._single_value import (
|
|
24
|
+
from cognite.neat.v0.core._data_model.models.entities._single_value import (
|
|
25
25
|
UnknownEntity,
|
|
26
26
|
)
|
|
27
|
-
from cognite.neat.core._data_model.models.physical import PhysicalProperty
|
|
28
|
-
from cognite.neat.core._data_model.models.physical._verified import PhysicalView
|
|
29
|
-
from cognite.neat.core._issues.errors import NeatValueError
|
|
30
|
-
from cognite.neat.core._issues.warnings import NeatValueWarning
|
|
27
|
+
from cognite.neat.v0.core._data_model.models.physical import PhysicalProperty
|
|
28
|
+
from cognite.neat.v0.core._data_model.models.physical._verified import PhysicalView
|
|
29
|
+
from cognite.neat.v0.core._issues.errors import NeatValueError
|
|
30
|
+
from cognite.neat.v0.core._issues.warnings import NeatValueWarning
|
|
31
31
|
|
|
32
32
|
T_Hashable = TypeVar("T_Hashable", bound=Hashable)
|
|
33
33
|
|
|
@@ -348,6 +348,10 @@ class DataModelAnalysis:
|
|
|
348
348
|
properties_by_view = self.properties_by_view(include_ancestors)
|
|
349
349
|
return {prop.view for prop in itertools.chain.from_iterable(properties_by_view.values())}
|
|
350
350
|
|
|
351
|
+
def concepts(self) -> set[ConceptEntity]:
|
|
352
|
+
"""Returns all concepts defined Concepts in the data model."""
|
|
353
|
+
return {concept.concept for concept in self.conceptual.concepts}
|
|
354
|
+
|
|
351
355
|
def defined_concepts(
|
|
352
356
|
self,
|
|
353
357
|
include_ancestors: bool = False,
|
|
@@ -2,7 +2,7 @@ from ._base import BaseExporter, CDFExporter
|
|
|
2
2
|
from ._data_model2dms import DMSExporter
|
|
3
3
|
from ._data_model2excel import ExcelExporter
|
|
4
4
|
from ._data_model2instance_template import InstanceTemplateExporter
|
|
5
|
-
from .
|
|
5
|
+
from ._data_model2semantic_model import GraphExporter, OWLExporter, SHACLExporter
|
|
6
6
|
from ._data_model2yaml import YAMLExporter
|
|
7
7
|
|
|
8
8
|
__all__ = [
|
|
@@ -14,7 +14,6 @@ __all__ = [
|
|
|
14
14
|
"InstanceTemplateExporter",
|
|
15
15
|
"OWLExporter",
|
|
16
16
|
"SHACLExporter",
|
|
17
|
-
"SemanticDataModelExporter",
|
|
18
17
|
"YAMLExporter",
|
|
19
18
|
]
|
|
20
19
|
|
|
@@ -5,14 +5,14 @@ from pathlib import Path
|
|
|
5
5
|
from types import UnionType
|
|
6
6
|
from typing import TYPE_CHECKING, Generic, TypeVar, Union, get_args, get_origin
|
|
7
7
|
|
|
8
|
-
from cognite.neat.core._client import NeatClient
|
|
9
|
-
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
10
|
-
from cognite.neat.core._data_model._shared import T_VerifiedDataModel
|
|
11
|
-
from cognite.neat.core._utils.auxiliary import class_html_doc
|
|
12
|
-
from cognite.neat.core._utils.upload import UploadResult, UploadResultList
|
|
8
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
9
|
+
from cognite.neat.v0.core._constants import DEFAULT_NAMESPACE
|
|
10
|
+
from cognite.neat.v0.core._data_model._shared import T_VerifiedDataModel
|
|
11
|
+
from cognite.neat.v0.core._utils.auxiliary import class_html_doc
|
|
12
|
+
from cognite.neat.v0.core._utils.upload import UploadResult, UploadResultList
|
|
13
13
|
|
|
14
14
|
if TYPE_CHECKING:
|
|
15
|
-
from cognite.neat.core._store._provenance import Agent as ProvenanceAgent
|
|
15
|
+
from cognite.neat.v0.core._store._provenance import Agent as ProvenanceAgent
|
|
16
16
|
|
|
17
17
|
T_Export = TypeVar("T_Export")
|
|
18
18
|
|
|
@@ -36,7 +36,7 @@ class BaseExporter(ABC, Generic[T_VerifiedDataModel, T_Export]):
|
|
|
36
36
|
@property
|
|
37
37
|
def agent(self) -> "ProvenanceAgent":
|
|
38
38
|
"""Provenance agent for the importer."""
|
|
39
|
-
from cognite.neat.core._store._provenance import Agent as ProvenanceAgent
|
|
39
|
+
from cognite.neat.v0.core._store._provenance import Agent as ProvenanceAgent
|
|
40
40
|
|
|
41
41
|
return ProvenanceAgent(id_=DEFAULT_NAMESPACE[f"agent/{type(self).__name__}"])
|
|
42
42
|
|
|
@@ -18,24 +18,24 @@ from cognite.client.data_classes.data_modeling import (
|
|
|
18
18
|
)
|
|
19
19
|
from cognite.client.exceptions import CogniteAPIError
|
|
20
20
|
|
|
21
|
-
from cognite.neat.core._client import DataModelingLoader, NeatClient
|
|
22
|
-
from cognite.neat.core._client._api.data_modeling_loaders import (
|
|
21
|
+
from cognite.neat.v0.core._client import DataModelingLoader, NeatClient
|
|
22
|
+
from cognite.neat.v0.core._client._api.data_modeling_loaders import (
|
|
23
23
|
MultiCogniteAPIError,
|
|
24
24
|
T_WritableCogniteResourceList,
|
|
25
25
|
)
|
|
26
|
-
from cognite.neat.core._client.data_classes.data_modeling import (
|
|
26
|
+
from cognite.neat.v0.core._client.data_classes.data_modeling import (
|
|
27
27
|
Component,
|
|
28
28
|
ViewApplyDict,
|
|
29
29
|
)
|
|
30
|
-
from cognite.neat.core._client.data_classes.schema import DMSSchema
|
|
31
|
-
from cognite.neat.core._data_model.models.physical import PhysicalDataModel
|
|
32
|
-
from cognite.neat.core._issues import IssueList
|
|
33
|
-
from cognite.neat.core._issues.warnings import (
|
|
30
|
+
from cognite.neat.v0.core._client.data_classes.schema import DMSSchema
|
|
31
|
+
from cognite.neat.v0.core._data_model.models.physical import PhysicalDataModel
|
|
32
|
+
from cognite.neat.v0.core._issues import IssueList
|
|
33
|
+
from cognite.neat.v0.core._issues.warnings import (
|
|
34
34
|
PrincipleOneModelOneSpaceWarning,
|
|
35
35
|
ResourceRetrievalWarning,
|
|
36
36
|
)
|
|
37
|
-
from cognite.neat.core._shared import T_ID
|
|
38
|
-
from cognite.neat.core._utils.upload import UploadResult
|
|
37
|
+
from cognite.neat.v0.core._shared import T_ID
|
|
38
|
+
from cognite.neat.v0.core._utils.upload import UploadResult
|
|
39
39
|
|
|
40
40
|
from ._base import CDFExporter
|
|
41
41
|
|
|
@@ -14,25 +14,25 @@ from openpyxl.worksheet.datavalidation import DataValidation
|
|
|
14
14
|
from openpyxl.worksheet.worksheet import Worksheet
|
|
15
15
|
from rdflib import Namespace
|
|
16
16
|
|
|
17
|
-
from cognite.neat.core._constants import BASE_MODEL, get_base_concepts
|
|
18
|
-
from cognite.neat.core._data_model._constants import get_internal_properties
|
|
19
|
-
from cognite.neat.core._data_model._shared import VerifiedDataModel
|
|
20
|
-
from cognite.neat.core._data_model.models import (
|
|
17
|
+
from cognite.neat.v0.core._constants import BASE_MODEL, get_base_concepts
|
|
18
|
+
from cognite.neat.v0.core._data_model._constants import get_internal_properties
|
|
19
|
+
from cognite.neat.v0.core._data_model._shared import VerifiedDataModel
|
|
20
|
+
from cognite.neat.v0.core._data_model.models import (
|
|
21
21
|
SheetRow,
|
|
22
22
|
)
|
|
23
|
-
from cognite.neat.core._data_model.models._base_verified import (
|
|
23
|
+
from cognite.neat.v0.core._data_model.models._base_verified import (
|
|
24
24
|
BaseVerifiedMetadata,
|
|
25
25
|
RoleTypes,
|
|
26
26
|
)
|
|
27
|
-
from cognite.neat.core._data_model.models.conceptual._verified import (
|
|
27
|
+
from cognite.neat.v0.core._data_model.models.conceptual._verified import (
|
|
28
28
|
ConceptualDataModel,
|
|
29
29
|
)
|
|
30
|
-
from cognite.neat.core._data_model.models.data_types import (
|
|
30
|
+
from cognite.neat.v0.core._data_model.models.data_types import (
|
|
31
31
|
_DATA_TYPE_BY_DMS_TYPE,
|
|
32
32
|
)
|
|
33
|
-
from cognite.neat.core._data_model.models.physical._verified import PhysicalDataModel
|
|
34
|
-
from cognite.neat.core._utils.spreadsheet import (
|
|
35
|
-
|
|
33
|
+
from cognite.neat.v0.core._data_model.models.physical._verified import PhysicalDataModel
|
|
34
|
+
from cognite.neat.v0.core._utils.spreadsheet import (
|
|
35
|
+
find_column_and_row_with_value,
|
|
36
36
|
generate_data_validation,
|
|
37
37
|
)
|
|
38
38
|
|
|
@@ -217,7 +217,7 @@ class ExcelExporter(BaseExporter[VerifiedDataModel, Workbook]):
|
|
|
217
217
|
continue
|
|
218
218
|
ws = workbook[sheet]
|
|
219
219
|
for col in get_internal_properties():
|
|
220
|
-
column_letter =
|
|
220
|
+
column_letter = find_column_and_row_with_value(ws, col)[0]
|
|
221
221
|
if column_letter:
|
|
222
222
|
ws.column_dimensions[column_letter].hidden = True
|
|
223
223
|
|
|
@@ -344,7 +344,7 @@ class ExcelExporter(BaseExporter[VerifiedDataModel, Workbook]):
|
|
|
344
344
|
for value_type_counter, value_type in enumerate(_DATA_TYPE_BY_DMS_TYPE.values()):
|
|
345
345
|
value_type_as_str = value_type.dms._type.casefold() if role == RoleTypes.dms else value_type.xsd
|
|
346
346
|
# skip types which require special handling or are surpassed by CDM
|
|
347
|
-
if value_type_as_str in ["enum", "timeseries", "sequence", "file"
|
|
347
|
+
if value_type_as_str in ["enum", "timeseries", "sequence", "file"]:
|
|
348
348
|
continue
|
|
349
349
|
workbook[self._helper_sheet_name].cell(
|
|
350
350
|
row=value_type_counter + 1,
|
|
@@ -451,7 +451,7 @@ class ExcelExporter(BaseExporter[VerifiedDataModel, Workbook]):
|
|
|
451
451
|
workbook[sheet_name].add_data_validation(data_validators[data_validator_name])
|
|
452
452
|
|
|
453
453
|
# APPLY VALIDATOR TO SPECIFIC COLUMN
|
|
454
|
-
if column_letter :=
|
|
454
|
+
if column_letter := find_column_and_row_with_value(workbook[sheet_name], column_name)[0]:
|
|
455
455
|
data_validators[data_validator_name].add(f"{column_letter}{3}:{column_letter}{3 + total_rows}")
|
|
456
456
|
|
|
457
457
|
def _create_sheet_with_header(
|
|
@@ -8,12 +8,12 @@ from openpyxl.styles import Alignment, Border, Font, NamedStyle, PatternFill, Si
|
|
|
8
8
|
from openpyxl.utils import get_column_letter
|
|
9
9
|
from openpyxl.worksheet.datavalidation import DataValidation
|
|
10
10
|
|
|
11
|
-
from cognite.neat.core._data_model._constants import EntityTypes
|
|
12
|
-
from cognite.neat.core._data_model.analysis import DataModelAnalysis
|
|
13
|
-
from cognite.neat.core._data_model.models.conceptual._verified import (
|
|
11
|
+
from cognite.neat.v0.core._data_model._constants import EntityTypes
|
|
12
|
+
from cognite.neat.v0.core._data_model.analysis import DataModelAnalysis
|
|
13
|
+
from cognite.neat.v0.core._data_model.models.conceptual._verified import (
|
|
14
14
|
ConceptualDataModel,
|
|
15
15
|
)
|
|
16
|
-
from cognite.neat.core._data_model.models.entities._single_value import ConceptEntity
|
|
16
|
+
from cognite.neat.v0.core._data_model.models.entities._single_value import ConceptEntity
|
|
17
17
|
|
|
18
18
|
from ._base import BaseExporter
|
|
19
19
|
|