cognite-neat 0.92.3__py3-none-any.whl → 0.94.0__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.
Potentially problematic release.
This version of cognite-neat might be problematic. Click here for more details.
- cognite/neat/__init__.py +3 -2
- cognite/neat/{app → _app}/api/configuration.py +9 -7
- cognite/neat/_app/api/context_manager/__init__.py +3 -0
- cognite/neat/{app → _app}/api/context_manager/manager.py +1 -1
- cognite/neat/{app → _app}/api/explorer.py +5 -5
- cognite/neat/{app → _app}/api/routers/configuration.py +2 -2
- cognite/neat/{app → _app}/api/routers/crud.py +4 -4
- cognite/neat/{app → _app}/api/routers/workflows.py +7 -7
- cognite/neat/{app → _app}/main.py +1 -1
- cognite/neat/_app/ui/neat-app/package-lock.json +18306 -0
- cognite/neat/_app/ui/neat-app/package.json +62 -0
- cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
- cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +116 -0
- cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +112 -0
- cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +34 -0
- cognite/neat/_app/ui/neat-app/public/index.html +43 -0
- cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
- cognite/neat/_app/ui/neat-app/public/manifest.json +25 -0
- cognite/neat/_app/ui/neat-app/public/robots.txt +3 -0
- cognite/neat/_app/ui/neat-app/src/App.css +38 -0
- cognite/neat/_app/ui/neat-app/src/App.js +17 -0
- cognite/neat/_app/ui/neat-app/src/App.test.js +8 -0
- cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +70 -0
- cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +43 -0
- cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +124 -0
- cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +63 -0
- cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +511 -0
- cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +36 -0
- cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +56 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +60 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +112 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +67 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +79 -0
- cognite/neat/_app/ui/neat-app/src/index.css +13 -0
- cognite/neat/_app/ui/neat-app/src/index.js +13 -0
- cognite/neat/_app/ui/neat-app/src/logo.svg +1 -0
- cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +13 -0
- cognite/neat/_app/ui/neat-app/src/setupTests.js +5 -0
- cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +388 -0
- cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +61 -0
- cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +184 -0
- cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +180 -0
- cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +570 -0
- cognite/neat/_app/ui/neat-app/tsconfig.json +27 -0
- cognite/neat/{config.py → _config.py} +3 -3
- cognite/neat/{constants.py → _constants.py} +13 -5
- cognite/neat/_graph/_shared.py +34 -0
- cognite/neat/{graph → _graph}/_tracking/base.py +1 -1
- cognite/neat/{graph → _graph}/_tracking/log.py +1 -1
- cognite/neat/{graph → _graph}/extractors/__init__.py +5 -0
- cognite/neat/{graph → _graph}/extractors/_base.py +2 -2
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_assets.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_base.py +4 -4
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_classic.py +5 -5
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_data_sets.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_events.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_files.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_labels.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_relationships.py +2 -2
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_sequences.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_timeseries.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_dexpi.py +5 -5
- cognite/neat/{graph → _graph}/extractors/_dms.py +3 -3
- cognite/neat/_graph/extractors/_iodd.py +402 -0
- cognite/neat/{graph → _graph}/extractors/_mock_graph_generator.py +9 -8
- cognite/neat/_graph/extractors/_rdf_file.py +49 -0
- cognite/neat/{graph → _graph}/loaders/_base.py +5 -5
- cognite/neat/{graph → _graph}/loaders/_rdf2asset.py +11 -10
- cognite/neat/{graph → _graph}/loaders/_rdf2dms.py +10 -10
- cognite/neat/{graph → _graph}/queries/_base.py +91 -19
- cognite/neat/{graph → _graph}/queries/_construct.py +5 -5
- cognite/neat/{graph → _graph}/queries/_shared.py +3 -3
- cognite/neat/{graph → _graph}/transformers/__init__.py +6 -0
- cognite/neat/{graph → _graph}/transformers/_classic_cdf.py +135 -3
- cognite/neat/_graph/transformers/_iodd.py +25 -0
- cognite/neat/_graph/transformers/_prune_graph.py +126 -0
- cognite/neat/{graph → _graph}/transformers/_rdfpath.py +3 -3
- cognite/neat/_graph/transformers/_value_type.py +66 -0
- cognite/neat/{issues → _issues}/_base.py +32 -17
- cognite/neat/{issues → _issues}/errors/__init__.py +1 -1
- cognite/neat/{issues → _issues}/errors/_external.py +8 -8
- cognite/neat/{issues → _issues}/errors/_general.py +5 -5
- cognite/neat/{issues → _issues}/errors/_properties.py +7 -7
- cognite/neat/{issues → _issues}/errors/_resources.py +11 -11
- cognite/neat/{issues → _issues}/errors/_workflow.py +5 -5
- cognite/neat/{issues → _issues}/warnings/__init__.py +1 -1
- cognite/neat/{issues → _issues}/warnings/_external.py +5 -5
- cognite/neat/{issues → _issues}/warnings/_general.py +4 -4
- cognite/neat/{issues → _issues}/warnings/_models.py +10 -10
- cognite/neat/{issues → _issues}/warnings/_properties.py +6 -6
- cognite/neat/{issues → _issues}/warnings/_resources.py +5 -5
- cognite/neat/{issues → _issues}/warnings/user_modeling.py +9 -9
- cognite/neat/_rules/_constants.py +190 -0
- cognite/neat/{rules → _rules}/_shared.py +5 -5
- cognite/neat/_rules/analysis/__init__.py +5 -0
- cognite/neat/{rules → _rules}/analysis/_asset.py +5 -5
- cognite/neat/{rules → _rules}/analysis/_base.py +5 -5
- cognite/neat/_rules/analysis/_dms.py +43 -0
- cognite/neat/{rules → _rules}/analysis/_information.py +12 -6
- cognite/neat/_rules/catalog/__init__.py +6 -0
- cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
- cognite/neat/{rules → _rules}/exporters/__init__.py +2 -0
- cognite/neat/{rules → _rules}/exporters/_base.py +3 -3
- cognite/neat/{rules → _rules}/exporters/_rules2dms.py +5 -5
- cognite/neat/{rules → _rules}/exporters/_rules2excel.py +12 -8
- cognite/neat/_rules/exporters/_rules2instance_template.py +152 -0
- cognite/neat/{rules → _rules}/exporters/_rules2ontology.py +10 -9
- cognite/neat/{rules → _rules}/exporters/_rules2yaml.py +1 -3
- cognite/neat/{rules → _rules}/exporters/_validation.py +2 -2
- cognite/neat/{rules → _rules}/importers/_base.py +3 -3
- cognite/neat/{rules → _rules}/importers/_dms2rules.py +9 -9
- cognite/neat/{rules → _rules}/importers/_dtdl2rules/dtdl_converter.py +7 -7
- cognite/neat/{rules → _rules}/importers/_dtdl2rules/dtdl_importer.py +9 -9
- cognite/neat/{rules → _rules}/importers/_dtdl2rules/spec.py +1 -1
- cognite/neat/_rules/importers/_rdf/_base.py +144 -0
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2classes.py +1 -1
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2metadata.py +4 -4
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2properties.py +2 -1
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2rules.py +8 -39
- cognite/neat/{rules → _rules}/importers/_rdf/_inference2rules.py +33 -106
- cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2classes.py +1 -1
- cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2metadata.py +5 -5
- cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2properties.py +1 -1
- cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2rules.py +39 -0
- cognite/neat/{rules → _rules}/importers/_rdf/_shared.py +4 -4
- cognite/neat/{rules → _rules}/importers/_spreadsheet2rules.py +7 -7
- cognite/neat/{rules → _rules}/importers/_yaml2rules.py +5 -5
- cognite/neat/{rules → _rules}/models/__init__.py +5 -5
- cognite/neat/{rules → _rules}/models/_base_input.py +15 -6
- cognite/neat/{rules → _rules}/models/_base_rules.py +14 -2
- cognite/neat/{rules → _rules}/models/_rdfpath.py +1 -1
- cognite/neat/_rules/models/_types.py +151 -0
- cognite/neat/{rules → _rules}/models/asset/_rules.py +4 -4
- cognite/neat/{rules → _rules}/models/asset/_rules_input.py +4 -4
- cognite/neat/{rules → _rules}/models/asset/_validation.py +7 -7
- cognite/neat/{rules → _rules}/models/data_types.py +15 -12
- cognite/neat/{rules → _rules}/models/dms/_exporter.py +60 -12
- cognite/neat/{rules → _rules}/models/dms/_rules.py +26 -23
- cognite/neat/{rules → _rules}/models/dms/_rules_input.py +4 -4
- cognite/neat/{rules → _rules}/models/dms/_schema.py +15 -14
- cognite/neat/{rules → _rules}/models/dms/_validation.py +8 -8
- cognite/neat/{rules → _rules}/models/domain.py +6 -6
- cognite/neat/{rules → _rules}/models/entities/__init__.py +1 -2
- cognite/neat/_rules/models/entities/_constants.py +15 -0
- cognite/neat/{rules → _rules}/models/entities/_loaders.py +2 -2
- cognite/neat/{rules → _rules}/models/entities/_multi_value.py +15 -2
- cognite/neat/{rules → _rules}/models/entities/_single_value.py +7 -4
- cognite/neat/{rules → _rules}/models/information/_rules.py +34 -22
- cognite/neat/{rules → _rules}/models/information/_rules_input.py +3 -3
- cognite/neat/{rules → _rules}/models/information/_validation.py +6 -5
- cognite/neat/_rules/models/mapping/__init__.py +4 -0
- cognite/neat/_rules/models/mapping/_base.py +131 -0
- cognite/neat/_rules/models/mapping/_classic2core.py +150 -0
- cognite/neat/{rules → _rules}/transformers/__init__.py +15 -2
- cognite/neat/{rules → _rules}/transformers/_base.py +3 -3
- cognite/neat/{rules → _rules}/transformers/_converters.py +289 -20
- cognite/neat/{rules/transformers/_map_onto.py → _rules/transformers/_mapping.py} +46 -4
- cognite/neat/{rules → _rules}/transformers/_pipelines.py +4 -4
- cognite/neat/{rules → _rules}/transformers/_verification.py +10 -4
- cognite/neat/_session/__init__.py +3 -0
- cognite/neat/_session/_base.py +86 -0
- cognite/neat/_session/_prepare.py +61 -0
- cognite/neat/_session/_read.py +118 -0
- cognite/neat/_session/_show.py +274 -0
- cognite/neat/_session/_state.py +69 -0
- cognite/neat/_session/_to.py +70 -0
- cognite/neat/_session/_wizard.py +39 -0
- cognite/neat/_session/exceptions.py +42 -0
- cognite/neat/{store → _store}/_base.py +62 -31
- cognite/neat/{store → _store}/_provenance.py +11 -1
- cognite/neat/{utils → _utils}/auth.py +14 -3
- cognite/neat/{utils → _utils}/auxiliary.py +1 -1
- cognite/neat/{utils → _utils}/cdf/loaders/_data_modeling.py +8 -2
- cognite/neat/{utils → _utils}/cdf/loaders/_ingestion.py +1 -1
- cognite/neat/{utils → _utils}/upload.py +1 -1
- cognite/neat/_version.py +1 -1
- cognite/neat/_workflows/__init__.py +17 -0
- cognite/neat/{workflows → _workflows}/base.py +10 -10
- cognite/neat/{workflows → _workflows}/cdf_store.py +3 -3
- cognite/neat/{workflows → _workflows}/examples/Export_DMS/workflow.yaml +89 -89
- cognite/neat/{workflows → _workflows}/manager.py +6 -6
- cognite/neat/{workflows → _workflows}/steps/data_contracts.py +3 -3
- cognite/neat/{workflows → _workflows}/steps/lib/current/graph_extractor.py +8 -31
- cognite/neat/{workflows → _workflows}/steps/lib/current/graph_loader.py +4 -4
- cognite/neat/{workflows → _workflows}/steps/lib/current/graph_store.py +4 -4
- cognite/neat/{workflows → _workflows}/steps/lib/current/rules_exporter.py +8 -8
- cognite/neat/{workflows → _workflows}/steps/lib/current/rules_importer.py +13 -13
- cognite/neat/{workflows → _workflows}/steps/lib/current/rules_validator.py +8 -8
- cognite/neat/{workflows → _workflows}/steps/lib/io/io_steps.py +3 -3
- cognite/neat/{workflows → _workflows}/steps/step_model.py +3 -3
- cognite/neat/{workflows → _workflows}/steps_registry.py +9 -9
- cognite/neat/{workflows → _workflows}/tasks.py +1 -1
- cognite/neat/{workflows → _workflows}/triggers.py +2 -2
- {cognite_neat-0.92.3.dist-info → cognite_neat-0.94.0.dist-info}/METADATA +6 -2
- cognite_neat-0.94.0.dist-info/RECORD +276 -0
- {cognite_neat-0.92.3.dist-info → cognite_neat-0.94.0.dist-info}/WHEEL +1 -1
- cognite_neat-0.94.0.dist-info/entry_points.txt +3 -0
- cognite/neat/app/api/context_manager/__init__.py +0 -3
- cognite/neat/graph/_shared.py +0 -5
- cognite/neat/graph/extractors/_iodd.py +0 -160
- cognite/neat/graph/extractors/_rdf_file.py +0 -26
- cognite/neat/rules/analysis/__init__.py +0 -6
- cognite/neat/rules/examples/__init__.py +0 -10
- cognite/neat/rules/examples/info-rules-imf.xlsx +0 -0
- cognite/neat/rules/examples/wind-energy.owl +0 -1511
- cognite/neat/rules/importers/_rdf/_owl2rules/_owl2rules.py +0 -65
- cognite/neat/rules/models/_types.py +0 -96
- cognite/neat/rules/models/entities/_constants.py +0 -73
- cognite/neat/utils/regex_patterns.py +0 -58
- cognite/neat/workflows/__init__.py +0 -12
- cognite_neat-0.92.3.dist-info/RECORD +0 -224
- cognite_neat-0.92.3.dist-info/entry_points.txt +0 -3
- /cognite/neat/{app → _app}/api/__init__.py +0 -0
- /cognite/neat/{app → _app}/api/asgi/metrics.py +0 -0
- /cognite/neat/{app → _app}/api/data_classes/__init__.py +0 -0
- /cognite/neat/{app → _app}/api/data_classes/rest.py +0 -0
- /cognite/neat/{app → _app}/api/routers/metrics.py +0 -0
- /cognite/neat/{app → _app}/api/utils/__init__.py +0 -0
- /cognite/neat/{app → _app}/api/utils/data_mapping.py +0 -0
- /cognite/neat/{app → _app}/api/utils/logging.py +0 -0
- /cognite/neat/{app → _app}/api/utils/query_templates.py +0 -0
- /cognite/neat/{app → _app}/monitoring/__init__.py +0 -0
- /cognite/neat/{app → _app}/monitoring/metrics.py +0 -0
- /cognite/neat/{app → _app}/ui/index.html +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/.gitignore +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/README.md +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/asset-manifest.json +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/favicon.ico +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/img/architect-icon.svg +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/img/developer-icon.svg +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/img/sme-icon.svg +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/index.html +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/logo192.png +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/manifest.json +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/robots.txt +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- /cognite/neat/{graph → _graph}/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/_tracking/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- /cognite/neat/{graph → _graph}/examples/Knowledge-Graph-Nordic44.xml +0 -0
- /cognite/neat/{graph → _graph}/examples/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- /cognite/neat/{graph → _graph}/extractors/_classic_cdf/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/loaders/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/models.py +0 -0
- /cognite/neat/{graph → _graph}/queries/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/transformers/_base.py +0 -0
- /cognite/neat/{issues → _issues}/__init__.py +0 -0
- /cognite/neat/{issues → _issues}/formatters.py +0 -0
- /cognite/neat/{rules → _rules}/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_dtdl2rules/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_dtdl2rules/_unit_lookup.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_rdf/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/models/asset/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/models/dms/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/models/entities/_types.py +0 -0
- /cognite/neat/{rules → _rules}/models/entities/_wrapped.py +0 -0
- /cognite/neat/{rules → _rules}/models/information/__init__.py +0 -0
- /cognite/neat/{store → _store}/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/data_classes.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/loaders/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/loaders/_base.py +0 -0
- /cognite/neat/{utils → _utils}/collection_.py +0 -0
- /cognite/neat/{utils → _utils}/rdf_.py +0 -0
- /cognite/neat/{utils → _utils}/spreadsheet.py +0 -0
- /cognite/neat/{utils → _utils}/text.py +0 -0
- /cognite/neat/{utils → _utils}/time_.py +0 -0
- /cognite/neat/{utils → _utils}/xml_.py +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Export_Semantic_Data_Model/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Import_DMS/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Validate_Rules/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Validate_Solution_Model/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/model.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/lib/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/lib/current/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/lib/io/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/utils.py +0 -0
- {cognite_neat-0.92.3.dist-info → cognite_neat-0.94.0.dist-info}/LICENSE +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from rdflib import XSD, Graph, URIRef
|
|
2
|
+
|
|
3
|
+
from cognite.neat._constants import UNKNOWN_TYPE
|
|
4
|
+
from cognite.neat._graph.queries import Queries
|
|
5
|
+
from cognite.neat._utils.rdf_ import remove_namespace_from_uri
|
|
6
|
+
|
|
7
|
+
from ._base import BaseTransformer
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SplitMultiValueProperty(BaseTransformer):
|
|
11
|
+
description: str = (
|
|
12
|
+
"SplitMultiValueProperty is a transformer that splits a "
|
|
13
|
+
"multi-value property into multiple single-value properties."
|
|
14
|
+
)
|
|
15
|
+
_use_only_once: bool = True
|
|
16
|
+
_need_changes = frozenset({})
|
|
17
|
+
|
|
18
|
+
_object_property_template: str = """SELECT ?s ?o WHERE{{
|
|
19
|
+
|
|
20
|
+
?s a <{subject_uri}> .
|
|
21
|
+
?s <{property_uri}> ?o .
|
|
22
|
+
?o a <{object_uri}> .
|
|
23
|
+
|
|
24
|
+
}}"""
|
|
25
|
+
|
|
26
|
+
_datatype_property_template: str = """SELECT ?s ?o WHERE {{
|
|
27
|
+
|
|
28
|
+
?s a <{subject_uri}> .
|
|
29
|
+
?s <{property_uri}> ?o .
|
|
30
|
+
FILTER (datatype(?o) = <{object_uri}>)
|
|
31
|
+
|
|
32
|
+
}}"""
|
|
33
|
+
|
|
34
|
+
_unknown_property_template: str = """SELECT ?s ?o WHERE {{
|
|
35
|
+
|
|
36
|
+
?s a <{subject_uri}> .
|
|
37
|
+
?s <{property_uri}> ?o .
|
|
38
|
+
FILTER NOT EXISTS {{ ?o a ?objectType }}
|
|
39
|
+
}}"""
|
|
40
|
+
|
|
41
|
+
def transform(self, graph: Graph) -> None:
|
|
42
|
+
# handle multi value type object properties
|
|
43
|
+
for subject_uri, property_uri, value_types in Queries(graph).multi_value_type_property():
|
|
44
|
+
for value_type_uri in value_types:
|
|
45
|
+
_args = {
|
|
46
|
+
"subject_uri": subject_uri,
|
|
47
|
+
"property_uri": property_uri,
|
|
48
|
+
"object_uri": value_type_uri,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# Case 1: Unknown value type
|
|
52
|
+
if value_type_uri == UNKNOWN_TYPE:
|
|
53
|
+
iterator = graph.query(self._unknown_property_template.format(**_args))
|
|
54
|
+
|
|
55
|
+
# Case 2: Datatype value type
|
|
56
|
+
elif value_type_uri.startswith(str(XSD)):
|
|
57
|
+
iterator = graph.query(self._datatype_property_template.format(**_args))
|
|
58
|
+
|
|
59
|
+
# Case 3: Object value type
|
|
60
|
+
else:
|
|
61
|
+
iterator = graph.query(self._object_property_template.format(**_args))
|
|
62
|
+
|
|
63
|
+
for s, o in iterator: # type: ignore [misc]
|
|
64
|
+
graph.remove((s, property_uri, o))
|
|
65
|
+
new_property = URIRef(f"{property_uri}_{remove_namespace_from_uri(value_type_uri)}")
|
|
66
|
+
graph.add((s, new_property, o))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import inspect
|
|
1
2
|
import sys
|
|
2
3
|
import warnings
|
|
3
4
|
from abc import ABC
|
|
4
|
-
from collections import UserList
|
|
5
5
|
from collections.abc import Collection, Hashable, Iterable, Sequence
|
|
6
6
|
from dataclasses import dataclass, fields
|
|
7
7
|
from functools import total_ordering
|
|
@@ -11,11 +11,11 @@ from typing import Any, ClassVar, Literal, TypeAlias, TypeVar, get_args, get_ori
|
|
|
11
11
|
from warnings import WarningMessage
|
|
12
12
|
|
|
13
13
|
import pandas as pd
|
|
14
|
-
from cognite.client.data_classes.data_modeling import ContainerId, ViewId
|
|
14
|
+
from cognite.client.data_classes.data_modeling import ContainerId, PropertyId, ViewId
|
|
15
15
|
from pydantic_core import ErrorDetails
|
|
16
16
|
|
|
17
|
-
from cognite.neat.
|
|
18
|
-
from cognite.neat.
|
|
17
|
+
from cognite.neat._utils.spreadsheet import SpreadsheetRead
|
|
18
|
+
from cognite.neat._utils.text import humanize_collection, to_camel, to_snake
|
|
19
19
|
|
|
20
20
|
if sys.version_info < (3, 11):
|
|
21
21
|
from exceptiongroup import ExceptionGroup
|
|
@@ -60,7 +60,7 @@ ResourceType: TypeAlias = (
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
@total_ordering
|
|
63
|
-
@dataclass(
|
|
63
|
+
@dataclass(unsafe_hash=True)
|
|
64
64
|
class NeatIssue:
|
|
65
65
|
"""This is the base class for all exceptions and warnings (issues) used in Neat."""
|
|
66
66
|
|
|
@@ -107,6 +107,8 @@ class NeatIssue:
|
|
|
107
107
|
|
|
108
108
|
@classmethod
|
|
109
109
|
def _dump_value(cls, value: Any) -> list | int | bool | float | str | dict:
|
|
110
|
+
from cognite.neat._rules.models.entities import Entity
|
|
111
|
+
|
|
110
112
|
if isinstance(value, str | int | bool | float):
|
|
111
113
|
return value
|
|
112
114
|
elif isinstance(value, frozenset):
|
|
@@ -117,13 +119,17 @@ class NeatIssue:
|
|
|
117
119
|
return [cls._dump_value(item) for item in value]
|
|
118
120
|
elif isinstance(value, ViewId | ContainerId):
|
|
119
121
|
return value.dump(camel_case=True, include_type=True)
|
|
122
|
+
elif isinstance(value, Entity):
|
|
123
|
+
return value.dump()
|
|
124
|
+
elif isinstance(value, PropertyId):
|
|
125
|
+
return value.dump(camel_case=True)
|
|
120
126
|
raise ValueError(f"Unsupported type: {type(value)}")
|
|
121
127
|
|
|
122
128
|
@classmethod
|
|
123
129
|
def load(cls, data: dict[str, Any]) -> "NeatIssue":
|
|
124
130
|
"""Create an instance of the issue from a dictionary."""
|
|
125
|
-
from cognite.neat.
|
|
126
|
-
from cognite.neat.
|
|
131
|
+
from cognite.neat._issues.errors import _NEAT_ERRORS_BY_NAME, NeatValueError
|
|
132
|
+
from cognite.neat._issues.warnings import _NEAT_WARNINGS_BY_NAME
|
|
127
133
|
|
|
128
134
|
if "NeatIssue" not in data:
|
|
129
135
|
raise NeatValueError("The data does not contain a NeatIssue key.")
|
|
@@ -147,7 +153,9 @@ class NeatIssue:
|
|
|
147
153
|
return neat_issue_cls(**args)
|
|
148
154
|
|
|
149
155
|
@classmethod
|
|
150
|
-
def _load_value(cls, type_:
|
|
156
|
+
def _load_value(cls, type_: Any, value: Any) -> Any:
|
|
157
|
+
from cognite.neat._rules.models.entities import Entity
|
|
158
|
+
|
|
151
159
|
if isinstance(type_, UnionType) or get_origin(type_) is UnionType:
|
|
152
160
|
args = get_args(type_)
|
|
153
161
|
return cls._load_value(args[0], value)
|
|
@@ -161,8 +169,12 @@ class NeatIssue:
|
|
|
161
169
|
return tuple(cls._load_value(subtype, item) for item in value)
|
|
162
170
|
elif type_ is ViewId:
|
|
163
171
|
return ViewId.load(value)
|
|
172
|
+
elif type_ is PropertyId:
|
|
173
|
+
return PropertyId.load(value)
|
|
164
174
|
elif type_ is ContainerId:
|
|
165
175
|
return ContainerId.load(value)
|
|
176
|
+
elif inspect.isclass(type_) and issubclass(type_, Entity):
|
|
177
|
+
return type_.load(value)
|
|
166
178
|
return value
|
|
167
179
|
|
|
168
180
|
def __lt__(self, other: "NeatIssue") -> bool:
|
|
@@ -176,7 +188,7 @@ class NeatIssue:
|
|
|
176
188
|
return (type(self).__name__, self.as_message()) == (type(other).__name__, other.as_message())
|
|
177
189
|
|
|
178
190
|
|
|
179
|
-
@dataclass(
|
|
191
|
+
@dataclass(unsafe_hash=True)
|
|
180
192
|
class NeatError(NeatIssue, Exception):
|
|
181
193
|
"""This is the base class for all exceptions (errors) used in Neat."""
|
|
182
194
|
|
|
@@ -212,8 +224,8 @@ class NeatError(NeatIssue, Exception):
|
|
|
212
224
|
|
|
213
225
|
@staticmethod
|
|
214
226
|
def _adjust_row_numbers(caught_error: "NeatError", read_info_by_sheet: dict[str, SpreadsheetRead]) -> None:
|
|
215
|
-
from cognite.neat.
|
|
216
|
-
from cognite.neat.
|
|
227
|
+
from cognite.neat._issues.errors._properties import PropertyDefinitionDuplicatedError
|
|
228
|
+
from cognite.neat._issues.errors._resources import ResourceNotDefinedError
|
|
217
229
|
|
|
218
230
|
reader = read_info_by_sheet.get("Properties", SpreadsheetRead())
|
|
219
231
|
|
|
@@ -238,7 +250,7 @@ class NeatError(NeatIssue, Exception):
|
|
|
238
250
|
object.__setattr__(caught_error, "row_number", new_row)
|
|
239
251
|
|
|
240
252
|
|
|
241
|
-
@dataclass(
|
|
253
|
+
@dataclass(unsafe_hash=True)
|
|
242
254
|
class DefaultPydanticError(NeatError, ValueError):
|
|
243
255
|
"""{type}: {msg} [loc={loc}]"""
|
|
244
256
|
|
|
@@ -263,7 +275,7 @@ class DefaultPydanticError(NeatError, ValueError):
|
|
|
263
275
|
return self.msg
|
|
264
276
|
|
|
265
277
|
|
|
266
|
-
@dataclass(
|
|
278
|
+
@dataclass(unsafe_hash=True)
|
|
267
279
|
class RowError(NeatError, ValueError):
|
|
268
280
|
"""In {sheet_name}, row={row}, column={column}: {msg}. [type={type}, input_value={input}]"""
|
|
269
281
|
|
|
@@ -307,7 +319,7 @@ class RowError(NeatError, ValueError):
|
|
|
307
319
|
return output
|
|
308
320
|
|
|
309
321
|
|
|
310
|
-
@dataclass(
|
|
322
|
+
@dataclass(unsafe_hash=True)
|
|
311
323
|
class NeatWarning(NeatIssue, UserWarning):
|
|
312
324
|
"""This is the base class for all warnings used in Neat."""
|
|
313
325
|
|
|
@@ -317,7 +329,7 @@ class NeatWarning(NeatIssue, UserWarning):
|
|
|
317
329
|
return DefaultWarning.from_warning_message(warning)
|
|
318
330
|
|
|
319
331
|
|
|
320
|
-
@dataclass(
|
|
332
|
+
@dataclass(unsafe_hash=True)
|
|
321
333
|
class DefaultWarning(NeatWarning):
|
|
322
334
|
"""{category}: {warning}"""
|
|
323
335
|
|
|
@@ -345,7 +357,7 @@ class DefaultWarning(NeatWarning):
|
|
|
345
357
|
T_NeatIssue = TypeVar("T_NeatIssue", bound=NeatIssue)
|
|
346
358
|
|
|
347
359
|
|
|
348
|
-
class NeatIssueList(
|
|
360
|
+
class NeatIssueList(list, Sequence[T_NeatIssue], ABC):
|
|
349
361
|
"""This is a generic list of NeatIssues."""
|
|
350
362
|
|
|
351
363
|
def __init__(self, issues: Sequence[T_NeatIssue] | None = None, title: str | None = None):
|
|
@@ -406,7 +418,10 @@ class MultiValueError(ValueError):
|
|
|
406
418
|
class IssueList(NeatIssueList[NeatIssue]):
|
|
407
419
|
"""This is a list of NeatIssues."""
|
|
408
420
|
|
|
409
|
-
|
|
421
|
+
def _repr_html_(self) -> str | None:
|
|
422
|
+
if not self:
|
|
423
|
+
return "<p>'No issues found'</p>"
|
|
424
|
+
return super()._repr_html_()
|
|
410
425
|
|
|
411
426
|
|
|
412
427
|
T_Cls = TypeVar("T_Cls")
|
|
@@ -3,10 +3,10 @@ from pathlib import Path
|
|
|
3
3
|
|
|
4
4
|
from yaml import YAMLError
|
|
5
5
|
|
|
6
|
-
from cognite.neat.
|
|
6
|
+
from cognite.neat._issues import NeatError
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
@dataclass(
|
|
9
|
+
@dataclass(unsafe_hash=True)
|
|
10
10
|
class AuthorizationError(NeatError, RuntimeError):
|
|
11
11
|
"""Missing authorization for {action}: {reason}"""
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ class AuthorizationError(NeatError, RuntimeError):
|
|
|
14
14
|
reason: str
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
@dataclass(
|
|
17
|
+
@dataclass(unsafe_hash=True)
|
|
18
18
|
class FileReadError(NeatError, RuntimeError):
|
|
19
19
|
"""Error when reading file, {filepath}: {reason}"""
|
|
20
20
|
|
|
@@ -23,7 +23,7 @@ class FileReadError(NeatError, RuntimeError):
|
|
|
23
23
|
reason: str
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
@dataclass(
|
|
26
|
+
@dataclass(unsafe_hash=True)
|
|
27
27
|
class FileNotFoundNeatError(NeatError, FileNotFoundError):
|
|
28
28
|
"""File {filepath} not found"""
|
|
29
29
|
|
|
@@ -31,7 +31,7 @@ class FileNotFoundNeatError(NeatError, FileNotFoundError):
|
|
|
31
31
|
filepath: Path
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
@dataclass(
|
|
34
|
+
@dataclass(unsafe_hash=True)
|
|
35
35
|
class FileMissingRequiredFieldError(NeatError, ValueError):
|
|
36
36
|
"""Missing required {field_name} in {filepath}: {field}"""
|
|
37
37
|
|
|
@@ -40,7 +40,7 @@ class FileMissingRequiredFieldError(NeatError, ValueError):
|
|
|
40
40
|
field: str
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
@dataclass(
|
|
43
|
+
@dataclass(unsafe_hash=True)
|
|
44
44
|
class NeatYamlError(NeatError, YAMLError):
|
|
45
45
|
"""Invalid YAML: {reason}"""
|
|
46
46
|
|
|
@@ -51,7 +51,7 @@ class NeatYamlError(NeatError, YAMLError):
|
|
|
51
51
|
expected_format: str | None = None
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
@dataclass(
|
|
54
|
+
@dataclass(unsafe_hash=True)
|
|
55
55
|
class FileTypeUnexpectedError(NeatError, TypeError):
|
|
56
56
|
"""Unexpected file type: {filepath}. Expected format: {expected_format}"""
|
|
57
57
|
|
|
@@ -59,7 +59,7 @@ class FileTypeUnexpectedError(NeatError, TypeError):
|
|
|
59
59
|
expected_format: frozenset[str]
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
@dataclass(
|
|
62
|
+
@dataclass(unsafe_hash=True)
|
|
63
63
|
class FileNotAFileError(NeatError, FileNotFoundError):
|
|
64
64
|
"""{filepath} is not a file"""
|
|
65
65
|
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
|
|
3
|
-
from cognite.neat.
|
|
3
|
+
from cognite.neat._issues import NeatError
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
@dataclass(
|
|
6
|
+
@dataclass(unsafe_hash=True)
|
|
7
7
|
class NeatValueError(NeatError, ValueError):
|
|
8
8
|
"""{raw_message}"""
|
|
9
9
|
|
|
10
10
|
raw_message: str
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
@dataclass(
|
|
13
|
+
@dataclass(unsafe_hash=True)
|
|
14
14
|
class NeatTypeError(NeatError, TypeError):
|
|
15
15
|
"""{raw_message}"""
|
|
16
16
|
|
|
17
17
|
raw_message: str
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
@dataclass(
|
|
20
|
+
@dataclass(unsafe_hash=True)
|
|
21
21
|
class RegexViolationError(NeatError, ValueError):
|
|
22
22
|
"""Value, {value} failed regex, {regex}, validation. Make sure that the name follows the regex pattern."""
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ class RegexViolationError(NeatError, ValueError):
|
|
|
25
25
|
regex: str
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
@dataclass(
|
|
28
|
+
@dataclass(unsafe_hash=True)
|
|
29
29
|
class NeatImportError(NeatError, ImportError):
|
|
30
30
|
"""The functionality requires {module}. You can include it
|
|
31
31
|
in your neat installation with `pip install "cognite-neat[{neat_extra}]"`.
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Generic
|
|
3
3
|
|
|
4
|
-
from cognite.neat.
|
|
4
|
+
from cognite.neat._issues._base import ResourceType
|
|
5
5
|
|
|
6
6
|
from ._resources import ResourceError, T_Identifier, T_ReferenceIdentifier
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
@dataclass(
|
|
9
|
+
@dataclass(unsafe_hash=True)
|
|
10
10
|
class PropertyError(ResourceError[T_Identifier]):
|
|
11
11
|
"""Base class for property errors {resource_type} with identifier {identifier}.{property_name}"""
|
|
12
12
|
|
|
13
13
|
property_name: str
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
@dataclass(
|
|
16
|
+
@dataclass(unsafe_hash=True)
|
|
17
17
|
class PropertyNotFoundError(PropertyError, Generic[T_Identifier, T_ReferenceIdentifier]):
|
|
18
18
|
"""The {resource_type} with identifier {identifier} does not have a property {property_name}"""
|
|
19
19
|
|
|
@@ -24,7 +24,7 @@ class PropertyNotFoundError(PropertyError, Generic[T_Identifier, T_ReferenceIden
|
|
|
24
24
|
referred_type: ResourceType | None = None
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
@dataclass(
|
|
27
|
+
@dataclass(unsafe_hash=True)
|
|
28
28
|
class PropertyTypeNotSupportedError(PropertyError[T_Identifier]):
|
|
29
29
|
"""The {resource_type} with identifier {identifier} has a property {property_name}
|
|
30
30
|
of unsupported type {property_type}"""
|
|
@@ -33,14 +33,14 @@ class PropertyTypeNotSupportedError(PropertyError[T_Identifier]):
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
# This is a generic error that should be used sparingly
|
|
36
|
-
@dataclass(
|
|
36
|
+
@dataclass(unsafe_hash=True)
|
|
37
37
|
class PropertyDefinitionError(PropertyError[T_Identifier]):
|
|
38
38
|
"""Invalid property definition for {resource_type} {identifier}.{property_name}: {reason}"""
|
|
39
39
|
|
|
40
40
|
reason: str
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
@dataclass(
|
|
43
|
+
@dataclass(unsafe_hash=True)
|
|
44
44
|
class PropertyDefinitionDuplicatedError(PropertyError[T_Identifier]):
|
|
45
45
|
"""The {resource_type} with identifier {identifier} has multiple definitions for the property {property_name}
|
|
46
46
|
with values {property_values}
|
|
@@ -53,7 +53,7 @@ class PropertyDefinitionDuplicatedError(PropertyError[T_Identifier]):
|
|
|
53
53
|
location_name: str | None = None
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
@dataclass(
|
|
56
|
+
@dataclass(unsafe_hash=True)
|
|
57
57
|
class PropertyMappingDuplicatedError(PropertyError[T_Identifier], Generic[T_Identifier, T_ReferenceIdentifier]):
|
|
58
58
|
"""The {resource_type} with identifier {identifier}.{property_name} is mapped to by: {mappings}. Ensure
|
|
59
59
|
that only one {mapping_type} maps to {resource_type} {identifier}.{property_name}"""
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Generic
|
|
3
3
|
|
|
4
|
-
from cognite.neat.
|
|
5
|
-
from cognite.neat.
|
|
4
|
+
from cognite.neat._issues._base import NeatError, ResourceType, T_Identifier, T_ReferenceIdentifier
|
|
5
|
+
from cognite.neat._utils.text import humanize_collection
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
@dataclass(
|
|
8
|
+
@dataclass(unsafe_hash=True)
|
|
9
9
|
class ResourceError(NeatError, Generic[T_Identifier], RuntimeError):
|
|
10
10
|
"""Base class for resource errors {resource_type} with identifier {identifier}"""
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ class ResourceError(NeatError, Generic[T_Identifier], RuntimeError):
|
|
|
13
13
|
resource_type: ResourceType
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
@dataclass(
|
|
16
|
+
@dataclass(unsafe_hash=True)
|
|
17
17
|
class ResourceDuplicatedError(ResourceError[T_Identifier]):
|
|
18
18
|
"""The {resource_type} with identifier {identifier} is duplicated in {location}"""
|
|
19
19
|
|
|
@@ -21,14 +21,14 @@ class ResourceDuplicatedError(ResourceError[T_Identifier]):
|
|
|
21
21
|
location: str
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
@dataclass(
|
|
24
|
+
@dataclass(unsafe_hash=True)
|
|
25
25
|
class ResourceRetrievalError(ResourceError[T_Identifier]):
|
|
26
26
|
"""Failed to retrieve {resource_type} with identifier {identifier}. The error was: {error}"""
|
|
27
27
|
|
|
28
28
|
error: str
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
@dataclass(
|
|
31
|
+
@dataclass(unsafe_hash=True)
|
|
32
32
|
class ResourceNotFoundError(ResourceError, Generic[T_Identifier, T_ReferenceIdentifier]):
|
|
33
33
|
"""The {resource_type} with identifier {identifier} does not exist"""
|
|
34
34
|
|
|
@@ -50,7 +50,7 @@ class ResourceNotFoundError(ResourceError, Generic[T_Identifier, T_ReferenceIden
|
|
|
50
50
|
return msg
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
@dataclass(
|
|
53
|
+
@dataclass(unsafe_hash=True)
|
|
54
54
|
class ResourceNotDefinedError(ResourceError[T_Identifier]):
|
|
55
55
|
"""The {resource_type} {identifier} is not defined in the {location}"""
|
|
56
56
|
|
|
@@ -63,7 +63,7 @@ class ResourceNotDefinedError(ResourceError[T_Identifier]):
|
|
|
63
63
|
sheet_name: str | None = None
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
@dataclass(
|
|
66
|
+
@dataclass(unsafe_hash=True)
|
|
67
67
|
class ResourceConvertionError(ResourceError, ValueError):
|
|
68
68
|
"""Failed to convert the {resource_type} {identifier} to {target_format}: {reason}"""
|
|
69
69
|
|
|
@@ -72,14 +72,14 @@ class ResourceConvertionError(ResourceError, ValueError):
|
|
|
72
72
|
reason: str
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
@dataclass(
|
|
75
|
+
@dataclass(unsafe_hash=True)
|
|
76
76
|
class ResourceCreationError(ResourceError[T_Identifier], ValueError):
|
|
77
77
|
"""Failed to create {resource_type} with identifier {identifier}. The error was: {error}"""
|
|
78
78
|
|
|
79
79
|
error: str
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
@dataclass(
|
|
82
|
+
@dataclass(unsafe_hash=True)
|
|
83
83
|
class ResourceMissingIdentifierError(NeatError, ValueError):
|
|
84
84
|
"""The {resource_type} with name {name} is missing an identifier."""
|
|
85
85
|
|
|
@@ -87,7 +87,7 @@ class ResourceMissingIdentifierError(NeatError, ValueError):
|
|
|
87
87
|
name: str | None = None
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
@dataclass(
|
|
90
|
+
@dataclass(unsafe_hash=True)
|
|
91
91
|
class ResourceChangedError(ResourceError[T_Identifier]):
|
|
92
92
|
"""The {resource_type} with identifier {identifier} has changed{changed}"""
|
|
93
93
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
|
|
3
|
-
from cognite.neat.
|
|
3
|
+
from cognite.neat._issues import NeatError
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
@dataclass(
|
|
6
|
+
@dataclass(unsafe_hash=True)
|
|
7
7
|
class WorkFlowMissingDataError(NeatError, ValueError):
|
|
8
8
|
"""In the workflow step {step_name} the following data is missing: {missing_data}."""
|
|
9
9
|
|
|
@@ -11,14 +11,14 @@ class WorkFlowMissingDataError(NeatError, ValueError):
|
|
|
11
11
|
missing_data: frozenset[str]
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
@dataclass(
|
|
14
|
+
@dataclass(unsafe_hash=True)
|
|
15
15
|
class WorkflowStepNotInitializedError(NeatError, RuntimeError):
|
|
16
16
|
"""Step {step_name} has not been initialized."""
|
|
17
17
|
|
|
18
18
|
step_name: str
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
@dataclass(
|
|
21
|
+
@dataclass(unsafe_hash=True)
|
|
22
22
|
class WorkflowConfigurationNotSetError(NeatError, RuntimeError):
|
|
23
23
|
"""The configuration variable '{config_variable}' is not set. Please set the configuration
|
|
24
24
|
before running the workflow."""
|
|
@@ -26,7 +26,7 @@ class WorkflowConfigurationNotSetError(NeatError, RuntimeError):
|
|
|
26
26
|
config_variable: str
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
@dataclass(
|
|
29
|
+
@dataclass(unsafe_hash=True)
|
|
30
30
|
class WorkflowStepOutputError(NeatError, RuntimeError):
|
|
31
31
|
"""Object type {step_type} is not supported as step output.
|
|
32
32
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
conflicts with the built-in Python warnings module. However, it is expected to always be used in an absolute
|
|
3
3
|
import, and should thus not cause a naming conflict."""
|
|
4
4
|
|
|
5
|
-
from cognite.neat.
|
|
5
|
+
from cognite.neat._issues._base import DefaultWarning, NeatWarning, _get_subclasses
|
|
6
6
|
|
|
7
7
|
from . import user_modeling
|
|
8
8
|
from ._external import (
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
|
|
4
|
-
from cognite.neat.
|
|
4
|
+
from cognite.neat._issues import NeatWarning
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
@dataclass(
|
|
7
|
+
@dataclass(unsafe_hash=True)
|
|
8
8
|
class FileReadWarning(NeatWarning):
|
|
9
9
|
"""Error when reading file, {filepath}: {reason}"""
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ class FileReadWarning(NeatWarning):
|
|
|
12
12
|
reason: str
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
@dataclass(
|
|
15
|
+
@dataclass(unsafe_hash=True)
|
|
16
16
|
class FileMissingRequiredFieldWarning(NeatWarning):
|
|
17
17
|
"""Missing required {field_name} in {filepath}: {field}. The file will be skipped"""
|
|
18
18
|
|
|
@@ -21,7 +21,7 @@ class FileMissingRequiredFieldWarning(NeatWarning):
|
|
|
21
21
|
field: str
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
@dataclass(
|
|
24
|
+
@dataclass(unsafe_hash=True)
|
|
25
25
|
class FileTypeUnexpectedWarning(NeatWarning):
|
|
26
26
|
"""Unexpected file type: {filepath}. Expected format: {expected_format}"""
|
|
27
27
|
|
|
@@ -32,7 +32,7 @@ class FileTypeUnexpectedWarning(NeatWarning):
|
|
|
32
32
|
error_message: str | None = None
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
@dataclass(
|
|
35
|
+
@dataclass(unsafe_hash=True)
|
|
36
36
|
class FileItemNotSupportedWarning(NeatWarning):
|
|
37
37
|
"""The item {item} in {filepath} is not supported. The item will be skipped"""
|
|
38
38
|
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
|
|
3
|
-
from cognite.neat.
|
|
3
|
+
from cognite.neat._issues import NeatWarning
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
@dataclass(
|
|
6
|
+
@dataclass(unsafe_hash=True)
|
|
7
7
|
class NeatValueWarning(NeatWarning):
|
|
8
8
|
"""{value}"""
|
|
9
9
|
|
|
10
10
|
value: str
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
@dataclass(
|
|
13
|
+
@dataclass(unsafe_hash=True)
|
|
14
14
|
class NotSupportedWarning(NeatWarning):
|
|
15
15
|
"""{feature} is not supported"""
|
|
16
16
|
|
|
17
17
|
feature: str
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
@dataclass(
|
|
20
|
+
@dataclass(unsafe_hash=True)
|
|
21
21
|
class RegexViolationWarning(NeatWarning):
|
|
22
22
|
"""The value '{value}' of {identifier} does not match the {pattern_name} pattern '{pattern}'"""
|
|
23
23
|
|
|
@@ -4,13 +4,13 @@ from typing import ClassVar
|
|
|
4
4
|
|
|
5
5
|
from cognite.client.data_classes.data_modeling import ViewId
|
|
6
6
|
|
|
7
|
-
from cognite.neat.
|
|
8
|
-
from cognite.neat.
|
|
7
|
+
from cognite.neat._constants import DMS_VIEW_CONTAINER_SIZE_LIMIT
|
|
8
|
+
from cognite.neat._issues import NeatWarning
|
|
9
9
|
|
|
10
10
|
_BASE_URL = "https://cognite-neat.readthedocs-hosted.com/en/latest/data-modeling-principles.html"
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
@dataclass(
|
|
13
|
+
@dataclass(unsafe_hash=True)
|
|
14
14
|
class BreakingModelingPrincipleWarning(NeatWarning, ABC):
|
|
15
15
|
"""{warning_class}: {specific} violates the {principle} principle.
|
|
16
16
|
See {url} for more information."""
|
|
@@ -29,7 +29,7 @@ class BreakingModelingPrincipleWarning(NeatWarning, ABC):
|
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
@dataclass(
|
|
32
|
+
@dataclass(unsafe_hash=True)
|
|
33
33
|
class PrincipleOneModelOneSpaceWarning(BreakingModelingPrincipleWarning):
|
|
34
34
|
"""{warning_class}: {specific} violates the {principle} principle.
|
|
35
35
|
See {url} for more information."""
|
|
@@ -37,7 +37,7 @@ class PrincipleOneModelOneSpaceWarning(BreakingModelingPrincipleWarning):
|
|
|
37
37
|
url = "all-data-models-are-kept-in-its-own-space"
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
@dataclass(
|
|
40
|
+
@dataclass(unsafe_hash=True)
|
|
41
41
|
class PrincipleMatchingSpaceAndVersionWarning(BreakingModelingPrincipleWarning):
|
|
42
42
|
"""{warning_class}: {specific} violates the {principle} principle.
|
|
43
43
|
See {url} for more information."""
|
|
@@ -45,7 +45,7 @@ class PrincipleMatchingSpaceAndVersionWarning(BreakingModelingPrincipleWarning):
|
|
|
45
45
|
url = "all-views-of-a-data-models-have-the-same-version-and-space-as-the-data-model"
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
@dataclass(
|
|
48
|
+
@dataclass(unsafe_hash=True)
|
|
49
49
|
class PrincipleSolutionBuildsOnEnterpriseWarning(BreakingModelingPrincipleWarning):
|
|
50
50
|
"""{warning_class}: {specific} violates the {principle} principle.
|
|
51
51
|
See {url} for more information."""
|
|
@@ -53,7 +53,7 @@ class PrincipleSolutionBuildsOnEnterpriseWarning(BreakingModelingPrincipleWarnin
|
|
|
53
53
|
url = "solution-data-models-should-always-be-referencing-the-enterprise-data-model"
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
@dataclass(
|
|
56
|
+
@dataclass(unsafe_hash=True)
|
|
57
57
|
class UserModelingWarning(NeatWarning, ABC):
|
|
58
58
|
"""This is a generic warning for user modeling issues.
|
|
59
59
|
These warnings will not cause the resulting model to be invalid, but
|
|
@@ -62,7 +62,7 @@ class UserModelingWarning(NeatWarning, ABC):
|
|
|
62
62
|
...
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
@dataclass(
|
|
65
|
+
@dataclass(unsafe_hash=True)
|
|
66
66
|
class CDFNotSupportedWarning(NeatWarning, ABC):
|
|
67
67
|
"""This is a base class for warnings for modeling issues that will
|
|
68
68
|
likely lead to the CDF API rejecting the model."""
|
|
@@ -70,7 +70,7 @@ class CDFNotSupportedWarning(NeatWarning, ABC):
|
|
|
70
70
|
...
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
@dataclass(
|
|
73
|
+
@dataclass(unsafe_hash=True)
|
|
74
74
|
class NotSupportedViewContainerLimitWarning(CDFNotSupportedWarning):
|
|
75
75
|
"""The view {view_id} maps, {count} containers, which is more than the limit {limit}."""
|
|
76
76
|
|
|
@@ -81,7 +81,7 @@ class NotSupportedViewContainerLimitWarning(CDFNotSupportedWarning):
|
|
|
81
81
|
limit: int = DMS_VIEW_CONTAINER_SIZE_LIMIT
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
@dataclass(
|
|
84
|
+
@dataclass(unsafe_hash=True)
|
|
85
85
|
class NotSupportedHasDataFilterLimitWarning(CDFNotSupportedWarning):
|
|
86
86
|
"""The view {view_id} uses a hasData filter applied to {count} containers, which is more than the limit {limit}."""
|
|
87
87
|
|