cognite-neat 0.103.1__py3-none-any.whl → 0.105.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/_client/_api/data_modeling_loaders.py +83 -23
- cognite/neat/_client/_api/schema.py +2 -1
- cognite/neat/_client/data_classes/neat_sequence.py +261 -0
- cognite/neat/_client/data_classes/schema.py +5 -1
- cognite/neat/_client/testing.py +33 -0
- cognite/neat/_constants.py +56 -0
- cognite/neat/_graph/extractors/_classic_cdf/_base.py +6 -5
- cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +225 -11
- cognite/neat/_graph/extractors/_mock_graph_generator.py +2 -2
- cognite/neat/_graph/loaders/_rdf2dms.py +13 -2
- cognite/neat/_graph/transformers/__init__.py +3 -1
- cognite/neat/_graph/transformers/_base.py +109 -1
- cognite/neat/_graph/transformers/_classic_cdf.py +6 -1
- cognite/neat/_graph/transformers/_prune_graph.py +103 -47
- cognite/neat/_graph/transformers/_rdfpath.py +41 -17
- cognite/neat/_graph/transformers/_value_type.py +188 -151
- cognite/neat/_issues/__init__.py +0 -2
- cognite/neat/_issues/_base.py +54 -43
- cognite/neat/_issues/warnings/__init__.py +4 -1
- cognite/neat/_issues/warnings/_general.py +7 -0
- cognite/neat/_issues/warnings/_resources.py +12 -1
- cognite/neat/_rules/_shared.py +18 -34
- cognite/neat/_rules/exporters/_base.py +28 -2
- cognite/neat/_rules/exporters/_rules2dms.py +39 -1
- cognite/neat/_rules/exporters/_rules2excel.py +13 -2
- cognite/neat/_rules/exporters/_rules2instance_template.py +4 -0
- cognite/neat/_rules/exporters/_rules2ontology.py +13 -1
- cognite/neat/_rules/exporters/_rules2yaml.py +4 -0
- cognite/neat/_rules/importers/_base.py +9 -0
- cognite/neat/_rules/importers/_dms2rules.py +80 -57
- cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +5 -2
- cognite/neat/_rules/importers/_rdf/_base.py +10 -8
- cognite/neat/_rules/importers/_rdf/_imf2rules.py +4 -0
- cognite/neat/_rules/importers/_rdf/_inference2rules.py +7 -0
- cognite/neat/_rules/importers/_rdf/_owl2rules.py +4 -0
- cognite/neat/_rules/importers/_spreadsheet2rules.py +17 -8
- cognite/neat/_rules/importers/_yaml2rules.py +21 -7
- cognite/neat/_rules/models/_base_input.py +1 -1
- cognite/neat/_rules/models/_base_rules.py +9 -1
- cognite/neat/_rules/models/dms/_rules.py +4 -0
- cognite/neat/_rules/models/dms/_rules_input.py +9 -0
- cognite/neat/_rules/models/entities/_wrapped.py +10 -5
- cognite/neat/_rules/models/information/_rules.py +4 -0
- cognite/neat/_rules/models/information/_rules_input.py +9 -0
- cognite/neat/_rules/models/mapping/_classic2core.py +2 -5
- cognite/neat/_rules/models/mapping/_classic2core.yaml +239 -38
- cognite/neat/_rules/transformers/__init__.py +13 -6
- cognite/neat/_rules/transformers/_base.py +41 -65
- cognite/neat/_rules/transformers/_converters.py +404 -234
- cognite/neat/_rules/transformers/_mapping.py +93 -72
- cognite/neat/_rules/transformers/_verification.py +50 -38
- cognite/neat/_session/_base.py +32 -121
- cognite/neat/_session/_inspect.py +5 -3
- cognite/neat/_session/_mapping.py +17 -105
- cognite/neat/_session/_prepare.py +138 -268
- cognite/neat/_session/_read.py +39 -195
- cognite/neat/_session/_set.py +6 -30
- cognite/neat/_session/_show.py +40 -21
- cognite/neat/_session/_state.py +49 -107
- cognite/neat/_session/_to.py +44 -33
- cognite/neat/_shared.py +23 -2
- cognite/neat/_store/_provenance.py +3 -82
- cognite/neat/_store/_rules_store.py +368 -10
- cognite/neat/_store/exceptions.py +23 -0
- cognite/neat/_utils/graph_transformations_report.py +36 -0
- cognite/neat/_utils/rdf_.py +8 -0
- cognite/neat/_utils/reader/_base.py +27 -0
- cognite/neat/_utils/spreadsheet.py +5 -4
- cognite/neat/_version.py +1 -1
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/METADATA +3 -2
- cognite_neat-0.105.0.dist-info/RECORD +179 -0
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/WHEEL +1 -1
- cognite/neat/_app/api/__init__.py +0 -0
- cognite/neat/_app/api/asgi/metrics.py +0 -4
- cognite/neat/_app/api/configuration.py +0 -98
- 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/__init__.py +0 -0
- cognite/neat/_app/api/data_classes/rest.py +0 -59
- cognite/neat/_app/api/explorer.py +0 -66
- cognite/neat/_app/api/routers/configuration.py +0 -25
- cognite/neat/_app/api/routers/crud.py +0 -102
- cognite/neat/_app/api/routers/metrics.py +0 -10
- cognite/neat/_app/api/routers/workflows.py +0 -224
- cognite/neat/_app/api/utils/__init__.py +0 -0
- 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/__init__.py +0 -0
- 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/img/architect-icon.svg +0 -116
- cognite/neat/_app/ui/neat-app/build/img/developer-icon.svg +0 -112
- cognite/neat/_app/ui/neat-app/build/img/sme-icon.svg +0 -34
- 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.72e3d92e.css +0 -2
- cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -1
- cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -3
- cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -88
- cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -1
- cognite/neat/_app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -1
- cognite/neat/_app/ui/neat-app/package-lock.json +0 -18306
- cognite/neat/_app/ui/neat-app/package.json +0 -62
- cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
- cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +0 -116
- cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +0 -112
- cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +0 -34
- cognite/neat/_app/ui/neat-app/public/index.html +0 -43
- cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
- cognite/neat/_app/ui/neat-app/public/manifest.json +0 -25
- cognite/neat/_app/ui/neat-app/public/robots.txt +0 -3
- cognite/neat/_app/ui/neat-app/src/App.css +0 -38
- cognite/neat/_app/ui/neat-app/src/App.js +0 -17
- cognite/neat/_app/ui/neat-app/src/App.test.js +0 -8
- cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +0 -70
- cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +0 -43
- cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +0 -124
- cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +0 -63
- cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +0 -511
- cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +0 -36
- cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +0 -56
- cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +0 -60
- cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +0 -112
- cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +0 -67
- cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +0 -79
- cognite/neat/_app/ui/neat-app/src/index.css +0 -13
- cognite/neat/_app/ui/neat-app/src/index.js +0 -13
- cognite/neat/_app/ui/neat-app/src/logo.svg +0 -1
- cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +0 -13
- cognite/neat/_app/ui/neat-app/src/setupTests.js +0 -5
- cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +0 -388
- cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +0 -61
- cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +0 -184
- cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +0 -180
- cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +0 -570
- cognite/neat/_app/ui/neat-app/tsconfig.json +0 -27
- cognite/neat/_rules/transformers/_pipelines.py +0 -70
- cognite/neat/_workflows/__init__.py +0 -17
- cognite/neat/_workflows/base.py +0 -590
- cognite/neat/_workflows/cdf_store.py +0 -393
- cognite/neat/_workflows/examples/Export_DMS/workflow.yaml +0 -89
- cognite/neat/_workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -66
- cognite/neat/_workflows/examples/Import_DMS/workflow.yaml +0 -65
- cognite/neat/_workflows/examples/Validate_Rules/workflow.yaml +0 -67
- cognite/neat/_workflows/examples/Validate_Solution_Model/workflow.yaml +0 -64
- cognite/neat/_workflows/manager.py +0 -292
- cognite/neat/_workflows/model.py +0 -203
- cognite/neat/_workflows/steps/__init__.py +0 -0
- cognite/neat/_workflows/steps/data_contracts.py +0 -109
- cognite/neat/_workflows/steps/lib/__init__.py +0 -0
- cognite/neat/_workflows/steps/lib/current/__init__.py +0 -6
- cognite/neat/_workflows/steps/lib/current/graph_extractor.py +0 -100
- cognite/neat/_workflows/steps/lib/current/graph_loader.py +0 -51
- cognite/neat/_workflows/steps/lib/current/graph_store.py +0 -48
- cognite/neat/_workflows/steps/lib/current/rules_exporter.py +0 -537
- cognite/neat/_workflows/steps/lib/current/rules_importer.py +0 -398
- cognite/neat/_workflows/steps/lib/current/rules_validator.py +0 -106
- cognite/neat/_workflows/steps/lib/io/__init__.py +0 -1
- cognite/neat/_workflows/steps/lib/io/io_steps.py +0 -393
- cognite/neat/_workflows/steps/step_model.py +0 -79
- cognite/neat/_workflows/steps_registry.py +0 -218
- cognite/neat/_workflows/tasks.py +0 -18
- cognite/neat/_workflows/triggers.py +0 -169
- cognite/neat/_workflows/utils.py +0 -19
- cognite_neat-0.103.1.dist-info/RECORD +0 -275
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/LICENSE +0 -0
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
from datetime import datetime, timezone
|
|
2
|
-
|
|
3
1
|
from cognite.neat._client import NeatClient
|
|
4
|
-
from cognite.neat.
|
|
5
|
-
from cognite.neat._rules.
|
|
6
|
-
from cognite.neat._rules.models.dms import DMSValidation
|
|
2
|
+
from cognite.neat._issues import IssueList
|
|
3
|
+
from cognite.neat._rules.models import DMSRules
|
|
7
4
|
from cognite.neat._rules.models.mapping import load_classic_to_core_mapping
|
|
8
|
-
from cognite.neat._rules.transformers import AsParentPropertyId,
|
|
9
|
-
from cognite.neat._store._provenance import Agent as ProvenanceAgent
|
|
10
|
-
from cognite.neat._store._provenance import Change
|
|
5
|
+
from cognite.neat._rules.transformers import AsParentPropertyId, IncludeReferenced, RuleMapper
|
|
11
6
|
|
|
12
7
|
from ._state import SessionState
|
|
13
8
|
from .exceptions import NeatSessionError, session_class_wrapper
|
|
@@ -25,7 +20,7 @@ class DataModelMappingAPI:
|
|
|
25
20
|
self._state = state
|
|
26
21
|
self._client = client
|
|
27
22
|
|
|
28
|
-
def classic_to_core(self, company_prefix: str, use_parent_property_name: bool = True) ->
|
|
23
|
+
def classic_to_core(self, company_prefix: str, use_parent_property_name: bool = True) -> IssueList:
|
|
29
24
|
"""Map classic types to core types.
|
|
30
25
|
|
|
31
26
|
Note this automatically creates an extended CogniteCore model.
|
|
@@ -44,101 +39,18 @@ class DataModelMappingAPI:
|
|
|
44
39
|
neat.mapping.classic_to_core(company_prefix="WindFarmX", use_parent_property_name=True)
|
|
45
40
|
```
|
|
46
41
|
"""
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
load_classic_to_core_mapping(company_prefix, rules.metadata.space, rules.metadata.version)
|
|
52
|
-
)
|
|
53
|
-
output = transformer.transform(rules)
|
|
54
|
-
end = datetime.now(timezone.utc)
|
|
55
|
-
|
|
56
|
-
change = Change.from_rules_activity(
|
|
57
|
-
output,
|
|
58
|
-
transformer.agent,
|
|
59
|
-
start,
|
|
60
|
-
end,
|
|
61
|
-
"Mapping classic to core",
|
|
62
|
-
self._state.data_model.provenance.source_entity(source_id)
|
|
63
|
-
or self._state.data_model.provenance.target_entity(source_id),
|
|
64
|
-
)
|
|
42
|
+
rules = self._state.rule_store.get_last_successful_entity().result
|
|
43
|
+
if not isinstance(rules, DMSRules):
|
|
44
|
+
# Todo better hint of what you should do.
|
|
45
|
+
raise NeatSessionError(f"Expected DMSRules, got {type(rules)}")
|
|
65
46
|
|
|
66
|
-
self._state.data_model.write(output.rules, change)
|
|
67
|
-
|
|
68
|
-
start = datetime.now(timezone.utc)
|
|
69
|
-
|
|
70
|
-
source_id, rules = self._state.data_model.last_verified_dms_rules
|
|
71
|
-
view_ids, container_ids = DMSValidation(rules, self._client).imported_views_and_containers_ids()
|
|
72
|
-
if not (view_ids or container_ids):
|
|
73
|
-
print(
|
|
74
|
-
f"Data model {rules.metadata.as_data_model_id()} does not have any referenced views or containers."
|
|
75
|
-
f"that is not already included in the data model."
|
|
76
|
-
)
|
|
77
|
-
return
|
|
78
47
|
if self._client is None:
|
|
79
|
-
raise NeatSessionError(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
imported = importer.to_rules()
|
|
89
|
-
if imported.rules is None:
|
|
90
|
-
self._state.data_model.issue_lists.append(imported.issues)
|
|
91
|
-
raise NeatSessionError(
|
|
92
|
-
"Could not import the referenced views and containers. "
|
|
93
|
-
"See `neat.inspect.issues()` for more information."
|
|
94
|
-
)
|
|
95
|
-
verified = VerifyDMSRules("continue", validate=False).transform(imported.rules)
|
|
96
|
-
if verified.rules is None:
|
|
97
|
-
self._state.data_model.issue_lists.append(verified.issues)
|
|
98
|
-
raise NeatSessionError(
|
|
99
|
-
"Could not verify the referenced views and containers. "
|
|
100
|
-
"See `neat.inspect.issues()` for more information."
|
|
101
|
-
)
|
|
102
|
-
if copy_.containers is None:
|
|
103
|
-
copy_.containers = verified.rules.containers
|
|
104
|
-
else:
|
|
105
|
-
existing_containers = {c.container for c in copy_.containers}
|
|
106
|
-
copy_.containers.extend(
|
|
107
|
-
[c for c in verified.rules.containers or [] if c.container not in existing_containers]
|
|
108
|
-
)
|
|
109
|
-
existing_views = {v.view for v in copy_.views}
|
|
110
|
-
copy_.views.extend([v for v in verified.rules.views if v.view not in existing_views])
|
|
111
|
-
end = datetime.now(timezone.utc)
|
|
112
|
-
|
|
113
|
-
change = Change.from_rules_activity(
|
|
114
|
-
copy_,
|
|
115
|
-
ProvenanceAgent(id_=DEFAULT_NAMESPACE["agent/"]),
|
|
116
|
-
start,
|
|
117
|
-
end,
|
|
118
|
-
(f"Included referenced views and containers in the data model {rules.metadata.as_data_model_id()}"),
|
|
119
|
-
self._state.data_model.provenance.source_entity(source_id)
|
|
120
|
-
or self._state.data_model.provenance.target_entity(source_id),
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
self._state.data_model.write(copy_, change)
|
|
124
|
-
|
|
125
|
-
if not use_parent_property_name:
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
source_id, rules = self._state.data_model.last_verified_dms_rules
|
|
129
|
-
start = datetime.now(timezone.utc)
|
|
130
|
-
transformer = AsParentPropertyId(self._client)
|
|
131
|
-
output = transformer.transform(rules)
|
|
132
|
-
end = datetime.now(timezone.utc)
|
|
133
|
-
|
|
134
|
-
change = Change.from_rules_activity(
|
|
135
|
-
output,
|
|
136
|
-
transformer.agent,
|
|
137
|
-
start,
|
|
138
|
-
end,
|
|
139
|
-
"Renaming property names to parent name",
|
|
140
|
-
self._state.data_model.provenance.source_entity(source_id)
|
|
141
|
-
or self._state.data_model.provenance.target_entity(source_id),
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
self._state.data_model.write(output.rules, change)
|
|
48
|
+
raise NeatSessionError("Client is required to map classic to core")
|
|
49
|
+
|
|
50
|
+
transformers = [
|
|
51
|
+
RuleMapper(load_classic_to_core_mapping(company_prefix, rules.metadata.space, rules.metadata.version)),
|
|
52
|
+
IncludeReferenced(self._client),
|
|
53
|
+
]
|
|
54
|
+
if use_parent_property_name:
|
|
55
|
+
transformers.append(AsParentPropertyId(self._client))
|
|
56
|
+
return self._state.rule_transform(*transformers)
|