cognite-neat 0.75.7__py3-none-any.whl → 0.75.9__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/_version.py +1 -1
- cognite/neat/app/api/configuration.py +4 -9
- cognite/neat/app/api/routers/configuration.py +2 -1
- cognite/neat/app/api/routers/crud.py +5 -5
- cognite/neat/app/api/routers/data_exploration.py +3 -1
- cognite/neat/app/api/routers/rules.py +3 -3
- cognite/neat/app/api/routers/workflows.py +3 -3
- cognite/neat/app/ui/neat-app/build/asset-manifest.json +3 -3
- cognite/neat/app/ui/neat-app/build/index.html +1 -1
- cognite/neat/app/ui/neat-app/build/static/js/{main.4345d42f.js → main.ec7f72e2.js} +3 -3
- cognite/neat/app/ui/neat-app/build/static/js/{main.4345d42f.js.map → main.ec7f72e2.js.map} +1 -1
- cognite/neat/config.py +147 -12
- cognite/neat/constants.py +1 -0
- cognite/neat/graph/exceptions.py +1 -2
- cognite/neat/graph/extractors/_mock_graph_generator.py +6 -5
- cognite/neat/legacy/graph/exceptions.py +1 -2
- cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +1 -2
- cognite/neat/legacy/graph/loaders/_asset_loader.py +8 -13
- cognite/neat/legacy/graph/loaders/_base.py +2 -4
- cognite/neat/legacy/graph/loaders/_exceptions.py +1 -3
- cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +4 -8
- cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +2 -4
- cognite/neat/legacy/graph/loaders/rdf_to_dms.py +2 -4
- cognite/neat/legacy/graph/loaders/validator.py +1 -1
- cognite/neat/legacy/graph/transformations/transformer.py +1 -2
- cognite/neat/legacy/rules/exporters/_rules2dms.py +1 -2
- cognite/neat/legacy/rules/exporters/_validation.py +4 -8
- cognite/neat/legacy/rules/importers/_base.py +0 -4
- cognite/neat/legacy/rules/importers/_dms2rules.py +0 -2
- cognite/neat/legacy/rules/models/rdfpath.py +1 -2
- cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +89 -0
- cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +152 -0
- cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +139 -0
- cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +270 -0
- cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +65 -0
- cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +116 -0
- cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +67 -0
- cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +64 -0
- cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +95 -0
- cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +111 -0
- cognite/neat/rules/analysis/_base.py +1 -1
- cognite/neat/rules/analysis/_information_rules.py +4 -4
- cognite/neat/rules/exporters/_rules2excel.py +2 -2
- cognite/neat/rules/exporters/_rules2ontology.py +20 -17
- cognite/neat/rules/exporters/_validation.py +8 -10
- cognite/neat/rules/importers/_base.py +2 -4
- cognite/neat/rules/importers/_dms2rules.py +16 -19
- cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +21 -19
- cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +2 -4
- cognite/neat/rules/importers/_dtdl2rules/spec.py +3 -5
- cognite/neat/rules/importers/_owl2rules/_owl2rules.py +4 -6
- cognite/neat/rules/importers/_spreadsheet2rules.py +10 -9
- cognite/neat/rules/importers/_yaml2rules.py +10 -6
- cognite/neat/rules/issues/dms.py +3 -5
- cognite/neat/rules/issues/formatters.py +3 -1
- cognite/neat/rules/models/data_types.py +54 -31
- cognite/neat/rules/models/entities.py +184 -42
- cognite/neat/rules/models/rdfpath.py +112 -13
- cognite/neat/rules/models/rules/_base.py +2 -2
- cognite/neat/rules/models/rules/_dms_architect_rules.py +119 -189
- cognite/neat/rules/models/rules/_dms_rules_write.py +344 -0
- cognite/neat/rules/models/rules/_dms_schema.py +3 -3
- cognite/neat/rules/models/rules/_domain_rules.py +6 -3
- cognite/neat/rules/models/rules/_information_rules.py +68 -61
- cognite/neat/rules/models/rules/_types/__init__.py +0 -47
- cognite/neat/rules/models/rules/_types/_base.py +1 -309
- cognite/neat/rules/models/rules/_types/_field.py +0 -225
- cognite/neat/utils/cdf_loaders/_data_modeling.py +3 -1
- cognite/neat/utils/cdf_loaders/_ingestion.py +2 -4
- cognite/neat/utils/spreadsheet.py +2 -4
- cognite/neat/utils/utils.py +2 -4
- cognite/neat/workflows/base.py +5 -5
- cognite/neat/workflows/manager.py +32 -22
- cognite/neat/workflows/model.py +3 -3
- cognite/neat/workflows/steps/lib/__init__.py +0 -7
- cognite/neat/workflows/steps/lib/current/__init__.py +6 -0
- cognite/neat/workflows/steps/lib/{rules_exporter.py → current/rules_exporter.py} +8 -8
- cognite/neat/workflows/steps/lib/{rules_importer.py → current/rules_importer.py} +7 -7
- cognite/neat/workflows/steps/lib/io/__init__.py +1 -0
- cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_contextualization.py +2 -2
- cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_extractor.py +9 -9
- cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_loader.py +9 -9
- cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_store.py +4 -4
- cognite/neat/workflows/steps/lib/{v1 → legacy}/graph_transformer.py +2 -2
- cognite/neat/workflows/steps/lib/{v1 → legacy}/rules_exporter.py +15 -17
- cognite/neat/workflows/steps/lib/{v1 → legacy}/rules_importer.py +7 -7
- cognite/neat/workflows/steps/step_model.py +5 -9
- cognite/neat/workflows/steps_registry.py +20 -11
- {cognite_neat-0.75.7.dist-info → cognite_neat-0.75.9.dist-info}/METADATA +1 -1
- {cognite_neat-0.75.7.dist-info → cognite_neat-0.75.9.dist-info}/RECORD +100 -90
- cognite/neat/app/api/data_classes/configuration.py +0 -121
- cognite/neat/rules/models/_entity.py +0 -142
- cognite/neat/rules/models/rules/_types/_value.py +0 -159
- /cognite/neat/app/ui/neat-app/build/static/js/{main.4345d42f.js.LICENSE.txt → main.ec7f72e2.js.LICENSE.txt} +0 -0
- /cognite/neat/workflows/steps/lib/{graph_extractor.py → current/graph_extractor.py} +0 -0
- /cognite/neat/workflows/steps/lib/{graph_loader.py → current/graph_loader.py} +0 -0
- /cognite/neat/workflows/steps/lib/{graph_store.py → current/graph_store.py} +0 -0
- /cognite/neat/workflows/steps/lib/{rules_validator.py → current/rules_validator.py} +0 -0
- /cognite/neat/workflows/steps/lib/{io_steps.py → io/io_steps.py} +0 -0
- /cognite/neat/workflows/steps/lib/{v1 → legacy}/__init__.py +0 -0
- {cognite_neat-0.75.7.dist-info → cognite_neat-0.75.9.dist-info}/LICENSE +0 -0
- {cognite_neat-0.75.7.dist-info → cognite_neat-0.75.9.dist-info}/WHEEL +0 -0
- {cognite_neat-0.75.7.dist-info → cognite_neat-0.75.9.dist-info}/entry_points.txt +0 -0
|
@@ -29,7 +29,7 @@ __all__ = [
|
|
|
29
29
|
"ExtractGraphFromDexpiFile",
|
|
30
30
|
]
|
|
31
31
|
|
|
32
|
-
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [
|
|
32
|
+
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [LEGACY]"
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
class ExtractGraphFromRdfFile(Step):
|
|
@@ -38,7 +38,7 @@ class ExtractGraphFromRdfFile(Step):
|
|
|
38
38
|
"""
|
|
39
39
|
|
|
40
40
|
description = "This step extract instances from a file into the source graph. The file must be in RDF format."
|
|
41
|
-
version = "
|
|
41
|
+
version = "legacy"
|
|
42
42
|
category = CATEGORY
|
|
43
43
|
configurables: ClassVar[list[Configurable]] = [
|
|
44
44
|
Configurable(
|
|
@@ -91,7 +91,7 @@ class ExtractGraphFromDexpiFile(Step):
|
|
|
91
91
|
"""
|
|
92
92
|
|
|
93
93
|
description = "This step converts DEXPI P&ID (XML) into Knowledge Graph"
|
|
94
|
-
version = "
|
|
94
|
+
version = "legacy"
|
|
95
95
|
category = CATEGORY
|
|
96
96
|
configurables: ClassVar[list[Configurable]] = [
|
|
97
97
|
Configurable(
|
|
@@ -130,7 +130,7 @@ class ExtractGraphFromGraphCapturingSheet(Step):
|
|
|
130
130
|
"""
|
|
131
131
|
|
|
132
132
|
description = "This step extracts nodes and edges from graph capturing spreadsheet and load them into graph"
|
|
133
|
-
version = "
|
|
133
|
+
version = "legacy"
|
|
134
134
|
category = CATEGORY
|
|
135
135
|
configurables: ClassVar[list[Configurable]] = [
|
|
136
136
|
Configurable(
|
|
@@ -187,7 +187,7 @@ class ExtractGraphFromMockGraph(Step):
|
|
|
187
187
|
"""
|
|
188
188
|
|
|
189
189
|
description = "This step generate mock graph based on the defined classes and target number of instances"
|
|
190
|
-
version = "
|
|
190
|
+
version = "legacy"
|
|
191
191
|
category = CATEGORY
|
|
192
192
|
configurables: ClassVar[list[Configurable]] = [
|
|
193
193
|
Configurable(
|
|
@@ -239,7 +239,7 @@ class ExtractGraphFromRulesInstanceSheet(Step):
|
|
|
239
239
|
|
|
240
240
|
description = "This step extracts instances from Rules object and loads them into the graph."
|
|
241
241
|
category = CATEGORY
|
|
242
|
-
version = "
|
|
242
|
+
version = "legacy"
|
|
243
243
|
|
|
244
244
|
configurables: ClassVar[list[Configurable]] = [
|
|
245
245
|
Configurable(
|
|
@@ -276,7 +276,7 @@ class ExtractGraphFromRulesDataModel(Step):
|
|
|
276
276
|
|
|
277
277
|
description = "This step extracts data model from rules file and loads it into source graph."
|
|
278
278
|
category = CATEGORY
|
|
279
|
-
version = "
|
|
279
|
+
version = "legacy"
|
|
280
280
|
|
|
281
281
|
def run( # type: ignore[override, syntax]
|
|
282
282
|
self, transformation_rules: RulesData, source_graph: SourceGraph
|
|
@@ -321,7 +321,7 @@ class ExtractGraphFromJsonFile(Step):
|
|
|
321
321
|
|
|
322
322
|
description = "This step extracts instances from json file and loads them into a graph store"
|
|
323
323
|
category = CATEGORY
|
|
324
|
-
version = "
|
|
324
|
+
version = "legacy"
|
|
325
325
|
configurables: ClassVar[list[Configurable]] = [
|
|
326
326
|
Configurable(
|
|
327
327
|
name="file_name", value="data_dump.json", label="Full path to the file containing data dump in JSON format"
|
|
@@ -504,7 +504,7 @@ class ExtractGraphFromAvevaPiAssetFramework(Step):
|
|
|
504
504
|
|
|
505
505
|
description = "This step extracts instances from Aveva PI AF and loads them into a graph store"
|
|
506
506
|
category = CATEGORY
|
|
507
|
-
version = "
|
|
507
|
+
version = "legacy"
|
|
508
508
|
configurables: ClassVar[list[Configurable]] = [
|
|
509
509
|
Configurable(
|
|
510
510
|
name="file_name",
|
|
@@ -52,7 +52,7 @@ __all__ = [
|
|
|
52
52
|
"LoadGraphToRdfFile",
|
|
53
53
|
]
|
|
54
54
|
|
|
55
|
-
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [
|
|
55
|
+
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [LEGACY]"
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
class LoadLabelsToCDF(Step):
|
|
@@ -62,7 +62,7 @@ class LoadLabelsToCDF(Step):
|
|
|
62
62
|
|
|
63
63
|
description = "This step creates default NEAT labels in CDF"
|
|
64
64
|
category = CATEGORY
|
|
65
|
-
version = "
|
|
65
|
+
version = "legacy"
|
|
66
66
|
configurables: ClassVar[list[Configurable]] = [
|
|
67
67
|
Configurable(name="data_set_id", value="", label=("CDF dataset id to which the labels will be added."))
|
|
68
68
|
]
|
|
@@ -176,7 +176,7 @@ class LoadGraphToRdfFile(Step):
|
|
|
176
176
|
|
|
177
177
|
description = "The step generates nodes and edges from the graph"
|
|
178
178
|
category = CATEGORY
|
|
179
|
-
version = "
|
|
179
|
+
version = "legacy"
|
|
180
180
|
configurables: ClassVar[list[Configurable]] = [
|
|
181
181
|
Configurable(
|
|
182
182
|
name="graph_name",
|
|
@@ -227,7 +227,7 @@ class LoadNodesToCDF(Step):
|
|
|
227
227
|
|
|
228
228
|
description = "This step uploads nodes to CDF"
|
|
229
229
|
category = CATEGORY
|
|
230
|
-
version = "
|
|
230
|
+
version = "legacy"
|
|
231
231
|
|
|
232
232
|
def run(self, cdf_client: CogniteClient, nodes: Nodes) -> FlowMessage: # type: ignore[override, syntax]
|
|
233
233
|
if nodes.nodes:
|
|
@@ -244,7 +244,7 @@ class LoadEdgesToCDF(Step):
|
|
|
244
244
|
|
|
245
245
|
description = "This step uploads edges to CDF"
|
|
246
246
|
category = CATEGORY
|
|
247
|
-
version = "
|
|
247
|
+
version = "legacy"
|
|
248
248
|
|
|
249
249
|
def run(self, cdf_client: CogniteClient, edges: Edges) -> FlowMessage: # type: ignore[override, syntax]
|
|
250
250
|
if edges.edges:
|
|
@@ -263,7 +263,7 @@ class GenerateAssetsFromGraph(Step):
|
|
|
263
263
|
"The step generates assets from the graph ,categorizes them and stores them in CategorizedAssets object"
|
|
264
264
|
)
|
|
265
265
|
category = CATEGORY
|
|
266
|
-
version = "
|
|
266
|
+
version = "legacy"
|
|
267
267
|
configurables: ClassVar[list[Configurable]] = [
|
|
268
268
|
Configurable(name="data_set_id", value="", label=("CDF dataset id to which the labels will be added.")),
|
|
269
269
|
Configurable(
|
|
@@ -469,7 +469,7 @@ class LoadAssetsToCDF(Step):
|
|
|
469
469
|
|
|
470
470
|
description = "This step uploads categorized assets to CDF"
|
|
471
471
|
category = CATEGORY
|
|
472
|
-
version = "
|
|
472
|
+
version = "legacy"
|
|
473
473
|
|
|
474
474
|
def run( # type: ignore[override]
|
|
475
475
|
self, cdf_client: CogniteClient, categorized_assets: CategorizedAssets, flow_msg: FlowMessage
|
|
@@ -528,7 +528,7 @@ class GenerateRelationshipsFromGraph(Step):
|
|
|
528
528
|
|
|
529
529
|
description = "This step generates relationships from the graph and saves them to CategorizedRelationships object"
|
|
530
530
|
category = CATEGORY
|
|
531
|
-
version = "
|
|
531
|
+
version = "legacy"
|
|
532
532
|
configurables: ClassVar[list[Configurable]] = [
|
|
533
533
|
Configurable(name="data_set_id", value="", label=("CDF dataset id to which the labels will be added.")),
|
|
534
534
|
Configurable(
|
|
@@ -597,7 +597,7 @@ class LoadRelationshipsToCDF(Step):
|
|
|
597
597
|
|
|
598
598
|
description = "This step uploads relationships to CDF"
|
|
599
599
|
category = CATEGORY
|
|
600
|
-
version = "
|
|
600
|
+
version = "legacy"
|
|
601
601
|
|
|
602
602
|
def run( # type: ignore[override, syntax]
|
|
603
603
|
self, client: CogniteClient, categorized_relationships: CategorizedRelationships
|
|
@@ -11,7 +11,7 @@ from cognite.neat.workflows.steps.step_model import Configurable, Step
|
|
|
11
11
|
|
|
12
12
|
__all__ = ["ResetGraphStores", "ConfigureGraphStore"]
|
|
13
13
|
|
|
14
|
-
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [
|
|
14
|
+
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [LEGACY]"
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class ConfigureDefaultGraphStores(Step):
|
|
@@ -21,7 +21,7 @@ class ConfigureDefaultGraphStores(Step):
|
|
|
21
21
|
|
|
22
22
|
description = "This step initializes the source and solution graph stores."
|
|
23
23
|
category = CATEGORY
|
|
24
|
-
version = "
|
|
24
|
+
version = "legacy"
|
|
25
25
|
configurables: ClassVar[list[Configurable]] = [
|
|
26
26
|
Configurable(
|
|
27
27
|
name="source_rdf_store.type",
|
|
@@ -154,7 +154,7 @@ class ResetGraphStores(Step):
|
|
|
154
154
|
|
|
155
155
|
description = "This step resets graph stores to their initial state (clears all data)."
|
|
156
156
|
category = CATEGORY
|
|
157
|
-
version = "
|
|
157
|
+
version = "legacy"
|
|
158
158
|
configurables: ClassVar[list[Configurable]] = [
|
|
159
159
|
Configurable(
|
|
160
160
|
name="graph_name",
|
|
@@ -186,7 +186,7 @@ class ConfigureGraphStore(Step):
|
|
|
186
186
|
"""
|
|
187
187
|
|
|
188
188
|
description = "This step initializes the source and solution graph stores."
|
|
189
|
-
version = "
|
|
189
|
+
version = "legacy"
|
|
190
190
|
category = CATEGORY
|
|
191
191
|
configurables: ClassVar[list[Configurable]] = [
|
|
192
192
|
Configurable(
|
|
@@ -10,7 +10,7 @@ from cognite.neat.workflows.steps.step_model import Configurable, Step
|
|
|
10
10
|
|
|
11
11
|
__all__ = ["TransformSourceToSolutionGraph"]
|
|
12
12
|
|
|
13
|
-
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [
|
|
13
|
+
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [LEGACY]"
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class TransformSourceToSolutionGraph(Step):
|
|
@@ -20,7 +20,7 @@ class TransformSourceToSolutionGraph(Step):
|
|
|
20
20
|
|
|
21
21
|
description = "The step transforms source graph to solution graph"
|
|
22
22
|
category = CATEGORY
|
|
23
|
-
version = "
|
|
23
|
+
version = "legacy"
|
|
24
24
|
configurables: ClassVar[list[Configurable]] = [
|
|
25
25
|
Configurable(
|
|
26
26
|
name="cdf_lookup_database",
|
|
@@ -30,7 +30,7 @@ __all__ = [
|
|
|
30
30
|
"DeleteDMSSchemaComponents",
|
|
31
31
|
]
|
|
32
32
|
|
|
33
|
-
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [
|
|
33
|
+
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [LEGACY]"
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class GenerateDMSSchemaComponentsFromRules(Step):
|
|
@@ -39,7 +39,7 @@ class GenerateDMSSchemaComponentsFromRules(Step):
|
|
|
39
39
|
"""
|
|
40
40
|
|
|
41
41
|
description = "This step generates DMS Schema components, such as data model, views, containers, etc. from Rules."
|
|
42
|
-
version = "
|
|
42
|
+
version = "legacy"
|
|
43
43
|
category = CATEGORY
|
|
44
44
|
|
|
45
45
|
def run(self, rules: RulesData) -> (FlowMessage, DMSSchemaComponentsData): # type: ignore[override, syntax]
|
|
@@ -66,10 +66,9 @@ class ExportDMSSchemaComponentsToYAML(Step):
|
|
|
66
66
|
"""
|
|
67
67
|
|
|
68
68
|
description = "This step exports DMS schema components as YAML files"
|
|
69
|
-
version = "
|
|
69
|
+
version = "legacy"
|
|
70
70
|
category = CATEGORY
|
|
71
71
|
configurables: ClassVar[list[Configurable]] = [
|
|
72
|
-
Configurable(name="storage_dir", value="staging", label="Directory to store DMS schema files"),
|
|
73
72
|
Configurable(
|
|
74
73
|
name="format",
|
|
75
74
|
value="yaml-dump",
|
|
@@ -82,10 +81,9 @@ class ExportDMSSchemaComponentsToYAML(Step):
|
|
|
82
81
|
if self.configs is None or self.data_store_path is None:
|
|
83
82
|
raise StepNotInitialized(type(self).__name__)
|
|
84
83
|
|
|
85
|
-
staging_dir_str = self.configs["storage_dir"]
|
|
86
84
|
format_ = self.configs["format"]
|
|
87
85
|
|
|
88
|
-
staging_dir = self.
|
|
86
|
+
staging_dir = self.config.staging_path
|
|
89
87
|
staging_dir.mkdir(parents=True, exist_ok=True)
|
|
90
88
|
|
|
91
89
|
if format_ in ["yaml-dump", "all"]:
|
|
@@ -119,10 +117,10 @@ class ExportDMSSchemaComponentsToYAML(Step):
|
|
|
119
117
|
"<p></p>"
|
|
120
118
|
"DMS Schema exported and can be downloaded here : "
|
|
121
119
|
"<p></p>"
|
|
122
|
-
f'- <a href="/data/{
|
|
120
|
+
f'- <a href="/data/{self.config.staging_path.name}/{_data_model_file_name}?{time.time()}" '
|
|
123
121
|
f'target="_blank">{_data_model_file_name}</a>'
|
|
124
122
|
"<p></p>"
|
|
125
|
-
f'- <a href="/data/{
|
|
123
|
+
f'- <a href="/data/{self.config.staging_path.name}/{_container_file_name}?{time.time()}" '
|
|
126
124
|
f'target="_blank">{_container_file_name}</a>'
|
|
127
125
|
)
|
|
128
126
|
|
|
@@ -140,7 +138,7 @@ class ExportDMSSchemaComponentsToCDF(Step):
|
|
|
140
138
|
"""
|
|
141
139
|
|
|
142
140
|
description = "This step exports generated DMS Schema components to CDF."
|
|
143
|
-
version = "
|
|
141
|
+
version = "legacy"
|
|
144
142
|
category = CATEGORY
|
|
145
143
|
|
|
146
144
|
configurables: ClassVar[list[Configurable]] = [
|
|
@@ -205,7 +203,7 @@ class ExportDMSSchemaComponentsToCDF(Step):
|
|
|
205
203
|
|
|
206
204
|
# report
|
|
207
205
|
report_file = "dms_component_creation_report.txt"
|
|
208
|
-
report_dir = self.
|
|
206
|
+
report_dir = self.config.staging_path
|
|
209
207
|
report_dir.mkdir(parents=True, exist_ok=True)
|
|
210
208
|
report_full_path = report_dir / report_file
|
|
211
209
|
report_full_path.write_text(report)
|
|
@@ -229,7 +227,7 @@ class DeleteDMSSchemaComponents(Step):
|
|
|
229
227
|
"""
|
|
230
228
|
|
|
231
229
|
description = "This step deletes DMS Data model and all underlying containers and views."
|
|
232
|
-
version = "
|
|
230
|
+
version = "legacy"
|
|
233
231
|
category = CATEGORY
|
|
234
232
|
|
|
235
233
|
configurables: ClassVar[list[Configurable]] = [
|
|
@@ -280,7 +278,7 @@ class DeleteDMSSchemaComponents(Step):
|
|
|
280
278
|
|
|
281
279
|
# report
|
|
282
280
|
report_file = "dms_component_removal_report.txt"
|
|
283
|
-
report_dir = self.
|
|
281
|
+
report_dir = self.config.staging_path
|
|
284
282
|
report_dir.mkdir(parents=True, exist_ok=True)
|
|
285
283
|
report_full_path = report_dir / report_file
|
|
286
284
|
report_full_path.write_text(report)
|
|
@@ -304,7 +302,7 @@ class ExportRulesToGraphQLSchema(Step):
|
|
|
304
302
|
"""
|
|
305
303
|
|
|
306
304
|
description = "This step generates GraphQL schema from data model defined in transformation rules."
|
|
307
|
-
version = "
|
|
305
|
+
version = "legacy"
|
|
308
306
|
category = CATEGORY
|
|
309
307
|
configurables: ClassVar[list[Configurable]] = [
|
|
310
308
|
Configurable(
|
|
@@ -354,7 +352,7 @@ class ExportRulesToOntology(Step):
|
|
|
354
352
|
"""
|
|
355
353
|
|
|
356
354
|
description = "This step exports Rules to OWL ontology"
|
|
357
|
-
version = "
|
|
355
|
+
version = "legacy"
|
|
358
356
|
category = CATEGORY
|
|
359
357
|
configurables: ClassVar[list[Configurable]] = [
|
|
360
358
|
Configurable(
|
|
@@ -410,7 +408,7 @@ class ExportRulesToSHACL(Step):
|
|
|
410
408
|
"""
|
|
411
409
|
|
|
412
410
|
description = "This step exports Rules to SHACL"
|
|
413
|
-
version = "
|
|
411
|
+
version = "legacy"
|
|
414
412
|
category = CATEGORY
|
|
415
413
|
configurables: ClassVar[list[Configurable]] = [
|
|
416
414
|
Configurable(
|
|
@@ -463,7 +461,7 @@ class ExportRulesToGraphCapturingSheet(Step):
|
|
|
463
461
|
"""
|
|
464
462
|
|
|
465
463
|
description = "This step generates graph capturing sheet"
|
|
466
|
-
version = "
|
|
464
|
+
version = "legacy"
|
|
467
465
|
category = CATEGORY
|
|
468
466
|
configurables: ClassVar[list[Configurable]] = [
|
|
469
467
|
Configurable(name="file_name", value="graph_capture_sheet.xlsx", label="File name of the data capture sheet"),
|
|
@@ -499,7 +497,7 @@ class ExportRulesToGraphCapturingSheet(Step):
|
|
|
499
497
|
|
|
500
498
|
class ExportRulesToExcel(Step):
|
|
501
499
|
description = "This step export Rules to Excel representation"
|
|
502
|
-
version = "
|
|
500
|
+
version = "legacy"
|
|
503
501
|
category = CATEGORY
|
|
504
502
|
configurables: ClassVar[list[Configurable]] = [
|
|
505
503
|
Configurable(
|
|
@@ -21,7 +21,7 @@ from cognite.neat.workflows.model import FlowMessage, StepExecutionStatus
|
|
|
21
21
|
from cognite.neat.workflows.steps.data_contracts import RulesData, SolutionGraph, SourceGraph
|
|
22
22
|
from cognite.neat.workflows.steps.step_model import Configurable, Step
|
|
23
23
|
|
|
24
|
-
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [
|
|
24
|
+
CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [LEGACY]"
|
|
25
25
|
|
|
26
26
|
__all__ = [
|
|
27
27
|
"ImportExcelToRules",
|
|
@@ -37,7 +37,7 @@ class ImportExcelToRules(Step):
|
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
39
|
description = "This step import rules from the Excel file"
|
|
40
|
-
version = "
|
|
40
|
+
version = "legacy"
|
|
41
41
|
category = CATEGORY
|
|
42
42
|
configurables: ClassVar[list[Configurable]] = [
|
|
43
43
|
Configurable(
|
|
@@ -68,7 +68,7 @@ class ImportExcelToRules(Step):
|
|
|
68
68
|
raise ValueError(f"Step {type(self).__name__} has not been configured.")
|
|
69
69
|
rules_file = Path(self.configs["file_name"])
|
|
70
70
|
if str(rules_file.parent) == ".":
|
|
71
|
-
rules_file_path =
|
|
71
|
+
rules_file_path = self.config.rules_store_path / rules_file
|
|
72
72
|
else:
|
|
73
73
|
rules_file_path = Path(self.data_store_path) / rules_file
|
|
74
74
|
|
|
@@ -134,7 +134,7 @@ class ImportOntologyToRules(Step):
|
|
|
134
134
|
description = "The step extracts NEAT rules object from OWL Ontology and \
|
|
135
135
|
exports them as an Excel rules files for further editing."
|
|
136
136
|
category = CATEGORY
|
|
137
|
-
version = "
|
|
137
|
+
version = "legacy"
|
|
138
138
|
configurables: ClassVar[list[Configurable]] = [
|
|
139
139
|
Configurable(
|
|
140
140
|
name="ontology_file_path", value="staging/ontology.ttl", label="Relative path to the OWL ontology file."
|
|
@@ -191,7 +191,7 @@ class ImportOpenApiToRules(Step):
|
|
|
191
191
|
description = "The step extracts schema from OpenAPI specification and generates NEAT transformation rules object. \
|
|
192
192
|
The rules object can be serialized to excel file or used directly in other steps."
|
|
193
193
|
category = CATEGORY
|
|
194
|
-
version = "
|
|
194
|
+
version = "legacy"
|
|
195
195
|
configurables: ClassVar[list[Configurable]] = [
|
|
196
196
|
Configurable(
|
|
197
197
|
name="openapi_spec_file_path",
|
|
@@ -377,7 +377,7 @@ class ImportArbitraryJsonYamlToRules(Step):
|
|
|
377
377
|
|
|
378
378
|
description = "The step extracts schema from arbitrary json file and generates NEAT transformation rules object."
|
|
379
379
|
category = CATEGORY
|
|
380
|
-
version = "
|
|
380
|
+
version = "legacy"
|
|
381
381
|
configurables: ClassVar[list[Configurable]] = [
|
|
382
382
|
Configurable(
|
|
383
383
|
name="file_path",
|
|
@@ -564,7 +564,7 @@ class ImportGraphToRules(Step):
|
|
|
564
564
|
description = "The step extracts data model from RDF graph and generates NEAT transformation rules object. \
|
|
565
565
|
The rules object can be serialized to excel file or used directly in other steps."
|
|
566
566
|
category = CATEGORY
|
|
567
|
-
version = "
|
|
567
|
+
version = "legacy"
|
|
568
568
|
configurables: ClassVar[list[Configurable]] = [
|
|
569
569
|
Configurable(
|
|
570
570
|
name="excel_file_path", value="staging/rules.xlsx", label="Relative path for the Excel rules storage."
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import typing
|
|
2
2
|
from abc import ABC, abstractmethod
|
|
3
|
-
from pathlib import Path
|
|
4
3
|
from typing import ClassVar, TypeVar
|
|
5
4
|
|
|
6
5
|
from pydantic import BaseModel, ConfigDict
|
|
7
6
|
|
|
8
7
|
from cognite.neat.app.monitoring.metrics import NeatMetricsCollector
|
|
8
|
+
from cognite.neat.config import Config
|
|
9
9
|
from cognite.neat.workflows.model import FlowMessage, WorkflowConfigs
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class Config(BaseModel):
|
|
13
|
-
...
|
|
14
|
-
|
|
15
|
-
|
|
16
12
|
class Configurable(BaseModel):
|
|
17
13
|
name: str
|
|
18
14
|
value: str | None = None
|
|
@@ -45,7 +41,7 @@ class Step(ABC):
|
|
|
45
41
|
)
|
|
46
42
|
docs_url: str = "https://cognite-neat.readthedocs-hosted.com/en/latest/" # url to the documentation of the step
|
|
47
43
|
|
|
48
|
-
def __init__(self,
|
|
44
|
+
def __init__(self, config: Config):
|
|
49
45
|
self.log: bool = False
|
|
50
46
|
self.configs: dict[str, str] = {}
|
|
51
47
|
self.complex_configs: dict[
|
|
@@ -53,7 +49,8 @@ class Step(ABC):
|
|
|
53
49
|
] = {} # complex configs are meant for more complex configurations. Value can be any type.
|
|
54
50
|
self.workflow_id: str = ""
|
|
55
51
|
self.workflow_run_id: str = ""
|
|
56
|
-
self.
|
|
52
|
+
self.config = config
|
|
53
|
+
self.data_store_path = config.data_store_path
|
|
57
54
|
|
|
58
55
|
@property
|
|
59
56
|
def _not_configured_message(self) -> str:
|
|
@@ -79,5 +76,4 @@ class Step(ABC):
|
|
|
79
76
|
self.flow_context = context
|
|
80
77
|
|
|
81
78
|
@abstractmethod
|
|
82
|
-
def run(self, *input_data: DataContract) -> DataContract | tuple[FlowMessage, DataContract] | FlowMessage:
|
|
83
|
-
...
|
|
79
|
+
def run(self, *input_data: DataContract) -> DataContract | tuple[FlowMessage, DataContract] | FlowMessage: ...
|
|
@@ -9,9 +9,12 @@ from typing import Any
|
|
|
9
9
|
|
|
10
10
|
from pydantic import BaseModel
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
import cognite.neat.workflows.steps.lib.
|
|
12
|
+
# steps
|
|
13
|
+
import cognite.neat.workflows.steps.lib.current
|
|
14
|
+
import cognite.neat.workflows.steps.lib.io
|
|
15
|
+
import cognite.neat.workflows.steps.lib.legacy
|
|
14
16
|
from cognite.neat.app.monitoring.metrics import NeatMetricsCollector
|
|
17
|
+
from cognite.neat.config import Config
|
|
15
18
|
from cognite.neat.exceptions import InvalidWorkFlowError
|
|
16
19
|
from cognite.neat.workflows._exceptions import ConfigurationNotSet
|
|
17
20
|
from cognite.neat.workflows.model import FlowMessage, WorkflowConfigs
|
|
@@ -34,26 +37,32 @@ class StepMetadata(BaseModel):
|
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
class StepsRegistry:
|
|
37
|
-
def __init__(self,
|
|
40
|
+
def __init__(self, config: Config):
|
|
41
|
+
self.config = config
|
|
38
42
|
self._step_classes: list[type[Step]] = []
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
self.user_steps_path = None
|
|
43
|
-
self.data_store_path: str = str(data_store_path)
|
|
43
|
+
self.user_steps_path: Path = config.data_store_path / "steps"
|
|
44
|
+
self.data_store_path: str = str(config.data_store_path)
|
|
45
|
+
self.categorized_steps: dict[str, set] = {"legacy": set(), "current": set(), "io": set()}
|
|
44
46
|
|
|
45
47
|
def load_step_classes(self):
|
|
46
48
|
if self._step_classes:
|
|
47
49
|
# classes already loaded - no need to reload
|
|
48
50
|
return
|
|
49
|
-
for name, step_cls in inspect.getmembers(cognite.neat.workflows.steps.lib):
|
|
51
|
+
for name, step_cls in inspect.getmembers(cognite.neat.workflows.steps.lib.current):
|
|
50
52
|
if inspect.isclass(step_cls):
|
|
51
53
|
logging.info(f"Loading NEAT step {name}")
|
|
52
54
|
self._step_classes.append(step_cls)
|
|
53
|
-
|
|
55
|
+
self.categorized_steps["current"].add(name)
|
|
56
|
+
for name, step_cls in inspect.getmembers(cognite.neat.workflows.steps.lib.io):
|
|
54
57
|
if inspect.isclass(step_cls):
|
|
55
58
|
logging.info(f"Loading NEAT step {name}")
|
|
56
59
|
self._step_classes.append(step_cls)
|
|
60
|
+
self.categorized_steps["io"].add(name)
|
|
61
|
+
for name, step_cls in inspect.getmembers(cognite.neat.workflows.steps.lib.legacy):
|
|
62
|
+
if inspect.isclass(step_cls):
|
|
63
|
+
logging.info(f"Loading NEAT step {name}")
|
|
64
|
+
self._step_classes.append(step_cls)
|
|
65
|
+
self.categorized_steps["legacy"].add(name)
|
|
57
66
|
sys.path.append(str(Path(self.data_store_path) / "workflows"))
|
|
58
67
|
try:
|
|
59
68
|
if self.user_steps_path:
|
|
@@ -124,7 +133,7 @@ class StepsRegistry:
|
|
|
124
133
|
step_complex_configs = {}
|
|
125
134
|
for step_cls in self._step_classes:
|
|
126
135
|
if step_cls.__name__ == step_name:
|
|
127
|
-
step_obj: Step = step_cls(
|
|
136
|
+
step_obj: Step = step_cls(config=self.config)
|
|
128
137
|
step_obj.configure(step_configs, step_complex_configs)
|
|
129
138
|
step_obj.set_flow_context(flow_context)
|
|
130
139
|
step_obj.set_metrics(metrics)
|