cognite-neat 0.70.1__py3-none-any.whl → 0.127.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cognite/neat/__init__.py +4 -1
- 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/_data_model/_analysis.py +186 -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 +399 -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 +291 -0
- cognite/neat/_data_model/importers/_table_importer/importer.py +192 -0
- cognite/neat/_data_model/importers/_table_importer/reader.py +875 -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 +47 -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 +94 -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 +57 -0
- cognite/neat/_data_model/validation/dms/_ai_readiness.py +167 -0
- cognite/neat/_data_model/validation/dms/_base.py +304 -0
- cognite/neat/_data_model/validation/dms/_connections.py +627 -0
- cognite/neat/_data_model/validation/dms/_consistency.py +56 -0
- cognite/neat/_data_model/validation/dms/_containers.py +135 -0
- cognite/neat/_data_model/validation/dms/_limits.py +414 -0
- cognite/neat/_data_model/validation/dms/_orchestrator.py +202 -0
- cognite/neat/_data_model/validation/dms/_views.py +101 -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 +149 -0
- cognite/neat/_session/_html/static/issues.css +211 -0
- cognite/neat/_session/_html/static/issues.js +167 -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 +74 -0
- cognite/neat/_session/_html/templates/issues.html +44 -0
- cognite/neat/_session/_issues.py +76 -0
- cognite/neat/_session/_opt.py +35 -0
- cognite/neat/_session/_physical.py +240 -0
- cognite/neat/_session/_result.py +231 -0
- cognite/neat/_session/_session.py +69 -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 +71 -0
- cognite/neat/_store/_store.py +144 -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 +149 -0
- cognite/neat/_version.py +2 -1
- cognite/neat/v0/core/__init__.py +0 -0
- cognite/neat/v0/core/_client/__init__.py +4 -0
- cognite/neat/v0/core/_client/_api/__init__.py +0 -0
- cognite/neat/v0/core/_client/_api/data_modeling_loaders.py +1032 -0
- cognite/neat/v0/core/_client/_api/neat_instances.py +101 -0
- cognite/neat/v0/core/_client/_api/schema.py +158 -0
- cognite/neat/v0/core/_client/_api/statistics.py +91 -0
- cognite/neat/v0/core/_client/_api_client.py +21 -0
- cognite/neat/v0/core/_client/data_classes/__init__.py +0 -0
- cognite/neat/v0/core/_client/data_classes/data_modeling.py +198 -0
- cognite/neat/v0/core/_client/data_classes/neat_sequence.py +261 -0
- cognite/neat/v0/core/_client/data_classes/schema.py +540 -0
- cognite/neat/v0/core/_client/data_classes/statistics.py +125 -0
- cognite/neat/v0/core/_client/testing.py +39 -0
- cognite/neat/v0/core/_config.py +11 -0
- cognite/neat/v0/core/_constants.py +278 -0
- cognite/neat/v0/core/_data_model/__init__.py +0 -0
- cognite/neat/v0/core/_data_model/_constants.py +210 -0
- cognite/neat/v0/core/_data_model/_shared.py +59 -0
- cognite/neat/v0/core/_data_model/analysis/__init__.py +3 -0
- cognite/neat/v0/core/_data_model/analysis/_base.py +578 -0
- cognite/neat/v0/core/_data_model/catalog/__init__.py +8 -0
- cognite/neat/v0/core/_data_model/catalog/classic_model.xlsx +0 -0
- cognite/neat/v0/core/_data_model/catalog/conceptual-imf-data-model.xlsx +0 -0
- cognite/neat/v0/core/_data_model/catalog/hello_world_pump.xlsx +0 -0
- cognite/neat/v0/core/_data_model/exporters/__init__.py +38 -0
- cognite/neat/v0/core/_data_model/exporters/_base.py +67 -0
- cognite/neat/v0/core/_data_model/exporters/_data_model2dms.py +428 -0
- cognite/neat/v0/core/_data_model/exporters/_data_model2excel.py +612 -0
- cognite/neat/v0/core/_data_model/exporters/_data_model2instance_template.py +158 -0
- cognite/neat/v0/core/_data_model/exporters/_data_model2semantic_model.py +646 -0
- cognite/neat/v0/core/_data_model/exporters/_data_model2yaml.py +84 -0
- cognite/neat/v0/core/_data_model/importers/__init__.py +49 -0
- cognite/neat/v0/core/_data_model/importers/_base.py +64 -0
- cognite/neat/v0/core/_data_model/importers/_base_file_reader.py +56 -0
- cognite/neat/v0/core/_data_model/importers/_dict2data_model.py +131 -0
- cognite/neat/v0/core/_data_model/importers/_dms2data_model.py +705 -0
- 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/v0/core/_data_model/importers/_rdf/_base.py +161 -0
- cognite/neat/v0/core/_data_model/importers/_rdf/_inference2rdata_model.py +618 -0
- cognite/neat/v0/core/_data_model/importers/_rdf/_owl2data_model.py +124 -0
- cognite/neat/v0/core/_data_model/importers/_rdf/_shared.py +255 -0
- cognite/neat/v0/core/_data_model/importers/_spreadsheet2data_model.py +424 -0
- cognite/neat/v0/core/_data_model/models/__init__.py +38 -0
- cognite/neat/v0/core/_data_model/models/_base_unverified.py +181 -0
- cognite/neat/v0/core/_data_model/models/_base_verified.py +449 -0
- cognite/neat/v0/core/_data_model/models/_import_contexts.py +82 -0
- cognite/neat/v0/core/_data_model/models/_types.py +171 -0
- cognite/neat/v0/core/_data_model/models/conceptual/__init__.py +25 -0
- cognite/neat/v0/core/_data_model/models/conceptual/_unverified.py +193 -0
- cognite/neat/v0/core/_data_model/models/conceptual/_validation.py +308 -0
- cognite/neat/v0/core/_data_model/models/conceptual/_verified.py +327 -0
- cognite/neat/v0/core/_data_model/models/data_types.py +422 -0
- cognite/neat/v0/core/_data_model/models/entities/__init__.py +70 -0
- cognite/neat/v0/core/_data_model/models/entities/_constants.py +18 -0
- cognite/neat/v0/core/_data_model/models/entities/_loaders.py +155 -0
- cognite/neat/v0/core/_data_model/models/entities/_multi_value.py +83 -0
- cognite/neat/v0/core/_data_model/models/entities/_restrictions.py +230 -0
- cognite/neat/v0/core/_data_model/models/entities/_single_value.py +676 -0
- cognite/neat/v0/core/_data_model/models/entities/_types.py +103 -0
- cognite/neat/v0/core/_data_model/models/entities/_wrapped.py +217 -0
- cognite/neat/v0/core/_data_model/models/mapping/__init__.py +3 -0
- cognite/neat/v0/core/_data_model/models/mapping/_classic2core.py +39 -0
- cognite/neat/v0/core/_data_model/models/mapping/_classic2core.yaml +608 -0
- cognite/neat/v0/core/_data_model/models/physical/__init__.py +40 -0
- cognite/neat/v0/core/_data_model/models/physical/_exporter.py +658 -0
- cognite/neat/v0/core/_data_model/models/physical/_unverified.py +557 -0
- cognite/neat/v0/core/_data_model/models/physical/_validation.py +887 -0
- cognite/neat/v0/core/_data_model/models/physical/_verified.py +667 -0
- cognite/neat/v0/core/_data_model/transformers/__init__.py +70 -0
- cognite/neat/v0/core/_data_model/transformers/_base.py +79 -0
- cognite/neat/v0/core/_data_model/transformers/_converters.py +2485 -0
- cognite/neat/v0/core/_data_model/transformers/_mapping.py +390 -0
- cognite/neat/v0/core/_data_model/transformers/_union_conceptual.py +208 -0
- cognite/neat/v0/core/_data_model/transformers/_verification.py +120 -0
- cognite/neat/v0/core/_instances/__init__.py +0 -0
- cognite/neat/v0/core/_instances/_shared.py +37 -0
- cognite/neat/v0/core/_instances/_tracking/__init__.py +4 -0
- cognite/neat/v0/core/_instances/_tracking/base.py +30 -0
- cognite/neat/v0/core/_instances/_tracking/log.py +27 -0
- cognite/neat/v0/core/_instances/extractors/__init__.py +76 -0
- cognite/neat/v0/core/_instances/extractors/_base.py +58 -0
- cognite/neat/v0/core/_instances/extractors/_classic_cdf/__init__.py +0 -0
- cognite/neat/v0/core/_instances/extractors/_classic_cdf/_assets.py +37 -0
- cognite/neat/v0/core/_instances/extractors/_classic_cdf/_base.py +443 -0
- cognite/neat/v0/core/_instances/extractors/_classic_cdf/_classic.py +479 -0
- cognite/neat/v0/core/_instances/extractors/_classic_cdf/_data_sets.py +35 -0
- cognite/neat/v0/core/_instances/extractors/_classic_cdf/_events.py +33 -0
- cognite/neat/v0/core/_instances/extractors/_classic_cdf/_files.py +45 -0
- cognite/neat/v0/core/_instances/extractors/_classic_cdf/_labels.py +54 -0
- cognite/neat/v0/core/_instances/extractors/_classic_cdf/_relationships.py +122 -0
- cognite/neat/v0/core/_instances/extractors/_classic_cdf/_sequences.py +280 -0
- cognite/neat/v0/core/_instances/extractors/_classic_cdf/_timeseries.py +48 -0
- cognite/neat/v0/core/_instances/extractors/_dict.py +105 -0
- cognite/neat/v0/core/_instances/extractors/_dms.py +315 -0
- cognite/neat/v0/core/_instances/extractors/_dms_graph.py +238 -0
- cognite/neat/v0/core/_instances/extractors/_mock_graph_generator.py +404 -0
- cognite/neat/v0/core/_instances/extractors/_raw.py +67 -0
- cognite/neat/v0/core/_instances/extractors/_rdf_file.py +80 -0
- cognite/neat/v0/core/_instances/loaders/__init__.py +24 -0
- cognite/neat/v0/core/_instances/loaders/_base.py +116 -0
- cognite/neat/v0/core/_instances/loaders/_rdf2dms.py +649 -0
- cognite/neat/v0/core/_instances/loaders/_rdf_to_instance_space.py +249 -0
- cognite/neat/v0/core/_instances/queries/__init__.py +3 -0
- cognite/neat/v0/core/_instances/queries/_base.py +16 -0
- cognite/neat/v0/core/_instances/queries/_queries.py +16 -0
- cognite/neat/v0/core/_instances/queries/_select.py +478 -0
- cognite/neat/v0/core/_instances/queries/_update.py +37 -0
- cognite/neat/v0/core/_instances/transformers/__init__.py +65 -0
- cognite/neat/v0/core/_instances/transformers/_base.py +133 -0
- cognite/neat/v0/core/_instances/transformers/_classic_cdf.py +589 -0
- cognite/neat/v0/core/_instances/transformers/_prune_graph.py +315 -0
- cognite/neat/v0/core/_instances/transformers/_rdfpath.py +84 -0
- cognite/neat/v0/core/_instances/transformers/_value_type.py +366 -0
- cognite/neat/v0/core/_issues/__init__.py +21 -0
- cognite/neat/v0/core/_issues/_base.py +348 -0
- cognite/neat/v0/core/_issues/_contextmanagers.py +50 -0
- cognite/neat/v0/core/_issues/_factory.py +69 -0
- cognite/neat/v0/core/_issues/errors/__init__.py +90 -0
- cognite/neat/v0/core/_issues/errors/_external.py +91 -0
- cognite/neat/v0/core/_issues/errors/_general.py +51 -0
- cognite/neat/v0/core/_issues/errors/_properties.py +80 -0
- cognite/neat/v0/core/_issues/errors/_resources.py +116 -0
- cognite/neat/v0/core/_issues/errors/_wrapper.py +93 -0
- cognite/neat/{rules/issues → v0/core/_issues}/formatters.py +12 -10
- cognite/neat/v0/core/_issues/warnings/__init__.py +99 -0
- cognite/neat/v0/core/_issues/warnings/_external.py +56 -0
- cognite/neat/v0/core/_issues/warnings/_general.py +46 -0
- cognite/neat/v0/core/_issues/warnings/_models.py +165 -0
- cognite/neat/v0/core/_issues/warnings/_properties.py +108 -0
- cognite/neat/v0/core/_issues/warnings/_resources.py +110 -0
- cognite/neat/v0/core/_issues/warnings/user_modeling.py +125 -0
- cognite/neat/v0/core/_shared.py +77 -0
- cognite/neat/v0/core/_store/__init__.py +4 -0
- cognite/neat/v0/core/_store/_data_model.py +487 -0
- cognite/neat/v0/core/_store/_instance.py +485 -0
- cognite/neat/v0/core/_store/_provenance.py +217 -0
- cognite/neat/v0/core/_store/exceptions.py +59 -0
- cognite/neat/v0/core/_utils/__init__.py +0 -0
- cognite/neat/v0/core/_utils/auth.py +364 -0
- cognite/neat/v0/core/_utils/auxiliary.py +169 -0
- cognite/neat/v0/core/_utils/collection_.py +66 -0
- cognite/neat/v0/core/_utils/graph_transformations_report.py +36 -0
- cognite/neat/v0/core/_utils/io_.py +11 -0
- cognite/neat/v0/core/_utils/rdf_.py +336 -0
- cognite/neat/v0/core/_utils/reader/__init__.py +3 -0
- cognite/neat/v0/core/_utils/reader/_base.py +194 -0
- cognite/neat/v0/core/_utils/spreadsheet.py +182 -0
- cognite/neat/v0/core/_utils/tarjan.py +44 -0
- cognite/neat/v0/core/_utils/text.py +277 -0
- cognite/neat/v0/core/_utils/time_.py +17 -0
- cognite/neat/v0/core/_utils/upload.py +134 -0
- cognite/neat/v0/core/_utils/xml_.py +52 -0
- 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/v0/plugins/_issues.py +35 -0
- cognite/neat/v0/plugins/_manager.py +94 -0
- cognite/neat/v0/session/__init__.py +3 -0
- cognite/neat/v0/session/_base.py +332 -0
- cognite/neat/v0/session/_collector.py +131 -0
- cognite/neat/v0/session/_diff.py +51 -0
- cognite/neat/v0/session/_drop.py +103 -0
- cognite/neat/v0/session/_experimental.py +26 -0
- cognite/neat/v0/session/_explore.py +39 -0
- cognite/neat/v0/session/_fix.py +28 -0
- cognite/neat/v0/session/_inspect.py +285 -0
- cognite/neat/v0/session/_mapping.py +71 -0
- cognite/neat/v0/session/_plugin.py +66 -0
- cognite/neat/v0/session/_prepare.py +286 -0
- cognite/neat/v0/session/_read.py +923 -0
- cognite/neat/v0/session/_set.py +101 -0
- cognite/neat/v0/session/_show.py +298 -0
- cognite/neat/v0/session/_state/README.md +23 -0
- cognite/neat/v0/session/_state.py +161 -0
- cognite/neat/v0/session/_subset.py +88 -0
- cognite/neat/v0/session/_template.py +208 -0
- cognite/neat/v0/session/_to.py +454 -0
- cognite/neat/v0/session/_wizard.py +44 -0
- cognite/neat/v0/session/engine/__init__.py +4 -0
- cognite/neat/v0/session/engine/_import.py +7 -0
- cognite/neat/v0/session/engine/_interface.py +25 -0
- cognite/neat/v0/session/engine/_load.py +131 -0
- cognite/neat/v0/session/exceptions.py +103 -0
- cognite/neat/v1.py +3 -0
- cognite_neat-0.127.19.dist-info/METADATA +145 -0
- cognite_neat-0.127.19.dist-info/RECORD +318 -0
- {cognite_neat-0.70.1.dist-info → cognite_neat-0.127.19.dist-info}/WHEEL +1 -1
- cognite/neat/app/api/asgi/metrics.py +0 -4
- cognite/neat/app/api/configuration.py +0 -110
- cognite/neat/app/api/context_manager/__init__.py +0 -3
- cognite/neat/app/api/context_manager/manager.py +0 -16
- cognite/neat/app/api/data_classes/configuration.py +0 -121
- cognite/neat/app/api/data_classes/rest.py +0 -78
- cognite/neat/app/api/explorer.py +0 -64
- cognite/neat/app/api/routers/configuration.py +0 -24
- cognite/neat/app/api/routers/core.py +0 -51
- cognite/neat/app/api/routers/crud.py +0 -112
- cognite/neat/app/api/routers/data_exploration.py +0 -334
- cognite/neat/app/api/routers/metrics.py +0 -10
- cognite/neat/app/api/routers/rules.py +0 -169
- cognite/neat/app/api/routers/workflows.py +0 -274
- cognite/neat/app/api/utils/data_mapping.py +0 -17
- cognite/neat/app/api/utils/logging.py +0 -26
- cognite/neat/app/api/utils/query_templates.py +0 -92
- cognite/neat/app/main.py +0 -17
- cognite/neat/app/monitoring/metrics.py +0 -69
- cognite/neat/app/ui/index.html +0 -1
- cognite/neat/app/ui/neat-app/.gitignore +0 -23
- cognite/neat/app/ui/neat-app/README.md +0 -70
- cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -14
- cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
- cognite/neat/app/ui/neat-app/build/index.html +0 -1
- cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
- cognite/neat/app/ui/neat-app/build/manifest.json +0 -25
- cognite/neat/app/ui/neat-app/build/robots.txt +0 -3
- cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css +0 -2
- cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css.map +0 -1
- cognite/neat/app/ui/neat-app/build/static/js/main.ed960141.js +0 -3
- cognite/neat/app/ui/neat-app/build/static/js/main.ed960141.js.LICENSE.txt +0 -97
- cognite/neat/app/ui/neat-app/build/static/js/main.ed960141.js.map +0 -1
- cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -1
- cognite/neat/config.py +0 -46
- cognite/neat/constants.py +0 -36
- cognite/neat/exceptions.py +0 -139
- cognite/neat/graph/__init__.py +0 -3
- cognite/neat/graph/exceptions.py +0 -91
- cognite/neat/graph/extractor/__init__.py +0 -6
- cognite/neat/graph/extractor/_base.py +0 -14
- cognite/neat/graph/extractor/_dexpi.py +0 -306
- cognite/neat/graph/extractor/_graph_capturing_sheet.py +0 -401
- cognite/neat/graph/extractor/_mock_graph_generator.py +0 -359
- cognite/neat/graph/extractors/_base.py +0 -14
- cognite/neat/graph/extractors/_mock_graph_generator.py +0 -359
- cognite/neat/graph/loader/__init__.py +0 -23
- cognite/neat/graph/loader/_asset_loader.py +0 -516
- cognite/neat/graph/loader/_base.py +0 -69
- cognite/neat/graph/loader/_exceptions.py +0 -87
- cognite/neat/graph/loader/core/labels.py +0 -58
- cognite/neat/graph/loader/core/models.py +0 -136
- cognite/neat/graph/loader/core/rdf_to_assets.py +0 -1047
- cognite/neat/graph/loader/core/rdf_to_relationships.py +0 -558
- cognite/neat/graph/loader/rdf_to_dms.py +0 -309
- cognite/neat/graph/loader/validator.py +0 -87
- cognite/neat/graph/models.py +0 -6
- cognite/neat/graph/stores/__init__.py +0 -13
- cognite/neat/graph/stores/_base.py +0 -384
- cognite/neat/graph/stores/_graphdb_store.py +0 -51
- cognite/neat/graph/stores/_memory_store.py +0 -43
- cognite/neat/graph/stores/_oxigraph_store.py +0 -145
- cognite/neat/graph/stores/_oxrdflib.py +0 -247
- cognite/neat/graph/stores/_rdf_to_graph.py +0 -40
- cognite/neat/graph/transformation/entity_matcher.py +0 -101
- cognite/neat/graph/transformation/query_generator/__init__.py +0 -3
- cognite/neat/graph/transformation/query_generator/sparql.py +0 -540
- cognite/neat/graph/transformation/transformer.py +0 -316
- cognite/neat/rules/_analysis/_base.py +0 -25
- cognite/neat/rules/_analysis/_information_rules.py +0 -414
- cognite/neat/rules/_shared.py +0 -5
- cognite/neat/rules/analysis.py +0 -231
- cognite/neat/rules/examples/Rules-Nordic44-to-TNT.xlsx +0 -0
- cognite/neat/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
- cognite/neat/rules/examples/__init__.py +0 -18
- cognite/neat/rules/examples/power-grid-containers.yaml +0 -113
- cognite/neat/rules/examples/power-grid-example.xlsx +0 -0
- cognite/neat/rules/examples/power-grid-model.yaml +0 -213
- cognite/neat/rules/examples/rules-template.xlsx +0 -0
- cognite/neat/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
- cognite/neat/rules/examples/skos-rules.xlsx +0 -0
- cognite/neat/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
- cognite/neat/rules/examples/wind-energy.owl +0 -1511
- cognite/neat/rules/exceptions.py +0 -2972
- cognite/neat/rules/exporter/__init__.py +0 -20
- cognite/neat/rules/exporter/_base.py +0 -45
- cognite/neat/rules/exporter/_core/__init__.py +0 -5
- cognite/neat/rules/exporter/_core/rules2labels.py +0 -24
- cognite/neat/rules/exporter/_rules2dms.py +0 -888
- cognite/neat/rules/exporter/_rules2excel.py +0 -212
- cognite/neat/rules/exporter/_rules2graphql.py +0 -183
- cognite/neat/rules/exporter/_rules2ontology.py +0 -523
- cognite/neat/rules/exporter/_rules2pydantic_models.py +0 -748
- cognite/neat/rules/exporter/_rules2rules.py +0 -104
- cognite/neat/rules/exporter/_rules2triples.py +0 -37
- cognite/neat/rules/exporter/_validation.py +0 -150
- cognite/neat/rules/exporters/__init__.py +0 -15
- cognite/neat/rules/exporters/_base.py +0 -42
- cognite/neat/rules/exporters/_models.py +0 -58
- cognite/neat/rules/exporters/_rules2dms.py +0 -259
- cognite/neat/rules/exporters/_rules2excel.py +0 -196
- cognite/neat/rules/exporters/_rules2ontology.py +0 -561
- cognite/neat/rules/exporters/_rules2yaml.py +0 -78
- cognite/neat/rules/exporters/_validation.py +0 -107
- cognite/neat/rules/importer/__init__.py +0 -22
- cognite/neat/rules/importer/_base.py +0 -70
- cognite/neat/rules/importer/_dict2rules.py +0 -158
- cognite/neat/rules/importer/_dms2rules.py +0 -196
- cognite/neat/rules/importer/_graph2rules.py +0 -304
- cognite/neat/rules/importer/_json2rules.py +0 -39
- cognite/neat/rules/importer/_owl2rules/__init__.py +0 -3
- cognite/neat/rules/importer/_owl2rules/_owl2classes.py +0 -239
- cognite/neat/rules/importer/_owl2rules/_owl2metadata.py +0 -255
- cognite/neat/rules/importer/_owl2rules/_owl2properties.py +0 -217
- cognite/neat/rules/importer/_owl2rules/_owl2rules.py +0 -290
- cognite/neat/rules/importer/_spreadsheet2rules.py +0 -45
- cognite/neat/rules/importer/_xsd2rules.py +0 -20
- cognite/neat/rules/importer/_yaml2rules.py +0 -39
- cognite/neat/rules/importers/__init__.py +0 -16
- cognite/neat/rules/importers/_base.py +0 -124
- cognite/neat/rules/importers/_dms2rules.py +0 -191
- cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -3
- cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -224
- cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -318
- cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -164
- cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -359
- cognite/neat/rules/importers/_owl2rules/__init__.py +0 -3
- cognite/neat/rules/importers/_owl2rules/_owl2classes.py +0 -219
- cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +0 -217
- cognite/neat/rules/importers/_owl2rules/_owl2properties.py +0 -203
- cognite/neat/rules/importers/_owl2rules/_owl2rules.py +0 -148
- cognite/neat/rules/importers/_spreadsheet2rules.py +0 -266
- cognite/neat/rules/importers/_yaml2rules.py +0 -110
- cognite/neat/rules/issues/__init__.py +0 -27
- cognite/neat/rules/issues/base.py +0 -190
- cognite/neat/rules/issues/dms.py +0 -331
- cognite/neat/rules/issues/fileread.py +0 -156
- cognite/neat/rules/issues/importing.py +0 -220
- cognite/neat/rules/issues/spreadsheet.py +0 -381
- cognite/neat/rules/issues/spreadsheet_file.py +0 -151
- cognite/neat/rules/models/__init__.py +0 -5
- cognite/neat/rules/models/_base.py +0 -151
- cognite/neat/rules/models/_rules/__init__.py +0 -14
- cognite/neat/rules/models/_rules/_types/__init__.py +0 -66
- cognite/neat/rules/models/_rules/_types/_base.py +0 -450
- cognite/neat/rules/models/_rules/_types/_field.py +0 -339
- cognite/neat/rules/models/_rules/_types/_value.py +0 -156
- cognite/neat/rules/models/_rules/base.py +0 -320
- cognite/neat/rules/models/_rules/dms_architect_rules.py +0 -1034
- cognite/neat/rules/models/_rules/dms_schema.py +0 -641
- cognite/neat/rules/models/_rules/domain_rules.py +0 -55
- cognite/neat/rules/models/_rules/information_rules.py +0 -525
- cognite/neat/rules/models/raw_rules.py +0 -304
- cognite/neat/rules/models/rdfpath.py +0 -238
- cognite/neat/rules/models/rules.py +0 -1269
- cognite/neat/rules/models/tables.py +0 -9
- cognite/neat/rules/models/value_types.py +0 -117
- cognite/neat/utils/__init__.py +0 -3
- cognite/neat/utils/auxiliary.py +0 -11
- cognite/neat/utils/cdf.py +0 -24
- cognite/neat/utils/cdf_loaders/__init__.py +0 -25
- cognite/neat/utils/cdf_loaders/_base.py +0 -62
- cognite/neat/utils/cdf_loaders/_data_modeling.py +0 -275
- cognite/neat/utils/cdf_loaders/_ingestion.py +0 -152
- cognite/neat/utils/cdf_loaders/data_classes.py +0 -121
- cognite/neat/utils/exceptions.py +0 -41
- cognite/neat/utils/spreadsheet.py +0 -84
- cognite/neat/utils/text.py +0 -104
- cognite/neat/utils/utils.py +0 -354
- cognite/neat/utils/xml.py +0 -37
- cognite/neat/workflows/__init__.py +0 -12
- cognite/neat/workflows/_exceptions.py +0 -41
- cognite/neat/workflows/base.py +0 -574
- cognite/neat/workflows/cdf_store.py +0 -393
- cognite/neat/workflows/examples/Export DMS/workflow.yaml +0 -89
- cognite/neat/workflows/examples/Export Rules to Ontology/workflow.yaml +0 -152
- cognite/neat/workflows/examples/Extract DEXPI Graph and Export Rules/workflow.yaml +0 -139
- cognite/neat/workflows/examples/Extract RDF Graph and Generate Assets/workflow.yaml +0 -270
- cognite/neat/workflows/examples/Import DMS/workflow.yaml +0 -65
- cognite/neat/workflows/examples/Ontology to Data Model/workflow.yaml +0 -116
- cognite/neat/workflows/examples/Validate Rules/workflow.yaml +0 -67
- cognite/neat/workflows/examples/Validate Solution Model/workflow.yaml +0 -64
- cognite/neat/workflows/examples/Visualize Data Model Using Mock Graph/workflow.yaml +0 -95
- cognite/neat/workflows/examples/Visualize Semantic Data Model/workflow.yaml +0 -111
- cognite/neat/workflows/manager.py +0 -309
- cognite/neat/workflows/migration/steps.py +0 -93
- cognite/neat/workflows/migration/wf_manifests.py +0 -33
- cognite/neat/workflows/model.py +0 -202
- cognite/neat/workflows/steps/data_contracts.py +0 -140
- cognite/neat/workflows/steps/lib/__init__.py +0 -7
- cognite/neat/workflows/steps/lib/graph_extractor.py +0 -123
- cognite/neat/workflows/steps/lib/graph_loader.py +0 -68
- cognite/neat/workflows/steps/lib/graph_store.py +0 -139
- cognite/neat/workflows/steps/lib/io_steps.py +0 -393
- cognite/neat/workflows/steps/lib/rules_exporter.py +0 -453
- cognite/neat/workflows/steps/lib/rules_importer.py +0 -171
- cognite/neat/workflows/steps/lib/rules_validator.py +0 -102
- cognite/neat/workflows/steps/lib/v1/__init__.py +0 -7
- cognite/neat/workflows/steps/lib/v1/graph_contextualization.py +0 -82
- cognite/neat/workflows/steps/lib/v1/graph_extractor.py +0 -644
- cognite/neat/workflows/steps/lib/v1/graph_loader.py +0 -606
- cognite/neat/workflows/steps/lib/v1/graph_store.py +0 -278
- cognite/neat/workflows/steps/lib/v1/graph_transformer.py +0 -58
- cognite/neat/workflows/steps/lib/v1/rules_exporter.py +0 -513
- cognite/neat/workflows/steps/lib/v1/rules_importer.py +0 -612
- cognite/neat/workflows/steps/step_model.py +0 -83
- cognite/neat/workflows/steps_registry.py +0 -212
- cognite/neat/workflows/tasks.py +0 -18
- cognite/neat/workflows/triggers.py +0 -169
- cognite/neat/workflows/utils.py +0 -19
- cognite_neat-0.70.1.dist-info/METADATA +0 -212
- cognite_neat-0.70.1.dist-info/RECORD +0 -234
- cognite_neat-0.70.1.dist-info/entry_points.txt +0 -3
- /cognite/neat/{app/api → _data_model}/__init__.py +0 -0
- /cognite/neat/{app/api/data_classes → _data_model/deployer}/__init__.py +0 -0
- /cognite/neat/{app/api/utils → _data_model/exporters/_table_exporter}/__init__.py +0 -0
- /cognite/neat/{app/monitoring → _data_model/importers/_table_importer}/__init__.py +0 -0
- /cognite/neat/{graph/extractors → _data_model/models}/__init__.py +0 -0
- /cognite/neat/{graph/loader/core → _data_model/models/conceptual}/__init__.py +0 -0
- /cognite/neat/{graph/transformation → _data_model/validation}/__init__.py +0 -0
- /cognite/neat/{rules → _session/_html}/__init__.py +0 -0
- /cognite/neat/{rules/_analysis → _session/_usage_analytics}/__init__.py +0 -0
- /cognite/neat/{workflows/migration → _utils}/__init__.py +0 -0
- /cognite/neat/{workflows/steps → v0}/__init__.py +0 -0
- /cognite/neat/{graph → v0/core/_instances}/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- /cognite/neat/{graph → v0/core/_instances}/examples/Knowledge-Graph-Nordic44.xml +0 -0
- /cognite/neat/{graph → v0/core/_instances}/examples/__init__.py +0 -0
- /cognite/neat/{graph → v0/core/_instances}/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.70.1.dist-info → cognite_neat-0.127.19.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from collections.abc import Sequence
|
|
2
|
+
from typing import Literal, TypeVar, get_args
|
|
3
|
+
|
|
4
|
+
from rich.prompt import IntPrompt, Prompt
|
|
5
|
+
|
|
6
|
+
from cognite.neat.v0.core._data_model._constants import PATTERNS
|
|
7
|
+
|
|
8
|
+
RDFFileType = Literal["Ontology", "IMF Types", "Inference"]
|
|
9
|
+
NeatObjectType = Literal["Data Model", "Instances"]
|
|
10
|
+
XMLFileType = Literal["dexpi", "aml"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def object_wizard(message: str = "Select object") -> NeatObjectType:
|
|
14
|
+
return _selection(message, get_args(NeatObjectType))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def xml_format_wizard(message: str = "Select XML format") -> XMLFileType:
|
|
18
|
+
return _selection(message, get_args(XMLFileType))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def rdf_dm_wizard(message: str = "Select source:") -> RDFFileType:
|
|
22
|
+
return _selection(message, get_args(RDFFileType))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
_T_Option = TypeVar("_T_Option")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _selection(message: str, options: Sequence[_T_Option]) -> _T_Option:
|
|
29
|
+
option_text = "\n ".join([f"{i + 1}) {option}" for i, option in enumerate(options)])
|
|
30
|
+
selected_index = (
|
|
31
|
+
IntPrompt().ask(f"{message}\n {option_text}\n", choices=list(map(str, range(1, len(options) + 1)))) - 1
|
|
32
|
+
)
|
|
33
|
+
return options[selected_index]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def space_wizard(message: str = "Set space", space: str | None = None) -> str:
|
|
37
|
+
while True:
|
|
38
|
+
user_input = space or Prompt().ask(f"{message}:")
|
|
39
|
+
if PATTERNS.space_compliance.match(str(user_input)):
|
|
40
|
+
return user_input
|
|
41
|
+
else:
|
|
42
|
+
print(f"Invalid input. Please provide a valid space name. {PATTERNS.space_compliance.pattern}")
|
|
43
|
+
|
|
44
|
+
space = ""
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from collections.abc import Iterable
|
|
2
|
+
from typing import Any, Protocol
|
|
3
|
+
|
|
4
|
+
from rdflib import Literal, URIRef
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Extractor(Protocol):
|
|
8
|
+
def extract(self) -> Iterable[tuple[URIRef, URIRef, Literal | URIRef]]: ...
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ConfigAPI(Protocol):
|
|
12
|
+
format: str | None = None
|
|
13
|
+
file: Any | None
|
|
14
|
+
type: str | None
|
|
15
|
+
primary_key: str | None
|
|
16
|
+
mapping: Any | None = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class NeatEngine(Protocol):
|
|
20
|
+
version: str = "2.0.5"
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def set(self) -> ConfigAPI: ...
|
|
24
|
+
|
|
25
|
+
def create_extractor(self) -> Extractor: ...
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
import shutil
|
|
4
|
+
import sys
|
|
5
|
+
import tempfile
|
|
6
|
+
import warnings
|
|
7
|
+
from collections.abc import Callable
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Literal, cast
|
|
10
|
+
|
|
11
|
+
from cognite.client import CogniteClient
|
|
12
|
+
from packaging.version import Version
|
|
13
|
+
from packaging.version import parse as parse_version
|
|
14
|
+
|
|
15
|
+
from cognite.neat._version import __engine__
|
|
16
|
+
from cognite.neat.v0.core._issues.errors import NeatValueError
|
|
17
|
+
|
|
18
|
+
ENVIRONMENT_VARIABLE = "NEATENGINE"
|
|
19
|
+
PACKAGE_NAME = "neatengine"
|
|
20
|
+
PYVERSION = f"{sys.version_info.major}{sys.version_info.minor}"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def load_neat_engine(client: CogniteClient | None, location: Literal["newest", "cache"]) -> str | None:
|
|
24
|
+
if location not in ["newest", "cache"]:
|
|
25
|
+
raise NeatValueError(f"Cannot load engine from location: {location}")
|
|
26
|
+
|
|
27
|
+
if not __engine__.startswith("^"):
|
|
28
|
+
# Using value error as this is a developer error
|
|
29
|
+
raise ValueError(f"Invalid engine version: {__engine__}")
|
|
30
|
+
|
|
31
|
+
lower_bound = parse_version(__engine__[1:])
|
|
32
|
+
upper_bound = Version(f"{lower_bound.major + 1}.0.0")
|
|
33
|
+
|
|
34
|
+
cache_dir = Path(tempfile.gettempdir()) / PACKAGE_NAME
|
|
35
|
+
cache_dir.mkdir(exist_ok=True)
|
|
36
|
+
pattern = re.compile(rf"{PACKAGE_NAME}-(\d+\.\d+\.\d+)-{PYVERSION}.zip")
|
|
37
|
+
|
|
38
|
+
candidates: dict[Version, Callable[[], Path]] = {}
|
|
39
|
+
if location == "cache" and cache_dir.exists():
|
|
40
|
+
candidates = _load_from_path(cache_dir, pattern, lower_bound, upper_bound)
|
|
41
|
+
|
|
42
|
+
if location == "newest" or not candidates:
|
|
43
|
+
# Loading in reverse order of priority
|
|
44
|
+
# 4. Downloads folder
|
|
45
|
+
candidates = _load_from_path(Path.home() / "Downloads", pattern, lower_bound, upper_bound)
|
|
46
|
+
# 3. Current working directory
|
|
47
|
+
candidates.update(_load_from_path(Path.cwd(), pattern, lower_bound, upper_bound))
|
|
48
|
+
# 2. CDF
|
|
49
|
+
if client:
|
|
50
|
+
candidates.update(_load_from_cdf(client, pattern, lower_bound, upper_bound, cache_dir))
|
|
51
|
+
# 1. Environment variable
|
|
52
|
+
if ENVIRONMENT_VARIABLE in os.environ:
|
|
53
|
+
environ_path = Path(os.environ[ENVIRONMENT_VARIABLE])
|
|
54
|
+
if environ_path.exists():
|
|
55
|
+
candidates.update(_load_from_path(environ_path, pattern, lower_bound, upper_bound))
|
|
56
|
+
else:
|
|
57
|
+
warnings.warn(
|
|
58
|
+
f"Environment variable {ENVIRONMENT_VARIABLE} points to non-existing path: {environ_path}",
|
|
59
|
+
UserWarning,
|
|
60
|
+
stacklevel=2,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
if not candidates:
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
selected_version = max(candidates.keys(), default=None)
|
|
67
|
+
if not selected_version:
|
|
68
|
+
return None
|
|
69
|
+
source_path = candidates[selected_version]()
|
|
70
|
+
destination_path = cache_dir / source_path.name
|
|
71
|
+
if not destination_path.exists():
|
|
72
|
+
shutil.copy(source_path, destination_path)
|
|
73
|
+
sys.path.append(str(destination_path))
|
|
74
|
+
try:
|
|
75
|
+
from neatengine._version import __version__ as engine_version # type: ignore[import-not-found]
|
|
76
|
+
except ImportError:
|
|
77
|
+
return None
|
|
78
|
+
return engine_version
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _load_from_path(
|
|
82
|
+
path: Path, pattern: re.Pattern[str], lower_bound: Version, upper_bound: Version
|
|
83
|
+
) -> dict[Version, Callable[[], Path]]:
|
|
84
|
+
if path.is_file() and (match := pattern.match(path.name)):
|
|
85
|
+
version = parse_version(match.group(1))
|
|
86
|
+
if lower_bound <= version < upper_bound:
|
|
87
|
+
return {parse_version(match.group(1)): lambda: path}
|
|
88
|
+
return {}
|
|
89
|
+
elif path.is_dir():
|
|
90
|
+
output: dict[Version, Callable[[], Path]] = {}
|
|
91
|
+
for candidate in path.iterdir():
|
|
92
|
+
if candidate.is_file() and (match := pattern.match(candidate.name)):
|
|
93
|
+
version = parse_version(match.group(1))
|
|
94
|
+
if lower_bound <= version < upper_bound:
|
|
95
|
+
# Setting default value to ensure we use the candidate from the current iteration
|
|
96
|
+
# If not set, the function will use the last candidate from the loop
|
|
97
|
+
def return_path(the_path: Path = candidate) -> Path:
|
|
98
|
+
return the_path
|
|
99
|
+
|
|
100
|
+
output[parse_version(match.group(1))] = return_path
|
|
101
|
+
|
|
102
|
+
return output
|
|
103
|
+
return {}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _load_from_cdf(
|
|
107
|
+
client: CogniteClient, pattern: re.Pattern[str], lower_bound: Version, upper_bound: Version, cache_dir: Path
|
|
108
|
+
) -> dict[Version, Callable[[], Path]]:
|
|
109
|
+
file_metadata = client.files.list(
|
|
110
|
+
limit=-1,
|
|
111
|
+
data_set_external_ids=PACKAGE_NAME,
|
|
112
|
+
external_id_prefix=PACKAGE_NAME,
|
|
113
|
+
metadata={"python_version": PYVERSION},
|
|
114
|
+
)
|
|
115
|
+
output: dict[Version, Callable[[], Path]] = {}
|
|
116
|
+
for file in file_metadata:
|
|
117
|
+
name = cast(str, file.name)
|
|
118
|
+
|
|
119
|
+
# Use function to lazily download file
|
|
120
|
+
# Setting default value to ensure we use the file_id from the current iteration
|
|
121
|
+
# If not set, the function will use the last file_id from the loop
|
|
122
|
+
def download_file(file_id: int = file.id, filename: str = name) -> Path:
|
|
123
|
+
client.files.download(cache_dir, file_id)
|
|
124
|
+
return cache_dir / filename
|
|
125
|
+
|
|
126
|
+
if match := pattern.match(name):
|
|
127
|
+
version = parse_version(match.group(1))
|
|
128
|
+
if lower_bound <= version < upper_bound:
|
|
129
|
+
output[version] = download_file
|
|
130
|
+
|
|
131
|
+
return output
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import functools
|
|
2
|
+
import warnings
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from cognite.neat.v0.core._issues.errors import CDFMissingClientError, NeatImportError
|
|
7
|
+
from cognite.neat.v0.core._issues.errors._external import OxigraphStorageLockedError
|
|
8
|
+
from cognite.neat.v0.core._issues.errors._general import NeatValueError, WillExceedLimitError
|
|
9
|
+
from cognite.neat.v0.plugins._issues import PluginError
|
|
10
|
+
from cognite.neat.v0.session._experimental import ExperimentalFeatureWarning
|
|
11
|
+
|
|
12
|
+
from ._collector import _COLLECTOR
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
from rich import print
|
|
16
|
+
from rich.markup import escape
|
|
17
|
+
|
|
18
|
+
_ERROR_PREFIX = "[bold red][ERROR][/bold red]"
|
|
19
|
+
_WARNING_PREFIX = "[bold bright_magenta][WARNING][/bold bright_magenta]"
|
|
20
|
+
except ImportError:
|
|
21
|
+
_ERROR_PREFIX = "[ERROR]"
|
|
22
|
+
_WARNING_PREFIX = "[WARNING]"
|
|
23
|
+
|
|
24
|
+
def escape(x: Any, *_: Any, **__: Any) -> Any: # type: ignore[misc]
|
|
25
|
+
return x
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class NeatSessionError(Exception):
|
|
29
|
+
"""Base class for all exceptions raised by the NeatSession class."""
|
|
30
|
+
|
|
31
|
+
...
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _session_method_wrapper(func: Callable, cls_name: str) -> Any:
|
|
35
|
+
@functools.wraps(func)
|
|
36
|
+
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
37
|
+
_COLLECTOR.track_session_command(f"{cls_name}.{func.__name__}", *args, **kwargs)
|
|
38
|
+
try:
|
|
39
|
+
with warnings.catch_warnings(record=True) as w:
|
|
40
|
+
result = func(*args, **kwargs)
|
|
41
|
+
for warning in w:
|
|
42
|
+
if isinstance(warning.message, ExperimentalFeatureWarning):
|
|
43
|
+
print(f"{_WARNING_PREFIX} {warning.message}")
|
|
44
|
+
|
|
45
|
+
return result
|
|
46
|
+
except NeatSessionError as e:
|
|
47
|
+
action = _get_action()
|
|
48
|
+
print(f"{_ERROR_PREFIX} Cannot {action}: {e}")
|
|
49
|
+
except (
|
|
50
|
+
CDFMissingClientError,
|
|
51
|
+
NeatImportError,
|
|
52
|
+
NeatValueError,
|
|
53
|
+
OxigraphStorageLockedError,
|
|
54
|
+
PluginError,
|
|
55
|
+
WillExceedLimitError,
|
|
56
|
+
) as e:
|
|
57
|
+
print(f"{_ERROR_PREFIX} {escape(e.as_message())}")
|
|
58
|
+
except ModuleNotFoundError as e:
|
|
59
|
+
if e.name == "neatengine":
|
|
60
|
+
action = _get_action()
|
|
61
|
+
print(f"{_ERROR_PREFIX} The functionality {action} requires the NeatEngine.")
|
|
62
|
+
else:
|
|
63
|
+
raise e
|
|
64
|
+
|
|
65
|
+
def _get_action() -> str:
|
|
66
|
+
action = func.__name__
|
|
67
|
+
if action == "__call__":
|
|
68
|
+
action = func.__qualname__.removesuffix(".__call__").removesuffix("API")
|
|
69
|
+
return action
|
|
70
|
+
|
|
71
|
+
return wrapper
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
T_Class = TypeVar("T_Class", bound=object)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def session_class_wrapper(cls: type[T_Class]) -> type[T_Class]:
|
|
78
|
+
"""This decorator wraps all methods of a class.
|
|
79
|
+
|
|
80
|
+
It should be used with all composition classes used with the NeatSession class.
|
|
81
|
+
|
|
82
|
+
It does the following:
|
|
83
|
+
* Intercepts all NeatSession exceptions and prints them in a user-friendly way.
|
|
84
|
+
* Collects user metrics.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
cls: NeatSession composition class
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
cls: NeatSession composition class with all methods wrapped
|
|
91
|
+
"""
|
|
92
|
+
to_check = [cls]
|
|
93
|
+
while to_check:
|
|
94
|
+
cls = to_check.pop()
|
|
95
|
+
for attr_name in dir(cls):
|
|
96
|
+
if attr_name.startswith("_") and not attr_name == "__call__":
|
|
97
|
+
continue
|
|
98
|
+
attr = getattr(cls, attr_name)
|
|
99
|
+
if callable(attr):
|
|
100
|
+
setattr(cls, attr_name, _session_method_wrapper(attr, cls.__name__))
|
|
101
|
+
elif isinstance(attr, type):
|
|
102
|
+
to_check.append(attr)
|
|
103
|
+
return cls
|
cognite/neat/v1.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cognite-neat
|
|
3
|
+
Version: 0.127.19
|
|
4
|
+
Summary: Knowledge graph transformation
|
|
5
|
+
Project-URL: Documentation, https://cognite-neat.readthedocs-hosted.com/
|
|
6
|
+
Project-URL: Homepage, https://cognite-neat.readthedocs-hosted.com/
|
|
7
|
+
Project-URL: GitHub, https://github.com/cognitedata/neat
|
|
8
|
+
Project-URL: Changelog, https://github.com/cognitedata/neat/releases
|
|
9
|
+
Author-email: Nikola Vasiljevic <nikola.vasiljevic@cognite.com>, Anders Albert <anders.albert@cognite.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Requires-Dist: backports-strenum<2.0.0,>=1.2; python_version < '3.11'
|
|
14
|
+
Requires-Dist: cognite-sdk<8.0.0,>=7.83.0
|
|
15
|
+
Requires-Dist: elementpath<5.0.0,>=4.0.0
|
|
16
|
+
Requires-Dist: exceptiongroup<2.0.0,>=1.1.3; python_version < '3.11'
|
|
17
|
+
Requires-Dist: httpx>=0.28.1
|
|
18
|
+
Requires-Dist: jsonpath-python<2.0.0,>=1.0.6
|
|
19
|
+
Requires-Dist: mixpanel<5.0.0,>=4.10.1
|
|
20
|
+
Requires-Dist: networkx<4.0.0,>=3.4.2
|
|
21
|
+
Requires-Dist: openpyxl<4.0.0,>=3.0.10
|
|
22
|
+
Requires-Dist: packaging>=22.0
|
|
23
|
+
Requires-Dist: pandas<3.0.0,>=1.5.3
|
|
24
|
+
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
|
25
|
+
Requires-Dist: pyvis<1.0.0,>=0.3.2
|
|
26
|
+
Requires-Dist: pyyaml<7.0.0,>=6.0.1
|
|
27
|
+
Requires-Dist: rdflib<8.0.0,>=7.0.0
|
|
28
|
+
Requires-Dist: requests<3.0.0,>=2.28.1
|
|
29
|
+
Requires-Dist: rich[jupyter]<14.0.0,>=13.7.1
|
|
30
|
+
Requires-Dist: tomli<3.0.0,>=2.0.1; python_version < '3.11'
|
|
31
|
+
Requires-Dist: typing-extensions<5.0.0,>=4.8.0; python_version < '3.11'
|
|
32
|
+
Requires-Dist: urllib3<3.0.0,>=1.26.15
|
|
33
|
+
Provides-Extra: docs
|
|
34
|
+
Requires-Dist: mistune==3.0.2; extra == 'docs'
|
|
35
|
+
Requires-Dist: mkdocs-autorefs<1.0.0,>=0.5.0; extra == 'docs'
|
|
36
|
+
Requires-Dist: mkdocs-git-authors-plugin<1.0.0,>=0.9.4; extra == 'docs'
|
|
37
|
+
Requires-Dist: mkdocs-git-revision-date-localized-plugin; extra == 'docs'
|
|
38
|
+
Requires-Dist: mkdocs-gitbook<1.0.0,>=0.0.1; extra == 'docs'
|
|
39
|
+
Requires-Dist: mkdocs-glightbox<1.0.0,>=0.4.0; extra == 'docs'
|
|
40
|
+
Requires-Dist: mkdocs-jupyter<1.0.0,>=0.25.1; extra == 'docs'
|
|
41
|
+
Requires-Dist: mkdocs-material-extensions<2.0.0,>=1.3.1; extra == 'docs'
|
|
42
|
+
Requires-Dist: mkdocs<2.0.0,>=1.4.0; extra == 'docs'
|
|
43
|
+
Requires-Dist: mkdocstrings[python]<1.0.0,>=0.25.2; extra == 'docs'
|
|
44
|
+
Requires-Dist: pymdown-extensions<11.0.0,>=10.14.3; extra == 'docs'
|
|
45
|
+
Provides-Extra: google
|
|
46
|
+
Requires-Dist: google-api-python-client<3.0.0,>=2.70.0; extra == 'google'
|
|
47
|
+
Requires-Dist: google-auth-oauthlib<2.0.0,>=1.0.0; extra == 'google'
|
|
48
|
+
Requires-Dist: gspread<6.0.0,>=5.0.0; extra == 'google'
|
|
49
|
+
Provides-Extra: lxml
|
|
50
|
+
Requires-Dist: lxml<6.0.0,>=5.3.0; extra == 'lxml'
|
|
51
|
+
Provides-Extra: oxi
|
|
52
|
+
Requires-Dist: oxrdflib<0.5.0,>=0.4.0; extra == 'oxi'
|
|
53
|
+
Requires-Dist: pyoxigraph<0.5.0,>=0.4.3; extra == 'oxi'
|
|
54
|
+
Description-Content-Type: text/markdown
|
|
55
|
+
|
|
56
|
+
# kNowlEdge grAph Transformer (NEAT)
|
|
57
|
+
|
|
58
|
+
[](https://github.com/cognitedata/neat/actions/workflows/release.yaml)
|
|
59
|
+
[](https://cognite-neat.readthedocs-hosted.com/en/latest/?badge=latest)
|
|
60
|
+
[](https://github.com/cognitedata/neat)
|
|
61
|
+
[](https://pypi.org/project/cognite-neat/)
|
|
62
|
+
[](https://pypistats.org/packages/cognite-neat)
|
|
63
|
+
[](https://hub.docker.com/r/cognite/neat)
|
|
64
|
+
[](https://github.com/cognitedata/neat/blob/master/LICENSE)
|
|
65
|
+
[](https://github.com/ambv/black)
|
|
66
|
+
[](https://github.com/astral-sh/ruff)
|
|
67
|
+
[](http://mypy-lang.org)
|
|
68
|
+
|
|
69
|
+
NEAT is a domain expert centric and developer friendly solution for rapid:
|
|
70
|
+
|
|
71
|
+
- data modeling
|
|
72
|
+
- extraction, transformation and loading of instances
|
|
73
|
+
- and ingestion of the models and instances (i.e. knowledge graphs) into [Cognite Data Fusion](https://www.cognite.com/en/product/cognite_data_fusion_industrial_dataops_platform)
|
|
74
|
+
|
|
75
|
+
NEAT is using open and globally recognized standards maintained by the [World Wide Web Consortium (W3C)](https://www.w3.org/RDF/).
|
|
76
|
+
NEAT represents an essential tool for creation of standardized, machine-actionable, linked and semantic (meta)data.
|
|
77
|
+
|
|
78
|
+
> NEAT is a funny acronym derived from k**N**owl**Ed**ge gr**A**ph **T**ransformer produced using [ACRONIMIFY](https://acronymify.com/NEAT/?q=knowledge+graph+transformer).
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## History
|
|
82
|
+
|
|
83
|
+
NEAT emerged from years of experience in semantic tooling and knowledge graph development. The foundation was laid in 2020 with [sheet2rdf](https://github.com/nikokaoja/sheet2rdf), an Excel-based tool that trained data stewards to build domain-specific knowledge graphs and supported CI/CD processes in the Dutch Covid program and european wind energy community.
|
|
84
|
+
|
|
85
|
+
By mid of 2022, sheet2rdf was used in several POCs in Cognite. As Cognite's Data Modeling Service (DMS) development progressed, the need for simplified data modeling experience led to demonstration of proto-NEAT, known as [sheet2fdm](https://github.com/cognitedata/sheet2fdm), an extension of sheet2rdf, enabling semantic data model definitions in OWL, SHACL, Python and GraphQL (see e.g., [wind energy data model](https://cognitedata.github.io/wind-energy-data-model/)) using a simplified version of sheet2rdf Excel template.
|
|
86
|
+
|
|
87
|
+
Presented in various forums in 2022, this approach paved the way for NEAT’s formal development in November 2022 to enable cost-saving and empowerment of Cognite customers to self-sufficiently maintain and onboard knowledge graphs to Cognite Data Fusion.
|
|
88
|
+
|
|
89
|
+
## Authorship
|
|
90
|
+
|
|
91
|
+
### Authors
|
|
92
|
+
The plot below shows the NEAT authorship from the start until present day.
|
|
93
|
+
|
|
94
|
+

|
|
95
|
+
|
|
96
|
+
#### Current authors
|
|
97
|
+
- [Nikola Vasiljević](www.linkedin.com/in/thisisnikola)
|
|
98
|
+
- [Anders Albert](https://www.linkedin.com/in/anders-albert-00790483/)
|
|
99
|
+
|
|
100
|
+
#### Former authors
|
|
101
|
+
- [Aleksandrs Livincovs](https://www.linkedin.com/in/aleksandrslivincovs/)
|
|
102
|
+
- [Julia Graham](https://www.linkedin.com/in/julia-graham-959a78a7/)
|
|
103
|
+
- [Rogerio Júnior](https://www.linkedin.com/in/rogerio-saboia-j%C3%BAnior-087118a7/)
|
|
104
|
+
|
|
105
|
+
### Contributors
|
|
106
|
+
We are very grateful for the contributions made by:
|
|
107
|
+
|
|
108
|
+
- [Kristina Tomičić](https://www.linkedin.com/in/kristina-tomicic-6bb443108/), who implemented Data Model and Instances visualization
|
|
109
|
+
- [Marie Solvik Lepoutre](https://www.linkedin.com/in/mslepoutre/), who improved RDF triples projections to Cognite Data Fusion
|
|
110
|
+
- [Bård Henning Tvedt](https://www.linkedin.com/in/bhtvedt/), who implemented IMF importer
|
|
111
|
+
- [Hassan Gomaa](https://www.linkedin.com/in/dr-hassan-gomaa-232638121/), who extended the DEXPI extractor
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## Sponsors
|
|
115
|
+
NEAT is developed and maintained by Cognite. We are grateful for the past support of our sponsors, who funded us to develop NEAT and to make it open source.
|
|
116
|
+
|
|
117
|
+
- [Statnett](https://www.statnett.no/) - the MIMIR team ([Ola Hagen Øyan](https://www.linkedin.com/in/ola-%C3%B8yan-b0205b19/), [Olav Westeng Alstad](https://www.linkedin.com/in/olav-w-alstad-52329191/),[Andreas Kimsås](https://www.linkedin.com/in/andreas-kims%C3%A5s-964a0b2/) and [Anders Willersrud](https://www.linkedin.com/in/anders-willersrud-13a20220/)) – who supported the development of NEAT from end of 2022 to mid of 2023 and its integration with Statnett's infrastructure, where NEAT was battle-tested as a tool for non-sematic experts to define data models and transform large knowledge graphs representing the entire Norwegian power grid system. Without Statnett's support NEAT would not exist in the first place, and would not be open-source.
|
|
118
|
+
- [Aker Solutions](https://www.akersolutions.com/) – the IMod Team (currently lead by [Maria Kenderkova](https://www.linkedin.com/in/maria-kenderkova/)), who funded development of NEAT from mid of 2023 till end of 2024 (multi-level and role-based data modeling, support for ontologies, IMF, DEXPI, AML,...) , as well who were early adopters and embraced NEAT and who were patient with us when things did not work so well. Aker Solutions was instrumental to elevating NEAT to a product level, and who selflessly advocate for NEAT globally.
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
## Installation
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
pip install cognite-neat
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Usage
|
|
128
|
+
|
|
129
|
+
The user interface for `NEAT` is a notebook-based environment. Once you have set up your notebook
|
|
130
|
+
environment, you start by creating a `CogniteClient` and instantiate a `NeatSession` object.
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from cognite.neat import NeatSession, get_cognite_client
|
|
134
|
+
|
|
135
|
+
client = get_cognite_client(".env")
|
|
136
|
+
|
|
137
|
+
neat = NeatSession(client)
|
|
138
|
+
|
|
139
|
+
neat.read.cdf.data_model(("my_space", "MyDataModel", "v1"))
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Documentation
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
For more information, see the [documentation](https://cognite-neat.readthedocs-hosted.com/en/latest/)
|