cognite-neat 0.123.32__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 +198 -2
- cognite/neat/_data_model/models/dms/_base.py +13 -9
- cognite/neat/_data_model/models/dms/_constants.py +47 -1
- 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 +14 -10
- 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 → _data_model}/models/entities/_constants.py +5 -0
- cognite/neat/_data_model/models/entities/_data_types.py +144 -0
- cognite/neat/{data_model → _data_model}/models/entities/_identifiers.py +1 -1
- 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/_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/_reader.py +194 -0
- cognite/neat/_utils/auxiliary.py +7 -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/core/_client/_api/__init__.py +0 -0
- cognite/neat/{core → v0/core}/_client/_api/data_modeling_loaders.py +6 -6
- cognite/neat/{core → v0/core}/_client/_api/neat_instances.py +5 -5
- cognite/neat/{core → v0/core}/_client/_api/schema.py +5 -5
- cognite/neat/{core → v0/core}/_client/_api/statistics.py +3 -3
- cognite/neat/{core → v0/core}/_client/_api_client.py +1 -1
- cognite/neat/v0/core/_client/data_classes/__init__.py +0 -0
- cognite/neat/{core → v0/core}/_client/data_classes/schema.py +4 -4
- cognite/neat/{core → v0/core}/_client/testing.py +1 -1
- cognite/neat/{core → v0/core}/_constants.py +5 -3
- cognite/neat/v0/core/_data_model/__init__.py +0 -0
- cognite/neat/{core → v0/core}/_data_model/_constants.py +3 -0
- cognite/neat/{core → v0/core}/_data_model/_shared.py +4 -4
- cognite/neat/{core → v0/core}/_data_model/analysis/_base.py +8 -8
- cognite/neat/{core → v0/core}/_data_model/exporters/__init__.py +1 -2
- cognite/neat/{core → v0/core}/_data_model/exporters/_base.py +7 -7
- cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2dms.py +9 -9
- cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2excel.py +12 -12
- cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2instance_template.py +4 -4
- cognite/neat/{core/_data_model/exporters/_data_model2ontology.py → v0/core/_data_model/exporters/_data_model2semantic_model.py} +126 -116
- cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2yaml.py +1 -1
- cognite/neat/{core → v0/core}/_data_model/importers/_base.py +5 -5
- cognite/neat/{core → v0/core}/_data_model/importers/_base_file_reader.py +2 -2
- cognite/neat/{core → v0/core}/_data_model/importers/_dict2data_model.py +5 -5
- cognite/neat/{core → v0/core}/_data_model/importers/_dms2data_model.py +16 -15
- cognite/neat/{core → v0/core}/_data_model/importers/_graph2data_model.py +12 -12
- cognite/neat/{core → v0/core}/_data_model/importers/_rdf/_base.py +12 -12
- cognite/neat/{core → v0/core}/_data_model/importers/_rdf/_inference2rdata_model.py +14 -14
- cognite/neat/{core → v0/core}/_data_model/importers/_rdf/_owl2data_model.py +41 -21
- cognite/neat/{core → v0/core}/_data_model/importers/_rdf/_shared.py +9 -9
- cognite/neat/{core → v0/core}/_data_model/importers/_spreadsheet2data_model.py +92 -12
- cognite/neat/{core → v0/core}/_data_model/models/__init__.py +3 -3
- cognite/neat/{core → v0/core}/_data_model/models/_base_verified.py +5 -5
- cognite/neat/{core → v0/core}/_data_model/models/_import_contexts.py +1 -1
- cognite/neat/{core → v0/core}/_data_model/models/_types.py +5 -5
- cognite/neat/{core → v0/core}/_data_model/models/conceptual/_unverified.py +5 -5
- cognite/neat/{core → v0/core}/_data_model/models/conceptual/_validation.py +12 -12
- cognite/neat/{core → v0/core}/_data_model/models/conceptual/_verified.py +9 -9
- cognite/neat/{core → v0/core}/_data_model/models/data_types.py +4 -4
- cognite/neat/{core → v0/core}/_data_model/models/entities/__init__.py +2 -0
- cognite/neat/{core → v0/core}/_data_model/models/entities/_loaders.py +2 -2
- cognite/neat/{core → v0/core}/_data_model/models/entities/_multi_value.py +2 -2
- cognite/neat/{core → v0/core}/_data_model/models/entities/_restrictions.py +6 -6
- cognite/neat/{core → v0/core}/_data_model/models/entities/_single_value.py +17 -3
- 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 +24 -19
- cognite/neat/{core → v0/core}/_data_model/models/physical/_unverified.py +69 -20
- cognite/neat/{core → v0/core}/_data_model/models/physical/_validation.py +24 -20
- cognite/neat/{core → v0/core}/_data_model/models/physical/_verified.py +95 -24
- cognite/neat/{core → v0/core}/_data_model/transformers/_base.py +4 -4
- cognite/neat/{core → v0/core}/_data_model/transformers/_converters.py +35 -28
- cognite/neat/{core → v0/core}/_data_model/transformers/_mapping.py +7 -7
- cognite/neat/{core → v0/core}/_data_model/transformers/_union_conceptual.py +5 -5
- cognite/neat/{core → v0/core}/_data_model/transformers/_verification.py +7 -7
- cognite/neat/v0/core/_instances/__init__.py +0 -0
- cognite/neat/{core → v0/core}/_instances/_tracking/base.py +1 -1
- cognite/neat/{core → v0/core}/_instances/_tracking/log.py +1 -1
- cognite/neat/{core → v0/core}/_instances/extractors/__init__.py +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 +5 -5
- cognite/neat/{core → v0/core}/_issues/_contextmanagers.py +1 -1
- cognite/neat/{core → v0/core}/_issues/_factory.py +3 -3
- cognite/neat/{core → v0/core}/_issues/errors/__init__.py +1 -1
- cognite/neat/{core → v0/core}/_issues/errors/_external.py +1 -1
- cognite/neat/{core → v0/core}/_issues/errors/_general.py +1 -1
- cognite/neat/{core → v0/core}/_issues/errors/_properties.py +1 -1
- cognite/neat/{core → v0/core}/_issues/errors/_resources.py +2 -2
- cognite/neat/{core → v0/core}/_issues/errors/_wrapper.py +2 -2
- cognite/neat/{core → v0/core}/_issues/warnings/__init__.py +1 -1
- cognite/neat/{core → v0/core}/_issues/warnings/_external.py +1 -1
- cognite/neat/{core → v0/core}/_issues/warnings/_general.py +1 -1
- cognite/neat/{core → v0/core}/_issues/warnings/_models.py +2 -2
- cognite/neat/{core → v0/core}/_issues/warnings/_properties.py +2 -2
- cognite/neat/{core → v0/core}/_issues/warnings/_resources.py +1 -1
- cognite/neat/{core → v0/core}/_issues/warnings/user_modeling.py +1 -1
- cognite/neat/{core → v0/core}/_store/_data_model.py +12 -12
- cognite/neat/{core → v0/core}/_store/_instance.py +43 -10
- cognite/neat/{core → v0/core}/_store/_provenance.py +3 -3
- cognite/neat/{core → v0/core}/_store/exceptions.py +4 -4
- cognite/neat/v0/core/_utils/__init__.py +0 -0
- cognite/neat/{core → v0/core}/_utils/auth.py +1 -1
- cognite/neat/{core → v0/core}/_utils/auxiliary.py +1 -1
- cognite/neat/{core → v0/core}/_utils/collection_.py +2 -2
- cognite/neat/{core → v0/core}/_utils/graph_transformations_report.py +1 -1
- cognite/neat/{core → v0/core}/_utils/rdf_.py +1 -1
- cognite/neat/{core → v0/core}/_utils/reader/_base.py +1 -1
- cognite/neat/{core → v0/core}/_utils/spreadsheet.py +18 -4
- cognite/neat/{core → v0/core}/_utils/text.py +1 -1
- cognite/neat/{core → v0/core}/_utils/upload.py +3 -3
- cognite/neat/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 +12 -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 -20
- cognite/neat/{session → v0/session}/_set.py +8 -8
- cognite/neat/{session → v0/session}/_show.py +5 -5
- cognite/neat/{session → v0/session}/_state.py +10 -10
- cognite/neat/{session → v0/session}/_subset.py +4 -4
- cognite/neat/{session → v0/session}/_template.py +11 -11
- cognite/neat/{session → v0/session}/_to.py +12 -12
- cognite/neat/{session → v0/session}/_wizard.py +1 -1
- cognite/neat/{session → v0/session}/engine/_load.py +1 -1
- cognite/neat/{session → v0/session}/exceptions.py +5 -5
- cognite/neat/v1.py +3 -0
- {cognite_neat-0.123.32.dist-info → cognite_neat-0.127.30.dist-info}/METADATA +7 -6
- cognite_neat-0.127.30.dist-info/RECORD +319 -0
- {cognite_neat-0.123.32.dist-info → cognite_neat-0.127.30.dist-info}/WHEEL +1 -1
- cognite/neat/data_model/models/entities/__init__.py +0 -9
- 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.32.dist-info/RECORD +0 -209
- /cognite/neat/{core → _data_model/deployer}/__init__.py +0 -0
- /cognite/neat/{core/_client/_api → _data_model/exporters/_table_exporter}/__init__.py +0 -0
- /cognite/neat/{core/_client/data_classes → _data_model/importers/_table_importer}/__init__.py +0 -0
- /cognite/neat/{core/_data_model → _data_model/models/conceptual}/__init__.py +0 -0
- /cognite/neat/{core/_instances → _data_model/validation}/__init__.py +0 -0
- /cognite/neat/{core/_instances/extractors/_classic_cdf → _session/_html}/__init__.py +0 -0
- /cognite/neat/{core/_utils → _session/_usage_analytics}/__init__.py +0 -0
- /cognite/neat/{data_model → v0}/__init__.py +0 -0
- /cognite/neat/{plugins/data_model → v0/core}/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_client/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_client/data_classes/data_modeling.py +0 -0
- /cognite/neat/{core → v0/core}/_client/data_classes/neat_sequence.py +0 -0
- /cognite/neat/{core → v0/core}/_client/data_classes/statistics.py +0 -0
- /cognite/neat/{core → v0/core}/_config.py +0 -0
- /cognite/neat/{core → v0/core}/_data_model/analysis/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_data_model/catalog/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_data_model/catalog/classic_model.xlsx +0 -0
- /cognite/neat/{core → v0/core}/_data_model/catalog/conceptual-imf-data-model.xlsx +0 -0
- /cognite/neat/{core → v0/core}/_data_model/catalog/hello_world_pump.xlsx +0 -0
- /cognite/neat/{core → v0/core}/_data_model/importers/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_data_model/importers/_rdf/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_data_model/models/_base_unverified.py +0 -0
- /cognite/neat/{core → v0/core}/_data_model/models/conceptual/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_data_model/models/entities/_constants.py +0 -0
- /cognite/neat/{core → v0/core}/_data_model/models/entities/_wrapped.py +0 -0
- /cognite/neat/{core → v0/core}/_data_model/models/mapping/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_data_model/models/mapping/_classic2core.yaml +0 -0
- /cognite/neat/{core → v0/core}/_data_model/transformers/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/_shared.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/_tracking/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- /cognite/neat/{core → v0/core}/_instances/examples/Knowledge-Graph-Nordic44.xml +0 -0
- /cognite/neat/{core → v0/core}/_instances/examples/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_assets.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_data_sets.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_events.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_files.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_labels.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_timeseries.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/loaders/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/queries/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/queries/_base.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/queries/_queries.py +0 -0
- /cognite/neat/{core → v0/core}/_instances/transformers/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_issues/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_issues/formatters.py +0 -0
- /cognite/neat/{core → v0/core}/_shared.py +0 -0
- /cognite/neat/{core → v0/core}/_store/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_utils/io_.py +0 -0
- /cognite/neat/{core → v0/core}/_utils/reader/__init__.py +0 -0
- /cognite/neat/{core → v0/core}/_utils/tarjan.py +0 -0
- /cognite/neat/{core → v0/core}/_utils/time_.py +0 -0
- /cognite/neat/{core → v0/core}/_utils/xml_.py +0 -0
- /cognite/neat/{session → v0/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.32.dist-info → cognite_neat-0.127.30.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from cognite.neat.v0.core._data_model.importers._base import BaseImporter
|
|
5
|
+
from cognite.neat.v0.core._data_model.transformers._base import VerifiedDataModelTransformer
|
|
6
|
+
|
|
7
|
+
from ._base import NeatPlugin
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class DataModelImporterPlugin(NeatPlugin):
|
|
11
|
+
"""This class is used an interface for data model import plugins.
|
|
12
|
+
Any plugin that is used for importing data models should inherit from this class.
|
|
13
|
+
It is expected to implement the `configure` method which returns a configured importer.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
def configure(self, io: str | Path | None, **kwargs: Any) -> BaseImporter:
|
|
17
|
+
"""Return a configure plugin for data model import.
|
|
18
|
+
Args:
|
|
19
|
+
io (str | Path | None): The input/output interface for the plugin.
|
|
20
|
+
**kwargs (Any): Additional keyword arguments for configuration.
|
|
21
|
+
Returns:
|
|
22
|
+
BaseImporter: A configured instance of the BaseImporter.
|
|
23
|
+
!!! note "Returns"
|
|
24
|
+
The method must return an instance of `BaseImporter` or its subclasses
|
|
25
|
+
meaning it must implement the `BaseImporter` interface.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
raise NotImplementedError()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class DataModelTransformerPlugin(NeatPlugin):
|
|
32
|
+
"""This class is used as an interface for data model transformer plugins.
|
|
33
|
+
Any plugin that is used for transforming data models should inherit from this class.
|
|
34
|
+
It is expected to implement the `configure` method which returns a configured transformer.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def configure(self, **kwargs: Any) -> VerifiedDataModelTransformer:
|
|
38
|
+
"""Return a configure plugin for data model import.
|
|
39
|
+
Args:
|
|
40
|
+
**kwargs (Any): Additional keyword arguments for configuration.
|
|
41
|
+
Returns:
|
|
42
|
+
VerifiedDataModelTransformer: A configured instance of the VerifiedDataModelTransformer.
|
|
43
|
+
!!! note "Returns"
|
|
44
|
+
The method must return an instance of `VerifiedDataModelTransformer` or its subclasses
|
|
45
|
+
meaning it must implement the `VerifiedDataModelTransformer` interface.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
raise NotImplementedError()
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
"""Plugin manager for external plugins."""
|
|
2
2
|
|
|
3
3
|
from importlib import metadata
|
|
4
|
-
from typing import Any, ClassVar
|
|
4
|
+
from typing import Any, ClassVar
|
|
5
5
|
|
|
6
|
+
from ._base import NeatPlugin
|
|
7
|
+
from ._data_model import DataModelImporterPlugin, DataModelTransformerPlugin
|
|
6
8
|
from ._issues import PluginDuplicateError, PluginError, PluginLoadingError
|
|
7
|
-
from .data_model.importers import DataModelImporterPlugin
|
|
8
|
-
|
|
9
|
-
# Here we configure entry points where external plugins are going to be registered.
|
|
10
|
-
plugins_entry_points = {
|
|
11
|
-
"cognite.neat.plugins.data_model.importers": DataModelImporterPlugin,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
#: Type alias for all supported plugin types
|
|
15
|
-
NeatPlugin: TypeAlias = DataModelImporterPlugin
|
|
16
|
-
|
|
17
|
-
# Generic type variable for plugin types
|
|
18
|
-
T_NeatPlugin = TypeVar("T_NeatPlugin", bound=NeatPlugin)
|
|
19
9
|
|
|
20
10
|
|
|
21
11
|
class Plugin:
|
|
@@ -47,13 +37,14 @@ class PluginManager:
|
|
|
47
37
|
"""Plugin manager for external plugins."""
|
|
48
38
|
|
|
49
39
|
_plugins_entry_points: ClassVar[dict[str, type[NeatPlugin]]] = {
|
|
50
|
-
"cognite.neat.plugins.data_model.importers": DataModelImporterPlugin,
|
|
40
|
+
"cognite.neat.v0.plugins.data_model.importers": DataModelImporterPlugin,
|
|
41
|
+
"cognite.neat.v0.plugins.data_model.transformers": DataModelTransformerPlugin,
|
|
51
42
|
}
|
|
52
43
|
|
|
53
44
|
def __init__(self, plugins: dict[tuple[str, type[NeatPlugin]], Any]) -> None:
|
|
54
45
|
self._plugins = plugins
|
|
55
46
|
|
|
56
|
-
def get(self, name: str, type_: type[
|
|
47
|
+
def get(self, name: str, type_: type[NeatPlugin]) -> type[NeatPlugin]:
|
|
57
48
|
"""
|
|
58
49
|
Returns desired plugin
|
|
59
50
|
|
|
@@ -63,7 +54,7 @@ class PluginManager:
|
|
|
63
54
|
"""
|
|
64
55
|
try:
|
|
65
56
|
plugin_class = self._plugins[(name, type_)]
|
|
66
|
-
return
|
|
57
|
+
return plugin_class
|
|
67
58
|
except KeyError:
|
|
68
59
|
raise PluginError(plugin_name=name, plugin_type=type_.__name__) from None
|
|
69
60
|
|
|
@@ -5,26 +5,27 @@ from cognite.client import CogniteClient
|
|
|
5
5
|
from cognite.client import data_modeling as dm
|
|
6
6
|
|
|
7
7
|
from cognite.neat import _version
|
|
8
|
-
from cognite.neat.core._client import NeatClient
|
|
9
|
-
from cognite.neat.core._data_model import importers
|
|
10
|
-
from cognite.neat.core._data_model.models import PhysicalDataModel
|
|
11
|
-
from cognite.neat.core._data_model.models.conceptual._verified import (
|
|
8
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
9
|
+
from cognite.neat.v0.core._data_model import importers
|
|
10
|
+
from cognite.neat.v0.core._data_model.models import PhysicalDataModel
|
|
11
|
+
from cognite.neat.v0.core._data_model.models.conceptual._verified import (
|
|
12
12
|
ConceptualDataModel,
|
|
13
13
|
)
|
|
14
|
-
from cognite.neat.core._data_model.transformers import (
|
|
14
|
+
from cognite.neat.v0.core._data_model.transformers import (
|
|
15
15
|
ConceptualToPhysical,
|
|
16
16
|
MergeConceptualDataModels,
|
|
17
17
|
MergePhysicalDataModels,
|
|
18
18
|
ToDMSCompliantEntities,
|
|
19
19
|
VerifyConceptualDataModel,
|
|
20
20
|
)
|
|
21
|
-
from cognite.neat.core._issues import IssueList
|
|
22
|
-
from cognite.neat.core._issues.errors import RegexViolationError
|
|
23
|
-
from cognite.neat.core._issues.errors._general import NeatImportError
|
|
24
|
-
from cognite.neat.core._store._data_model import DataModelEntity
|
|
25
|
-
from cognite.neat.core._utils.auxiliary import local_import
|
|
21
|
+
from cognite.neat.v0.core._issues import IssueList
|
|
22
|
+
from cognite.neat.v0.core._issues.errors import RegexViolationError
|
|
23
|
+
from cognite.neat.v0.core._issues.errors._general import NeatImportError
|
|
24
|
+
from cognite.neat.v0.core._store._data_model import DataModelEntity
|
|
25
|
+
from cognite.neat.v0.core._utils.auxiliary import local_import
|
|
26
26
|
|
|
27
27
|
from ._collector import _COLLECTOR, Collector
|
|
28
|
+
from ._diff import DiffAPI
|
|
28
29
|
from ._drop import DropAPI
|
|
29
30
|
from ._explore import ExploreAPI
|
|
30
31
|
from ._fix import FixAPI
|
|
@@ -110,6 +111,7 @@ class NeatSession:
|
|
|
110
111
|
self.template = TemplateAPI(self._state)
|
|
111
112
|
self._explore = ExploreAPI(self._state)
|
|
112
113
|
self.plugins = PluginAPI(self._state)
|
|
114
|
+
self._diff = DiffAPI(self._state)
|
|
113
115
|
self.opt = OptAPI()
|
|
114
116
|
self.opt._display()
|
|
115
117
|
if load_engine != "skip" and (engine_version := load_neat_engine(client, load_engine)):
|
|
@@ -11,7 +11,7 @@ from typing import Any
|
|
|
11
11
|
from mixpanel import Consumer, Mixpanel # type: ignore[import-untyped]
|
|
12
12
|
|
|
13
13
|
from cognite.neat._version import __version__
|
|
14
|
-
from cognite.neat.core._constants import IN_NOTEBOOK, IN_PYODIDE
|
|
14
|
+
from cognite.neat.v0.core._constants import IN_NOTEBOOK, IN_PYODIDE
|
|
15
15
|
|
|
16
16
|
_NEAT_MIXPANEL_TOKEN: str = "bd630ad149d19999df3989c3a3750c4f"
|
|
17
17
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from typing import cast
|
|
2
|
+
|
|
3
|
+
from rdflib.query import ResultRow
|
|
4
|
+
|
|
5
|
+
from cognite.neat.v0.core._constants import NAMED_GRAPH_NAMESPACE
|
|
6
|
+
|
|
7
|
+
from ._state import SessionState
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class DiffAPI:
|
|
11
|
+
"""Compare RDF graphs (private API)."""
|
|
12
|
+
|
|
13
|
+
def __init__(self, state: SessionState) -> None:
|
|
14
|
+
self._state = state
|
|
15
|
+
|
|
16
|
+
def instances(self, current_named_graph: str, new_named_graph: str) -> None:
|
|
17
|
+
"""
|
|
18
|
+
Compare two named graphs and store diff results.
|
|
19
|
+
|
|
20
|
+
Results stored in DIFF_ADD and DIFF_DELETE named graphs.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
current_named_graph: Name of the current graph (e.g., "CURRENT")
|
|
24
|
+
new_named_graph: Name of the new graph (e.g., "NEW")
|
|
25
|
+
"""
|
|
26
|
+
current_uri = NAMED_GRAPH_NAMESPACE[current_named_graph]
|
|
27
|
+
new_uri = NAMED_GRAPH_NAMESPACE[new_named_graph]
|
|
28
|
+
|
|
29
|
+
self._state.instances.store.diff(current_uri, new_uri)
|
|
30
|
+
self._print_summary()
|
|
31
|
+
|
|
32
|
+
def _print_summary(self) -> None:
|
|
33
|
+
"""Print diff summary with triple counts."""
|
|
34
|
+
store = self._state.instances.store
|
|
35
|
+
|
|
36
|
+
add_query = (
|
|
37
|
+
f"SELECT (COUNT(*) as ?count) WHERE {{ GRAPH <{NAMED_GRAPH_NAMESPACE['DIFF_ADD']}> {{ ?s ?p ?o }} }}"
|
|
38
|
+
)
|
|
39
|
+
delete_query = (
|
|
40
|
+
f"SELECT (COUNT(*) as ?count) WHERE {{ GRAPH <{NAMED_GRAPH_NAMESPACE['DIFF_DELETE']}> {{ ?s ?p ?o }} }}"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
add_result = cast(ResultRow, next(iter(store.dataset.query(add_query))))
|
|
44
|
+
delete_result = cast(ResultRow, next(iter(store.dataset.query(delete_query))))
|
|
45
|
+
|
|
46
|
+
add_count = int(add_result[0])
|
|
47
|
+
delete_count = int(delete_result[0])
|
|
48
|
+
|
|
49
|
+
print("Diff complete:")
|
|
50
|
+
print(f" {add_count} triples to add (stored in DIFF_ADD)")
|
|
51
|
+
print(f" {delete_count} triples to delete (stored in DIFF_DELETE)")
|
|
@@ -5,9 +5,9 @@ from typing import Literal
|
|
|
5
5
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
6
6
|
from rdflib import URIRef
|
|
7
7
|
|
|
8
|
-
from cognite.neat.core._constants import COGNITE_MODELS
|
|
9
|
-
from cognite.neat.core._data_model.transformers import DropModelViews
|
|
10
|
-
from cognite.neat.core._issues import IssueList
|
|
8
|
+
from cognite.neat.v0.core._constants import COGNITE_MODELS
|
|
9
|
+
from cognite.neat.v0.core._data_model.transformers import DropModelViews
|
|
10
|
+
from cognite.neat.v0.core._issues import IssueList
|
|
11
11
|
|
|
12
12
|
from ._state import SessionState
|
|
13
13
|
from .exceptions import NeatSessionError, session_class_wrapper
|
|
@@ -3,8 +3,8 @@ from typing import cast
|
|
|
3
3
|
import pandas as pd
|
|
4
4
|
from rdflib import URIRef
|
|
5
5
|
|
|
6
|
-
from cognite.neat.core._utils.rdf_ import remove_namespace_from_uri
|
|
7
|
-
from cognite.neat.core._utils.text import humanize_collection
|
|
6
|
+
from cognite.neat.v0.core._utils.rdf_ import remove_namespace_from_uri
|
|
7
|
+
from cognite.neat.v0.core._utils.text import humanize_collection
|
|
8
8
|
|
|
9
9
|
from ._state import SessionState
|
|
10
10
|
from .exceptions import NeatSessionError, session_class_wrapper
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
from cognite.neat.core._data_model.transformers import (
|
|
1
|
+
from cognite.neat.v0.core._data_model.transformers import (
|
|
2
2
|
ToCompliantEntities,
|
|
3
3
|
)
|
|
4
|
-
from cognite.neat.core._issues._base import IssueList
|
|
4
|
+
from cognite.neat.v0.core._issues._base import IssueList
|
|
5
5
|
|
|
6
6
|
from ._state import SessionState
|
|
7
7
|
from .exceptions import session_class_wrapper
|
|
@@ -4,9 +4,9 @@ from typing import Literal, overload
|
|
|
4
4
|
|
|
5
5
|
import pandas as pd
|
|
6
6
|
|
|
7
|
-
from cognite.neat.core._constants import IN_NOTEBOOK
|
|
8
|
-
from cognite.neat.core._issues import IssueList
|
|
9
|
-
from cognite.neat.core._utils.upload import (
|
|
7
|
+
from cognite.neat.v0.core._constants import IN_NOTEBOOK
|
|
8
|
+
from cognite.neat.v0.core._issues import IssueList
|
|
9
|
+
from cognite.neat.v0.core._utils.upload import (
|
|
10
10
|
UploadResult,
|
|
11
11
|
UploadResultCore,
|
|
12
12
|
UploadResultList,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
from cognite.neat.core._data_model.models.mapping import load_classic_to_core_mapping
|
|
2
|
-
from cognite.neat.core._data_model.transformers import (
|
|
1
|
+
from cognite.neat.v0.core._data_model.models.mapping import load_classic_to_core_mapping
|
|
2
|
+
from cognite.neat.v0.core._data_model.transformers import (
|
|
3
3
|
AsParentPropertyId,
|
|
4
4
|
ChangeViewPrefix,
|
|
5
5
|
IncludeReferenced,
|
|
6
6
|
PhysicalDataModelMapper,
|
|
7
7
|
VerifiedDataModelTransformer,
|
|
8
8
|
)
|
|
9
|
-
from cognite.neat.core._issues import IssueList
|
|
9
|
+
from cognite.neat.v0.core._issues import IssueList
|
|
10
10
|
|
|
11
11
|
from ._state import SessionState
|
|
12
12
|
from .exceptions import NeatSessionError, session_class_wrapper
|
|
@@ -2,11 +2,10 @@ import warnings
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
from typing import Any
|
|
4
4
|
|
|
5
|
-
from cognite.neat.core._issues._base import IssueList
|
|
6
|
-
from cognite.neat.core._utils.reader._base import NeatReader
|
|
7
|
-
from cognite.neat.plugins import get_plugin_manager
|
|
8
|
-
from cognite.neat.
|
|
9
|
-
from cognite.neat.session._experimental import ExperimentalFlags
|
|
5
|
+
from cognite.neat.v0.core._issues._base import IssueList
|
|
6
|
+
from cognite.neat.v0.core._utils.reader._base import NeatReader
|
|
7
|
+
from cognite.neat.v0.plugins import DataModelImporterPlugin, get_plugin_manager
|
|
8
|
+
from cognite.neat.v0.session._experimental import ExperimentalFlags
|
|
10
9
|
|
|
11
10
|
from ._state import SessionState
|
|
12
11
|
from .exceptions import session_class_wrapper
|
|
@@ -4,19 +4,19 @@ from typing import Any
|
|
|
4
4
|
|
|
5
5
|
from rdflib import URIRef
|
|
6
6
|
|
|
7
|
-
from cognite.neat.core._data_model.transformers import PrefixEntities, StandardizeNaming
|
|
8
|
-
from cognite.neat.core._data_model.transformers._converters import StandardizeSpaceAndVersion
|
|
9
|
-
from cognite.neat.core._instances.transformers import (
|
|
7
|
+
from cognite.neat.v0.core._data_model.transformers import PrefixEntities, StandardizeNaming
|
|
8
|
+
from cognite.neat.v0.core._data_model.transformers._converters import StandardizeSpaceAndVersion
|
|
9
|
+
from cognite.neat.v0.core._instances.transformers import (
|
|
10
10
|
ConnectionToLiteral,
|
|
11
11
|
ConvertLiteral,
|
|
12
12
|
LiteralToEntity,
|
|
13
13
|
RelationshipAsEdgeTransformer,
|
|
14
14
|
)
|
|
15
|
-
from cognite.neat.core._instances.transformers._rdfpath import MakeConnectionOnExactMatch
|
|
16
|
-
from cognite.neat.core._issues import IssueList
|
|
17
|
-
from cognite.neat.core._issues.errors import NeatValueError
|
|
18
|
-
from cognite.neat.core._utils.text import humanize_collection
|
|
19
|
-
from cognite.neat.session._experimental import ExperimentalFlags
|
|
15
|
+
from cognite.neat.v0.core._instances.transformers._rdfpath import MakeConnectionOnExactMatch
|
|
16
|
+
from cognite.neat.v0.core._issues import IssueList
|
|
17
|
+
from cognite.neat.v0.core._issues.errors import NeatValueError
|
|
18
|
+
from cognite.neat.v0.core._utils.text import humanize_collection
|
|
19
|
+
from cognite.neat.v0.session._experimental import ExperimentalFlags
|
|
20
20
|
|
|
21
21
|
from ._state import SessionState
|
|
22
22
|
from .exceptions import NeatSessionError, session_class_wrapper
|
|
@@ -1,41 +1,45 @@
|
|
|
1
|
+
import re
|
|
1
2
|
import warnings
|
|
2
3
|
from typing import Any, Literal, cast
|
|
3
4
|
|
|
4
5
|
from cognite.client.data_classes.data_modeling import DataModelId, DataModelIdentifier
|
|
5
6
|
from cognite.client.utils.useful_types import SequenceNotStr
|
|
7
|
+
from rdflib import URIRef
|
|
6
8
|
|
|
7
|
-
from cognite.neat.core._client import NeatClient
|
|
8
|
-
from cognite.neat.core._constants import (
|
|
9
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
10
|
+
from cognite.neat.v0.core._constants import (
|
|
9
11
|
CLASSIC_CDF_NAMESPACE,
|
|
12
|
+
NAMED_GRAPH_NAMESPACE,
|
|
10
13
|
get_default_prefixes_and_namespaces,
|
|
11
14
|
)
|
|
12
|
-
from cognite.neat.core._data_model import catalog, importers
|
|
13
|
-
from cognite.neat.core._data_model.
|
|
14
|
-
from cognite.neat.core._data_model.
|
|
15
|
-
from cognite.neat.core._data_model.
|
|
16
|
-
from cognite.neat.core._data_model.transformers
|
|
15
|
+
from cognite.neat.v0.core._data_model import catalog, importers
|
|
16
|
+
from cognite.neat.v0.core._data_model._constants import SPACE_COMPLIANCE_REGEX
|
|
17
|
+
from cognite.neat.v0.core._data_model.importers import BaseImporter
|
|
18
|
+
from cognite.neat.v0.core._data_model.models.entities._single_value import ViewEntity
|
|
19
|
+
from cognite.neat.v0.core._data_model.transformers import ClassicPrepareCore
|
|
20
|
+
from cognite.neat.v0.core._data_model.transformers._converters import (
|
|
17
21
|
ToEnterpriseModel,
|
|
18
22
|
_SubsetEditableCDMPhysicalDataModel,
|
|
19
23
|
)
|
|
20
|
-
from cognite.neat.core._instances import examples as instances_examples
|
|
21
|
-
from cognite.neat.core._instances import extractors
|
|
22
|
-
from cognite.neat.core._instances.extractors._classic_cdf._base import InstanceIdPrefix
|
|
23
|
-
from cognite.neat.core._instances.transformers import (
|
|
24
|
+
from cognite.neat.v0.core._instances import examples as instances_examples
|
|
25
|
+
from cognite.neat.v0.core._instances import extractors
|
|
26
|
+
from cognite.neat.v0.core._instances.extractors._classic_cdf._base import InstanceIdPrefix
|
|
27
|
+
from cognite.neat.v0.core._instances.transformers import (
|
|
24
28
|
ConvertLiteral,
|
|
25
29
|
LiteralToEntity,
|
|
26
30
|
Transformers,
|
|
27
31
|
)
|
|
28
|
-
from cognite.neat.core._instances.transformers._prune_graph import (
|
|
32
|
+
from cognite.neat.v0.core._instances.transformers._prune_graph import (
|
|
29
33
|
AttachPropertyFromTargetToSource,
|
|
30
34
|
PruneDeadEndEdges,
|
|
31
35
|
PruneInstancesOfUnknownType,
|
|
32
36
|
PruneTypes,
|
|
33
37
|
)
|
|
34
|
-
from cognite.neat.core._issues import IssueList
|
|
35
|
-
from cognite.neat.core._issues.errors import NeatValueError
|
|
36
|
-
from cognite.neat.core._issues.warnings import MissingCogniteClientWarning
|
|
37
|
-
from cognite.neat.core._utils.reader import NeatReader
|
|
38
|
-
from cognite.neat.session._experimental import ExperimentalFlags
|
|
38
|
+
from cognite.neat.v0.core._issues import IssueList
|
|
39
|
+
from cognite.neat.v0.core._issues.errors import NeatValueError
|
|
40
|
+
from cognite.neat.v0.core._issues.warnings import MissingCogniteClientWarning
|
|
41
|
+
from cognite.neat.v0.core._utils.reader import NeatReader
|
|
42
|
+
from cognite.neat.v0.session._experimental import ExperimentalFlags
|
|
39
43
|
|
|
40
44
|
from ._state import SessionState
|
|
41
45
|
from ._wizard import NeatObjectType, RDFFileType, XMLFileType, object_wizard, rdf_dm_wizard, xml_format_wizard
|
|
@@ -826,13 +830,21 @@ class RDFReadAPI(BaseReadAPI):
|
|
|
826
830
|
importer = importers.OWLImporter.from_file(reader.materialize_path(), source_name=f"file {reader!s}")
|
|
827
831
|
return self._state.data_model_import(importer)
|
|
828
832
|
|
|
829
|
-
def instances(self, io: Any) -> IssueList:
|
|
833
|
+
def instances(self, io: Any, named_graph: str | None = None) -> IssueList:
|
|
830
834
|
self._state._raise_exception_if_condition_not_met(
|
|
831
835
|
"Read RDF Instances",
|
|
832
836
|
empty_data_model_store_required=True,
|
|
833
837
|
)
|
|
834
838
|
reader = NeatReader.create(io)
|
|
835
|
-
|
|
839
|
+
|
|
840
|
+
# validate and convert named_graph to URI
|
|
841
|
+
named_graph_uri: URIRef | None = None
|
|
842
|
+
if named_graph:
|
|
843
|
+
if not re.match(SPACE_COMPLIANCE_REGEX, named_graph):
|
|
844
|
+
raise NeatValueError(f"Named graph '{named_graph}' does not comply with naming requirements. ")
|
|
845
|
+
named_graph_uri = NAMED_GRAPH_NAMESPACE[named_graph]
|
|
846
|
+
|
|
847
|
+
self._state.instances.store.write(extractors.RdfFileExtractor(reader.materialize_path()), named_graph_uri)
|
|
836
848
|
return IssueList()
|
|
837
849
|
|
|
838
850
|
def __call__(
|
|
@@ -840,6 +852,7 @@ class RDFReadAPI(BaseReadAPI):
|
|
|
840
852
|
io: Any,
|
|
841
853
|
type: NeatObjectType | None = None,
|
|
842
854
|
source: RDFFileType | None = None,
|
|
855
|
+
named_graph: str | URIRef | None = None,
|
|
843
856
|
) -> IssueList:
|
|
844
857
|
if type is None:
|
|
845
858
|
type = object_wizard()
|
|
@@ -858,7 +871,7 @@ class RDFReadAPI(BaseReadAPI):
|
|
|
858
871
|
raise ValueError(f"Expected ontology, imf types or instances, got {source}")
|
|
859
872
|
|
|
860
873
|
elif type == "instances":
|
|
861
|
-
return self.instances(io)
|
|
874
|
+
return self.instances(io, named_graph=named_graph)
|
|
862
875
|
|
|
863
876
|
else:
|
|
864
877
|
raise NeatSessionError(f"Expected data model or instances, got {type}")
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
from cognite.client import CogniteClient
|
|
2
2
|
from cognite.client import data_modeling as dm
|
|
3
3
|
|
|
4
|
-
from cognite.neat.core._client import NeatClient
|
|
5
|
-
from cognite.neat.core._constants import COGNITE_MODELS
|
|
6
|
-
from cognite.neat.core._data_model.models import PhysicalDataModel
|
|
7
|
-
from cognite.neat.core._data_model.transformers import SetIDDMSModel
|
|
8
|
-
from cognite.neat.core._instances.transformers import SetType
|
|
9
|
-
from cognite.neat.core._issues import IssueList
|
|
10
|
-
from cognite.neat.core._issues.errors import NeatValueError
|
|
11
|
-
from cognite.neat.core._utils.text import humanize_collection
|
|
4
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
5
|
+
from cognite.neat.v0.core._constants import COGNITE_MODELS
|
|
6
|
+
from cognite.neat.v0.core._data_model.models import PhysicalDataModel
|
|
7
|
+
from cognite.neat.v0.core._data_model.transformers import SetIDDMSModel
|
|
8
|
+
from cognite.neat.v0.core._instances.transformers import SetType
|
|
9
|
+
from cognite.neat.v0.core._issues import IssueList
|
|
10
|
+
from cognite.neat.v0.core._issues.errors import NeatValueError
|
|
11
|
+
from cognite.neat.v0.core._utils.text import humanize_collection
|
|
12
12
|
|
|
13
13
|
from ._state import SessionState
|
|
14
14
|
from .exceptions import NeatSessionError, session_class_wrapper
|
|
@@ -6,11 +6,11 @@ import networkx as nx
|
|
|
6
6
|
from IPython.display import HTML, display
|
|
7
7
|
from pyvis.network import Network as PyVisNetwork # type: ignore
|
|
8
8
|
|
|
9
|
-
from cognite.neat.core._constants import IN_NOTEBOOK, IN_PYODIDE
|
|
10
|
-
from cognite.neat.core._data_model.analysis._base import DataModelAnalysis
|
|
11
|
-
from cognite.neat.core._utils.io_ import to_directory_compatible
|
|
12
|
-
from cognite.neat.core._utils.rdf_ import remove_namespace_from_uri, uri_display_name
|
|
13
|
-
from cognite.neat.session.exceptions import NeatSessionError
|
|
9
|
+
from cognite.neat.v0.core._constants import IN_NOTEBOOK, IN_PYODIDE
|
|
10
|
+
from cognite.neat.v0.core._data_model.analysis._base import DataModelAnalysis
|
|
11
|
+
from cognite.neat.v0.core._utils.io_ import to_directory_compatible
|
|
12
|
+
from cognite.neat.v0.core._utils.rdf_ import remove_namespace_from_uri, uri_display_name
|
|
13
|
+
from cognite.neat.v0.session.exceptions import NeatSessionError
|
|
14
14
|
|
|
15
15
|
from ._state import SessionState
|
|
16
16
|
from .exceptions import session_class_wrapper
|
|
@@ -3,18 +3,18 @@ from typing import Literal, cast
|
|
|
3
3
|
|
|
4
4
|
from rdflib import URIRef
|
|
5
5
|
|
|
6
|
-
from cognite.neat.core._client import NeatClient
|
|
7
|
-
from cognite.neat.core._data_model.importers import BaseImporter, InferenceImporter
|
|
8
|
-
from cognite.neat.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
9
|
-
from cognite.neat.core._data_model.models.conceptual._validation import ConceptualValidation
|
|
10
|
-
from cognite.neat.core._data_model.transformers import (
|
|
6
|
+
from cognite.neat.v0.core._client import NeatClient
|
|
7
|
+
from cognite.neat.v0.core._data_model.importers import BaseImporter, InferenceImporter
|
|
8
|
+
from cognite.neat.v0.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
9
|
+
from cognite.neat.v0.core._data_model.models.conceptual._validation import ConceptualValidation
|
|
10
|
+
from cognite.neat.v0.core._data_model.transformers import (
|
|
11
11
|
VerifiedDataModelTransformer,
|
|
12
12
|
)
|
|
13
|
-
from cognite.neat.core._instances.extractors import KnowledgeGraphExtractor
|
|
14
|
-
from cognite.neat.core._issues import IssueList
|
|
15
|
-
from cognite.neat.core._issues.warnings._models import ConversionToPhysicalModelImpossibleWarning
|
|
16
|
-
from cognite.neat.core._store import NeatDataModelStore, NeatInstanceStore
|
|
17
|
-
from cognite.neat.core._utils.upload import UploadResultList
|
|
13
|
+
from cognite.neat.v0.core._instances.extractors import KnowledgeGraphExtractor
|
|
14
|
+
from cognite.neat.v0.core._issues import IssueList
|
|
15
|
+
from cognite.neat.v0.core._issues.warnings._models import ConversionToPhysicalModelImpossibleWarning
|
|
16
|
+
from cognite.neat.v0.core._store import NeatDataModelStore, NeatInstanceStore
|
|
17
|
+
from cognite.neat.v0.core._utils.upload import UploadResultList
|
|
18
18
|
|
|
19
19
|
from .exceptions import NeatSessionError, _session_method_wrapper
|
|
20
20
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import warnings
|
|
2
2
|
|
|
3
|
-
from cognite.neat.core._data_model.models.entities._single_value import (
|
|
3
|
+
from cognite.neat.v0.core._data_model.models.entities._single_value import (
|
|
4
4
|
ConceptEntity,
|
|
5
5
|
ViewEntity,
|
|
6
6
|
)
|
|
7
|
-
from cognite.neat.core._data_model.transformers import (
|
|
7
|
+
from cognite.neat.v0.core._data_model.transformers import (
|
|
8
8
|
SubsetConceptualDataModel,
|
|
9
9
|
SubsetPhysicalDataModel,
|
|
10
10
|
)
|
|
11
|
-
from cognite.neat.core._issues._base import IssueList
|
|
12
|
-
from cognite.neat.session._experimental import ExperimentalFlags
|
|
11
|
+
from cognite.neat.v0.core._issues._base import IssueList
|
|
12
|
+
from cognite.neat.v0.session._experimental import ExperimentalFlags
|
|
13
13
|
|
|
14
14
|
from ._state import SessionState
|
|
15
15
|
from .exceptions import NeatSessionError, session_class_wrapper
|
|
@@ -3,23 +3,23 @@ from typing import Any, Literal
|
|
|
3
3
|
|
|
4
4
|
from cognite.client.data_classes.data_modeling import DataModelIdentifier
|
|
5
5
|
|
|
6
|
-
from cognite.neat.core._constants import BASE_MODEL
|
|
7
|
-
from cognite.neat.core._data_model._shared import ImportedDataModel
|
|
8
|
-
from cognite.neat.core._data_model.exporters import ExcelExporter
|
|
9
|
-
from cognite.neat.core._data_model.importers import ExcelImporter
|
|
10
|
-
from cognite.neat.core._data_model.models import UnverifiedConceptualDataModel
|
|
11
|
-
from cognite.neat.core._data_model.models._base_verified import RoleTypes
|
|
12
|
-
from cognite.neat.core._data_model.models.physical import PhysicalValidation
|
|
13
|
-
from cognite.neat.core._data_model.transformers import (
|
|
6
|
+
from cognite.neat.v0.core._constants import BASE_MODEL
|
|
7
|
+
from cognite.neat.v0.core._data_model._shared import ImportedDataModel
|
|
8
|
+
from cognite.neat.v0.core._data_model.exporters import ExcelExporter
|
|
9
|
+
from cognite.neat.v0.core._data_model.importers import ExcelImporter
|
|
10
|
+
from cognite.neat.v0.core._data_model.models import UnverifiedConceptualDataModel
|
|
11
|
+
from cognite.neat.v0.core._data_model.models._base_verified import RoleTypes
|
|
12
|
+
from cognite.neat.v0.core._data_model.models.physical import PhysicalValidation
|
|
13
|
+
from cognite.neat.v0.core._data_model.transformers import (
|
|
14
14
|
AddCogniteProperties,
|
|
15
15
|
IncludeReferenced,
|
|
16
16
|
ToDataProductModel,
|
|
17
17
|
ToEnterpriseModel,
|
|
18
18
|
VerifiedDataModelTransformer,
|
|
19
19
|
)
|
|
20
|
-
from cognite.neat.core._issues import IssueList, catch_issues
|
|
21
|
-
from cognite.neat.core._utils.reader import NeatReader, PathReader
|
|
22
|
-
from cognite.neat.session._experimental import ExperimentalFlags
|
|
20
|
+
from cognite.neat.v0.core._issues import IssueList, catch_issues
|
|
21
|
+
from cognite.neat.v0.core._utils.reader import NeatReader, PathReader
|
|
22
|
+
from cognite.neat.v0.session._experimental import ExperimentalFlags
|
|
23
23
|
|
|
24
24
|
from ._state import SessionState
|
|
25
25
|
from .exceptions import NeatSessionError, session_class_wrapper
|
|
@@ -6,18 +6,18 @@ from typing import Any, Literal, cast, overload
|
|
|
6
6
|
from cognite.client import data_modeling as dm
|
|
7
7
|
from cognite.client.data_classes.data_modeling import DataModelIdentifier
|
|
8
8
|
|
|
9
|
-
from cognite.neat.core._client._api_client import NeatClient
|
|
10
|
-
from cognite.neat.core._constants import COGNITE_MODELS
|
|
11
|
-
from cognite.neat.core._data_model import exporters
|
|
12
|
-
from cognite.neat.core._data_model._constants import PATTERNS
|
|
13
|
-
from cognite.neat.core._data_model._shared import VerifiedDataModel
|
|
14
|
-
from cognite.neat.core._data_model.importers import DMSImporter
|
|
15
|
-
from cognite.neat.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
16
|
-
from cognite.neat.core._data_model.models.physical import PhysicalMetadata
|
|
17
|
-
from cognite.neat.core._instances import loaders
|
|
18
|
-
from cognite.neat.core._issues import IssueList, NeatIssue, catch_issues
|
|
19
|
-
from cognite.neat.core._utils.upload import UploadResultList
|
|
20
|
-
from cognite.neat.session._experimental import ExperimentalFlags
|
|
9
|
+
from cognite.neat.v0.core._client._api_client import NeatClient
|
|
10
|
+
from cognite.neat.v0.core._constants import COGNITE_MODELS
|
|
11
|
+
from cognite.neat.v0.core._data_model import exporters
|
|
12
|
+
from cognite.neat.v0.core._data_model._constants import PATTERNS
|
|
13
|
+
from cognite.neat.v0.core._data_model._shared import VerifiedDataModel
|
|
14
|
+
from cognite.neat.v0.core._data_model.importers import DMSImporter
|
|
15
|
+
from cognite.neat.v0.core._data_model.models import ConceptualDataModel, PhysicalDataModel
|
|
16
|
+
from cognite.neat.v0.core._data_model.models.physical import PhysicalMetadata
|
|
17
|
+
from cognite.neat.v0.core._instances import loaders
|
|
18
|
+
from cognite.neat.v0.core._issues import IssueList, NeatIssue, catch_issues
|
|
19
|
+
from cognite.neat.v0.core._utils.upload import UploadResultList
|
|
20
|
+
from cognite.neat.v0.session._experimental import ExperimentalFlags
|
|
21
21
|
|
|
22
22
|
from ._state import SessionState
|
|
23
23
|
from .exceptions import NeatSessionError, session_class_wrapper
|
|
@@ -3,7 +3,7 @@ from typing import Literal, TypeVar, get_args
|
|
|
3
3
|
|
|
4
4
|
from rich.prompt import IntPrompt, Prompt
|
|
5
5
|
|
|
6
|
-
from cognite.neat.core._data_model._constants import PATTERNS
|
|
6
|
+
from cognite.neat.v0.core._data_model._constants import PATTERNS
|
|
7
7
|
|
|
8
8
|
RDFFileType = Literal["Ontology", "IMF Types", "Inference"]
|
|
9
9
|
NeatObjectType = Literal["Data Model", "Instances"]
|
|
@@ -13,7 +13,7 @@ from packaging.version import Version
|
|
|
13
13
|
from packaging.version import parse as parse_version
|
|
14
14
|
|
|
15
15
|
from cognite.neat._version import __engine__
|
|
16
|
-
from cognite.neat.core._issues.errors import NeatValueError
|
|
16
|
+
from cognite.neat.v0.core._issues.errors import NeatValueError
|
|
17
17
|
|
|
18
18
|
ENVIRONMENT_VARIABLE = "NEATENGINE"
|
|
19
19
|
PACKAGE_NAME = "neatengine"
|