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
|
@@ -10,17 +10,17 @@ from cognite.client import data_modeling as dm
|
|
|
10
10
|
from cognite.client.data_classes.capabilities import Capability, DataModelsAcl
|
|
11
11
|
from rdflib import URIRef
|
|
12
12
|
|
|
13
|
-
from cognite.neat.core._client import NeatClient
|
|
14
|
-
from cognite.neat.core._client._api.data_modeling_loaders import MultiCogniteAPIError
|
|
15
|
-
from cognite.neat.core._constants import COGNITE_SPACES
|
|
16
|
-
from cognite.neat.core._issues import IssueList, NeatIssue
|
|
17
|
-
from cognite.neat.core._issues.errors import ResourceCreationError, ResourceNotFoundError
|
|
18
|
-
from cognite.neat.core._issues.warnings import NeatValueWarning
|
|
19
|
-
from cognite.neat.core._store import NeatInstanceStore
|
|
20
|
-
from cognite.neat.core._utils.collection_ import iterate_progress_bar_if_above_config_threshold
|
|
21
|
-
from cognite.neat.core._utils.rdf_ import namespace_as_space, split_uri
|
|
22
|
-
from cognite.neat.core._utils.text import NamingStandardization
|
|
23
|
-
from cognite.neat.core._utils.upload import UploadResult
|
|
13
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
14
|
+
from cognite.neat.v0.core._client._api.data_modeling_loaders import MultiCogniteAPIError
|
|
15
|
+
from cognite.neat.v0.core._constants import COGNITE_SPACES
|
|
16
|
+
from cognite.neat.v0.core._issues import IssueList, NeatIssue
|
|
17
|
+
from cognite.neat.v0.core._issues.errors import ResourceCreationError, ResourceNotFoundError
|
|
18
|
+
from cognite.neat.v0.core._issues.warnings import NeatValueWarning
|
|
19
|
+
from cognite.neat.v0.core._store import NeatInstanceStore
|
|
20
|
+
from cognite.neat.v0.core._utils.collection_ import iterate_progress_bar_if_above_config_threshold
|
|
21
|
+
from cognite.neat.v0.core._utils.rdf_ import namespace_as_space, split_uri
|
|
22
|
+
from cognite.neat.v0.core._utils.text import NamingStandardization
|
|
23
|
+
from cognite.neat.v0.core._utils.upload import UploadResult
|
|
24
24
|
|
|
25
25
|
from ._base import _END_OF_CLASS, _START_OF_CLASS, CDFLoader
|
|
26
26
|
|
|
@@ -7,9 +7,9 @@ from rdflib import RDF, XSD, Namespace, URIRef
|
|
|
7
7
|
from rdflib import Literal as RdfLiteral
|
|
8
8
|
from rdflib.query import ResultRow
|
|
9
9
|
|
|
10
|
-
from cognite.neat.core._constants import NEAT
|
|
11
|
-
from cognite.neat.core._shared import InstanceType
|
|
12
|
-
from cognite.neat.core._utils.rdf_ import remove_namespace_from_uri
|
|
10
|
+
from cognite.neat.v0.core._constants import NEAT
|
|
11
|
+
from cognite.neat.v0.core._shared import InstanceType
|
|
12
|
+
from cognite.neat.v0.core._utils.rdf_ import remove_namespace_from_uri
|
|
13
13
|
|
|
14
14
|
from ._base import BaseQuery
|
|
15
15
|
|
|
@@ -450,3 +450,29 @@ class SelectQueries(BaseQuery):
|
|
|
450
450
|
yield instance_id, str(space.toPython())
|
|
451
451
|
else:
|
|
452
452
|
yield instance_id, str(space)
|
|
453
|
+
|
|
454
|
+
def get_graph_diff(
|
|
455
|
+
self, source_graph: URIRef, target_graph: URIRef
|
|
456
|
+
) -> Iterable[tuple[URIRef, URIRef, URIRef | RdfLiteral]]:
|
|
457
|
+
"""Return triples that exist in the source graph but not in the target graph.
|
|
458
|
+
|
|
459
|
+
This method compares two named graphs within the dataset and identifies all triples
|
|
460
|
+
that are present in the `source_graph` but are missing from the `target_graph`.
|
|
461
|
+
|
|
462
|
+
Args:
|
|
463
|
+
source_graph: URI of the graph to compare from.
|
|
464
|
+
target_graph: URI of the graph to compare against.
|
|
465
|
+
|
|
466
|
+
Returns:
|
|
467
|
+
Iterable of triples (subject, predicate, object)
|
|
468
|
+
"""
|
|
469
|
+
query = f"""
|
|
470
|
+
SELECT ?s ?p ?o
|
|
471
|
+
WHERE {{
|
|
472
|
+
GRAPH <{source_graph}> {{ ?s ?p ?o }}
|
|
473
|
+
FILTER NOT EXISTS {{
|
|
474
|
+
GRAPH <{target_graph}> {{ ?s ?p ?o }}
|
|
475
|
+
}}
|
|
476
|
+
}}
|
|
477
|
+
"""
|
|
478
|
+
return cast(Iterable[tuple[URIRef, URIRef, URIRef | RdfLiteral]], self.dataset.query(query))
|
|
@@ -7,12 +7,12 @@ from typing import ClassVar, TypeAlias, cast
|
|
|
7
7
|
from rdflib import Graph
|
|
8
8
|
from rdflib.query import ResultRow
|
|
9
9
|
|
|
10
|
-
from cognite.neat.core._issues.warnings import NeatValueWarning
|
|
11
|
-
from cognite.neat.core._shared import Triple
|
|
12
|
-
from cognite.neat.core._utils.collection_ import (
|
|
10
|
+
from cognite.neat.v0.core._issues.warnings import NeatValueWarning
|
|
11
|
+
from cognite.neat.v0.core._shared import Triple
|
|
12
|
+
from cognite.neat.v0.core._utils.collection_ import (
|
|
13
13
|
iterate_progress_bar_if_above_config_threshold,
|
|
14
14
|
)
|
|
15
|
-
from cognite.neat.core._utils.graph_transformations_report import (
|
|
15
|
+
from cognite.neat.v0.core._utils.graph_transformations_report import (
|
|
16
16
|
GraphTransformationResult,
|
|
17
17
|
)
|
|
18
18
|
|
|
@@ -8,12 +8,12 @@ from typing import cast
|
|
|
8
8
|
from rdflib import RDF, Graph, Literal, Namespace, URIRef
|
|
9
9
|
from rdflib.query import ResultRow
|
|
10
10
|
|
|
11
|
-
from cognite.neat.core._constants import CLASSIC_CDF_NAMESPACE, DEFAULT_NAMESPACE
|
|
12
|
-
from cognite.neat.core._instances import extractors
|
|
13
|
-
from cognite.neat.core._issues.errors import NeatValueError
|
|
14
|
-
from cognite.neat.core._issues.warnings import ResourceNotFoundWarning
|
|
15
|
-
from cognite.neat.core._utils.collection_ import iterate_progress_bar
|
|
16
|
-
from cognite.neat.core._utils.rdf_ import (
|
|
11
|
+
from cognite.neat.v0.core._constants import CLASSIC_CDF_NAMESPACE, DEFAULT_NAMESPACE
|
|
12
|
+
from cognite.neat.v0.core._instances import extractors
|
|
13
|
+
from cognite.neat.v0.core._issues.errors import NeatValueError
|
|
14
|
+
from cognite.neat.v0.core._issues.warnings import ResourceNotFoundWarning
|
|
15
|
+
from cognite.neat.v0.core._utils.collection_ import iterate_progress_bar
|
|
16
|
+
from cognite.neat.v0.core._utils.rdf_ import (
|
|
17
17
|
Triple,
|
|
18
18
|
add_triples_in_batch,
|
|
19
19
|
get_namespace,
|
|
@@ -3,10 +3,10 @@ from typing import Any, cast
|
|
|
3
3
|
from rdflib import Graph, Namespace, URIRef
|
|
4
4
|
from rdflib.query import ResultRow
|
|
5
5
|
|
|
6
|
-
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
7
|
-
from cognite.neat.core._shared import Triple
|
|
8
|
-
from cognite.neat.core._utils.rdf_ import as_neat_compliant_uri
|
|
9
|
-
from cognite.neat.core._utils.text import sentence_or_string_to_camel
|
|
6
|
+
from cognite.neat.v0.core._constants import DEFAULT_NAMESPACE
|
|
7
|
+
from cognite.neat.v0.core._shared import Triple
|
|
8
|
+
from cognite.neat.v0.core._utils.rdf_ import as_neat_compliant_uri
|
|
9
|
+
from cognite.neat.v0.core._utils.text import sentence_or_string_to_camel
|
|
10
10
|
|
|
11
11
|
from ._base import BaseTransformer, BaseTransformerStandardised, RowTransformationOutput
|
|
12
12
|
|
|
@@ -4,7 +4,7 @@ from urllib.parse import quote
|
|
|
4
4
|
from rdflib import Namespace, URIRef
|
|
5
5
|
from rdflib.query import ResultRow
|
|
6
6
|
|
|
7
|
-
from cognite.neat.core._utils.rdf_ import get_namespace, remove_namespace_from_uri
|
|
7
|
+
from cognite.neat.v0.core._utils.rdf_ import get_namespace, remove_namespace_from_uri
|
|
8
8
|
|
|
9
9
|
from ._base import BaseTransformerStandardised, RowTransformationOutput
|
|
10
10
|
|
|
@@ -7,10 +7,10 @@ import rdflib
|
|
|
7
7
|
from rdflib import RDF, RDFS, Graph, Literal, Namespace, URIRef
|
|
8
8
|
from rdflib.query import ResultRow
|
|
9
9
|
|
|
10
|
-
from cognite.neat.core._constants import NEAT
|
|
11
|
-
from cognite.neat.core._issues.warnings import PropertyDataTypeConversionWarning
|
|
12
|
-
from cognite.neat.core._utils.auxiliary import string_to_ideal_type
|
|
13
|
-
from cognite.neat.core._utils.rdf_ import Triple, get_namespace, remove_namespace_from_uri, uri_to_cdf_id
|
|
10
|
+
from cognite.neat.v0.core._constants import NEAT
|
|
11
|
+
from cognite.neat.v0.core._issues.warnings import PropertyDataTypeConversionWarning
|
|
12
|
+
from cognite.neat.v0.core._utils.auxiliary import string_to_ideal_type
|
|
13
|
+
from cognite.neat.v0.core._utils.rdf_ import Triple, get_namespace, remove_namespace_from_uri, uri_to_cdf_id
|
|
14
14
|
|
|
15
15
|
from ._base import BaseTransformerStandardised, RowTransformationOutput
|
|
16
16
|
|
|
@@ -16,7 +16,7 @@ from cognite.client.data_classes.data_modeling import (
|
|
|
16
16
|
ViewId,
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
-
from cognite.neat.core._utils.text import (
|
|
19
|
+
from cognite.neat.v0.core._utils.text import (
|
|
20
20
|
humanize_collection,
|
|
21
21
|
to_camel_case,
|
|
22
22
|
to_snake_case,
|
|
@@ -119,12 +119,12 @@ class NeatIssue:
|
|
|
119
119
|
|
|
120
120
|
@classmethod
|
|
121
121
|
def _dump_value(cls, value: Any) -> list | int | bool | float | str | dict:
|
|
122
|
-
from cognite.neat.core._data_model.models.entities import ConceptualEntity
|
|
122
|
+
from cognite.neat.v0.core._data_model.models.entities import ConceptualEntity
|
|
123
123
|
|
|
124
124
|
if isinstance(value, str | int | bool | float):
|
|
125
125
|
return value
|
|
126
126
|
elif isinstance(value, frozenset):
|
|
127
|
-
return [cls._dump_value(item) for item in value]
|
|
127
|
+
return [cls._dump_value(item) for item in sorted(value)]
|
|
128
128
|
elif isinstance(value, Path):
|
|
129
129
|
return value.as_posix()
|
|
130
130
|
elif isinstance(value, tuple):
|
|
@@ -144,11 +144,11 @@ class NeatIssue:
|
|
|
144
144
|
@classmethod
|
|
145
145
|
def load(cls, data: dict[str, Any]) -> "NeatIssue":
|
|
146
146
|
"""Create an instance of the issue from a dictionary."""
|
|
147
|
-
from cognite.neat.core._issues.errors import (
|
|
147
|
+
from cognite.neat.v0.core._issues.errors import (
|
|
148
148
|
_NEAT_ERRORS_BY_NAME,
|
|
149
149
|
NeatValueError,
|
|
150
150
|
)
|
|
151
|
-
from cognite.neat.core._issues.warnings import _NEAT_WARNINGS_BY_NAME
|
|
151
|
+
from cognite.neat.v0.core._issues.warnings import _NEAT_WARNINGS_BY_NAME
|
|
152
152
|
|
|
153
153
|
if "NeatIssue" not in data:
|
|
154
154
|
raise NeatValueError("The data does not contain a NeatIssue key.")
|
|
@@ -173,7 +173,7 @@ class NeatIssue:
|
|
|
173
173
|
|
|
174
174
|
@classmethod
|
|
175
175
|
def _load_value(cls, type_: Any, value: Any) -> Any:
|
|
176
|
-
from cognite.neat.core._data_model.models.entities import ConceptualEntity
|
|
176
|
+
from cognite.neat.v0.core._data_model.models.entities import ConceptualEntity
|
|
177
177
|
|
|
178
178
|
if isinstance(type_, UnionType) or get_origin(type_) is UnionType:
|
|
179
179
|
args = get_args(type_)
|
|
@@ -255,6 +255,11 @@ class IssueList(list, Sequence[NeatIssue]):
|
|
|
255
255
|
self.action = action
|
|
256
256
|
self.hint = hint
|
|
257
257
|
|
|
258
|
+
def append_if_not_exist(self, issue: NeatIssue) -> None:
|
|
259
|
+
"""Append an issue to the list if it does not already exist."""
|
|
260
|
+
if issue not in self:
|
|
261
|
+
self.append(issue)
|
|
262
|
+
|
|
258
263
|
@property
|
|
259
264
|
def errors(self) -> Self:
|
|
260
265
|
"""Return all the errors in this list."""
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import warnings
|
|
2
2
|
from collections.abc import Iterator
|
|
3
3
|
from contextlib import contextmanager
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
4
5
|
|
|
5
6
|
from pydantic import ValidationError
|
|
6
7
|
|
|
7
|
-
from cognite.neat.core._utils.spreadsheet import SpreadsheetRead
|
|
8
|
-
|
|
9
8
|
from ._base import IssueList, MultiValueError, NeatError
|
|
10
9
|
from ._factory import from_pydantic_errors, from_warning
|
|
11
10
|
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from cognite.neat.v0.core._data_model.models._import_contexts import ImportContext
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
@contextmanager
|
|
14
16
|
def catch_warnings() -> Iterator[IssueList]:
|
|
@@ -26,12 +28,12 @@ def catch_warnings() -> Iterator[IssueList]:
|
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
@contextmanager
|
|
29
|
-
def catch_issues(
|
|
31
|
+
def catch_issues(context: "ImportContext | None" = None) -> Iterator[IssueList]:
|
|
30
32
|
"""This is an internal help function to handle issues and warnings.
|
|
31
33
|
|
|
32
34
|
Args:
|
|
33
|
-
|
|
34
|
-
the row numbers in the errors/warnings.
|
|
35
|
+
context (ImportContext): The read context. This is used to adjust
|
|
36
|
+
the row numbers in the errors/warnings if the data is read from a spreadsheet.
|
|
35
37
|
|
|
36
38
|
Returns:
|
|
37
39
|
IssueList: The list of issues.
|
|
@@ -41,7 +43,7 @@ def catch_issues(read_info_by_sheet: dict[str, SpreadsheetRead] | None = None) -
|
|
|
41
43
|
try:
|
|
42
44
|
yield issues
|
|
43
45
|
except ValidationError as e:
|
|
44
|
-
issues.extend(from_pydantic_errors(e.errors(),
|
|
46
|
+
issues.extend(from_pydantic_errors(e.errors(), context))
|
|
45
47
|
except NeatError as single:
|
|
46
48
|
issues.append(single)
|
|
47
49
|
except MultiValueError as multi:
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
from typing import cast
|
|
1
|
+
from typing import TYPE_CHECKING, cast
|
|
2
2
|
from warnings import WarningMessage
|
|
3
3
|
|
|
4
4
|
from pydantic_core import ErrorDetails
|
|
5
5
|
|
|
6
|
-
from cognite.neat.core._issues._base import NeatError, NeatWarning
|
|
7
|
-
from cognite.neat.core._utils.spreadsheet import SpreadsheetRead
|
|
6
|
+
from cognite.neat.v0.core._issues._base import NeatError, NeatWarning
|
|
8
7
|
|
|
9
8
|
from .errors import NeatValueError, SpreadsheetError
|
|
10
9
|
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from cognite.neat.v0.core._data_model.models._import_contexts import ImportContext, SpreadsheetContext
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
|
|
14
|
+
def from_pydantic_errors(errors: list[ErrorDetails], context: "ImportContext | None" = None) -> list[NeatError]:
|
|
15
|
+
# To avoid circular import, we import SpreadsheetContext here.
|
|
16
|
+
from cognite.neat.v0.core._data_model.models._import_contexts import SpreadsheetContext
|
|
17
|
+
|
|
18
|
+
read_info_by_sheet = context if isinstance(context, SpreadsheetContext) else SpreadsheetContext({})
|
|
16
19
|
return [
|
|
17
20
|
_from_pydantic_error(error, read_info_by_sheet)
|
|
18
21
|
for error in errors
|
|
@@ -29,7 +32,7 @@ def from_warning(warning: WarningMessage) -> NeatWarning | None:
|
|
|
29
32
|
return None
|
|
30
33
|
|
|
31
34
|
|
|
32
|
-
def _from_pydantic_error(error: ErrorDetails, read_info_by_sheet:
|
|
35
|
+
def _from_pydantic_error(error: ErrorDetails, read_info_by_sheet: "SpreadsheetContext") -> NeatError:
|
|
33
36
|
neat_error = _create_neat_value_error(error)
|
|
34
37
|
location = error["loc"]
|
|
35
38
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from cognite.neat.core._issues._base import NeatError, _get_subclasses
|
|
1
|
+
from cognite.neat.v0.core._issues._base import NeatError, _get_subclasses
|
|
2
2
|
|
|
3
3
|
from ._external import (
|
|
4
4
|
AuthorizationError,
|
|
@@ -16,6 +16,7 @@ from ._general import NeatImportError, NeatTypeError, NeatValueError, RegexViola
|
|
|
16
16
|
from ._properties import (
|
|
17
17
|
PropertyDefinitionDuplicatedError,
|
|
18
18
|
PropertyDefinitionError,
|
|
19
|
+
PropertyInvalidDefinitionError,
|
|
19
20
|
PropertyMappingDuplicatedError,
|
|
20
21
|
PropertyNotFoundError,
|
|
21
22
|
PropertyTypeNotSupportedError,
|
|
@@ -65,6 +66,7 @@ __all__ = [
|
|
|
65
66
|
"OxigraphStorageLockedError",
|
|
66
67
|
"PropertyDefinitionDuplicatedError",
|
|
67
68
|
"PropertyDefinitionError",
|
|
69
|
+
"PropertyInvalidDefinitionError",
|
|
68
70
|
"PropertyMappingDuplicatedError",
|
|
69
71
|
"PropertyNotFoundError",
|
|
70
72
|
"PropertyTypeNotSupportedError",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Generic
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core._issues._base import ResourceType
|
|
4
|
+
from cognite.neat.v0.core._issues._base import ResourceType
|
|
5
5
|
|
|
6
6
|
from ._resources import ResourceError, T_Identifier, T_ReferenceIdentifier
|
|
7
7
|
|
|
@@ -60,6 +60,17 @@ class PropertyDefinitionDuplicatedError(PropertyError[T_Identifier]):
|
|
|
60
60
|
location_name: str | None = None
|
|
61
61
|
|
|
62
62
|
|
|
63
|
+
@dataclass(unsafe_hash=True)
|
|
64
|
+
class PropertyInvalidDefinitionError(PropertyError[T_Identifier]):
|
|
65
|
+
"""The {resource_type} with identifier {identifier} has an invalid definition of {property_name}. {reason}"""
|
|
66
|
+
|
|
67
|
+
extra = "in locations {locations} with name {location_name}"
|
|
68
|
+
|
|
69
|
+
reason: str
|
|
70
|
+
locations: tuple[str | int, ...] | None = None
|
|
71
|
+
location_name: str | None = None
|
|
72
|
+
|
|
73
|
+
|
|
63
74
|
@dataclass(unsafe_hash=True)
|
|
64
75
|
class PropertyMappingDuplicatedError(PropertyError[T_Identifier], Generic[T_Identifier, T_ReferenceIdentifier]):
|
|
65
76
|
"""The {resource_type} with identifier {identifier}.{property_name} is mapped to by: {mappings}. Ensure
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Generic
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core._issues._base import (
|
|
4
|
+
from cognite.neat.v0.core._issues._base import (
|
|
5
5
|
NeatError,
|
|
6
6
|
ResourceType,
|
|
7
7
|
T_Identifier,
|
|
8
8
|
T_ReferenceIdentifier,
|
|
9
9
|
)
|
|
10
|
-
from cognite.neat.core._utils.text import humanize_collection
|
|
10
|
+
from cognite.neat.v0.core._utils.text import humanize_collection
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
@dataclass(unsafe_hash=True)
|
|
@@ -2,8 +2,8 @@ from abc import ABC
|
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
from typing import ClassVar, cast
|
|
4
4
|
|
|
5
|
-
from cognite.neat.core._issues import NeatError
|
|
6
|
-
from cognite.neat.core._utils.spreadsheet import SpreadsheetRead
|
|
5
|
+
from cognite.neat.v0.core._issues import NeatError
|
|
6
|
+
from cognite.neat.v0.core._utils.spreadsheet import SpreadsheetRead
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
@dataclass(unsafe_hash=True)
|
|
@@ -20,7 +20,11 @@ class SpreadsheetError(NeatError, ValueError, ABC):
|
|
|
20
20
|
spreadsheet_name = cast(str, location[0])
|
|
21
21
|
if spreadsheet_name not in ERROR_CLS_BY_SPREADSHEET_NAME:
|
|
22
22
|
# This happens for the metadata sheet, which are individual fields
|
|
23
|
-
|
|
23
|
+
if spreadsheet_name == "Metadata" and len(location) >= 2 and isinstance(location[1], str):
|
|
24
|
+
field_name = cast(str, location[1])
|
|
25
|
+
else:
|
|
26
|
+
field_name = spreadsheet_name
|
|
27
|
+
return MetadataValueError(error, field_name=field_name)
|
|
24
28
|
|
|
25
29
|
error_cls = ERROR_CLS_BY_SPREADSHEET_NAME[spreadsheet_name]
|
|
26
30
|
row, column = cast(tuple[int, str], location[2:4])
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
conflicts with the built-in Python warnings module. However, it is expected to always be used in an absolute
|
|
3
3
|
import, and should thus not cause a naming conflict."""
|
|
4
4
|
|
|
5
|
-
from cognite.neat.core._issues._base import NeatWarning, _get_subclasses
|
|
5
|
+
from cognite.neat.v0.core._issues._base import NeatWarning, _get_subclasses
|
|
6
6
|
|
|
7
7
|
from . import user_modeling
|
|
8
8
|
from ._external import (
|
|
@@ -23,6 +23,7 @@ from ._general import (
|
|
|
23
23
|
from ._models import (
|
|
24
24
|
BreakingModelingPrincipleWarning,
|
|
25
25
|
CDFNotSupportedWarning,
|
|
26
|
+
ConversionToPhysicalModelImpossibleWarning,
|
|
26
27
|
NotSupportedHasDataFilterLimitWarning,
|
|
27
28
|
NotSupportedViewContainerLimitWarning,
|
|
28
29
|
PrincipleMatchingSpaceAndVersionWarning,
|
|
@@ -34,6 +35,7 @@ from ._models import (
|
|
|
34
35
|
from ._properties import (
|
|
35
36
|
PropertyDataTypeConversionWarning,
|
|
36
37
|
PropertyDefinitionDuplicatedWarning,
|
|
38
|
+
PropertyDefinitionWarning,
|
|
37
39
|
PropertyDirectRelationLimitWarning,
|
|
38
40
|
PropertyMultipleValueWarning,
|
|
39
41
|
PropertyNotFoundWarning,
|
|
@@ -57,6 +59,7 @@ __all__ = [
|
|
|
57
59
|
"CDFAuthWarning",
|
|
58
60
|
"CDFMaxIterationsWarning",
|
|
59
61
|
"CDFNotSupportedWarning",
|
|
62
|
+
"ConversionToPhysicalModelImpossibleWarning",
|
|
60
63
|
"DeprecatedWarning",
|
|
61
64
|
"FileItemNotSupportedWarning",
|
|
62
65
|
"FileMissingRequiredFieldWarning",
|
|
@@ -72,6 +75,7 @@ __all__ = [
|
|
|
72
75
|
"PrincipleSolutionBuildsOnEnterpriseWarning",
|
|
73
76
|
"PropertyDataTypeConversionWarning",
|
|
74
77
|
"PropertyDefinitionDuplicatedWarning",
|
|
78
|
+
"PropertyDefinitionWarning",
|
|
75
79
|
"PropertyDirectRelationLimitWarning",
|
|
76
80
|
"PropertyMultipleValueWarning",
|
|
77
81
|
"PropertyNotFoundWarning",
|
|
@@ -4,8 +4,8 @@ from typing import ClassVar
|
|
|
4
4
|
|
|
5
5
|
from cognite.client.data_classes.data_modeling import DataModelId, ViewId
|
|
6
6
|
|
|
7
|
-
from cognite.neat.core._constants import DMS_VIEW_CONTAINER_SIZE_LIMIT
|
|
8
|
-
from cognite.neat.core._issues import NeatWarning
|
|
7
|
+
from cognite.neat.v0.core._constants import DMS_VIEW_CONTAINER_SIZE_LIMIT
|
|
8
|
+
from cognite.neat.v0.core._issues import NeatWarning
|
|
9
9
|
|
|
10
10
|
_BASE_URL = "https://cognite-neat.readthedocs-hosted.com/en/latest/data-modeling-principles.html"
|
|
11
11
|
|
|
@@ -92,15 +92,50 @@ class NotSupportedHasDataFilterLimitWarning(CDFNotSupportedWarning):
|
|
|
92
92
|
limit: int = DMS_VIEW_CONTAINER_SIZE_LIMIT
|
|
93
93
|
|
|
94
94
|
|
|
95
|
+
@dataclass(unsafe_hash=True)
|
|
96
|
+
class ViewWithoutPropertiesWarning(UserModelingWarning):
|
|
97
|
+
"""View {view_id} has neither explicit properties nor implements views that have properties."""
|
|
98
|
+
|
|
99
|
+
fix = "Define properties for view or inherit properties by implementing view(s) that has properties."
|
|
100
|
+
|
|
101
|
+
view_id: ViewId
|
|
102
|
+
|
|
103
|
+
|
|
95
104
|
@dataclass(unsafe_hash=True)
|
|
96
105
|
class UndefinedConceptWarning(UserModelingWarning):
|
|
97
|
-
"""
|
|
106
|
+
"""Concept {concept_id} has no explicit properties neither implements concepts that have properties."""
|
|
98
107
|
|
|
99
|
-
fix = "Define properties for concept or inherit properties by implementing
|
|
108
|
+
fix = "Define properties for concept or inherit properties by implementing concept(s) that has properties."
|
|
100
109
|
|
|
101
110
|
concept_id: str
|
|
102
111
|
|
|
103
112
|
|
|
113
|
+
@dataclass(unsafe_hash=True)
|
|
114
|
+
class ConceptOnlyDataModelWarning(UserModelingWarning):
|
|
115
|
+
"""Data model is concept-only (contains concepts but no properties).
|
|
116
|
+
This model will likely cause issues when converting to a physical data model."""
|
|
117
|
+
|
|
118
|
+
fix = "Define properties for concepts or make sure that concepts implement other concepts that have properties."
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@dataclass(unsafe_hash=True)
|
|
122
|
+
class ConversionToPhysicalModelImpossibleWarning(UserModelingWarning):
|
|
123
|
+
"""Conceptual data model has {issue_types} that will lead to problems when converting to a physical data model."""
|
|
124
|
+
|
|
125
|
+
fix = "Fix the issues in the conceptual data model before attempting to convert it to a physical data model."
|
|
126
|
+
issue_types: frozenset[str]
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@dataclass(unsafe_hash=True)
|
|
130
|
+
class DanglingPropertyWarning(UserModelingWarning):
|
|
131
|
+
"""Property {property_id} is not defined for any concept.
|
|
132
|
+
This will likely cause issues when converting to a physical data model."""
|
|
133
|
+
|
|
134
|
+
fix = "Define the property for a concept or remove it from the data model."
|
|
135
|
+
|
|
136
|
+
property_id: str
|
|
137
|
+
|
|
138
|
+
|
|
104
139
|
@dataclass(unsafe_hash=True)
|
|
105
140
|
class UndefinedViewWarning(UserModelingWarning):
|
|
106
141
|
"""Undefined view {value_type} has been referred as value type for property <{view_property}> of view {view_id}."""
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Generic
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core._constants import DMS_DIRECT_RELATION_LIST_DEFAULT_LIMIT
|
|
5
|
-
from cognite.neat.core._issues._base import ResourceType
|
|
4
|
+
from cognite.neat.v0.core._constants import DMS_DIRECT_RELATION_LIST_DEFAULT_LIMIT
|
|
5
|
+
from cognite.neat.v0.core._issues._base import ResourceType
|
|
6
6
|
|
|
7
7
|
from ._resources import ResourceNeatWarning, T_Identifier, T_ReferenceIdentifier
|
|
8
8
|
|
|
@@ -90,6 +90,17 @@ class PropertyMultipleValueWarning(PropertyWarning[T_Identifier]):
|
|
|
90
90
|
value: str
|
|
91
91
|
|
|
92
92
|
|
|
93
|
+
@dataclass(unsafe_hash=True)
|
|
94
|
+
class PropertyDefinitionWarning(PropertyWarning[T_Identifier]):
|
|
95
|
+
"""The {resource_type} with identifier {identifier} property {property_name}: {reason}"""
|
|
96
|
+
|
|
97
|
+
extra = "in locations {locations} with name {location_name}"
|
|
98
|
+
|
|
99
|
+
reason: str
|
|
100
|
+
locations: tuple[str | int, ...] | None = None
|
|
101
|
+
location_name: str | None = None
|
|
102
|
+
|
|
103
|
+
|
|
93
104
|
@dataclass(unsafe_hash=True)
|
|
94
105
|
class ReversedConnectionNotFeasibleWarning(PropertyWarning[T_Identifier]):
|
|
95
106
|
"""The {resource_type} {identifier}.{property_name} cannot be created: {reason}"""
|
|
@@ -7,7 +7,7 @@ from dataclasses import dataclass
|
|
|
7
7
|
|
|
8
8
|
from cognite.client.data_classes.data_modeling import ContainerId, ViewId
|
|
9
9
|
|
|
10
|
-
from cognite.neat.core._constants import DMS_CONTAINER_PROPERTY_SIZE_LIMIT
|
|
10
|
+
from cognite.neat.v0.core._constants import DMS_CONTAINER_PROPERTY_SIZE_LIMIT
|
|
11
11
|
|
|
12
12
|
from ._models import UserModelingWarning
|
|
13
13
|
|
|
@@ -10,25 +10,25 @@ from typing import Any, cast
|
|
|
10
10
|
import rdflib
|
|
11
11
|
from rdflib import URIRef
|
|
12
12
|
|
|
13
|
-
from cognite.neat.core._client import NeatClient
|
|
14
|
-
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
15
|
-
from cognite.neat.core._data_model._shared import T_VerifiedDataModel, VerifiedDataModel
|
|
16
|
-
from cognite.neat.core._data_model.exporters import BaseExporter
|
|
17
|
-
from cognite.neat.core._data_model.exporters._base import CDFExporter, T_Export
|
|
18
|
-
from cognite.neat.core._data_model.importers import BaseImporter
|
|
19
|
-
from cognite.neat.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
20
|
-
from cognite.neat.core._data_model.transformers import (
|
|
13
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
14
|
+
from cognite.neat.v0.core._constants import DEFAULT_NAMESPACE
|
|
15
|
+
from cognite.neat.v0.core._data_model._shared import T_VerifiedDataModel, VerifiedDataModel
|
|
16
|
+
from cognite.neat.v0.core._data_model.exporters import BaseExporter
|
|
17
|
+
from cognite.neat.v0.core._data_model.exporters._base import CDFExporter, T_Export
|
|
18
|
+
from cognite.neat.v0.core._data_model.importers import BaseImporter
|
|
19
|
+
from cognite.neat.v0.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
20
|
+
from cognite.neat.v0.core._data_model.transformers import (
|
|
21
21
|
PhysicalToConceptual,
|
|
22
22
|
VerifiedDataModelTransformer,
|
|
23
23
|
VerifyAnyDataModel,
|
|
24
24
|
)
|
|
25
|
-
from cognite.neat.core._instances.extractors import (
|
|
25
|
+
from cognite.neat.v0.core._instances.extractors import (
|
|
26
26
|
DMSGraphExtractor,
|
|
27
27
|
KnowledgeGraphExtractor,
|
|
28
28
|
)
|
|
29
|
-
from cognite.neat.core._issues import IssueList, catch_issues
|
|
30
|
-
from cognite.neat.core._issues.errors import NeatValueError
|
|
31
|
-
from cognite.neat.core._utils.upload import UploadResultList
|
|
29
|
+
from cognite.neat.v0.core._issues import IssueList, catch_issues
|
|
30
|
+
from cognite.neat.v0.core._issues.errors import NeatValueError
|
|
31
|
+
from cognite.neat.v0.core._utils.upload import UploadResultList
|
|
32
32
|
|
|
33
33
|
from ._provenance import (
|
|
34
34
|
EXTERNAL_AGENT,
|
|
@@ -355,6 +355,7 @@ class NeatDataModelStore:
|
|
|
355
355
|
|
|
356
356
|
agent = exporter.agent
|
|
357
357
|
start = datetime.now(timezone.utc)
|
|
358
|
+
result: UploadResultList | Path | URIRef | None = None
|
|
358
359
|
with catch_issues() as issue_list:
|
|
359
360
|
# Validate the type of the result
|
|
360
361
|
result = action(input_, *exporter_args)
|