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
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
from collections.abc import Iterable, Set
|
|
2
|
+
from typing import Literal
|
|
3
|
+
|
|
4
|
+
from cognite.neat.v0.core._data_model.models import ConceptualDataModel, SheetList
|
|
5
|
+
from cognite.neat.v0.core._data_model.models.conceptual import Concept, ConceptualProperty
|
|
6
|
+
from cognite.neat.v0.core._data_model.models.data_types import DataType
|
|
7
|
+
from cognite.neat.v0.core._data_model.models.entities import (
|
|
8
|
+
ConceptEntity,
|
|
9
|
+
MultiValueTypeInfo,
|
|
10
|
+
UnknownEntity,
|
|
11
|
+
)
|
|
12
|
+
from cognite.neat.v0.core._data_model.transformers import VerifiedDataModelTransformer
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class UnionConceptualDataModel(VerifiedDataModelTransformer[ConceptualDataModel, ConceptualDataModel]):
|
|
16
|
+
"""Takes the union two conceptual models.
|
|
17
|
+
Args:
|
|
18
|
+
primary: The primary model to merge with the secondary model given in the transform method.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, primary: ConceptualDataModel) -> None:
|
|
22
|
+
self.primary = primary
|
|
23
|
+
|
|
24
|
+
def transform(self, data_model: ConceptualDataModel) -> ConceptualDataModel:
|
|
25
|
+
primary_model = self.primary
|
|
26
|
+
secondary_model = data_model
|
|
27
|
+
|
|
28
|
+
output = primary_model.model_copy(deep=True)
|
|
29
|
+
secondary_concepts = {cls.concept: cls for cls in secondary_model.concepts}
|
|
30
|
+
secondary_properties = {(prop.concept, prop.property_): prop for prop in secondary_model.properties}
|
|
31
|
+
|
|
32
|
+
union_concepts_by_id = self._union_concepts(output.concepts, secondary_concepts)
|
|
33
|
+
output.concepts = SheetList[Concept](union_concepts_by_id.values())
|
|
34
|
+
|
|
35
|
+
union_properties = self._union_properties(
|
|
36
|
+
output.properties, secondary_properties, set(union_concepts_by_id.keys())
|
|
37
|
+
)
|
|
38
|
+
output.properties = SheetList[ConceptualProperty](union_properties.values())
|
|
39
|
+
|
|
40
|
+
return output
|
|
41
|
+
|
|
42
|
+
def _union_concepts(
|
|
43
|
+
self, primary_concepts: Iterable[Concept], new_concepts: dict[ConceptEntity, Concept]
|
|
44
|
+
) -> dict[ConceptEntity, Concept]:
|
|
45
|
+
union_concepts = {cls.concept: cls for cls in primary_concepts}
|
|
46
|
+
for concept, primary_concept in union_concepts.items():
|
|
47
|
+
if concept not in new_concepts:
|
|
48
|
+
continue
|
|
49
|
+
secondary_concept = new_concepts[concept]
|
|
50
|
+
union_concepts[concept] = self.union_concepts(
|
|
51
|
+
primary=primary_concept,
|
|
52
|
+
secondary=secondary_concept,
|
|
53
|
+
conflict_resolution="combined",
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
for concept, secondary_concept in new_concepts.items():
|
|
57
|
+
if concept not in union_concepts:
|
|
58
|
+
union_concepts[concept] = secondary_concept
|
|
59
|
+
return union_concepts
|
|
60
|
+
|
|
61
|
+
def _union_properties(
|
|
62
|
+
self,
|
|
63
|
+
primary_properties: Iterable[ConceptualProperty],
|
|
64
|
+
secondary_properties: dict[tuple[ConceptEntity, str], ConceptualProperty],
|
|
65
|
+
used_concepts: Set[ConceptEntity],
|
|
66
|
+
) -> dict[tuple[ConceptEntity, str], ConceptualProperty]:
|
|
67
|
+
union_properties = {(prop.concept, prop.property_): prop for prop in primary_properties}
|
|
68
|
+
for (concept, prop_id), primary_property in union_properties.items():
|
|
69
|
+
if (concept not in used_concepts) or (concept, prop_id) not in secondary_properties:
|
|
70
|
+
continue
|
|
71
|
+
secondary_property = secondary_properties[(concept, prop_id)]
|
|
72
|
+
union_properties[(concept, prop_id)] = self.union_properties(
|
|
73
|
+
primary=primary_property,
|
|
74
|
+
secondary=secondary_property,
|
|
75
|
+
conflict_resolution="combined",
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
for (concept, prop_id), prop in secondary_properties.items():
|
|
79
|
+
if (concept, prop_id) not in union_properties and concept in used_concepts:
|
|
80
|
+
union_properties[(concept, prop_id)] = prop
|
|
81
|
+
return union_properties
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def union_concepts(
|
|
85
|
+
cls,
|
|
86
|
+
primary: Concept,
|
|
87
|
+
secondary: Concept,
|
|
88
|
+
conflict_resolution: Literal["priority", "combined"] = "priority",
|
|
89
|
+
) -> Concept:
|
|
90
|
+
"""Union two concepts.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
primary (Concept): The primary concept.
|
|
94
|
+
secondary (Concept): The secondary concept.
|
|
95
|
+
conflict_resolution (Literal["priority", "combined"]): How to resolve conflicts:
|
|
96
|
+
- "priority": Keep the primary concept with fallback to the secondary.
|
|
97
|
+
- "combined": Merge implements from both concepts. (only applies to implements)
|
|
98
|
+
Returns:
|
|
99
|
+
Concept: The union of the two concepts.
|
|
100
|
+
|
|
101
|
+
"""
|
|
102
|
+
if conflict_resolution == "combined":
|
|
103
|
+
all_implements = (primary.implements or []) + (secondary.implements or [])
|
|
104
|
+
implements = list(dict.fromkeys(all_implements))
|
|
105
|
+
else:
|
|
106
|
+
implements = (primary.implements or secondary.implements or []).copy()
|
|
107
|
+
|
|
108
|
+
return Concept(
|
|
109
|
+
neatId=primary.neatId,
|
|
110
|
+
concept=primary.concept,
|
|
111
|
+
name=primary.name or secondary.name,
|
|
112
|
+
description=primary.description or secondary.description,
|
|
113
|
+
implements=implements,
|
|
114
|
+
instance_source=primary.instance_source or secondary.instance_source,
|
|
115
|
+
physical=primary.physical,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
@classmethod
|
|
119
|
+
def union_properties(
|
|
120
|
+
cls,
|
|
121
|
+
primary: ConceptualProperty,
|
|
122
|
+
secondary: ConceptualProperty,
|
|
123
|
+
conflict_resolution: Literal["priority", "combined"] = "priority",
|
|
124
|
+
) -> ConceptualProperty:
|
|
125
|
+
"""Union two conceptual properties.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
primary (ConceptualProperty): The primary property.
|
|
129
|
+
secondary (ConceptualProperty): The secondary property.
|
|
130
|
+
conflict_resolution (Literal["priority", "combined"]): How to resolve conflicts:
|
|
131
|
+
- "priority": Keep the primary property with fallback to the secondary.
|
|
132
|
+
- "combined": Merge value types and instance sources.
|
|
133
|
+
Returns:
|
|
134
|
+
ConceptualProperty: The union of the two properties.
|
|
135
|
+
|
|
136
|
+
"""
|
|
137
|
+
if conflict_resolution == "combined":
|
|
138
|
+
all_sources = (primary.instance_source or []) + (secondary.instance_source or [])
|
|
139
|
+
instance_source = list(dict.fromkeys(all_sources))
|
|
140
|
+
else:
|
|
141
|
+
instance_source = (primary.instance_source or secondary.instance_source or []).copy()
|
|
142
|
+
|
|
143
|
+
use_primary = conflict_resolution == "priority"
|
|
144
|
+
return ConceptualProperty(
|
|
145
|
+
neatId=primary.neatId,
|
|
146
|
+
concept=primary.concept,
|
|
147
|
+
property_=primary.property_,
|
|
148
|
+
name=primary.name or secondary.name,
|
|
149
|
+
description=primary.description or secondary.description,
|
|
150
|
+
min_count=primary.min_count
|
|
151
|
+
if use_primary
|
|
152
|
+
else cls._union_min_count(primary.min_count, secondary.min_count),
|
|
153
|
+
max_count=primary.max_count
|
|
154
|
+
if use_primary
|
|
155
|
+
else cls._union_max_count(primary.max_count, secondary.max_count),
|
|
156
|
+
default=primary.default or secondary.default,
|
|
157
|
+
value_type=primary.value_type
|
|
158
|
+
if use_primary
|
|
159
|
+
else cls.union_value_type(primary.value_type, secondary.value_type),
|
|
160
|
+
instance_source=instance_source,
|
|
161
|
+
inherited=primary.inherited,
|
|
162
|
+
physical=primary.physical,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
@staticmethod
|
|
166
|
+
def _union_min_count(primary: int | None, secondary: int | None) -> int | None:
|
|
167
|
+
if primary is None:
|
|
168
|
+
return secondary
|
|
169
|
+
if secondary is None:
|
|
170
|
+
return primary
|
|
171
|
+
return min(primary, secondary)
|
|
172
|
+
|
|
173
|
+
@staticmethod
|
|
174
|
+
def _union_max_count(primary: int | float | None, secondary: int | float | None) -> int | float | None:
|
|
175
|
+
if primary is None:
|
|
176
|
+
return secondary
|
|
177
|
+
if secondary is None:
|
|
178
|
+
return primary
|
|
179
|
+
output = max(primary, secondary)
|
|
180
|
+
try:
|
|
181
|
+
return int(output)
|
|
182
|
+
except (OverflowError, ValueError):
|
|
183
|
+
# The value is float('inf') or float('-inf')
|
|
184
|
+
return output
|
|
185
|
+
|
|
186
|
+
@staticmethod
|
|
187
|
+
def union_value_type(
|
|
188
|
+
primary: DataType | ConceptEntity | MultiValueTypeInfo | UnknownEntity,
|
|
189
|
+
secondary: DataType | ConceptEntity | MultiValueTypeInfo | UnknownEntity,
|
|
190
|
+
) -> DataType | ConceptEntity | MultiValueTypeInfo | UnknownEntity:
|
|
191
|
+
all_types: list[DataType | ConceptEntity] = []
|
|
192
|
+
for type_ in (primary, secondary):
|
|
193
|
+
if isinstance(type_, MultiValueTypeInfo):
|
|
194
|
+
all_types.extend(type_.types)
|
|
195
|
+
elif isinstance(type_, UnknownEntity):
|
|
196
|
+
continue
|
|
197
|
+
elif isinstance(type_, DataType | ConceptEntity):
|
|
198
|
+
all_types.append(type_)
|
|
199
|
+
else:
|
|
200
|
+
raise NotImplementedError(f"Unsupported type: {type_}")
|
|
201
|
+
|
|
202
|
+
ordered_types = list(dict.fromkeys(all_types))
|
|
203
|
+
if len(ordered_types) == 0:
|
|
204
|
+
return UnknownEntity()
|
|
205
|
+
if len(ordered_types) == 1:
|
|
206
|
+
return ordered_types[0]
|
|
207
|
+
else: # len(ordered_types) > 1:
|
|
208
|
+
return MultiValueTypeInfo(types=ordered_types)
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
from abc import ABC
|
|
2
2
|
from typing import cast
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core._client import NeatClient
|
|
5
|
-
from cognite.neat.core._data_model._shared import (
|
|
4
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
5
|
+
from cognite.neat.v0.core._data_model._shared import (
|
|
6
6
|
ImportedDataModel,
|
|
7
7
|
T_ImportedUnverifiedDataModel,
|
|
8
8
|
T_VerifiedDataModel,
|
|
9
9
|
VerifiedDataModel,
|
|
10
10
|
)
|
|
11
|
-
from cognite.neat.core._data_model.models import (
|
|
11
|
+
from cognite.neat.v0.core._data_model.models import (
|
|
12
12
|
ConceptualDataModel,
|
|
13
13
|
PhysicalDataModel,
|
|
14
14
|
UnverifiedConceptualDataModel,
|
|
15
15
|
UnverifiedPhysicalDataModel,
|
|
16
16
|
)
|
|
17
|
-
from cognite.neat.core._data_model.models.conceptual import ConceptualValidation
|
|
18
|
-
from cognite.neat.core._data_model.models.physical import PhysicalValidation
|
|
19
|
-
from cognite.neat.core._issues import MultiValueError, catch_issues
|
|
20
|
-
from cognite.neat.core._issues.errors import NeatTypeError, NeatValueError
|
|
17
|
+
from cognite.neat.v0.core._data_model.models.conceptual import ConceptualValidation
|
|
18
|
+
from cognite.neat.v0.core._data_model.models.physical import PhysicalValidation
|
|
19
|
+
from cognite.neat.v0.core._issues import MultiValueError, catch_issues
|
|
20
|
+
from cognite.neat.v0.core._issues.errors import NeatTypeError, NeatValueError
|
|
21
21
|
|
|
22
22
|
from ._base import DataModelTransformer
|
|
23
23
|
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from cognite.neat.session.engine._interface import Extractor as EngineExtractor
|
|
1
|
+
from cognite.neat.v0.session.engine._interface import Extractor as EngineExtractor
|
|
2
2
|
|
|
3
3
|
from ._base import BaseExtractor, KnowledgeGraphExtractor
|
|
4
4
|
from ._classic_cdf._assets import AssetsExtractor
|
|
@@ -4,13 +4,13 @@ from typing import TYPE_CHECKING
|
|
|
4
4
|
|
|
5
5
|
from rdflib import URIRef
|
|
6
6
|
|
|
7
|
-
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
8
|
-
from cognite.neat.core._data_model.models import ConceptualDataModel
|
|
9
|
-
from cognite.neat.core._shared import Triple
|
|
10
|
-
from cognite.neat.core._utils.auxiliary import class_html_doc
|
|
7
|
+
from cognite.neat.v0.core._constants import DEFAULT_NAMESPACE
|
|
8
|
+
from cognite.neat.v0.core._data_model.models import ConceptualDataModel
|
|
9
|
+
from cognite.neat.v0.core._shared import Triple
|
|
10
|
+
from cognite.neat.v0.core._utils.auxiliary import class_html_doc
|
|
11
11
|
|
|
12
12
|
if TYPE_CHECKING:
|
|
13
|
-
from cognite.neat.core._store._provenance import Agent as ProvenanceAgent
|
|
13
|
+
from cognite.neat.v0.core._store._provenance import Agent as ProvenanceAgent
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class BaseExtractor:
|
|
@@ -53,6 +53,6 @@ class KnowledgeGraphExtractor(BaseExtractor):
|
|
|
53
53
|
@property
|
|
54
54
|
def agent(self) -> "ProvenanceAgent":
|
|
55
55
|
"""Provenance agent for the importer."""
|
|
56
|
-
from cognite.neat.core._store._provenance import Agent as ProvenanceAgent
|
|
56
|
+
from cognite.neat.v0.core._store._provenance import Agent as ProvenanceAgent
|
|
57
57
|
|
|
58
58
|
return ProvenanceAgent(id_=DEFAULT_NAMESPACE[f"agent/{type(self).__name__}"])
|
|
File without changes
|
|
@@ -17,13 +17,13 @@ from pydantic import AnyHttpUrl, ValidationError
|
|
|
17
17
|
from rdflib import RDF, XSD, Literal, Namespace, URIRef
|
|
18
18
|
from typing_extensions import Self
|
|
19
19
|
|
|
20
|
-
from cognite.neat.core._constants import DEFAULT_NAMESPACE
|
|
21
|
-
from cognite.neat.core._instances.extractors._base import BaseExtractor
|
|
22
|
-
from cognite.neat.core._issues.errors import NeatValueError
|
|
23
|
-
from cognite.neat.core._issues.warnings import CDFAuthWarning, NeatValueWarning
|
|
24
|
-
from cognite.neat.core._shared import Triple
|
|
25
|
-
from cognite.neat.core._utils.auxiliary import string_to_ideal_type
|
|
26
|
-
from cognite.neat.core._utils.collection_ import (
|
|
20
|
+
from cognite.neat.v0.core._constants import DEFAULT_NAMESPACE
|
|
21
|
+
from cognite.neat.v0.core._instances.extractors._base import BaseExtractor
|
|
22
|
+
from cognite.neat.v0.core._issues.errors import NeatValueError
|
|
23
|
+
from cognite.neat.v0.core._issues.warnings import CDFAuthWarning, NeatValueWarning
|
|
24
|
+
from cognite.neat.v0.core._shared import Triple
|
|
25
|
+
from cognite.neat.v0.core._utils.auxiliary import string_to_ideal_type
|
|
26
|
+
from cognite.neat.v0.core._utils.collection_ import (
|
|
27
27
|
iterate_progress_bar_if_above_config_threshold,
|
|
28
28
|
)
|
|
29
29
|
|
|
@@ -9,24 +9,24 @@ from cognite.client import CogniteClient
|
|
|
9
9
|
from cognite.client.exceptions import CogniteAPIError
|
|
10
10
|
from rdflib import Namespace, URIRef
|
|
11
11
|
|
|
12
|
-
from cognite.neat.core._constants import (
|
|
12
|
+
from cognite.neat.v0.core._constants import (
|
|
13
13
|
CLASSIC_CDF_NAMESPACE,
|
|
14
14
|
DEFAULT_NAMESPACE,
|
|
15
15
|
get_default_prefixes_and_namespaces,
|
|
16
16
|
)
|
|
17
|
-
from cognite.neat.core._data_model._shared import ImportedDataModel
|
|
18
|
-
from cognite.neat.core._data_model.catalog import classic_model
|
|
19
|
-
from cognite.neat.core._data_model.models import (
|
|
17
|
+
from cognite.neat.v0.core._data_model._shared import ImportedDataModel
|
|
18
|
+
from cognite.neat.v0.core._data_model.catalog import classic_model
|
|
19
|
+
from cognite.neat.v0.core._data_model.models import (
|
|
20
20
|
ConceptualDataModel,
|
|
21
21
|
UnverifiedConceptualDataModel,
|
|
22
22
|
)
|
|
23
|
-
from cognite.neat.core._instances.extractors._base import KnowledgeGraphExtractor
|
|
24
|
-
from cognite.neat.core._issues.errors import NeatValueError, ResourceNotFoundError
|
|
25
|
-
from cognite.neat.core._issues.warnings import CDFAuthWarning, NeatValueWarning
|
|
26
|
-
from cognite.neat.core._shared import Triple
|
|
27
|
-
from cognite.neat.core._utils.collection_ import chunker, iterate_progress_bar
|
|
28
|
-
from cognite.neat.core._utils.rdf_ import remove_namespace_from_uri
|
|
29
|
-
from cognite.neat.core._utils.text import to_snake_case
|
|
23
|
+
from cognite.neat.v0.core._instances.extractors._base import KnowledgeGraphExtractor
|
|
24
|
+
from cognite.neat.v0.core._issues.errors import NeatValueError, ResourceNotFoundError
|
|
25
|
+
from cognite.neat.v0.core._issues.warnings import CDFAuthWarning, NeatValueWarning
|
|
26
|
+
from cognite.neat.v0.core._shared import Triple
|
|
27
|
+
from cognite.neat.v0.core._utils.collection_ import chunker, iterate_progress_bar
|
|
28
|
+
from cognite.neat.v0.core._utils.rdf_ import remove_namespace_from_uri
|
|
29
|
+
from cognite.neat.v0.core._utils.text import to_snake_case
|
|
30
30
|
|
|
31
31
|
from ._assets import AssetsExtractor
|
|
32
32
|
from ._base import ClassicCDFBaseExtractor, InstanceIdPrefix
|
|
@@ -210,7 +210,7 @@ class ClassicGraphExtractor(KnowledgeGraphExtractor):
|
|
|
210
210
|
|
|
211
211
|
def get_conceptual_data_model(self) -> ConceptualDataModel:
|
|
212
212
|
# To avoid circular imports
|
|
213
|
-
from cognite.neat.core._data_model.importers import ExcelImporter
|
|
213
|
+
from cognite.neat.v0.core._data_model.importers import ExcelImporter
|
|
214
214
|
|
|
215
215
|
unverified = cast(
|
|
216
216
|
ImportedDataModel[UnverifiedConceptualDataModel],
|
|
@@ -9,9 +9,9 @@ from cognite.client import CogniteClient
|
|
|
9
9
|
from cognite.client.data_classes import Relationship, RelationshipList
|
|
10
10
|
from rdflib import Namespace, URIRef
|
|
11
11
|
|
|
12
|
-
from cognite.neat.core._issues.warnings import NeatValueWarning
|
|
13
|
-
from cognite.neat.core._shared import Triple
|
|
14
|
-
from cognite.neat.core._utils.auxiliary import create_sha256_hash
|
|
12
|
+
from cognite.neat.v0.core._issues.warnings import NeatValueWarning
|
|
13
|
+
from cognite.neat.v0.core._shared import Triple
|
|
14
|
+
from cognite.neat.v0.core._utils.auxiliary import create_sha256_hash
|
|
15
15
|
|
|
16
16
|
from ._base import DEFAULT_SKIP_METADATA_VALUES, ClassicCDFBaseExtractor, InstanceIdPrefix, T_CogniteResource
|
|
17
17
|
|
|
@@ -10,11 +10,11 @@ from cognite.client.data_classes import Sequence, SequenceFilter
|
|
|
10
10
|
from rdflib import RDF, XSD, Literal, Namespace, URIRef
|
|
11
11
|
from typing_extensions import Self
|
|
12
12
|
|
|
13
|
-
from cognite.neat.core._client.data_classes.neat_sequence import (
|
|
13
|
+
from cognite.neat.v0.core._client.data_classes.neat_sequence import (
|
|
14
14
|
NeatSequence,
|
|
15
15
|
NeatSequenceList,
|
|
16
16
|
)
|
|
17
|
-
from cognite.neat.core._shared import Triple
|
|
17
|
+
from cognite.neat.v0.core._shared import Triple
|
|
18
18
|
|
|
19
19
|
from ._base import DEFAULT_SKIP_METADATA_VALUES, ClassicCDFBaseExtractor, InstanceIdPrefix
|
|
20
20
|
|
|
@@ -7,8 +7,8 @@ from cognite.client import data_modeling as dm
|
|
|
7
7
|
from cognite.client.data_classes.data_modeling.instances import Instance
|
|
8
8
|
from rdflib import XSD, Literal, Namespace, URIRef
|
|
9
9
|
|
|
10
|
-
from cognite.neat.core._shared import Triple
|
|
11
|
-
from cognite.neat.core._utils.auxiliary import string_to_ideal_type
|
|
10
|
+
from cognite.neat.v0.core._shared import Triple
|
|
11
|
+
from cognite.neat.v0.core._utils.auxiliary import string_to_ideal_type
|
|
12
12
|
|
|
13
13
|
from ._base import BaseExtractor
|
|
14
14
|
|
|
@@ -43,9 +43,12 @@ class DictExtractor(BaseExtractor):
|
|
|
43
43
|
self, key: str, value: Any, unpack_json: bool
|
|
44
44
|
) -> Iterable[tuple[str, Literal | URIRef]]:
|
|
45
45
|
if key in self.uri_ref_keys and not isinstance(value, dict | list):
|
|
46
|
+
# exist if key is meant to form a URIRef
|
|
46
47
|
yield key, URIRef(self.namespace[urllib.parse.quote(value)])
|
|
47
|
-
|
|
48
|
+
elif isinstance(value, float | bool | int):
|
|
48
49
|
yield key, Literal(value)
|
|
50
|
+
elif isinstance(value, str):
|
|
51
|
+
yield key, Literal(string_to_ideal_type(value)) if self.str_to_ideal_type else Literal(value)
|
|
49
52
|
elif isinstance(value, dict) and unpack_json:
|
|
50
53
|
yield from self._unpack_json(value)
|
|
51
54
|
elif isinstance(value, dict):
|
|
@@ -9,12 +9,12 @@ from cognite.client.data_classes.data_modeling.instances import Edge, Instance,
|
|
|
9
9
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
10
10
|
from rdflib import RDF, Literal, Namespace, URIRef
|
|
11
11
|
|
|
12
|
-
from cognite.neat.core._client import NeatClient
|
|
13
|
-
from cognite.neat.core._config import GLOBAL_CONFIG
|
|
14
|
-
from cognite.neat.core._constants import DEFAULT_SPACE_URI, is_readonly_property
|
|
15
|
-
from cognite.neat.core._issues.errors import ResourceRetrievalError
|
|
16
|
-
from cognite.neat.core._shared import Triple
|
|
17
|
-
from cognite.neat.core._utils.collection_ import iterate_progress_bar
|
|
12
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
13
|
+
from cognite.neat.v0.core._config import GLOBAL_CONFIG
|
|
14
|
+
from cognite.neat.v0.core._constants import DEFAULT_SPACE_URI, is_readonly_property
|
|
15
|
+
from cognite.neat.v0.core._issues.errors import ResourceRetrievalError
|
|
16
|
+
from cognite.neat.v0.core._shared import Triple
|
|
17
|
+
from cognite.neat.v0.core._utils.collection_ import iterate_progress_bar
|
|
18
18
|
|
|
19
19
|
from ._base import BaseExtractor
|
|
20
20
|
from ._dict import DEFAULT_EMPTY_VALUES, DMSPropertyExtractor
|
|
@@ -5,24 +5,24 @@ from cognite.client.exceptions import CogniteAPIError
|
|
|
5
5
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
6
6
|
from rdflib import Namespace, URIRef
|
|
7
7
|
|
|
8
|
-
from cognite.neat.core._client import NeatClient
|
|
9
|
-
from cognite.neat.core._constants import COGNITE_SPACES, DEFAULT_NAMESPACE
|
|
10
|
-
from cognite.neat.core._data_model.importers import DMSImporter
|
|
11
|
-
from cognite.neat.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
12
|
-
from cognite.neat.core._data_model.models.conceptual import ConceptualProperty
|
|
13
|
-
from cognite.neat.core._data_model.models.data_types import Json
|
|
14
|
-
from cognite.neat.core._data_model.models.entities import UnknownEntity
|
|
15
|
-
from cognite.neat.core._data_model.transformers import (
|
|
8
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
9
|
+
from cognite.neat.v0.core._constants import COGNITE_SPACES, DEFAULT_NAMESPACE
|
|
10
|
+
from cognite.neat.v0.core._data_model.importers import DMSImporter
|
|
11
|
+
from cognite.neat.v0.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
12
|
+
from cognite.neat.v0.core._data_model.models.conceptual import ConceptualProperty
|
|
13
|
+
from cognite.neat.v0.core._data_model.models.data_types import Json
|
|
14
|
+
from cognite.neat.v0.core._data_model.models.entities import UnknownEntity
|
|
15
|
+
from cognite.neat.v0.core._data_model.transformers import (
|
|
16
16
|
PhysicalToConceptual,
|
|
17
17
|
VerifyPhysicalDataModel,
|
|
18
18
|
)
|
|
19
|
-
from cognite.neat.core._issues import IssueList, NeatIssue, catch_warnings
|
|
20
|
-
from cognite.neat.core._issues.warnings import (
|
|
19
|
+
from cognite.neat.v0.core._issues import IssueList, NeatIssue, catch_warnings
|
|
20
|
+
from cognite.neat.v0.core._issues.warnings import (
|
|
21
21
|
CDFAuthWarning,
|
|
22
22
|
ResourceNotFoundWarning,
|
|
23
23
|
ResourceRetrievalWarning,
|
|
24
24
|
)
|
|
25
|
-
from cognite.neat.core._shared import Triple
|
|
25
|
+
from cognite.neat.v0.core._shared import Triple
|
|
26
26
|
|
|
27
27
|
from ._base import KnowledgeGraphExtractor
|
|
28
28
|
from ._dms import DMSExtractor
|
|
@@ -11,15 +11,15 @@ import numpy
|
|
|
11
11
|
import pandas as pd
|
|
12
12
|
from rdflib import RDF, Literal, Namespace, URIRef
|
|
13
13
|
|
|
14
|
-
from cognite.neat.core._data_model._constants import EntityTypes
|
|
15
|
-
from cognite.neat.core._data_model.analysis import DataModelAnalysis
|
|
16
|
-
from cognite.neat.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
17
|
-
from cognite.neat.core._data_model.models.conceptual import ConceptualProperty
|
|
18
|
-
from cognite.neat.core._data_model.models.data_types import DataType
|
|
19
|
-
from cognite.neat.core._data_model.models.entities import ConceptEntity
|
|
20
|
-
from cognite.neat.core._data_model.transformers import SubsetConceptualDataModel
|
|
21
|
-
from cognite.neat.core._shared import Triple
|
|
22
|
-
from cognite.neat.core._utils.rdf_ import remove_namespace_from_uri
|
|
14
|
+
from cognite.neat.v0.core._data_model._constants import EntityTypes
|
|
15
|
+
from cognite.neat.v0.core._data_model.analysis import DataModelAnalysis
|
|
16
|
+
from cognite.neat.v0.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
17
|
+
from cognite.neat.v0.core._data_model.models.conceptual import ConceptualProperty
|
|
18
|
+
from cognite.neat.v0.core._data_model.models.data_types import DataType
|
|
19
|
+
from cognite.neat.v0.core._data_model.models.entities import ConceptEntity
|
|
20
|
+
from cognite.neat.v0.core._data_model.transformers import SubsetConceptualDataModel
|
|
21
|
+
from cognite.neat.v0.core._shared import Triple
|
|
22
|
+
from cognite.neat.v0.core._utils.rdf_ import remove_namespace_from_uri
|
|
23
23
|
|
|
24
24
|
from ._base import BaseExtractor
|
|
25
25
|
|
|
@@ -45,7 +45,7 @@ class MockGraphGenerator(BaseExtractor):
|
|
|
45
45
|
):
|
|
46
46
|
if isinstance(data_model, PhysicalDataModel):
|
|
47
47
|
# fixes potential issues with circular dependencies
|
|
48
|
-
from cognite.neat.core._data_model.transformers import PhysicalToConceptual
|
|
48
|
+
from cognite.neat.v0.core._data_model.transformers import PhysicalToConceptual
|
|
49
49
|
|
|
50
50
|
self.data_model = PhysicalToConceptual().transform(data_model)
|
|
51
51
|
elif isinstance(data_model, ConceptualDataModel):
|
|
@@ -6,9 +6,9 @@ from cognite.client.data_classes import Row, RowList
|
|
|
6
6
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
7
7
|
from rdflib import RDF, Namespace, URIRef
|
|
8
8
|
|
|
9
|
-
from cognite.neat.core._client import NeatClient
|
|
10
|
-
from cognite.neat.core._constants import DEFAULT_RAW_URI
|
|
11
|
-
from cognite.neat.core._shared import Triple
|
|
9
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
10
|
+
from cognite.neat.v0.core._constants import DEFAULT_RAW_URI
|
|
11
|
+
from cognite.neat.v0.core._shared import Triple
|
|
12
12
|
|
|
13
13
|
from ._base import BaseExtractor
|
|
14
14
|
from ._dict import DEFAULT_EMPTY_VALUES, DictExtractor
|
|
@@ -7,16 +7,16 @@ from rdflib import URIRef
|
|
|
7
7
|
from rdflib.util import guess_format
|
|
8
8
|
from typing_extensions import Self
|
|
9
9
|
|
|
10
|
-
from cognite.neat.core._constants import DEFAULT_BASE_URI
|
|
11
|
-
from cognite.neat.core._instances._shared import RDFTypes
|
|
12
|
-
from cognite.neat.core._instances.extractors._base import BaseExtractor
|
|
13
|
-
from cognite.neat.core._issues._base import IssueList
|
|
14
|
-
from cognite.neat.core._issues.errors import (
|
|
10
|
+
from cognite.neat.v0.core._constants import DEFAULT_BASE_URI
|
|
11
|
+
from cognite.neat.v0.core._instances._shared import RDFTypes
|
|
12
|
+
from cognite.neat.v0.core._instances.extractors._base import BaseExtractor
|
|
13
|
+
from cognite.neat.v0.core._issues._base import IssueList
|
|
14
|
+
from cognite.neat.v0.core._issues.errors import (
|
|
15
15
|
FileNotFoundNeatError,
|
|
16
16
|
FileTypeUnexpectedError,
|
|
17
17
|
)
|
|
18
|
-
from cognite.neat.core._issues.errors._general import NeatValueError
|
|
19
|
-
from cognite.neat.core._shared import Triple
|
|
18
|
+
from cognite.neat.v0.core._issues.errors._general import NeatValueError
|
|
19
|
+
from cognite.neat.v0.core._shared import Triple
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class RdfFileExtractor(BaseExtractor):
|
|
@@ -5,11 +5,11 @@ from typing import ClassVar, Generic, TypeVar
|
|
|
5
5
|
|
|
6
6
|
from cognite.client.data_classes.capabilities import Capability
|
|
7
7
|
|
|
8
|
-
from cognite.neat.core._client import NeatClient
|
|
9
|
-
from cognite.neat.core._issues import IssueList, NeatIssue
|
|
10
|
-
from cognite.neat.core._issues.errors import AuthorizationError
|
|
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._issues import IssueList, NeatIssue
|
|
10
|
+
from cognite.neat.v0.core._issues.errors import AuthorizationError
|
|
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
|
T_Output = TypeVar("T_Output")
|
|
15
15
|
|
|
@@ -19,46 +19,46 @@ from cognite.client.exceptions import CogniteAPIError
|
|
|
19
19
|
from pydantic import BaseModel, ValidationInfo, create_model, field_validator
|
|
20
20
|
from rdflib import RDF, URIRef
|
|
21
21
|
|
|
22
|
-
from cognite.neat.core._client import NeatClient
|
|
23
|
-
from cognite.neat.core._client._api_client import SchemaAPI
|
|
24
|
-
from cognite.neat.core._constants import (
|
|
22
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
23
|
+
from cognite.neat.v0.core._client._api_client import SchemaAPI
|
|
24
|
+
from cognite.neat.v0.core._constants import (
|
|
25
25
|
COGNITE_SPACES,
|
|
26
26
|
DMS_DIRECT_RELATION_LIST_DEFAULT_LIMIT,
|
|
27
27
|
is_readonly_property,
|
|
28
28
|
)
|
|
29
|
-
from cognite.neat.core._data_model.analysis import DataModelAnalysis
|
|
30
|
-
from cognite.neat.core._data_model.analysis._base import ViewQuery, ViewQueryDict
|
|
31
|
-
from cognite.neat.core._data_model.models import PhysicalDataModel
|
|
32
|
-
from cognite.neat.core._data_model.models.conceptual._verified import (
|
|
29
|
+
from cognite.neat.v0.core._data_model.analysis import DataModelAnalysis
|
|
30
|
+
from cognite.neat.v0.core._data_model.analysis._base import ViewQuery, ViewQueryDict
|
|
31
|
+
from cognite.neat.v0.core._data_model.models import PhysicalDataModel
|
|
32
|
+
from cognite.neat.v0.core._data_model.models.conceptual._verified import (
|
|
33
33
|
ConceptualDataModel,
|
|
34
34
|
)
|
|
35
|
-
from cognite.neat.core._data_model.models.data_types import (
|
|
35
|
+
from cognite.neat.v0.core._data_model.models.data_types import (
|
|
36
36
|
_DATA_TYPE_BY_DMS_TYPE,
|
|
37
37
|
Json,
|
|
38
38
|
String,
|
|
39
39
|
)
|
|
40
|
-
from cognite.neat.core._issues import IssueList, NeatError, NeatIssue, catch_issues
|
|
41
|
-
from cognite.neat.core._issues.errors import (
|
|
40
|
+
from cognite.neat.v0.core._issues import IssueList, NeatError, NeatIssue, catch_issues
|
|
41
|
+
from cognite.neat.v0.core._issues.errors import (
|
|
42
42
|
ResourceCreationError,
|
|
43
43
|
ResourceDuplicatedError,
|
|
44
44
|
ResourceNotFoundError,
|
|
45
45
|
)
|
|
46
|
-
from cognite.neat.core._issues.warnings import (
|
|
46
|
+
from cognite.neat.v0.core._issues.warnings import (
|
|
47
47
|
PropertyDirectRelationLimitWarning,
|
|
48
48
|
PropertyMultipleValueWarning,
|
|
49
49
|
PropertyTypeNotSupportedWarning,
|
|
50
50
|
ResourceNeatWarning,
|
|
51
51
|
)
|
|
52
|
-
from cognite.neat.core._shared import InstanceType
|
|
53
|
-
from cognite.neat.core._store import NeatInstanceStore
|
|
54
|
-
from cognite.neat.core._utils.auxiliary import create_sha256_hash
|
|
55
|
-
from cognite.neat.core._utils.collection_ import (
|
|
52
|
+
from cognite.neat.v0.core._shared import InstanceType
|
|
53
|
+
from cognite.neat.v0.core._store import NeatInstanceStore
|
|
54
|
+
from cognite.neat.v0.core._utils.auxiliary import create_sha256_hash
|
|
55
|
+
from cognite.neat.v0.core._utils.collection_ import (
|
|
56
56
|
iterate_progress_bar_if_above_config_threshold,
|
|
57
57
|
)
|
|
58
|
-
from cognite.neat.core._utils.rdf_ import (
|
|
58
|
+
from cognite.neat.v0.core._utils.rdf_ import (
|
|
59
59
|
remove_namespace_from_uri,
|
|
60
60
|
)
|
|
61
|
-
from cognite.neat.core._utils.upload import UploadResult
|
|
61
|
+
from cognite.neat.v0.core._utils.upload import UploadResult
|
|
62
62
|
|
|
63
63
|
from ._base import _END_OF_CLASS, _START_OF_CLASS, CDFLoader
|
|
64
64
|
|