cognite-neat 0.87.4__py3-none-any.whl → 0.88.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.

Files changed (132) hide show
  1. cognite/neat/_version.py +1 -1
  2. cognite/neat/app/api/data_classes/rest.py +0 -19
  3. cognite/neat/app/api/explorer.py +6 -4
  4. cognite/neat/app/api/routers/crud.py +11 -21
  5. cognite/neat/app/api/routers/workflows.py +24 -94
  6. cognite/neat/graph/extractors/_classic_cdf/_assets.py +8 -2
  7. cognite/neat/graph/extractors/_mock_graph_generator.py +2 -2
  8. cognite/neat/graph/loaders/_base.py +17 -12
  9. cognite/neat/graph/loaders/_rdf2asset.py +223 -58
  10. cognite/neat/graph/loaders/_rdf2dms.py +1 -1
  11. cognite/neat/graph/stores/_base.py +5 -0
  12. cognite/neat/rules/analysis/_asset.py +31 -1
  13. cognite/neat/rules/importers/_inference2rules.py +31 -35
  14. cognite/neat/rules/models/information/_rules.py +1 -1
  15. cognite/neat/workflows/steps/data_contracts.py +17 -43
  16. cognite/neat/workflows/steps/lib/current/graph_extractor.py +28 -24
  17. cognite/neat/workflows/steps/lib/current/graph_loader.py +4 -21
  18. cognite/neat/workflows/steps/lib/current/graph_store.py +18 -134
  19. cognite/neat/workflows/steps_registry.py +5 -7
  20. {cognite_neat-0.87.4.dist-info → cognite_neat-0.88.0.dist-info}/METADATA +1 -1
  21. {cognite_neat-0.87.4.dist-info → cognite_neat-0.88.0.dist-info}/RECORD +24 -132
  22. cognite/neat/app/api/routers/core.py +0 -91
  23. cognite/neat/app/api/routers/data_exploration.py +0 -336
  24. cognite/neat/app/api/routers/rules.py +0 -203
  25. cognite/neat/legacy/__init__.py +0 -0
  26. cognite/neat/legacy/graph/__init__.py +0 -3
  27. cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -20182
  28. cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44.xml +0 -20163
  29. cognite/neat/legacy/graph/examples/__init__.py +0 -10
  30. cognite/neat/legacy/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  31. cognite/neat/legacy/graph/exceptions.py +0 -90
  32. cognite/neat/legacy/graph/extractors/__init__.py +0 -6
  33. cognite/neat/legacy/graph/extractors/_base.py +0 -14
  34. cognite/neat/legacy/graph/extractors/_dexpi.py +0 -44
  35. cognite/neat/legacy/graph/extractors/_graph_capturing_sheet.py +0 -403
  36. cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +0 -361
  37. cognite/neat/legacy/graph/loaders/__init__.py +0 -23
  38. cognite/neat/legacy/graph/loaders/_asset_loader.py +0 -511
  39. cognite/neat/legacy/graph/loaders/_base.py +0 -67
  40. cognite/neat/legacy/graph/loaders/_exceptions.py +0 -85
  41. cognite/neat/legacy/graph/loaders/core/__init__.py +0 -0
  42. cognite/neat/legacy/graph/loaders/core/labels.py +0 -58
  43. cognite/neat/legacy/graph/loaders/core/models.py +0 -136
  44. cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +0 -1046
  45. cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +0 -559
  46. cognite/neat/legacy/graph/loaders/rdf_to_dms.py +0 -309
  47. cognite/neat/legacy/graph/loaders/validator.py +0 -87
  48. cognite/neat/legacy/graph/models.py +0 -6
  49. cognite/neat/legacy/graph/stores/__init__.py +0 -13
  50. cognite/neat/legacy/graph/stores/_base.py +0 -400
  51. cognite/neat/legacy/graph/stores/_graphdb_store.py +0 -52
  52. cognite/neat/legacy/graph/stores/_memory_store.py +0 -43
  53. cognite/neat/legacy/graph/stores/_oxigraph_store.py +0 -151
  54. cognite/neat/legacy/graph/stores/_oxrdflib.py +0 -247
  55. cognite/neat/legacy/graph/stores/_rdf_to_graph.py +0 -42
  56. cognite/neat/legacy/graph/transformations/__init__.py +0 -0
  57. cognite/neat/legacy/graph/transformations/entity_matcher.py +0 -101
  58. cognite/neat/legacy/graph/transformations/query_generator/__init__.py +0 -3
  59. cognite/neat/legacy/graph/transformations/query_generator/sparql.py +0 -575
  60. cognite/neat/legacy/graph/transformations/transformer.py +0 -322
  61. cognite/neat/legacy/rules/__init__.py +0 -0
  62. cognite/neat/legacy/rules/analysis.py +0 -231
  63. cognite/neat/legacy/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
  64. cognite/neat/legacy/rules/examples/Rules-Nordic44.xlsx +0 -0
  65. cognite/neat/legacy/rules/examples/__init__.py +0 -18
  66. cognite/neat/legacy/rules/examples/power-grid-containers.yaml +0 -124
  67. cognite/neat/legacy/rules/examples/power-grid-example.xlsx +0 -0
  68. cognite/neat/legacy/rules/examples/power-grid-model.yaml +0 -224
  69. cognite/neat/legacy/rules/examples/rules-template.xlsx +0 -0
  70. cognite/neat/legacy/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
  71. cognite/neat/legacy/rules/examples/skos-rules.xlsx +0 -0
  72. cognite/neat/legacy/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
  73. cognite/neat/legacy/rules/examples/wind-energy.owl +0 -1511
  74. cognite/neat/legacy/rules/exceptions.py +0 -2972
  75. cognite/neat/legacy/rules/exporters/__init__.py +0 -20
  76. cognite/neat/legacy/rules/exporters/_base.py +0 -45
  77. cognite/neat/legacy/rules/exporters/_core/__init__.py +0 -5
  78. cognite/neat/legacy/rules/exporters/_core/rules2labels.py +0 -24
  79. cognite/neat/legacy/rules/exporters/_rules2dms.py +0 -885
  80. cognite/neat/legacy/rules/exporters/_rules2excel.py +0 -213
  81. cognite/neat/legacy/rules/exporters/_rules2graphql.py +0 -183
  82. cognite/neat/legacy/rules/exporters/_rules2ontology.py +0 -524
  83. cognite/neat/legacy/rules/exporters/_rules2pydantic_models.py +0 -748
  84. cognite/neat/legacy/rules/exporters/_rules2rules.py +0 -105
  85. cognite/neat/legacy/rules/exporters/_rules2triples.py +0 -38
  86. cognite/neat/legacy/rules/exporters/_validation.py +0 -146
  87. cognite/neat/legacy/rules/importers/__init__.py +0 -22
  88. cognite/neat/legacy/rules/importers/_base.py +0 -66
  89. cognite/neat/legacy/rules/importers/_dict2rules.py +0 -158
  90. cognite/neat/legacy/rules/importers/_dms2rules.py +0 -194
  91. cognite/neat/legacy/rules/importers/_graph2rules.py +0 -308
  92. cognite/neat/legacy/rules/importers/_json2rules.py +0 -39
  93. cognite/neat/legacy/rules/importers/_owl2rules/__init__.py +0 -3
  94. cognite/neat/legacy/rules/importers/_owl2rules/_owl2classes.py +0 -239
  95. cognite/neat/legacy/rules/importers/_owl2rules/_owl2metadata.py +0 -260
  96. cognite/neat/legacy/rules/importers/_owl2rules/_owl2properties.py +0 -217
  97. cognite/neat/legacy/rules/importers/_owl2rules/_owl2rules.py +0 -290
  98. cognite/neat/legacy/rules/importers/_spreadsheet2rules.py +0 -45
  99. cognite/neat/legacy/rules/importers/_xsd2rules.py +0 -20
  100. cognite/neat/legacy/rules/importers/_yaml2rules.py +0 -39
  101. cognite/neat/legacy/rules/models/__init__.py +0 -5
  102. cognite/neat/legacy/rules/models/_base.py +0 -151
  103. cognite/neat/legacy/rules/models/raw_rules.py +0 -316
  104. cognite/neat/legacy/rules/models/rdfpath.py +0 -237
  105. cognite/neat/legacy/rules/models/rules.py +0 -1289
  106. cognite/neat/legacy/rules/models/tables.py +0 -9
  107. cognite/neat/legacy/rules/models/value_types.py +0 -118
  108. cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +0 -89
  109. cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -152
  110. cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -139
  111. cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -270
  112. cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +0 -65
  113. cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -116
  114. cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +0 -67
  115. cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -64
  116. cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -95
  117. cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -111
  118. cognite/neat/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -270
  119. cognite/neat/workflows/migration/__init__.py +0 -0
  120. cognite/neat/workflows/migration/steps.py +0 -91
  121. cognite/neat/workflows/migration/wf_manifests.py +0 -33
  122. cognite/neat/workflows/steps/lib/legacy/__init__.py +0 -7
  123. cognite/neat/workflows/steps/lib/legacy/graph_contextualization.py +0 -82
  124. cognite/neat/workflows/steps/lib/legacy/graph_extractor.py +0 -746
  125. cognite/neat/workflows/steps/lib/legacy/graph_loader.py +0 -606
  126. cognite/neat/workflows/steps/lib/legacy/graph_store.py +0 -307
  127. cognite/neat/workflows/steps/lib/legacy/graph_transformer.py +0 -58
  128. cognite/neat/workflows/steps/lib/legacy/rules_exporter.py +0 -511
  129. cognite/neat/workflows/steps/lib/legacy/rules_importer.py +0 -612
  130. {cognite_neat-0.87.4.dist-info → cognite_neat-0.88.0.dist-info}/LICENSE +0 -0
  131. {cognite_neat-0.87.4.dist-info → cognite_neat-0.88.0.dist-info}/WHEEL +0 -0
  132. {cognite_neat-0.87.4.dist-info → cognite_neat-0.88.0.dist-info}/entry_points.txt +0 -0
@@ -1,111 +0,0 @@
1
- configs: []
2
- description: null
3
- implementation_module: null
4
- name: Visualize Semantic Data Model
5
- steps:
6
- - complex_configs: {}
7
- configs: {}
8
- description: null
9
- enabled: true
10
- id: step_upload_excel_rules
11
- label: Upload Excel Rules
12
- max_retries: 0
13
- method: null
14
- params:
15
- file_type: rules
16
- retry_delay: 3
17
- stype: file_uploader
18
- system_component_id: null
19
- transition_to:
20
- - step_421523
21
- - step_excel_to_rules
22
- trigger: true
23
- ui_config:
24
- pos_x: 498
25
- pos_y: 149
26
- - complex_configs: {}
27
- configs:
28
- File name: ''
29
- Report formatter: BasicHTML
30
- Role: infer
31
- description: null
32
- enabled: true
33
- id: step_excel_to_rules
34
- label: Import and Validate Rules
35
- max_retries: 0
36
- method: ExcelToRules
37
- params: {}
38
- retry_delay: 3
39
- stype: stdstep
40
- system_component_id: null
41
- transition_to:
42
- - step_rules_to_ontology
43
- trigger: false
44
- ui_config:
45
- pos_x: 497
46
- pos_y: 234
47
- - complex_configs: {}
48
- configs:
49
- File path: staging/semantic-data-model.ttl
50
- description: null
51
- enabled: true
52
- id: step_rules_to_ontology
53
- label: Rules to Ontology
54
- max_retries: 0
55
- method: RulesToSemanticDataModel
56
- params: {}
57
- retry_delay: 3
58
- stype: stdstep
59
- system_component_id: null
60
- transition_to:
61
- - step_configure_graph_store
62
- trigger: false
63
- ui_config:
64
- pos_x: 497
65
- pos_y: 323
66
- - complex_configs: {}
67
- configs:
68
- Disk storage directory: semantic-data-model
69
- Graph: source
70
- Graph store type: oxigraph
71
- GraphDB API root URL: ''
72
- Init procedure: reset
73
- Query URL: ''
74
- Update URL: ''
75
- description: null
76
- enabled: true
77
- id: step_configure_graph_store
78
- label: Configure Graph Store
79
- max_retries: 0
80
- method: GraphStoreConfiguration
81
- params: {}
82
- retry_delay: 3
83
- stype: stdstep
84
- system_component_id: null
85
- transition_to:
86
- - step_load_semantic_data_model
87
- trigger: false
88
- ui_config:
89
- pos_x: 495
90
- pos_y: 399
91
- - complex_configs: {}
92
- configs:
93
- Add base URI: 'False'
94
- File path: staging/semantic-data-model.ttl
95
- MIME type: text/turtle
96
- description: null
97
- enabled: true
98
- id: step_load_semantic_data_model
99
- label: Load Semantic Data Model
100
- max_retries: 0
101
- method: GraphFromRdfFile
102
- params: {}
103
- retry_delay: 3
104
- stype: stdstep
105
- system_component_id: null
106
- transition_to: []
107
- trigger: false
108
- ui_config:
109
- pos_x: 495
110
- pos_y: 476
111
- system_components: []
@@ -1,270 +0,0 @@
1
- configs: []
2
- description: null
3
- implementation_module: null
4
- name: Extract RDF Graph and Generate Assets
5
- steps:
6
- - complex_configs: {}
7
- configs: {}
8
- description: null
9
- enabled: true
10
- id: step_http_trigger
11
- label: Process trigger
12
- max_retries: 0
13
- method: null
14
- params:
15
- workflow_start_method: persistent_blocking
16
- retry_delay: 3
17
- stype: http_trigger
18
- system_component_id: null
19
- transition_to:
20
- - step_rules_loader
21
- trigger: true
22
- ui_config:
23
- pos_x: 454
24
- pos_y: 77
25
- - complex_configs: {}
26
- configs:
27
- file_name: Rules-Nordic44.xlsx
28
- validation_report_file: rules_validation_report.txt
29
- validation_report_storage_dir: rules_validation_report
30
- version: ""
31
- description: null
32
- enabled: true
33
- id: step_rules_loader
34
- label: Rules loader
35
- max_retries: 0
36
- method: ImportExcelToRules
37
- params: {}
38
- retry_delay: 3
39
- stype: stdstep
40
- system_component_id: null
41
- transition_to:
42
- - step_234135
43
- - step_configure_source_graph_store
44
- trigger: false
45
- ui_config:
46
- pos_x: 452
47
- pos_y: 167
48
- - complex_configs: {}
49
- configs:
50
- add_base_iri: "True"
51
- file_path: source-graphs/Knowledge-Graph-Nordic44-dirty.xml
52
- mime_type: application/rdf+xml
53
- description: null
54
- enabled: true
55
- id: step_graph_loader
56
- label: Extract Graph from RDF File
57
- max_retries: 0
58
- method: ExtractGraphFromRdfFile
59
- params: {}
60
- retry_delay: 3
61
- stype: stdstep
62
- system_component_id: null
63
- transition_to:
64
- - step_transform
65
- trigger: false
66
- ui_config:
67
- pos_x: 453
68
- pos_y: 418
69
- - complex_configs: {}
70
- configs:
71
- cdf_lookup_database: ""
72
- description: null
73
- enabled: true
74
- id: step_transform
75
- label: Transform graph
76
- max_retries: 0
77
- method: TransformSourceToSolutionGraph
78
- params: {}
79
- retry_delay: 3
80
- stype: stdstep
81
- system_component_id: null
82
- transition_to: []
83
- trigger: false
84
- ui_config:
85
- pos_x: 453
86
- pos_y: 500
87
- - complex_configs: {}
88
- configs:
89
- asset_external_id_prefix: ""
90
- assets_cleanup_type: full
91
- data_set_id: "2626756768281823"
92
- description: null
93
- enabled: true
94
- id: step_generate_assets
95
- label: Generate cdf assets
96
- max_retries: 0
97
- method: GenerateAssetsFromGraph
98
- params: {}
99
- retry_delay: 3
100
- stype: stdstep
101
- system_component_id: null
102
- transition_to:
103
- - step_generate_relationships
104
- trigger: false
105
- ui_config:
106
- pos_x: 455
107
- pos_y: 571
108
- - complex_configs: {}
109
- configs:
110
- data_set_id: "2626756768281823"
111
- relationship_external_id_prefix: ""
112
- description: null
113
- enabled: true
114
- id: step_generate_relationships
115
- label: Generate relationships
116
- max_retries: 0
117
- method: GenerateRelationshipsFromGraph
118
- params: {}
119
- retry_delay: 3
120
- stype: stdstep
121
- system_component_id: null
122
- transition_to: []
123
- trigger: false
124
- ui_config:
125
- pos_x: 456
126
- pos_y: 633
127
- - complex_configs: {}
128
- configs:
129
- db_server_api_root_url: ""
130
- disk_store_dir: nordic44-graph-store
131
- graph_name: source
132
- init_procedure: reset
133
- sparql_query_url: ""
134
- sparql_update_url: ""
135
- store_type: oxigraph
136
- description: null
137
- enabled: true
138
- id: step_configure_source_graph_store
139
- label: Configure source graph store
140
- max_retries: 0
141
- method: ConfigureGraphStore
142
- params: {}
143
- retry_delay: 3
144
- stype: stdstep
145
- system_component_id: null
146
- transition_to:
147
- - step_configure_solution_graph_store
148
- trigger: false
149
- ui_config:
150
- pos_x: 451
151
- pos_y: 245
152
- - complex_configs: {}
153
- configs:
154
- db_server_api_root_url: ""
155
- disk_store_dir: solution-graph-store-4
156
- graph_name: solution
157
- init_procedure: reset
158
- sparql_query_url: ""
159
- sparql_update_url: ""
160
- store_type: oxigraph
161
- description: null
162
- enabled: true
163
- id: step_configure_solution_graph_store
164
- label: Configure solution graph store
165
- max_retries: 0
166
- method: ConfigureGraphStore
167
- params: {}
168
- retry_delay: 3
169
- stype: stdstep
170
- system_component_id: null
171
- transition_to:
172
- - step_graph_loader
173
- trigger: false
174
- ui_config:
175
- pos_x: 454
176
- pos_y: 334
177
- system_components:
178
- - description: null
179
- id: grid_management_system
180
- label: Grid management system
181
- transition_to:
182
- - rdf_xml_file
183
- ui_config:
184
- pos_x: 171
185
- pos_y: 6
186
- - description: null
187
- id: rdf_xml_file
188
- label: RDF XML File
189
- transition_to:
190
- - graph_db_store
191
- ui_config:
192
- pos_x: 170
193
- pos_y: 103
194
- - description: null
195
- id: graph_db_store
196
- label: OxiGraph source graph_store
197
- transition_to:
198
- - transformer
199
- ui_config:
200
- pos_x: 240
201
- pos_y: 177
202
- - description: null
203
- id: in_memmory_store
204
- label: In-memory source graph_store
205
- transition_to: []
206
- ui_config:
207
- pos_x: 73
208
- pos_y: 175
209
- - description: null
210
- id: transformation_rules
211
- label: Transformation rules
212
- transition_to:
213
- - transformer
214
- ui_config:
215
- pos_x: 413
216
- pos_y: 195
217
- - description: null
218
- id: cdf_raw_table
219
- label: Cdf raw lookup table
220
- transition_to:
221
- - transformer
222
- ui_config:
223
- pos_x: 586
224
- pos_y: 195
225
- - description: null
226
- id: transformer
227
- label: Transformer
228
- transition_to:
229
- - solution_graph
230
- ui_config:
231
- pos_x: 237
232
- pos_y: 329
233
- - description: null
234
- id: solution_graph
235
- label: Solution graph
236
- transition_to:
237
- - cdf_classic_exporter
238
- ui_config:
239
- pos_x: 237
240
- pos_y: 405
241
- - description: null
242
- id: cdf_classic_exporter
243
- label: CDF Classic exporter
244
- transition_to:
245
- - cdf_classic
246
- ui_config:
247
- pos_x: 181
248
- pos_y: 498
249
- - description: null
250
- id: cdf_fdm_exporter
251
- label: CDF FDM exporter
252
- transition_to:
253
- - cdf_fdm
254
- ui_config:
255
- pos_x: 345
256
- pos_y: 498
257
- - description: null
258
- id: cdf_classic
259
- label: CDF Classic (Asset,Relationships)
260
- transition_to: []
261
- ui_config:
262
- pos_x: 182
263
- pos_y: 586
264
- - description: null
265
- id: cdf_fdm
266
- label: CDF FDM
267
- transition_to: []
268
- ui_config:
269
- pos_x: 347
270
- pos_y: 586
File without changes
@@ -1,91 +0,0 @@
1
- from pathlib import Path
2
-
3
- import yaml
4
-
5
- # Migration mapping
6
-
7
- # LoadTransformationRules to ImportExcelToRules
8
- # InstancesFromRdfFileToSourceGraph to ExtractGraphFromRdfFile
9
- # InstancesFromRulesToSolutionGraph to ExtractGraphFromRulesInstanceSheet
10
- # GraphCapturingSheetToGraph to ExtractGraphFromGraphCapturingSheet
11
- # GenerateMockGraph to ExtractGraphFromMockGraph
12
- # InstancesFromJsonToGraph to ExtractGraphFromJsonFile
13
- # InstancesFromAvevaPiAF to ExtractGraphFromAvevaPiAssetFramework
14
- # DexpiToGraph to ExtractGraphFromDexpiFile
15
- # GenerateCDFAssetsFromGraph to GenerateAssetsFromGraph
16
- # GenerateCDFRelationshipsFromGraph to GenerateRelationshipsFromGraph
17
- # GenerateCDFNodesAndEdgesFromGraph to GenerateNodesAndEdgesFromGraph
18
- # UploadCDFAssets to LoadAssetsToCDF
19
- # UploadCDFRelationships to LoadRelationshipsToCDF
20
- # UploadCDFNodes to LoadNodesToCDF
21
- # UploadCDFEdges to LoadEdgesToCDF
22
- # CreateCDFLabels to LoadLabelsToCDF
23
- # OpenApiToRules to `ImportOpenApiToRules
24
- # ArbitraryJsonYamlToRules to ImportArbitraryJsonYamlToRules
25
- # GraphToRules to ImportGraphToRules
26
- # OntologyToRules to ImportOntologyToRules
27
- # GraphQLSchemaFromRules to ExportGraphQLSchemaFromRules
28
- # OntologyFromRules to ExportOntologyFromRules
29
- # SHACLFromRules to ExportSHACLFromRules
30
- # GraphCaptureSpreadsheetFromRules to ExportRulesToGraphCapturingSheet
31
- # ExcelFromRules to ExportRulesToExcel
32
-
33
- # Define a dictionary that maps old step names to new ones
34
- step_rename_mapping = {
35
- "LoadTransformationRules": "ImportExcelToRules",
36
- "InstancesFromRdfFileToSourceGraph": "ExtractGraphFromRdfFile",
37
- "InstancesFromRulesToSolutionGraph": "ExtractGraphFromRulesInstanceSheet",
38
- "GraphCapturingSheetToGraph": "ExtractGraphFromGraphCapturingSheet",
39
- "GenerateMockGraph": "ExtractGraphFromMockGraph",
40
- "InstancesFromJsonToGraph": "ExtractGraphFromJsonFile",
41
- "InstancesFromAvevaPiAF": "ExtractGraphFromAvevaPiAssetFramework",
42
- "DexpiToGraph": "ExtractGraphFromDexpiFile",
43
- "GenerateCDFAssetsFromGraph": "GenerateAssetsFromGraph",
44
- "GenerateCDFRelationshipsFromGraph": "GenerateRelationshipsFromGraph",
45
- "GenerateCDFNodesAndEdgesFromGraph": "GenerateNodesAndEdgesFromGraph",
46
- "UploadCDFAssets": "LoadAssetsToCDF",
47
- "UploadCDFRelationships": "LoadRelationshipsToCDF",
48
- "UploadCDFNodes": "LoadNodesToCDF",
49
- "UploadCDFEdges": "LoadEdgesToCDF",
50
- "CreateCDFLabels": "LoadLabelsToCDF",
51
- "OpenApiToRules": "ImportOpenApiToRules",
52
- "ArbitraryJsonYamlToRules": "ImportArbitraryJsonYamlToRules",
53
- "GraphToRules": "ImportGraphToRules",
54
- "OntologyToRules": "ImportOntologyToRules",
55
- "GraphQLSchemaFromRules": "ExportGraphQLSchemaFromRules",
56
- "OntologyFromRules": "ExportOntologyFromRules",
57
- "SHACLFromRules": "ExportSHACLFromRules",
58
- "GraphCaptureSpreadsheetFromRules": "ExportRulesToGraphCapturingSheet",
59
- "ExcelFromRules": "ExportRulesToExcel",
60
- }
61
-
62
-
63
- def rename_workflow_steps(workflow_path: Path, dry_run: bool) -> str:
64
- # Load the YAML file
65
- data = yaml.safe_load(workflow_path.read_text())
66
- # Replace old step names with new ones
67
- for step in data["steps"]:
68
- if step["method"] in step_rename_mapping:
69
- print(f"Renaming step {step['method']} to {step_rename_mapping[step['method']]}")
70
- step["method"] = step_rename_mapping[step["method"]]
71
-
72
- # Save the updated YAML file
73
- with workflow_path.open("w") as file:
74
- yaml.safe_dump(data, file)
75
- return "ok"
76
-
77
-
78
- def migrate_all_workflow_names(workflows_path: str, dry_run: bool) -> str:
79
- # Get all workflow files
80
- workflow_files = Path(workflows_path).rglob("workflow.yaml")
81
- # Migrate each workflow file
82
- for workflow_file in workflow_files:
83
- print(f"Migrating {workflow_file}")
84
- rename_workflow_steps(workflow_file, dry_run)
85
- return "ok"
86
-
87
-
88
- if __name__ == "__main__":
89
- # print current directory
90
- print("The current directory is", Path.cwd())
91
- migrate_all_workflow_names("data/workflows", True)
@@ -1,33 +0,0 @@
1
- import logging
2
- import os
3
- from pathlib import Path
4
-
5
- import yaml
6
-
7
-
8
- def migrate_wf_manifest(wf_store_path: Path):
9
- """Migrate workflow manifests . Changed name of element from groups -> system_components"""
10
- migrated_files = []
11
- wf_store_path = wf_store_path / "workflows"
12
- for wf_module_name in os.listdir(wf_store_path):
13
- wf_module_full_path = wf_store_path / wf_module_name
14
-
15
- if wf_module_full_path.is_dir():
16
- metadata_file = wf_store_path / wf_module_name / "workflow.yaml"
17
- metadata_file_migrated = wf_store_path / wf_module_name / "workflow.yaml"
18
- logging.info(f"Loading workflow {wf_module_name} metadata from {metadata_file}")
19
- if metadata_file.exists():
20
- with metadata_file.open() as f:
21
- manifest_yaml = yaml.safe_load(f)
22
- logging.info(f"Loaded workflow {wf_module_name} metadata from {metadata_file}")
23
- if "groups" in manifest_yaml:
24
- logging.info(f"Found groups in {metadata_file}, migrating to system_components")
25
- manifest_yaml["system_components"] = manifest_yaml["groups"]
26
- del manifest_yaml["groups"]
27
- with metadata_file_migrated.open("w") as f:
28
- yaml.dump(manifest_yaml, f, indent=4)
29
- migrated_files.append(metadata_file_migrated)
30
- else:
31
- logging.info(f"Metadata file {metadata_file} not found, skipping")
32
- continue
33
- return migrated_files
@@ -1,7 +0,0 @@
1
- from .graph_extractor import * # noqa
2
- from .graph_transformer import * # noqa
3
- from .graph_loader import * # noqa
4
- from .graph_store import * # noqa
5
- from .rules_importer import * # noqa
6
- from .rules_exporter import * # noqa
7
- from .graph_contextualization import * # noqa
@@ -1,82 +0,0 @@
1
- from typing import ClassVar, cast
2
-
3
- from cognite.neat.legacy.graph.transformations.entity_matcher import simple_entity_matcher
4
- from cognite.neat.workflows._exceptions import StepNotInitialized
5
- from cognite.neat.workflows.model import FlowMessage
6
- from cognite.neat.workflows.steps.data_contracts import SolutionGraph, SourceGraph
7
- from cognite.neat.workflows.steps.step_model import Configurable, Step
8
-
9
- __all__ = ["SimpleGraphEntityMatcher"]
10
- CATEGORY = __name__.split(".")[-1].replace("_", " ").title() + " [LEGACY]"
11
-
12
-
13
- class SimpleGraphEntityMatcher(Step):
14
- version = "legacy"
15
- description = "The step matches entities in the graph and creates links based on provided configurations"
16
- category = CATEGORY
17
- configurables: ClassVar[list[Configurable]] = [
18
- Configurable(name="source_class", value="", label="Name of the source class"),
19
- Configurable(name="source_property", value="", label="Name of the source property"),
20
- Configurable(
21
- name="source_value_type",
22
- value="single_value_str",
23
- label="Type of the value in the source property.Propery can have single value \
24
- or multiple values separated by comma.",
25
- options=["single_value_str", "multi_value_str"],
26
- ),
27
- Configurable(name="target_class", value="", label="Name of the target class"),
28
- Configurable(name="target_property", value="", label="Name of the target property"),
29
- Configurable(name="relationship_name", value="link", label="Label of the relationship to be created"),
30
- Configurable(
31
- name="link_direction",
32
- value="target_to_source",
33
- label="Direction of the relationship.",
34
- options=["target_to_source", "source_to_target"],
35
- ),
36
- Configurable(
37
- name="matching_method",
38
- value="regexp",
39
- label="Method to be used for matching. Supported options .",
40
- options=["exact_match", "regexp"],
41
- ),
42
- Configurable(
43
- name="graph_name",
44
- value="source",
45
- label="The name of the graph to be used for matching.",
46
- options=["source", "solution"],
47
- ),
48
- Configurable(
49
- name="link_namespace",
50
- value="http://purl.org/cognite/neat#",
51
- label="The namespace of the link to be created",
52
- ),
53
- ]
54
-
55
- def run(self, graph_store: SolutionGraph | SourceGraph) -> FlowMessage: # type: ignore[override, syntax]
56
- # We can't use the graph_store to get the graph as input parameter directly,
57
- # resolver might resolve the wrong graph
58
- # if both are present in the flow context
59
- if self.configs is None:
60
- raise StepNotInitialized(type(self).__name__)
61
- configs = self.configs
62
- if self.configs["graph_name"] == "solution":
63
- # Todo Anders: Why is the graph fetched from context when it is passed as an argument?
64
- graph_store = cast(SourceGraph | SolutionGraph, self.flow_context["SolutionGraph"])
65
- else:
66
- graph_store = cast(SourceGraph | SolutionGraph, self.flow_context["SourceGraph"])
67
-
68
- self.graph_store = graph_store.graph
69
- new_links_counter = simple_entity_matcher(
70
- graph_store=self.graph_store,
71
- source_class=configs["source_class"],
72
- source_property=configs["source_property"],
73
- source_value_type=configs["source_value_type"],
74
- target_class=configs["target_class"],
75
- target_property=configs["target_property"],
76
- relationship_name=configs["relationship_name"],
77
- link_direction=configs["link_direction"],
78
- matching_method=configs["matching_method"],
79
- link_namespace=configs["link_namespace"],
80
- )
81
- output_text = f"Matcher has created {new_links_counter} links"
82
- return FlowMessage(output_text=output_text)