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,80 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Generic
|
|
3
|
+
|
|
4
|
+
from cognite.neat.v0.core._issues._base import ResourceType
|
|
5
|
+
|
|
6
|
+
from ._resources import ResourceError, T_Identifier, T_ReferenceIdentifier
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass(unsafe_hash=True)
|
|
10
|
+
class PropertyError(ResourceError[T_Identifier]):
|
|
11
|
+
"""Base class for property errors {resource_type} with identifier {identifier}.{property_name}"""
|
|
12
|
+
|
|
13
|
+
property_name: str
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass(unsafe_hash=True)
|
|
17
|
+
class PropertyNotFoundError(PropertyError, Generic[T_Identifier, T_ReferenceIdentifier]):
|
|
18
|
+
"""The {resource_type} with identifier {identifier} does not have a property {property_name}"""
|
|
19
|
+
|
|
20
|
+
extra = "referred to by {referred_type} {referred_by} does not exist"
|
|
21
|
+
fix = "Ensure the {resource_type} {identifier} has a {property_name} property"
|
|
22
|
+
|
|
23
|
+
referred_by: T_ReferenceIdentifier | None = None
|
|
24
|
+
referred_type: ResourceType | None = None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass(unsafe_hash=True)
|
|
28
|
+
class PropertyTypeNotSupportedError(PropertyError[T_Identifier]):
|
|
29
|
+
"""The {resource_type} with identifier {identifier} has a property {property_name}
|
|
30
|
+
of unsupported type {property_type}"""
|
|
31
|
+
|
|
32
|
+
property_type: str
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass(unsafe_hash=True)
|
|
36
|
+
class ReversedConnectionNotFeasibleError(PropertyError[T_Identifier]):
|
|
37
|
+
"""The {resource_type} {identifier}.{property_name} cannot be created: {reason}"""
|
|
38
|
+
|
|
39
|
+
reason: str
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# This is a generic error that should be used sparingly
|
|
43
|
+
@dataclass(unsafe_hash=True)
|
|
44
|
+
class PropertyDefinitionError(PropertyError[T_Identifier]):
|
|
45
|
+
"""Invalid property definition for {resource_type} {identifier}.{property_name}: {reason}"""
|
|
46
|
+
|
|
47
|
+
reason: str
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass(unsafe_hash=True)
|
|
51
|
+
class PropertyDefinitionDuplicatedError(PropertyError[T_Identifier]):
|
|
52
|
+
"""The {resource_type} with identifier {identifier} has multiple definitions for the property {property_name}
|
|
53
|
+
with values {property_values}
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
extra = "in locations {locations} with name {location_name}"
|
|
57
|
+
|
|
58
|
+
property_values: frozenset[str | int | float | bool | None | tuple[str | int | float | bool | None, ...]]
|
|
59
|
+
locations: tuple[str | int, ...] | None = None
|
|
60
|
+
location_name: str | None = None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@dataclass(unsafe_hash=True)
|
|
64
|
+
class PropertyInvalidDefinitionError(PropertyError[T_Identifier]):
|
|
65
|
+
"""The {resource_type} with identifier {identifier} has an invalid definition of {property_name}. {reason}"""
|
|
66
|
+
|
|
67
|
+
extra = "in locations {locations} with name {location_name}"
|
|
68
|
+
|
|
69
|
+
reason: str
|
|
70
|
+
locations: tuple[str | int, ...] | None = None
|
|
71
|
+
location_name: str | None = None
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(unsafe_hash=True)
|
|
75
|
+
class PropertyMappingDuplicatedError(PropertyError[T_Identifier], Generic[T_Identifier, T_ReferenceIdentifier]):
|
|
76
|
+
"""The {resource_type} with identifier {identifier}.{property_name} is mapped to by: {mappings}. Ensure
|
|
77
|
+
that only one {mapping_type} maps to {resource_type} {identifier}.{property_name}"""
|
|
78
|
+
|
|
79
|
+
mappings: frozenset[T_ReferenceIdentifier]
|
|
80
|
+
mapping_type: ResourceType
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Generic
|
|
3
|
+
|
|
4
|
+
from cognite.neat.v0.core._issues._base import (
|
|
5
|
+
NeatError,
|
|
6
|
+
ResourceType,
|
|
7
|
+
T_Identifier,
|
|
8
|
+
T_ReferenceIdentifier,
|
|
9
|
+
)
|
|
10
|
+
from cognite.neat.v0.core._utils.text import humanize_collection
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass(unsafe_hash=True)
|
|
14
|
+
class ResourceError(NeatError, Generic[T_Identifier], RuntimeError):
|
|
15
|
+
"""Base class for resource errors {resource_type} with identifier {identifier}"""
|
|
16
|
+
|
|
17
|
+
identifier: T_Identifier
|
|
18
|
+
resource_type: ResourceType
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass(unsafe_hash=True)
|
|
22
|
+
class ResourceDuplicatedError(ResourceError[T_Identifier]):
|
|
23
|
+
"""The {resource_type} with identifier {identifier} is duplicated in {location}"""
|
|
24
|
+
|
|
25
|
+
fix = "Remove the duplicate {resource_type} {identifier}."
|
|
26
|
+
location: str
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclass(unsafe_hash=True)
|
|
30
|
+
class ResourceRetrievalError(ResourceError[T_Identifier]):
|
|
31
|
+
"""Failed to retrieve {resource_type} with identifier {identifier}. The error was: {error}"""
|
|
32
|
+
|
|
33
|
+
error: str
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass(unsafe_hash=True)
|
|
37
|
+
class ResourceNotFoundError(ResourceError, Generic[T_Identifier, T_ReferenceIdentifier]):
|
|
38
|
+
"""The {resource_type} with identifier '{identifier}' does not exist"""
|
|
39
|
+
|
|
40
|
+
extra = " This is expected by {referred_type} {referred_by}."
|
|
41
|
+
|
|
42
|
+
fix = "Create the {resource_type} {identifier}"
|
|
43
|
+
|
|
44
|
+
referred_by: T_ReferenceIdentifier | None = None
|
|
45
|
+
referred_type: ResourceType | None = None
|
|
46
|
+
more: str | None = None
|
|
47
|
+
|
|
48
|
+
def as_message(self, include_type: bool = True) -> str:
|
|
49
|
+
msg = (self.__doc__ or "").format(resource_type=self.resource_type, identifier=self.identifier)
|
|
50
|
+
if self.referred_by and self.referred_type:
|
|
51
|
+
msg += self.extra.format(referred_type=self.referred_type, referred_by=self.referred_by)
|
|
52
|
+
if self.more:
|
|
53
|
+
msg += f" {self.more}"
|
|
54
|
+
msg += f" Fix {self.fix.format(resource_type=self.resource_type, identifier=self.identifier)}"
|
|
55
|
+
return msg
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass(unsafe_hash=True)
|
|
59
|
+
class ResourceNotDefinedError(ResourceError[T_Identifier]):
|
|
60
|
+
"""The {resource_type} {identifier} is not defined in the {location}"""
|
|
61
|
+
|
|
62
|
+
extra = "{column_name} {row_number} in {sheet_name}"
|
|
63
|
+
fix = "Define the {resource_type} {identifier} in {location}."
|
|
64
|
+
|
|
65
|
+
location: str
|
|
66
|
+
column_name: str | None = None
|
|
67
|
+
row_number: int | None = None
|
|
68
|
+
sheet_name: str | None = None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass(unsafe_hash=True)
|
|
72
|
+
class ResourceConversionError(ResourceError, ValueError):
|
|
73
|
+
"""Failed to convert the {resource_type} {identifier} to {target_format}: {reason}"""
|
|
74
|
+
|
|
75
|
+
fix = "Check the error message and correct the data model."
|
|
76
|
+
target_format: str
|
|
77
|
+
reason: str
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@dataclass(unsafe_hash=True)
|
|
81
|
+
class ResourceCreationError(ResourceError[T_Identifier], ValueError):
|
|
82
|
+
"""Failed to create {resource_type} with identifier {identifier}. The error was: {error}"""
|
|
83
|
+
|
|
84
|
+
error: str
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@dataclass(unsafe_hash=True)
|
|
88
|
+
class ResourceMissingIdentifierError(NeatError, ValueError):
|
|
89
|
+
"""The {resource_type} with name {name} is missing an identifier."""
|
|
90
|
+
|
|
91
|
+
resource_type: ResourceType
|
|
92
|
+
name: str | None = None
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@dataclass(unsafe_hash=True)
|
|
96
|
+
class ResourceChangedError(ResourceError[T_Identifier]):
|
|
97
|
+
"""The {resource_type} with identifier {identifier} has changed{changed}"""
|
|
98
|
+
|
|
99
|
+
fix = (
|
|
100
|
+
"When extending model with extension set to addition or reshape, "
|
|
101
|
+
"the {resource_type} properties must remain the same"
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
changed_properties: frozenset[str]
|
|
105
|
+
changed_attributes: frozenset[str]
|
|
106
|
+
|
|
107
|
+
def as_message(self, include_type: bool = True) -> str:
|
|
108
|
+
if self.changed_properties:
|
|
109
|
+
changed = f" properties {humanize_collection(self.changed_properties)}."
|
|
110
|
+
elif self.changed_attributes:
|
|
111
|
+
changed = f" attributes {humanize_collection(self.changed_attributes)}."
|
|
112
|
+
else:
|
|
113
|
+
changed = "."
|
|
114
|
+
msg = (self.__doc__ or "").format(resource_type=self.resource_type, identifier=self.identifier, changed=changed)
|
|
115
|
+
msg += f"Fix {self.fix.format(resource_type=self.resource_type)}"
|
|
116
|
+
return msg
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
from abc import ABC
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import ClassVar, cast
|
|
4
|
+
|
|
5
|
+
from cognite.neat.v0.core._issues import NeatError
|
|
6
|
+
from cognite.neat.v0.core._utils.spreadsheet import SpreadsheetRead
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass(unsafe_hash=True)
|
|
10
|
+
class SpreadsheetError(NeatError, ValueError, ABC):
|
|
11
|
+
"""In row {row}: {error}"""
|
|
12
|
+
|
|
13
|
+
_name: ClassVar[str] = ""
|
|
14
|
+
error: NeatError
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def create(
|
|
18
|
+
cls, location: tuple[int | str, ...], error: NeatError, spreadsheet: SpreadsheetRead | None = None
|
|
19
|
+
) -> "SpreadsheetError":
|
|
20
|
+
spreadsheet_name = cast(str, location[0])
|
|
21
|
+
if spreadsheet_name not in ERROR_CLS_BY_SPREADSHEET_NAME:
|
|
22
|
+
# This happens for the metadata sheet, which are individual fields
|
|
23
|
+
if spreadsheet_name == "Metadata" and len(location) >= 2 and isinstance(location[1], str):
|
|
24
|
+
field_name = cast(str, location[1])
|
|
25
|
+
else:
|
|
26
|
+
field_name = spreadsheet_name
|
|
27
|
+
return MetadataValueError(error, field_name=field_name)
|
|
28
|
+
|
|
29
|
+
error_cls = ERROR_CLS_BY_SPREADSHEET_NAME[spreadsheet_name]
|
|
30
|
+
row, column = cast(tuple[int, str], location[2:4])
|
|
31
|
+
|
|
32
|
+
if spreadsheet:
|
|
33
|
+
row = spreadsheet.adjusted_row_number(row)
|
|
34
|
+
|
|
35
|
+
return error_cls(
|
|
36
|
+
row=row,
|
|
37
|
+
error=error,
|
|
38
|
+
column=column,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@dataclass(unsafe_hash=True)
|
|
43
|
+
class SpreadsheetListError(SpreadsheetError, ABC):
|
|
44
|
+
"""In row {row}, column '{column}': {error}"""
|
|
45
|
+
|
|
46
|
+
row: int
|
|
47
|
+
column: str
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass(unsafe_hash=True)
|
|
51
|
+
class MetadataValueError(SpreadsheetError):
|
|
52
|
+
"""In field {field_name}: {error}"""
|
|
53
|
+
|
|
54
|
+
_type: ClassVar[str] = "Metadata"
|
|
55
|
+
field_name: str
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass(unsafe_hash=True)
|
|
59
|
+
class ViewValueError(SpreadsheetListError):
|
|
60
|
+
_name = "Views"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@dataclass(unsafe_hash=True)
|
|
64
|
+
class ContainerValueError(SpreadsheetListError):
|
|
65
|
+
_name = "Containers"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@dataclass(unsafe_hash=True)
|
|
69
|
+
class PropertyValueError(SpreadsheetListError):
|
|
70
|
+
_name = "Properties"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@dataclass(unsafe_hash=True)
|
|
74
|
+
class ConceptValueError(SpreadsheetListError):
|
|
75
|
+
_name = "Concepts"
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@dataclass(unsafe_hash=True)
|
|
79
|
+
class EnumValueError(SpreadsheetListError):
|
|
80
|
+
_name = "Enum"
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@dataclass(unsafe_hash=True)
|
|
84
|
+
class NodeValueError(SpreadsheetListError):
|
|
85
|
+
_name = "Nodes"
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
ERROR_CLS_BY_SPREADSHEET_NAME = {cls_._name: cls_ for cls_ in SpreadsheetListError.__subclasses__()}
|
|
89
|
+
|
|
90
|
+
# Efficient way to set docstring for all classes
|
|
91
|
+
for _cls in ERROR_CLS_BY_SPREADSHEET_NAME.values():
|
|
92
|
+
_cls.__doc__ = SpreadsheetListError.__doc__
|
|
93
|
+
del _cls
|
|
@@ -3,9 +3,9 @@ import xml.etree.ElementTree as ET
|
|
|
3
3
|
from abc import ABC, abstractmethod
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
|
-
from .
|
|
6
|
+
from ._base import IssueList, NeatError, NeatWarning
|
|
7
7
|
|
|
8
|
-
__all__ = ["
|
|
8
|
+
__all__ = ["FORMATTER_BY_NAME", "BasicHTML", "Formatter"]
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Formatter(ABC):
|
|
@@ -37,13 +37,13 @@ class Formatter(ABC):
|
|
|
37
37
|
class BasicHTML(Formatter):
|
|
38
38
|
file_suffix = ".html"
|
|
39
39
|
|
|
40
|
-
def __init__(self):
|
|
40
|
+
def __init__(self) -> None:
|
|
41
41
|
self._doc = ET.Element("html")
|
|
42
42
|
self._body = ET.SubElement(self._doc, "body")
|
|
43
43
|
|
|
44
44
|
def create_report(self, issues: IssueList) -> str:
|
|
45
|
-
errors = [issue for issue in issues if isinstance(issue,
|
|
46
|
-
warnings_ = [issue for issue in issues if isinstance(issue,
|
|
45
|
+
errors = [issue for issue in issues if isinstance(issue, NeatError)]
|
|
46
|
+
warnings_ = [issue for issue in issues if isinstance(issue, NeatWarning)]
|
|
47
47
|
self._doc.clear()
|
|
48
48
|
self._body = ET.SubElement(self._doc, "body")
|
|
49
49
|
h1 = ET.SubElement(self._body, "h1")
|
|
@@ -61,11 +61,11 @@ class BasicHTML(Formatter):
|
|
|
61
61
|
|
|
62
62
|
return ET.tostring(self._doc, encoding="unicode")
|
|
63
63
|
|
|
64
|
-
def _write_errors_or_warnings(self, issues: list[
|
|
65
|
-
issue_name = "errors" if isinstance(issues[0],
|
|
64
|
+
def _write_errors_or_warnings(self, issues: list[NeatError] | list[NeatWarning]) -> None:
|
|
65
|
+
issue_name = "errors" if isinstance(issues[0], NeatError) else "warnings"
|
|
66
66
|
main_categories = {base_ for issue in issues for base_ in type(issue).__bases__}
|
|
67
67
|
for category in main_categories:
|
|
68
|
-
issues_in_category: list[
|
|
68
|
+
issues_in_category: list[NeatError] | list[NeatWarning] = [ # type: ignore[assignment]
|
|
69
69
|
issue for issue in issues if isinstance(issue, category)
|
|
70
70
|
]
|
|
71
71
|
h3 = ET.SubElement(self._body, "h3")
|
|
@@ -75,9 +75,11 @@ class BasicHTML(Formatter):
|
|
|
75
75
|
ul = ET.SubElement(self._body, "ul")
|
|
76
76
|
for issue in issues_in_category:
|
|
77
77
|
li = ET.SubElement(ul, "li")
|
|
78
|
-
li.text = issue.
|
|
78
|
+
li.text = issue.as_message()
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
FORMATTER_BY_NAME: dict[str, type[Formatter]] = {
|
|
82
|
-
subclass.__name__: subclass
|
|
82
|
+
subclass.__name__: subclass # type: ignore[type-abstract]
|
|
83
|
+
for subclass in Formatter.__subclasses__()
|
|
84
|
+
if ABC not in subclass.__bases__ # type: ignore[type-abstract]
|
|
83
85
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""All warnings raised by the neat package are defined here. Note this module is called 'warnings' which
|
|
2
|
+
conflicts with the built-in Python warnings module. However, it is expected to always be used in an absolute
|
|
3
|
+
import, and should thus not cause a naming conflict."""
|
|
4
|
+
|
|
5
|
+
from cognite.neat.v0.core._issues._base import NeatWarning, _get_subclasses
|
|
6
|
+
|
|
7
|
+
from . import user_modeling
|
|
8
|
+
from ._external import (
|
|
9
|
+
CDFAuthWarning,
|
|
10
|
+
CDFMaxIterationsWarning,
|
|
11
|
+
FileItemNotSupportedWarning,
|
|
12
|
+
FileMissingRequiredFieldWarning,
|
|
13
|
+
FileReadWarning,
|
|
14
|
+
FileTypeUnexpectedWarning,
|
|
15
|
+
)
|
|
16
|
+
from ._general import (
|
|
17
|
+
DeprecatedWarning,
|
|
18
|
+
MissingCogniteClientWarning,
|
|
19
|
+
NeatValueWarning,
|
|
20
|
+
NotSupportedWarning,
|
|
21
|
+
RegexViolationWarning,
|
|
22
|
+
)
|
|
23
|
+
from ._models import (
|
|
24
|
+
BreakingModelingPrincipleWarning,
|
|
25
|
+
CDFNotSupportedWarning,
|
|
26
|
+
ConversionToPhysicalModelImpossibleWarning,
|
|
27
|
+
NotSupportedHasDataFilterLimitWarning,
|
|
28
|
+
NotSupportedViewContainerLimitWarning,
|
|
29
|
+
PrincipleMatchingSpaceAndVersionWarning,
|
|
30
|
+
PrincipleOneModelOneSpaceWarning,
|
|
31
|
+
PrincipleSolutionBuildsOnEnterpriseWarning,
|
|
32
|
+
UndefinedViewWarning,
|
|
33
|
+
UserModelingWarning,
|
|
34
|
+
)
|
|
35
|
+
from ._properties import (
|
|
36
|
+
PropertyDataTypeConversionWarning,
|
|
37
|
+
PropertyDefinitionDuplicatedWarning,
|
|
38
|
+
PropertyDefinitionWarning,
|
|
39
|
+
PropertyDirectRelationLimitWarning,
|
|
40
|
+
PropertyMultipleValueWarning,
|
|
41
|
+
PropertyNotFoundWarning,
|
|
42
|
+
PropertyOverwritingWarning,
|
|
43
|
+
PropertyTypeNotSupportedWarning,
|
|
44
|
+
PropertyValueTypeUndefinedWarning,
|
|
45
|
+
ReversedConnectionNotFeasibleWarning,
|
|
46
|
+
)
|
|
47
|
+
from ._resources import (
|
|
48
|
+
ResourceNeatWarning,
|
|
49
|
+
ResourceNotFoundWarning,
|
|
50
|
+
ResourceRegexViolationWarning,
|
|
51
|
+
ResourceRetrievalWarning,
|
|
52
|
+
ResourcesDuplicatedWarning,
|
|
53
|
+
ResourceTypeNotSupportedWarning,
|
|
54
|
+
ResourceUnknownWarning,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
__all__ = [
|
|
58
|
+
"BreakingModelingPrincipleWarning",
|
|
59
|
+
"CDFAuthWarning",
|
|
60
|
+
"CDFMaxIterationsWarning",
|
|
61
|
+
"CDFNotSupportedWarning",
|
|
62
|
+
"ConversionToPhysicalModelImpossibleWarning",
|
|
63
|
+
"DeprecatedWarning",
|
|
64
|
+
"FileItemNotSupportedWarning",
|
|
65
|
+
"FileMissingRequiredFieldWarning",
|
|
66
|
+
"FileReadWarning",
|
|
67
|
+
"FileTypeUnexpectedWarning",
|
|
68
|
+
"MissingCogniteClientWarning",
|
|
69
|
+
"NeatValueWarning",
|
|
70
|
+
"NotSupportedHasDataFilterLimitWarning",
|
|
71
|
+
"NotSupportedViewContainerLimitWarning",
|
|
72
|
+
"NotSupportedWarning",
|
|
73
|
+
"PrincipleMatchingSpaceAndVersionWarning",
|
|
74
|
+
"PrincipleOneModelOneSpaceWarning",
|
|
75
|
+
"PrincipleSolutionBuildsOnEnterpriseWarning",
|
|
76
|
+
"PropertyDataTypeConversionWarning",
|
|
77
|
+
"PropertyDefinitionDuplicatedWarning",
|
|
78
|
+
"PropertyDefinitionWarning",
|
|
79
|
+
"PropertyDirectRelationLimitWarning",
|
|
80
|
+
"PropertyMultipleValueWarning",
|
|
81
|
+
"PropertyNotFoundWarning",
|
|
82
|
+
"PropertyOverwritingWarning",
|
|
83
|
+
"PropertyTypeNotSupportedWarning",
|
|
84
|
+
"PropertyValueTypeUndefinedWarning",
|
|
85
|
+
"RegexViolationWarning",
|
|
86
|
+
"ResourceNeatWarning",
|
|
87
|
+
"ResourceNotFoundWarning",
|
|
88
|
+
"ResourceRegexViolationWarning",
|
|
89
|
+
"ResourceRetrievalWarning",
|
|
90
|
+
"ResourceTypeNotSupportedWarning",
|
|
91
|
+
"ResourceUnknownWarning",
|
|
92
|
+
"ResourcesDuplicatedWarning",
|
|
93
|
+
"ReversedConnectionNotFeasibleWarning",
|
|
94
|
+
"UndefinedViewWarning",
|
|
95
|
+
"UserModelingWarning",
|
|
96
|
+
"user_modeling",
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
_NEAT_WARNINGS_BY_NAME = {warning.__name__: warning for warning in _get_subclasses(NeatWarning, include_base=True)}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from cognite.neat.v0.core._issues import NeatWarning
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass(unsafe_hash=True)
|
|
8
|
+
class FileReadWarning(NeatWarning):
|
|
9
|
+
"""Error when reading file, {filepath}: {reason}"""
|
|
10
|
+
|
|
11
|
+
filepath: Path
|
|
12
|
+
reason: str
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(unsafe_hash=True)
|
|
16
|
+
class FileMissingRequiredFieldWarning(NeatWarning):
|
|
17
|
+
"""Missing required {field_name} in {filepath}: {field}. The file will be skipped"""
|
|
18
|
+
|
|
19
|
+
filepath: Path
|
|
20
|
+
field_name: str
|
|
21
|
+
field: str
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass(unsafe_hash=True)
|
|
25
|
+
class FileTypeUnexpectedWarning(NeatWarning):
|
|
26
|
+
"""Unexpected file type: {filepath}. Expected format: {expected_format}"""
|
|
27
|
+
|
|
28
|
+
extra = "Error: {error_message}"
|
|
29
|
+
|
|
30
|
+
filepath: Path
|
|
31
|
+
expected_format: frozenset[str]
|
|
32
|
+
error_message: str | None = None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass(unsafe_hash=True)
|
|
36
|
+
class FileItemNotSupportedWarning(NeatWarning):
|
|
37
|
+
"""The item {item} in {filepath} is not supported. The item will be skipped"""
|
|
38
|
+
|
|
39
|
+
item: str
|
|
40
|
+
filepath: Path
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass(unsafe_hash=True)
|
|
44
|
+
class CDFAuthWarning(NeatWarning):
|
|
45
|
+
"""Failed to {action}: {reason}"""
|
|
46
|
+
|
|
47
|
+
action: str
|
|
48
|
+
reason: str
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclass(unsafe_hash=True)
|
|
52
|
+
class CDFMaxIterationsWarning(NeatWarning):
|
|
53
|
+
"""The maximum number of iterations ({max_iterations}) has been reached. {message}"""
|
|
54
|
+
|
|
55
|
+
message: str
|
|
56
|
+
max_iterations: int
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cognite.neat.v0.core._issues import NeatWarning
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass(unsafe_hash=True)
|
|
7
|
+
class NeatValueWarning(NeatWarning):
|
|
8
|
+
"""{value}"""
|
|
9
|
+
|
|
10
|
+
value: str
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass(unsafe_hash=True)
|
|
14
|
+
class NotSupportedWarning(NeatWarning):
|
|
15
|
+
"""{feature} is not supported"""
|
|
16
|
+
|
|
17
|
+
feature: str
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass(unsafe_hash=True)
|
|
21
|
+
class RegexViolationWarning(NeatWarning):
|
|
22
|
+
"""The value '{value}' of {identifier} does not match the {pattern_name} pattern '{pattern}'"""
|
|
23
|
+
|
|
24
|
+
extra = "{motivation}"
|
|
25
|
+
value: str
|
|
26
|
+
pattern: str
|
|
27
|
+
identifier: str
|
|
28
|
+
pattern_name: str
|
|
29
|
+
motivation: str | None = None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass(unsafe_hash=True)
|
|
33
|
+
class MissingCogniteClientWarning(NeatWarning):
|
|
34
|
+
"""Missing Cognite Client required for {functionality}"""
|
|
35
|
+
|
|
36
|
+
functionality: str
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass(unsafe_hash=True)
|
|
40
|
+
class DeprecatedWarning(NeatWarning):
|
|
41
|
+
"""{feature} is deprecated"""
|
|
42
|
+
|
|
43
|
+
extra = "{replacement}"
|
|
44
|
+
|
|
45
|
+
feature: str
|
|
46
|
+
replacement: str | None = None
|