cognite-neat 0.101.0__py3-none-any.whl → 0.103.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 +1 -1
- cognite/neat/_app/api/routers/crud.py +1 -1
- cognite/neat/_client/__init__.py +1 -1
- cognite/neat/_client/_api/data_modeling_loaders.py +1 -1
- cognite/neat/_client/_api/schema.py +1 -1
- cognite/neat/_constants.py +5 -1
- cognite/neat/_graph/_tracking/__init__.py +1 -1
- cognite/neat/_graph/extractors/__init__.py +8 -8
- cognite/neat/_graph/extractors/_mock_graph_generator.py +2 -3
- cognite/neat/_graph/loaders/_base.py +1 -1
- cognite/neat/_graph/loaders/_rdf2dms.py +165 -47
- cognite/neat/_graph/queries/_base.py +22 -2
- cognite/neat/_graph/queries/_shared.py +4 -4
- cognite/neat/_graph/transformers/__init__.py +25 -9
- cognite/neat/_graph/transformers/_base.py +1 -1
- cognite/neat/_graph/transformers/_iodd.py +2 -2
- cognite/neat/_graph/transformers/_prune_graph.py +98 -24
- cognite/neat/_graph/transformers/_value_type.py +196 -2
- cognite/neat/_issues/__init__.py +6 -6
- cognite/neat/_issues/_base.py +4 -4
- cognite/neat/_issues/errors/__init__.py +22 -22
- cognite/neat/_issues/formatters.py +1 -1
- cognite/neat/_issues/warnings/__init__.py +20 -18
- cognite/neat/_issues/warnings/_properties.py +7 -0
- cognite/neat/_issues/warnings/user_modeling.py +2 -2
- cognite/neat/_rules/analysis/__init__.py +1 -1
- cognite/neat/_rules/catalog/__init__.py +1 -0
- cognite/neat/_rules/catalog/hello_world_pump.xlsx +0 -0
- cognite/neat/_rules/exporters/__init__.py +5 -5
- cognite/neat/_rules/exporters/_rules2excel.py +12 -6
- cognite/neat/_rules/importers/__init__.py +4 -4
- cognite/neat/_rules/importers/_base.py +7 -3
- cognite/neat/_rules/importers/_dms2rules.py +51 -19
- cognite/neat/_rules/importers/_rdf/__init__.py +1 -1
- cognite/neat/_rules/importers/_rdf/_base.py +2 -2
- cognite/neat/_rules/models/__init__.py +5 -5
- cognite/neat/_rules/models/_base_rules.py +1 -1
- cognite/neat/_rules/models/dms/__init__.py +11 -11
- cognite/neat/_rules/models/dms/_validation.py +16 -10
- cognite/neat/_rules/models/entities/__init__.py +26 -26
- cognite/neat/_rules/models/information/__init__.py +5 -5
- cognite/neat/_rules/models/information/_rules.py +3 -3
- cognite/neat/_rules/models/mapping/_classic2core.yaml +54 -8
- cognite/neat/_rules/transformers/__init__.py +12 -12
- cognite/neat/_rules/transformers/_pipelines.py +10 -5
- cognite/neat/_session/_base.py +71 -0
- cognite/neat/_session/_collector.py +3 -1
- cognite/neat/_session/_drop.py +10 -0
- cognite/neat/_session/_inspect.py +35 -1
- cognite/neat/_session/_mapping.py +5 -0
- cognite/neat/_session/_prepare.py +196 -7
- cognite/neat/_session/_read.py +180 -20
- cognite/neat/_session/_set.py +11 -1
- cognite/neat/_session/_show.py +41 -2
- cognite/neat/_session/_to.py +58 -10
- cognite/neat/_session/engine/__init__.py +1 -1
- cognite/neat/_session/engine/_load.py +3 -1
- cognite/neat/_store/__init__.py +3 -2
- cognite/neat/_store/{_base.py → _graph_store.py} +56 -2
- cognite/neat/_store/_provenance.py +11 -1
- cognite/neat/_store/_rules_store.py +20 -0
- cognite/neat/_utils/auth.py +7 -5
- cognite/neat/_utils/reader/__init__.py +1 -1
- cognite/neat/_version.py +2 -2
- cognite/neat/_workflows/__init__.py +3 -3
- cognite/neat/_workflows/steps/lib/current/graph_extractor.py +1 -1
- cognite/neat/_workflows/steps/lib/current/rules_exporter.py +1 -1
- cognite/neat/_workflows/steps/lib/current/rules_importer.py +2 -2
- cognite/neat/_workflows/steps/lib/io/io_steps.py +3 -3
- {cognite_neat-0.101.0.dist-info → cognite_neat-0.103.0.dist-info}/METADATA +1 -1
- {cognite_neat-0.101.0.dist-info → cognite_neat-0.103.0.dist-info}/RECORD +74 -72
- {cognite_neat-0.101.0.dist-info → cognite_neat-0.103.0.dist-info}/LICENSE +0 -0
- {cognite_neat-0.101.0.dist-info → cognite_neat-0.103.0.dist-info}/WHEEL +0 -0
- {cognite_neat-0.101.0.dist-info → cognite_neat-0.103.0.dist-info}/entry_points.txt +0 -0
|
@@ -2,10 +2,12 @@ enum:
|
|
|
2
2
|
- collection: timeseriesType
|
|
3
3
|
description: Time series with double floating point data points.
|
|
4
4
|
name: numeric
|
|
5
|
+
neatId: http://purl.org/cognite/neat/neatId_d4e42064_7c60_4bfc_b629_a873345f0ee2
|
|
5
6
|
value: numeric
|
|
6
7
|
- collection: timeseriesType
|
|
7
8
|
description: Time series with string data points.
|
|
8
9
|
name: string
|
|
10
|
+
neatId: http://purl.org/cognite/neat/neatId_8bb46fae_572d_464a_bc61_1055b0aa6c5d
|
|
9
11
|
value: string
|
|
10
12
|
metadata:
|
|
11
13
|
created: '2024-08-29T13:49:56.696000'
|
|
@@ -23,6 +25,7 @@ properties:
|
|
|
23
25
|
description: Description of the instance
|
|
24
26
|
immutable: false
|
|
25
27
|
is_list: false
|
|
28
|
+
neatId: http://purl.org/cognite/neat/neatId_d887305d_af9d_4843_af6e_4115a7217d90
|
|
26
29
|
nullable: true
|
|
27
30
|
value_type: text
|
|
28
31
|
view: ClassicAsset
|
|
@@ -32,6 +35,7 @@ properties:
|
|
|
32
35
|
description: Text based labels for generic use, limited to 1000
|
|
33
36
|
immutable: false
|
|
34
37
|
is_list: true
|
|
38
|
+
neatId: http://purl.org/cognite/neat/neatId_105a0fee_3942_4a6b_9d25_74d46d09c209
|
|
35
39
|
nullable: true
|
|
36
40
|
value_type: text
|
|
37
41
|
view: ClassicAsset
|
|
@@ -42,6 +46,7 @@ properties:
|
|
|
42
46
|
immutable: false
|
|
43
47
|
index: name
|
|
44
48
|
is_list: false
|
|
49
|
+
neatId: http://purl.org/cognite/neat/neatId_9559ecd6_a585_4fb9_90b7_7301da5f2170
|
|
45
50
|
nullable: true
|
|
46
51
|
value_type: text
|
|
47
52
|
view: ClassicAsset
|
|
@@ -53,6 +58,7 @@ properties:
|
|
|
53
58
|
immutable: false
|
|
54
59
|
is_list: false
|
|
55
60
|
name: Parent
|
|
61
|
+
neatId: http://purl.org/cognite/neat/neatId_fdc3280b_0d11_4e66_b2b5_8f37a398bed9
|
|
56
62
|
nullable: true
|
|
57
63
|
value_type: ClassicAsset
|
|
58
64
|
view: ClassicAsset
|
|
@@ -64,8 +70,9 @@ properties:
|
|
|
64
70
|
immutable: false
|
|
65
71
|
index: source
|
|
66
72
|
is_list: false
|
|
73
|
+
neatId: http://purl.org/cognite/neat/neatId_247e5b5d_4caf_4312_bd5b_341ed3fc3a03
|
|
67
74
|
nullable: true
|
|
68
|
-
value_type:
|
|
75
|
+
value_type: ClassicSourceSystem
|
|
69
76
|
view: ClassicAsset
|
|
70
77
|
view_property: source
|
|
71
78
|
- container: cdf_cdm:CogniteDescribable
|
|
@@ -73,6 +80,7 @@ properties:
|
|
|
73
80
|
description: Alternative names for the node
|
|
74
81
|
immutable: false
|
|
75
82
|
is_list: true
|
|
83
|
+
neatId: http://purl.org/cognite/neat/neatId_7412eae6_e77c_41b7_92ca_737798f5844a
|
|
76
84
|
nullable: true
|
|
77
85
|
value_type: text
|
|
78
86
|
view: ClassicEvent
|
|
@@ -84,6 +92,7 @@ properties:
|
|
|
84
92
|
immutable: false
|
|
85
93
|
is_list: true
|
|
86
94
|
name: Assets
|
|
95
|
+
neatId: http://purl.org/cognite/neat/neatId_439538ba_610d_4300_a8cd_aa51dbbf5c1a
|
|
87
96
|
nullable: true
|
|
88
97
|
value_type: ClassicAsset
|
|
89
98
|
view: ClassicEvent
|
|
@@ -93,6 +102,7 @@ properties:
|
|
|
93
102
|
description: Description of the instance
|
|
94
103
|
immutable: false
|
|
95
104
|
is_list: false
|
|
105
|
+
neatId: http://purl.org/cognite/neat/neatId_8ab69b21_b84e_4374_a2bd_6b7e6321f22d
|
|
96
106
|
nullable: true
|
|
97
107
|
value_type: text
|
|
98
108
|
view: ClassicEvent
|
|
@@ -103,6 +113,7 @@ properties:
|
|
|
103
113
|
immutable: false
|
|
104
114
|
index: endTime
|
|
105
115
|
is_list: false
|
|
116
|
+
neatId: http://purl.org/cognite/neat/neatId_fce69deb_af37_4c49_b1cf_caf569563ba7
|
|
106
117
|
nullable: true
|
|
107
118
|
value_type: timestamp
|
|
108
119
|
view: ClassicEvent
|
|
@@ -112,6 +123,7 @@ properties:
|
|
|
112
123
|
description: Text based labels for generic use, limited to 1000
|
|
113
124
|
immutable: false
|
|
114
125
|
is_list: true
|
|
126
|
+
neatId: http://purl.org/cognite/neat/neatId_0ed58b00_11ab_4774_9c66_d2eabc5f8f42
|
|
115
127
|
nullable: true
|
|
116
128
|
value_type: text
|
|
117
129
|
view: ClassicEvent
|
|
@@ -123,8 +135,9 @@ properties:
|
|
|
123
135
|
immutable: false
|
|
124
136
|
index: source
|
|
125
137
|
is_list: false
|
|
138
|
+
neatId: http://purl.org/cognite/neat/neatId_b0c7d726_6504_4189_896d_1b978d9ef5b2
|
|
126
139
|
nullable: true
|
|
127
|
-
value_type:
|
|
140
|
+
value_type: ClassicSourceSystem
|
|
128
141
|
view: ClassicEvent
|
|
129
142
|
view_property: source
|
|
130
143
|
- container: cdf_cdm:CogniteSchedulable
|
|
@@ -133,6 +146,7 @@ properties:
|
|
|
133
146
|
immutable: false
|
|
134
147
|
index: startTime
|
|
135
148
|
is_list: false
|
|
149
|
+
neatId: http://purl.org/cognite/neat/neatId_2304763f_d0f3_4723_a4c5_2e879069195d
|
|
136
150
|
nullable: true
|
|
137
151
|
value_type: timestamp
|
|
138
152
|
view: ClassicEvent
|
|
@@ -144,6 +158,7 @@ properties:
|
|
|
144
158
|
immutable: false
|
|
145
159
|
is_list: true
|
|
146
160
|
name: Assets
|
|
161
|
+
neatId: http://purl.org/cognite/neat/neatId_77ec0da0_839b_4b52_9f64_35382213dac6
|
|
147
162
|
nullable: true
|
|
148
163
|
value_type: ClassicAsset
|
|
149
164
|
view: ClassicFile
|
|
@@ -155,6 +170,7 @@ properties:
|
|
|
155
170
|
immutable: false
|
|
156
171
|
is_list: false
|
|
157
172
|
name: Directory
|
|
173
|
+
neatId: http://purl.org/cognite/neat/neatId_f06ff883_4f00_4a5d_b9c3_83664b62b573
|
|
158
174
|
nullable: true
|
|
159
175
|
value_type: text
|
|
160
176
|
view: ClassicFile
|
|
@@ -164,6 +180,7 @@ properties:
|
|
|
164
180
|
description: Text based labels for generic use, limited to 1000
|
|
165
181
|
immutable: false
|
|
166
182
|
is_list: true
|
|
183
|
+
neatId: http://purl.org/cognite/neat/neatId_5d721016_c99e_4f73_8e9d_bdd27b4472c3
|
|
167
184
|
nullable: true
|
|
168
185
|
value_type: text
|
|
169
186
|
view: ClassicFile
|
|
@@ -174,6 +191,7 @@ properties:
|
|
|
174
191
|
immutable: false
|
|
175
192
|
is_list: false
|
|
176
193
|
name: MIME type
|
|
194
|
+
neatId: http://purl.org/cognite/neat/neatId_d65bd20a_bcb9_4243_b3e9_06188378c4cc
|
|
177
195
|
nullable: true
|
|
178
196
|
value_type: text
|
|
179
197
|
view: ClassicFile
|
|
@@ -184,6 +202,7 @@ properties:
|
|
|
184
202
|
immutable: false
|
|
185
203
|
index: name
|
|
186
204
|
is_list: false
|
|
205
|
+
neatId: http://purl.org/cognite/neat/neatId_793d1480_2fba_4dde_8325_c11ef7e57de5
|
|
187
206
|
nullable: true
|
|
188
207
|
value_type: text
|
|
189
208
|
view: ClassicFile
|
|
@@ -195,8 +214,9 @@ properties:
|
|
|
195
214
|
immutable: false
|
|
196
215
|
index: source
|
|
197
216
|
is_list: false
|
|
217
|
+
neatId: http://purl.org/cognite/neat/neatId_87aa809b_a7cc_4136_885c_276844ed6b38
|
|
198
218
|
nullable: true
|
|
199
|
-
value_type:
|
|
219
|
+
value_type: ClassicSourceSystem
|
|
200
220
|
view: ClassicFile
|
|
201
221
|
view_property: source
|
|
202
222
|
- container: cdf_cdm:CogniteSourceable
|
|
@@ -205,6 +225,7 @@ properties:
|
|
|
205
225
|
immutable: false
|
|
206
226
|
index: sourceCreatedTime
|
|
207
227
|
is_list: false
|
|
228
|
+
neatId: http://purl.org/cognite/neat/neatId_26b7346d_3d5f_43a5_894e_96707e89227c
|
|
208
229
|
nullable: true
|
|
209
230
|
value_type: timestamp
|
|
210
231
|
view: ClassicFile
|
|
@@ -215,10 +236,20 @@ properties:
|
|
|
215
236
|
immutable: false
|
|
216
237
|
index: sourceUpdatedTime
|
|
217
238
|
is_list: false
|
|
239
|
+
neatId: http://purl.org/cognite/neat/neatId_4b6be7c8_8b26_4f11_9ad5_283123a54c91
|
|
218
240
|
nullable: true
|
|
219
241
|
value_type: timestamp
|
|
220
242
|
view: ClassicFile
|
|
221
243
|
view_property: sourceModifiedTime
|
|
244
|
+
- container: cdf_cdm:CogniteDescribable
|
|
245
|
+
container_property: name
|
|
246
|
+
immutable: false
|
|
247
|
+
is_list: false
|
|
248
|
+
neatId: http://purl.org/cognite/neat/neatId_7d7c614a_43ea_4fc2_abb0_3f3fdddaa239
|
|
249
|
+
nullable: true
|
|
250
|
+
value_type: text
|
|
251
|
+
view: ClassicSourceSystem
|
|
252
|
+
view_property: name
|
|
222
253
|
- connection: direct
|
|
223
254
|
container: cdf_cdm:CogniteTimeSeries
|
|
224
255
|
container_property: assets
|
|
@@ -226,6 +257,7 @@ properties:
|
|
|
226
257
|
immutable: false
|
|
227
258
|
is_list: true
|
|
228
259
|
name: Assets
|
|
260
|
+
neatId: http://purl.org/cognite/neat/neatId_bc4e12b0_82bd_4859_995d_d219181f9b52
|
|
229
261
|
nullable: true
|
|
230
262
|
value_type: ClassicAsset
|
|
231
263
|
view: ClassicTimeSeries
|
|
@@ -235,6 +267,7 @@ properties:
|
|
|
235
267
|
description: Description of the instance
|
|
236
268
|
immutable: false
|
|
237
269
|
is_list: false
|
|
270
|
+
neatId: http://purl.org/cognite/neat/neatId_73372a76_aa52_47c1_bdae_34bfbd80f572
|
|
238
271
|
nullable: true
|
|
239
272
|
value_type: text
|
|
240
273
|
view: ClassicTimeSeries
|
|
@@ -246,6 +279,7 @@ properties:
|
|
|
246
279
|
immutable: false
|
|
247
280
|
is_list: false
|
|
248
281
|
name: Is step
|
|
282
|
+
neatId: http://purl.org/cognite/neat/neatId_cfa476ae_125b_4e6a_8caf_152f44095037
|
|
249
283
|
nullable: false
|
|
250
284
|
value_type: boolean
|
|
251
285
|
view: ClassicTimeSeries
|
|
@@ -256,6 +290,7 @@ properties:
|
|
|
256
290
|
immutable: true
|
|
257
291
|
is_list: false
|
|
258
292
|
name: Type
|
|
293
|
+
neatId: http://purl.org/cognite/neat/neatId_7943437b_6138_47e6_889a_f414280df48e
|
|
259
294
|
nullable: false
|
|
260
295
|
value_type: enum(collection=timeseriesType)
|
|
261
296
|
view: ClassicTimeSeries
|
|
@@ -265,6 +300,7 @@ properties:
|
|
|
265
300
|
description: Alternative names for the node
|
|
266
301
|
immutable: false
|
|
267
302
|
is_list: true
|
|
303
|
+
neatId: http://purl.org/cognite/neat/neatId_15cfc454_8fc0_443b_8af6_9db5368d6fd4
|
|
268
304
|
nullable: true
|
|
269
305
|
value_type: text
|
|
270
306
|
view: ClassicTimeSeries
|
|
@@ -275,6 +311,7 @@ properties:
|
|
|
275
311
|
immutable: false
|
|
276
312
|
index: name
|
|
277
313
|
is_list: false
|
|
314
|
+
neatId: http://purl.org/cognite/neat/neatId_01370dd7_3371_40a1_b4eb_ddfcbbac63c8
|
|
278
315
|
nullable: true
|
|
279
316
|
value_type: text
|
|
280
317
|
view: ClassicTimeSeries
|
|
@@ -284,6 +321,7 @@ properties:
|
|
|
284
321
|
description: Text based labels for generic use, limited to 1000
|
|
285
322
|
immutable: false
|
|
286
323
|
is_list: true
|
|
324
|
+
neatId: http://purl.org/cognite/neat/neatId_d7e122ee_421a_490f_9bec_b0f9f5ececfd
|
|
287
325
|
nullable: true
|
|
288
326
|
value_type: text
|
|
289
327
|
view: ClassicTimeSeries
|
|
@@ -294,6 +332,7 @@ properties:
|
|
|
294
332
|
immutable: false
|
|
295
333
|
is_list: false
|
|
296
334
|
name: Source unit
|
|
335
|
+
neatId: http://purl.org/cognite/neat/neatId_3bfc11e0_9d27_47ea_841e_de1e4363dbed
|
|
297
336
|
nullable: true
|
|
298
337
|
value_type: text
|
|
299
338
|
view: ClassicTimeSeries
|
|
@@ -305,39 +344,46 @@ properties:
|
|
|
305
344
|
immutable: false
|
|
306
345
|
is_list: false
|
|
307
346
|
name: Unit
|
|
347
|
+
neatId: http://purl.org/cognite/neat/neatId_33b75362_e127_4a5a_9690_2df55501250c
|
|
308
348
|
nullable: true
|
|
309
349
|
value_type: cdf_cdm:CogniteUnit(version=v1)
|
|
310
350
|
view: ClassicTimeSeries
|
|
311
351
|
view_property: unitExternalId
|
|
312
352
|
views:
|
|
313
|
-
- description: The CogniteSourceSystem core concept is used to standardize the way
|
|
314
|
-
source system is stored.
|
|
315
|
-
implements: cdf_cdm:CogniteDescribable(version=v1)
|
|
316
|
-
in_model: true
|
|
317
|
-
view: cdf_cdm:CogniteSourceSystem(version=v1)
|
|
318
353
|
- description: Represents a single unit of measurement
|
|
319
354
|
implements: cdf_cdm:CogniteDescribable(version=v1)
|
|
320
355
|
in_model: true
|
|
356
|
+
neatId: http://purl.org/cognite/neat/neatId_f3397b4c_b6e0_4701_8ea3_7edbf72bf50d
|
|
321
357
|
view: cdf_cdm:CogniteUnit(version=v1)
|
|
322
358
|
- description: Assets represent systems that support industrial functions or processes.
|
|
323
359
|
Assets are often called 'functional location'.
|
|
324
360
|
implements: cdf_cdm:CogniteAsset(version=v1)
|
|
325
361
|
in_model: true
|
|
326
362
|
name: Asset
|
|
363
|
+
neatId: http://purl.org/cognite/neat/neatId_23380192_0c8a_4870_9684_cb91e5e5d67d
|
|
327
364
|
view: ClassicAsset
|
|
328
365
|
- description: Represents activities. Activities typically happen over a period and
|
|
329
366
|
have a start and end time.
|
|
330
367
|
implements: cdf_cdm:CogniteActivity(version=v1)
|
|
331
368
|
in_model: true
|
|
332
369
|
name: Activity
|
|
370
|
+
neatId: http://purl.org/cognite/neat/neatId_3c0bda0e_9af0_4c75_9f1c_d76a6eae2e44
|
|
333
371
|
view: ClassicEvent
|
|
334
372
|
- description: Represents files.
|
|
335
373
|
implements: cdf_cdm:CogniteFile(version=v1)
|
|
336
374
|
in_model: true
|
|
337
375
|
name: File
|
|
376
|
+
neatId: http://purl.org/cognite/neat/neatId_4a92bfcc_a259_4ec6_b58b_bdb386ba9ce2
|
|
338
377
|
view: ClassicFile
|
|
378
|
+
- description: The CogniteSourceSystem core concept is used to standardize the way
|
|
379
|
+
source system is stored.
|
|
380
|
+
implements: cdf_cdm:CogniteSourceSystem(version=v1)
|
|
381
|
+
in_model: true
|
|
382
|
+
neatId: http://purl.org/cognite/neat/neatId_280264e2_a809_4feb_81e3_454adc00fdde
|
|
383
|
+
view: ClassicSourceSystem
|
|
339
384
|
- description: Represents a series of data points in time order.
|
|
340
385
|
implements: cdf_cdm:CogniteTimeSeries(version=v1)
|
|
341
386
|
in_model: true
|
|
342
387
|
name: Time series
|
|
388
|
+
neatId: http://purl.org/cognite/neat/neatId_0730d4f7_51ce_40de_a8af_b9efff498b06
|
|
343
389
|
view: ClassicTimeSeries
|
|
@@ -14,21 +14,21 @@ from ._pipelines import ImporterPipeline
|
|
|
14
14
|
from ._verification import VerifyAnyRules, VerifyDMSRules, VerifyInformationRules
|
|
15
15
|
|
|
16
16
|
__all__ = [
|
|
17
|
-
"
|
|
18
|
-
"RulesTransformer",
|
|
19
|
-
"RulesPipeline",
|
|
20
|
-
"InformationToDMS",
|
|
17
|
+
"AsParentPropertyId",
|
|
21
18
|
"ConvertToRules",
|
|
22
|
-
"PrefixEntities",
|
|
23
19
|
"DMSToInformation",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"VerifyAnyRules",
|
|
20
|
+
"ImporterPipeline",
|
|
21
|
+
"InformationToDMS",
|
|
27
22
|
"MapOneToOne",
|
|
28
|
-
"
|
|
29
|
-
"RuleMapper",
|
|
30
|
-
"ToExtension",
|
|
23
|
+
"PrefixEntities",
|
|
31
24
|
"ReduceCogniteModel",
|
|
25
|
+
"RuleMapper",
|
|
26
|
+
"RulesPipeline",
|
|
27
|
+
"RulesTransformer",
|
|
32
28
|
"SetIDDMSModel",
|
|
33
|
-
"
|
|
29
|
+
"ToCompliantEntities",
|
|
30
|
+
"ToExtension",
|
|
31
|
+
"VerifyAnyRules",
|
|
32
|
+
"VerifyDMSRules",
|
|
33
|
+
"VerifyInformationRules",
|
|
34
34
|
]
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
from collections.abc import Iterable
|
|
2
|
+
from typing import TYPE_CHECKING
|
|
2
3
|
|
|
3
4
|
from cognite.neat._issues.errors import NeatValueError
|
|
4
5
|
from cognite.neat._rules._shared import InputRules, MaybeRules, VerifiedRules
|
|
5
|
-
from cognite.neat._rules.importers import BaseImporter
|
|
6
6
|
from cognite.neat._rules.models import VERIFIED_RULES_BY_ROLE, RoleTypes
|
|
7
7
|
|
|
8
8
|
from ._base import RulesPipeline, RulesTransformer
|
|
9
9
|
from ._converters import ConvertToRules
|
|
10
10
|
from ._verification import VerifyAnyRules
|
|
11
11
|
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from cognite.neat._rules.importers import BaseImporter
|
|
14
|
+
|
|
12
15
|
|
|
13
16
|
class ImporterPipeline(RulesPipeline[InputRules, VerifiedRules]):
|
|
14
17
|
"""This is a standard pipeline that verifies, convert and return the rules from the importer."""
|
|
15
18
|
|
|
16
19
|
def __init__(
|
|
17
20
|
self,
|
|
18
|
-
importer: BaseImporter[InputRules],
|
|
21
|
+
importer: "BaseImporter[InputRules]",
|
|
19
22
|
items: Iterable[RulesTransformer[InputRules, VerifiedRules]] | None = None,
|
|
20
23
|
) -> None:
|
|
21
24
|
super().__init__(items or [])
|
|
22
25
|
self._importer = importer
|
|
23
26
|
|
|
24
27
|
@classmethod
|
|
25
|
-
def _create_pipeline(
|
|
28
|
+
def _create_pipeline(
|
|
29
|
+
cls, importer: "BaseImporter[InputRules]", role: RoleTypes | None = None
|
|
30
|
+
) -> "ImporterPipeline":
|
|
26
31
|
items: list[RulesTransformer] = [VerifyAnyRules(errors="continue", validate=True)]
|
|
27
32
|
if role is not None:
|
|
28
33
|
out_cls = VERIFIED_RULES_BY_ROLE[role]
|
|
@@ -30,7 +35,7 @@ class ImporterPipeline(RulesPipeline[InputRules, VerifiedRules]):
|
|
|
30
35
|
return cls(importer, items)
|
|
31
36
|
|
|
32
37
|
@classmethod
|
|
33
|
-
def try_verify(cls, importer: BaseImporter, role: RoleTypes | None = None) -> MaybeRules[VerifiedRules]:
|
|
38
|
+
def try_verify(cls, importer: "BaseImporter", role: RoleTypes | None = None) -> MaybeRules[VerifiedRules]:
|
|
34
39
|
"""This is a standard pipeline that verifies, convert and return the rules from the importer.
|
|
35
40
|
|
|
36
41
|
Args:
|
|
@@ -43,7 +48,7 @@ class ImporterPipeline(RulesPipeline[InputRules, VerifiedRules]):
|
|
|
43
48
|
return cls._create_pipeline(importer, role).try_execute()
|
|
44
49
|
|
|
45
50
|
@classmethod
|
|
46
|
-
def verify(cls, importer: BaseImporter, role: RoleTypes | None = None) -> VerifiedRules:
|
|
51
|
+
def verify(cls, importer: "BaseImporter", role: RoleTypes | None = None) -> VerifiedRules:
|
|
47
52
|
"""Verify the rules."""
|
|
48
53
|
return cls._create_pipeline(importer, role).execute()
|
|
49
54
|
|
cognite/neat/_session/_base.py
CHANGED
|
@@ -54,6 +54,26 @@ class NeatSession:
|
|
|
54
54
|
load_engine: Whether to load the Neat Engine. Can be "newest", "cache", or "skip". "newest" will always
|
|
55
55
|
check for the newest version of the engine. "cache" will load the engine if it has been downloaded before.
|
|
56
56
|
"skip" will not load the engine.
|
|
57
|
+
|
|
58
|
+
Example:
|
|
59
|
+
Instantiate a NeatSession outside CDF jupyter notebook (needs instantiation of a CogniteClient)
|
|
60
|
+
```python
|
|
61
|
+
from cognite.neat import get_cognite_client
|
|
62
|
+
from cognite.neat import NeatSession
|
|
63
|
+
|
|
64
|
+
client = get_cognite_client(env_file_name=".env")
|
|
65
|
+
neat = NeatSession(client)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Example:
|
|
69
|
+
Instantiate a NeatSession inside a CDF jupyter notebook (use your user's CogniteClient directly)
|
|
70
|
+
```python
|
|
71
|
+
from cognite.client import CogniteClient
|
|
72
|
+
from cognite.neat import NeatSession
|
|
73
|
+
|
|
74
|
+
client = CogniteClient()
|
|
75
|
+
neat = NeatSession(client)
|
|
76
|
+
```
|
|
57
77
|
"""
|
|
58
78
|
|
|
59
79
|
def __init__(
|
|
@@ -81,9 +101,33 @@ class NeatSession:
|
|
|
81
101
|
|
|
82
102
|
@property
|
|
83
103
|
def version(self) -> str:
|
|
104
|
+
"""Get the current version of neat.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
The current version of neat used in the session.
|
|
108
|
+
|
|
109
|
+
Example:
|
|
110
|
+
```python
|
|
111
|
+
neat.version
|
|
112
|
+
```
|
|
113
|
+
"""
|
|
84
114
|
return _version.__version__
|
|
85
115
|
|
|
86
116
|
def verify(self) -> IssueList:
|
|
117
|
+
"""
|
|
118
|
+
Verify the Data Model schema before the model can be written to CDF. If verification was unsuccessful, use
|
|
119
|
+
`.inspect.issues()` to see what went wrong.
|
|
120
|
+
|
|
121
|
+
Example:
|
|
122
|
+
Verify a data model after reading a source file and inferring the data model
|
|
123
|
+
```python
|
|
124
|
+
# From an active NeatSession
|
|
125
|
+
...
|
|
126
|
+
neat.read.xml.dexpi("url_or_path_to_dexpi_file")
|
|
127
|
+
neat.infer()
|
|
128
|
+
neat.verify()
|
|
129
|
+
```
|
|
130
|
+
"""
|
|
87
131
|
source_id, last_unverified_rule = self._state.data_model.last_unverified_rule
|
|
88
132
|
transformer = VerifyAnyRules("continue", validate=False)
|
|
89
133
|
start = datetime.now(timezone.utc)
|
|
@@ -135,6 +179,18 @@ class NeatSession:
|
|
|
135
179
|
target: The target type to convert the data model to.
|
|
136
180
|
mode: If the target is "dms", the mode to use for the conversion. None is used for default conversion.
|
|
137
181
|
"edge_properties" treas classes that implements Edge as edge properties.
|
|
182
|
+
|
|
183
|
+
Example:
|
|
184
|
+
Convert to DMS rules
|
|
185
|
+
```python
|
|
186
|
+
neat.convert(target="dms")
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Example:
|
|
190
|
+
Convert to Information rules
|
|
191
|
+
```python
|
|
192
|
+
neat.convert(target="information")
|
|
193
|
+
```
|
|
138
194
|
"""
|
|
139
195
|
start = datetime.now(timezone.utc)
|
|
140
196
|
issues = IssueList()
|
|
@@ -196,6 +252,15 @@ class NeatSession:
|
|
|
196
252
|
Args:
|
|
197
253
|
model_id: The ID of the inferred data model.
|
|
198
254
|
max_number_of_instance: The maximum number of instances to use for inference.
|
|
255
|
+
|
|
256
|
+
Example:
|
|
257
|
+
Infer a data model after reading a source file
|
|
258
|
+
```python
|
|
259
|
+
# From an active NeatSession
|
|
260
|
+
...
|
|
261
|
+
neat.read.xml.dexpi("url_or_path_to_dexpi_file")
|
|
262
|
+
neat.infer()
|
|
263
|
+
```
|
|
199
264
|
"""
|
|
200
265
|
model_id = dm.DataModelId.load(model_id)
|
|
201
266
|
|
|
@@ -254,6 +319,10 @@ class NeatSession:
|
|
|
254
319
|
|
|
255
320
|
@session_class_wrapper
|
|
256
321
|
class OptAPI:
|
|
322
|
+
"""For the user to decide if they want their usage of neat to be collected or not. We do not collect personal
|
|
323
|
+
information like name etc. only usage.
|
|
324
|
+
"""
|
|
325
|
+
|
|
257
326
|
def __init__(self, collector: Collector | None = None) -> None:
|
|
258
327
|
self._collector = collector or _COLLECTOR
|
|
259
328
|
|
|
@@ -268,9 +337,11 @@ class OptAPI:
|
|
|
268
337
|
)
|
|
269
338
|
|
|
270
339
|
def in_(self) -> None:
|
|
340
|
+
"""Consent to collection of neat user insights."""
|
|
271
341
|
self._collector.enable()
|
|
272
342
|
print("You have successfully opted in to data collection.")
|
|
273
343
|
|
|
274
344
|
def out(self) -> None:
|
|
345
|
+
"""Opt out of allowing usage of neat to be collected from current user."""
|
|
275
346
|
self._collector.disable()
|
|
276
347
|
print("You have successfully opted out of data collection.")
|
|
@@ -60,7 +60,7 @@ class Collector:
|
|
|
60
60
|
if len(args) > 1:
|
|
61
61
|
# The first argument is self.
|
|
62
62
|
for i, arg in enumerate(args[1:]):
|
|
63
|
-
event_information[f"arg{i}"] = arg
|
|
63
|
+
event_information[f"arg{i}"] = self._serialize_value(arg)[:500]
|
|
64
64
|
|
|
65
65
|
if kwargs:
|
|
66
66
|
for key, value in kwargs.items():
|
|
@@ -73,6 +73,8 @@ class Collector:
|
|
|
73
73
|
return str(value)
|
|
74
74
|
if isinstance(value, list | tuple | dict):
|
|
75
75
|
return str(value)
|
|
76
|
+
if callable(value):
|
|
77
|
+
return value.__name__
|
|
76
78
|
return str(type(value))
|
|
77
79
|
|
|
78
80
|
def _track(self, event_name: str, event_information: dict[str, Any]) -> bool:
|
cognite/neat/_session/_drop.py
CHANGED
|
@@ -11,6 +11,10 @@ except ImportError:
|
|
|
11
11
|
|
|
12
12
|
@session_class_wrapper
|
|
13
13
|
class DropAPI:
|
|
14
|
+
"""
|
|
15
|
+
Drop instances from the session. Check out `.instances()` for performing the operation.
|
|
16
|
+
"""
|
|
17
|
+
|
|
14
18
|
def __init__(self, state: SessionState):
|
|
15
19
|
self._state = state
|
|
16
20
|
|
|
@@ -19,6 +23,12 @@ class DropAPI:
|
|
|
19
23
|
|
|
20
24
|
Args:
|
|
21
25
|
type: The type of instances to drop.
|
|
26
|
+
|
|
27
|
+
Example:
|
|
28
|
+
```python
|
|
29
|
+
node_type_to_drop = "Pump"
|
|
30
|
+
neat.drop.instances(node_type_to_drop)
|
|
31
|
+
```
|
|
22
32
|
"""
|
|
23
33
|
type_list = type if isinstance(type, list) else [type]
|
|
24
34
|
uri_type_type = dict((v, k) for k, v in self._state.instances.store.queries.types.items())
|
|
@@ -21,6 +21,28 @@ except ImportError:
|
|
|
21
21
|
|
|
22
22
|
@session_class_wrapper
|
|
23
23
|
class InspectAPI:
|
|
24
|
+
"""Inspect issues or outcomes after performing operations with NeatSession.
|
|
25
|
+
To inspect properties of the current data model, try out `.properties()`.
|
|
26
|
+
|
|
27
|
+
Example:
|
|
28
|
+
Inspect issues
|
|
29
|
+
```python
|
|
30
|
+
neat.inspect.issues()
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Example:
|
|
34
|
+
Inspect outcome after writing a data model
|
|
35
|
+
```python
|
|
36
|
+
neat.inspect.outcome.data_model()
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Example:
|
|
40
|
+
Inspect outcome after writing instances
|
|
41
|
+
```python
|
|
42
|
+
neat.inspect.outcome.instances()
|
|
43
|
+
```
|
|
44
|
+
"""
|
|
45
|
+
|
|
24
46
|
def __init__(self, state: SessionState) -> None:
|
|
25
47
|
self._state = state
|
|
26
48
|
self.issues = InspectIssues(state)
|
|
@@ -28,7 +50,15 @@ class InspectAPI:
|
|
|
28
50
|
|
|
29
51
|
@property
|
|
30
52
|
def properties(self) -> pd.DataFrame:
|
|
31
|
-
"""Returns the properties of the current data model.
|
|
53
|
+
"""Returns the properties of the current data model.
|
|
54
|
+
|
|
55
|
+
Example:
|
|
56
|
+
Inspect properties of the current data model
|
|
57
|
+
```python
|
|
58
|
+
# From an active NeatSession
|
|
59
|
+
neat.inspect.properties
|
|
60
|
+
```
|
|
61
|
+
"""
|
|
32
62
|
return self._state.data_model.last_verified_rule[1].properties.to_pandas()
|
|
33
63
|
|
|
34
64
|
|
|
@@ -106,6 +136,10 @@ class InspectIssues:
|
|
|
106
136
|
|
|
107
137
|
@session_class_wrapper
|
|
108
138
|
class InspectOutcome:
|
|
139
|
+
"""
|
|
140
|
+
Inspect the outcome after writing a Data Model and Instances to CDF.
|
|
141
|
+
"""
|
|
142
|
+
|
|
109
143
|
def __init__(self, state: SessionState) -> None:
|
|
110
144
|
self.data_model = InspectUploadOutcome(lambda: state.data_model.last_outcome)
|
|
111
145
|
self.instances = InspectUploadOutcome(lambda: state.instances.last_outcome)
|
|
@@ -38,6 +38,11 @@ class DataModelMappingAPI:
|
|
|
38
38
|
If you extend CogniteAsset, with for example, ClassicAsset. You will map the property `parentId` to `parent`.
|
|
39
39
|
If you set `user_parent_property_name` to True, the `parentId` will be renamed to `parent` after the
|
|
40
40
|
mapping is done. If you set it to False, the property will remain `parentId`.
|
|
41
|
+
|
|
42
|
+
Example:
|
|
43
|
+
```python
|
|
44
|
+
neat.mapping.classic_to_core(company_prefix="WindFarmX", use_parent_property_name=True)
|
|
45
|
+
```
|
|
41
46
|
"""
|
|
42
47
|
source_id, rules = self._state.data_model.last_verified_dms_rules
|
|
43
48
|
|