cognite-neat 0.109.4__py3-none-any.whl → 0.111.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/_alpha.py +8 -0
- cognite/neat/_client/_api/schema.py +43 -1
- cognite/neat/_client/data_classes/schema.py +4 -4
- cognite/neat/_constants.py +15 -1
- cognite/neat/_graph/extractors/__init__.py +4 -0
- cognite/neat/_graph/extractors/_classic_cdf/_base.py +8 -16
- cognite/neat/_graph/extractors/_classic_cdf/_classic.py +48 -19
- cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +23 -17
- cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +15 -17
- cognite/neat/_graph/extractors/_dict.py +102 -0
- cognite/neat/_graph/extractors/_dms.py +27 -40
- cognite/neat/_graph/extractors/_dms_graph.py +30 -3
- cognite/neat/_graph/extractors/_iodd.py +3 -3
- cognite/neat/_graph/extractors/_mock_graph_generator.py +9 -7
- cognite/neat/_graph/extractors/_raw.py +67 -0
- cognite/neat/_graph/loaders/_base.py +20 -4
- cognite/neat/_graph/loaders/_rdf2dms.py +476 -383
- cognite/neat/_graph/queries/_base.py +163 -133
- cognite/neat/_graph/transformers/__init__.py +1 -3
- cognite/neat/_graph/transformers/_classic_cdf.py +6 -22
- cognite/neat/_graph/transformers/_rdfpath.py +2 -49
- cognite/neat/_issues/__init__.py +1 -6
- cognite/neat/_issues/_base.py +21 -252
- cognite/neat/_issues/_contextmanagers.py +46 -0
- cognite/neat/_issues/_factory.py +69 -0
- cognite/neat/_issues/errors/__init__.py +20 -4
- cognite/neat/_issues/errors/_external.py +7 -0
- cognite/neat/_issues/errors/_wrapper.py +81 -3
- cognite/neat/_issues/formatters.py +4 -4
- cognite/neat/_issues/warnings/__init__.py +3 -2
- cognite/neat/_issues/warnings/_properties.py +8 -0
- cognite/neat/_issues/warnings/user_modeling.py +12 -0
- cognite/neat/_rules/_constants.py +12 -0
- cognite/neat/_rules/_shared.py +3 -2
- cognite/neat/_rules/analysis/__init__.py +2 -3
- cognite/neat/_rules/analysis/_base.py +430 -259
- cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
- cognite/neat/_rules/exporters/_rules2excel.py +3 -9
- cognite/neat/_rules/exporters/_rules2instance_template.py +2 -2
- cognite/neat/_rules/exporters/_rules2ontology.py +5 -4
- cognite/neat/_rules/importers/_base.py +2 -47
- cognite/neat/_rules/importers/_dms2rules.py +7 -10
- cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +2 -2
- cognite/neat/_rules/importers/_rdf/_inference2rules.py +66 -26
- cognite/neat/_rules/importers/_rdf/_shared.py +1 -1
- cognite/neat/_rules/importers/_spreadsheet2rules.py +12 -9
- cognite/neat/_rules/models/_base_rules.py +0 -2
- cognite/neat/_rules/models/data_types.py +7 -0
- cognite/neat/_rules/models/dms/_exporter.py +9 -8
- cognite/neat/_rules/models/dms/_rules.py +29 -2
- cognite/neat/_rules/models/dms/_rules_input.py +9 -1
- cognite/neat/_rules/models/dms/_validation.py +115 -5
- cognite/neat/_rules/models/entities/_loaders.py +1 -1
- cognite/neat/_rules/models/entities/_multi_value.py +2 -2
- cognite/neat/_rules/models/entities/_single_value.py +8 -3
- cognite/neat/_rules/models/entities/_wrapped.py +2 -2
- cognite/neat/_rules/models/information/_rules.py +18 -17
- cognite/neat/_rules/models/information/_rules_input.py +3 -1
- cognite/neat/_rules/models/information/_validation.py +66 -17
- cognite/neat/_rules/transformers/__init__.py +8 -2
- cognite/neat/_rules/transformers/_converters.py +234 -44
- cognite/neat/_rules/transformers/_verification.py +5 -10
- cognite/neat/_session/_base.py +6 -4
- cognite/neat/_session/_explore.py +39 -0
- cognite/neat/_session/_inspect.py +25 -6
- cognite/neat/_session/_prepare.py +12 -0
- cognite/neat/_session/_read.py +88 -20
- cognite/neat/_session/_set.py +7 -1
- cognite/neat/_session/_show.py +11 -123
- cognite/neat/_session/_state.py +6 -2
- cognite/neat/_session/_subset.py +64 -0
- cognite/neat/_session/_to.py +177 -19
- cognite/neat/_store/_graph_store.py +9 -246
- cognite/neat/_utils/rdf_.py +36 -5
- cognite/neat/_utils/spreadsheet.py +44 -1
- cognite/neat/_utils/text.py +124 -37
- cognite/neat/_utils/upload.py +2 -0
- cognite/neat/_version.py +2 -2
- {cognite_neat-0.109.4.dist-info → cognite_neat-0.111.0.dist-info}/METADATA +1 -1
- {cognite_neat-0.109.4.dist-info → cognite_neat-0.111.0.dist-info}/RECORD +83 -82
- {cognite_neat-0.109.4.dist-info → cognite_neat-0.111.0.dist-info}/WHEEL +1 -1
- cognite/neat/_graph/queries/_construct.py +0 -187
- cognite/neat/_graph/queries/_shared.py +0 -173
- cognite/neat/_rules/analysis/_dms.py +0 -57
- cognite/neat/_rules/analysis/_information.py +0 -249
- cognite/neat/_rules/models/_rdfpath.py +0 -372
- {cognite_neat-0.109.4.dist-info → cognite_neat-0.111.0.dist-info}/LICENSE +0 -0
- {cognite_neat-0.109.4.dist-info → cognite_neat-0.111.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
cognite/neat/__init__.py,sha256=AXLMIF5t8RmjOpSaIlfqT8ltbPc__Tb8nAVbc1pkE0Q,176
|
|
2
|
-
cognite/neat/_alpha.py,sha256=
|
|
2
|
+
cognite/neat/_alpha.py,sha256=522yLo11tHaA5R4W-hEoXX12jJm5dTLzHixV6z3dn24,891
|
|
3
3
|
cognite/neat/_client/__init__.py,sha256=RQ7MwL8mwGqGHokRzsPqO3XStDzmI4-c12_gz1UPJ74,177
|
|
4
4
|
cognite/neat/_client/_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
cognite/neat/_client/_api/data_modeling_loaders.py,sha256=0BZ5_NeszBvs4DHuHr0cGXytmvkTxrQ8k7v6iaX_mn4,35932
|
|
6
|
-
cognite/neat/_client/_api/schema.py,sha256=
|
|
6
|
+
cognite/neat/_client/_api/schema.py,sha256=K8iNuTKHayHGVldMWfY8N6KWG71hOpNIklWGsAkCPMY,6925
|
|
7
7
|
cognite/neat/_client/_api_client.py,sha256=6cNMizDuqMJZiOqiNRLX46BEtlCB-BpgGLyypksRVYU,616
|
|
8
8
|
cognite/neat/_client/data_classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
cognite/neat/_client/data_classes/data_modeling.py,sha256=RvpUp9ygd-yffQFJ7O2mQqMLDPIa-dmip5zPb8QVIiw,6672
|
|
10
10
|
cognite/neat/_client/data_classes/neat_sequence.py,sha256=QZWSfWnwk6KlYJvsInco4Wdwc1U8DnOQKWmHebArbQY,10830
|
|
11
|
-
cognite/neat/_client/data_classes/schema.py,sha256=
|
|
11
|
+
cognite/neat/_client/data_classes/schema.py,sha256=jPFTIKrZI0qZtwu1Bc1m3aLu_VbxIEkhZCneHpIbNkc,23205
|
|
12
12
|
cognite/neat/_client/testing.py,sha256=M5WUzi3YbtZAN22TXas0SjvMSxmjPFT5m3lNwR0MVkI,1077
|
|
13
13
|
cognite/neat/_config.py,sha256=WT1BS8uADcFvGoUYOOfwFOVq_VBl472TisdoA3wLick,280
|
|
14
|
-
cognite/neat/_constants.py,sha256=
|
|
14
|
+
cognite/neat/_constants.py,sha256=5yqCdCckVDu4uVycN3gPrYNpoe8XLEhdzxiXt9X-LQs,6300
|
|
15
15
|
cognite/neat/_graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
cognite/neat/_graph/_shared.py,sha256=6avH6mtjxjHI7JDLkXwICxGvZwooGBr6APs1_w1To-A,940
|
|
17
17
|
cognite/neat/_graph/_tracking/__init__.py,sha256=WOwsYieZtCW-iW15YkxUFrfKVVdLWdXHOGGStTwvE8A,91
|
|
@@ -21,134 +21,135 @@ cognite/neat/_graph/examples/Knowledge-Graph-Nordic44-dirty.xml,sha256=ujJip6XBs
|
|
|
21
21
|
cognite/neat/_graph/examples/Knowledge-Graph-Nordic44.xml,sha256=U2Ns-M4LRjT1fBkhmRj63ur7jDzlRtHK9yOLf_npZ_g,1437996
|
|
22
22
|
cognite/neat/_graph/examples/__init__.py,sha256=yAjHVY3b5jOjmbW-iLbhvu7BG014TpGi3K4igkDqW5I,368
|
|
23
23
|
cognite/neat/_graph/examples/skos-capturing-sheet-wind-topics.xlsx,sha256=CV_yK5ZSbYS_ktfIZUPD8Sevs47zpswLXQUDFkGE4Gw,45798
|
|
24
|
-
cognite/neat/_graph/extractors/__init__.py,sha256=
|
|
24
|
+
cognite/neat/_graph/extractors/__init__.py,sha256=v7hPDaRzI4koBTesbCgcxTb2W0Eoqydir7AVikT1_wk,2362
|
|
25
25
|
cognite/neat/_graph/extractors/_base.py,sha256=qQE-fl3f1hfqZg5KLF3zLHybP0u8ofRKf4jk7pEHnl4,1907
|
|
26
26
|
cognite/neat/_graph/extractors/_classic_cdf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
27
|
cognite/neat/_graph/extractors/_classic_cdf/_assets.py,sha256=9WVFrAtUFAp_AAlb26Rtt2Axz9xsPQYetg7SKVrNCr4,1474
|
|
28
|
-
cognite/neat/_graph/extractors/_classic_cdf/_base.py,sha256=
|
|
29
|
-
cognite/neat/_graph/extractors/_classic_cdf/_classic.py,sha256=
|
|
28
|
+
cognite/neat/_graph/extractors/_classic_cdf/_base.py,sha256=ZDnxqbgKE2ps8kVFLOqDGYPT0SPvEBg5D977NAxWRSA,15836
|
|
29
|
+
cognite/neat/_graph/extractors/_classic_cdf/_classic.py,sha256=uf1lo-OfsXwBqRyfHsvIbw7Gaf3d8lZZxhvLYrACdqg,20331
|
|
30
30
|
cognite/neat/_graph/extractors/_classic_cdf/_data_sets.py,sha256=xRFv9pVFgIMTZ45E8teMC0Ynku_CuZdcZkVCbhPuPBk,1294
|
|
31
31
|
cognite/neat/_graph/extractors/_classic_cdf/_events.py,sha256=B8hRoMAg8GQvApjxals5PfPyjmdPO93U3nj_G7g0kDQ,1394
|
|
32
32
|
cognite/neat/_graph/extractors/_classic_cdf/_files.py,sha256=Q816cVQ9qS7Art66HJfErL2OV7MxH_eSIG7bJ8_HJ7Q,1406
|
|
33
33
|
cognite/neat/_graph/extractors/_classic_cdf/_labels.py,sha256=7guTZdGFT1r7ItE2VNgXwbBZ1y_005oB3fg1XbwT7WQ,2083
|
|
34
|
-
cognite/neat/_graph/extractors/_classic_cdf/_relationships.py,sha256=
|
|
35
|
-
cognite/neat/_graph/extractors/_classic_cdf/_sequences.py,sha256=
|
|
34
|
+
cognite/neat/_graph/extractors/_classic_cdf/_relationships.py,sha256=wQDR0DFmGqXFiRHxQtQWNTVk4zVKhZzjrCfCHihXvlU,5293
|
|
35
|
+
cognite/neat/_graph/extractors/_classic_cdf/_sequences.py,sha256=HxN0mnm5GrPAfcN5C90b6LA5FXaevYiGhgeEwLTdbgo,11209
|
|
36
36
|
cognite/neat/_graph/extractors/_classic_cdf/_timeseries.py,sha256=6CmmxWWG2IErfNKOPhsjQ5wSOTUZZMjulpaRbHj0Q-g,1560
|
|
37
37
|
cognite/neat/_graph/extractors/_dexpi.py,sha256=SFWnKXYpQToWag9aoX8fxISNa9b8KlqjZnkwI18BzNY,9431
|
|
38
|
-
cognite/neat/_graph/extractors/
|
|
39
|
-
cognite/neat/_graph/extractors/
|
|
40
|
-
cognite/neat/_graph/extractors/
|
|
41
|
-
cognite/neat/_graph/extractors/
|
|
38
|
+
cognite/neat/_graph/extractors/_dict.py,sha256=CmXvYkzhRjWDPEaXZAb_YyWCwJDeNzdWBkmFyc2K90s,4321
|
|
39
|
+
cognite/neat/_graph/extractors/_dms.py,sha256=_y-qgDiYEILdwAVEwYj9trxbPsf1mV9fBGVL8vZunJc,12934
|
|
40
|
+
cognite/neat/_graph/extractors/_dms_graph.py,sha256=b_OpXsLZ1xCGEWAqsF5Qk6EknZzxDbcfaZ5NOZGaYrE,9441
|
|
41
|
+
cognite/neat/_graph/extractors/_iodd.py,sha256=sV5xKZi2ZT7MQsUQTVji9vxH34pD5yAvUjtT-gb8mts,18473
|
|
42
|
+
cognite/neat/_graph/extractors/_mock_graph_generator.py,sha256=k6qVslbxwE2WpU1L5NLgHJExk8Sho96Ag6-_bcCiLwA,15436
|
|
43
|
+
cognite/neat/_graph/extractors/_raw.py,sha256=xU3SmeLBCeqbs1WBdGCge8ZMnlOU6wgkKX5GRNXc0D0,2499
|
|
42
44
|
cognite/neat/_graph/extractors/_rdf_file.py,sha256=vz145N1_ZDAlAzCuMiv2z5-7Z4nG2fciLMnl9OpEc3M,2857
|
|
43
45
|
cognite/neat/_graph/loaders/__init__.py,sha256=XS6vwmxgBzntg7UuG_ct_1hfhShVnFH5u0gGrdA8WfA,699
|
|
44
|
-
cognite/neat/_graph/loaders/_base.py,sha256=
|
|
45
|
-
cognite/neat/_graph/loaders/_rdf2dms.py,sha256=
|
|
46
|
+
cognite/neat/_graph/loaders/_base.py,sha256=Xq91-4GeQF2XN90-QgEFCU4aJabBXkeFeFXS2k4mWU4,4472
|
|
47
|
+
cognite/neat/_graph/loaders/_rdf2dms.py,sha256=04vU32Jlma2YYzJQuUEPCAfRJoXgygHJQZ4t72fISYI,34308
|
|
46
48
|
cognite/neat/_graph/queries/__init__.py,sha256=BgDd-037kvtWwAoGAy8eORVNMiZ5-E9sIV0txIpeaN4,50
|
|
47
|
-
cognite/neat/_graph/queries/_base.py,sha256=
|
|
48
|
-
cognite/neat/_graph/
|
|
49
|
-
cognite/neat/_graph/queries/_shared.py,sha256=uhw-nY4jJvivgtj1msdCRrfTWgauU7ybSHUqqUaFOUU,5390
|
|
50
|
-
cognite/neat/_graph/transformers/__init__.py,sha256=YQoJ2vuZ2bo1cSnzWM_exw3pkzQFiBRb-0uUMpXb178,1850
|
|
49
|
+
cognite/neat/_graph/queries/_base.py,sha256=xs_kCiqQFJfaPyYrKhpyPIAvyDOf19RgYcdg3WxjB6s,19344
|
|
50
|
+
cognite/neat/_graph/transformers/__init__.py,sha256=YzC1Z8BuT77NwagWX4Z-F9R9BARLSS7zM4bCdxBbqKg,1761
|
|
51
51
|
cognite/neat/_graph/transformers/_base.py,sha256=8W_PSlsp-jQuKNb9z-lN0Khdq1tKsnWxXAMj2XnXcTc,4561
|
|
52
|
-
cognite/neat/_graph/transformers/_classic_cdf.py,sha256=
|
|
52
|
+
cognite/neat/_graph/transformers/_classic_cdf.py,sha256=XjsMj5J0cmZyNzuGnGdlWec_drjaUNSgWwqIIa-YE7Y,25294
|
|
53
53
|
cognite/neat/_graph/transformers/_iodd.py,sha256=KNz1fPdKK40UaHgPMECzNZgSeU5PdPRyLdaRYdq1iug,866
|
|
54
54
|
cognite/neat/_graph/transformers/_prune_graph.py,sha256=X9wVOBl3mhcPB-SSqWvJHV1hNIq7ra4_HX4_2lpT74Y,12438
|
|
55
|
-
cognite/neat/_graph/transformers/_rdfpath.py,sha256=
|
|
55
|
+
cognite/neat/_graph/transformers/_rdfpath.py,sha256=9KCiq8UCeNWcV9VAmyV5gbqwmozUaHRJuMyzVmL3ji4,3156
|
|
56
56
|
cognite/neat/_graph/transformers/_value_type.py,sha256=wsuiIKHG6O8F7PaedicMfynTxiVpLZ55zwVU3mCDEYw,15679
|
|
57
|
-
cognite/neat/_issues/__init__.py,sha256=
|
|
58
|
-
cognite/neat/_issues/_base.py,sha256=
|
|
59
|
-
cognite/neat/_issues/
|
|
60
|
-
cognite/neat/_issues/
|
|
57
|
+
cognite/neat/_issues/__init__.py,sha256=NQ-PN3fqp-hBPlpG2AZEND4cDn3_3UXAPfhLNtF5mtc,457
|
|
58
|
+
cognite/neat/_issues/_base.py,sha256=UDcx0s9_PqLD4z1NnOxI4wgsk2z6IiVCuJoG-V8aPyQ,11671
|
|
59
|
+
cognite/neat/_issues/_contextmanagers.py,sha256=Qve1778doz41N6NYxs_lVhJfvUEtD1r-WwBv386UUnc,1502
|
|
60
|
+
cognite/neat/_issues/_factory.py,sha256=aSEWacUkFxU6z5RVMq0DOZMrS3lwFJ0tpqltq_QyNZg,3000
|
|
61
|
+
cognite/neat/_issues/errors/__init__.py,sha256=1MK8nHFrN5c2Uiq9r4PkjL8GnBY7TGhcqGNkgQzVmKs,2359
|
|
62
|
+
cognite/neat/_issues/errors/_external.py,sha256=WISG6rA0GH7lD23hN7WDhDIfOh9QrsXUDSxMCkTcBj4,2210
|
|
61
63
|
cognite/neat/_issues/errors/_general.py,sha256=MnBm9V1S-Agr9kUfTMvviBB4_NkuOXamlgJCu2UojEM,849
|
|
62
64
|
cognite/neat/_issues/errors/_properties.py,sha256=T_nquQeEQS3DQY--DQ13acxhGX_-gpUMjWGTBKCh6r8,2536
|
|
63
65
|
cognite/neat/_issues/errors/_resources.py,sha256=qndhGGPdulWpU7G4PkFHsF4Bjflf3lehGV4A0l-BeNI,3966
|
|
64
|
-
cognite/neat/_issues/errors/_wrapper.py,sha256=
|
|
65
|
-
cognite/neat/_issues/formatters.py,sha256=
|
|
66
|
-
cognite/neat/_issues/warnings/__init__.py,sha256=
|
|
66
|
+
cognite/neat/_issues/errors/_wrapper.py,sha256=QkAjvryW5RFZV8sSRXu-EFtnZaxH2GO5g67rxXwPFUo,2307
|
|
67
|
+
cognite/neat/_issues/formatters.py,sha256=XgtfnnDkXY_LE8xPpFfm2N9yXN6aY4d9NZhsix_WgHo,3315
|
|
68
|
+
cognite/neat/_issues/warnings/__init__.py,sha256=dkrlKW0ykp0mw5uwN12oBeYFtb-KDefdt1uP-ak-1Ug,2941
|
|
67
69
|
cognite/neat/_issues/warnings/_external.py,sha256=O5GSRmIsAC6HyToQ7itpFFNILWCAg0OehPTVUy8pTuc,1319
|
|
68
70
|
cognite/neat/_issues/warnings/_general.py,sha256=idZZZDbeSrDJJ1PomdmIO40QsZQNn_lWztWvMA-9q50,782
|
|
69
71
|
cognite/neat/_issues/warnings/_models.py,sha256=cowgEjD7OMgTY7OpJT5WGxMFrCjdM3YUWYsw7lzroeI,4373
|
|
70
|
-
cognite/neat/_issues/warnings/_properties.py,sha256=
|
|
72
|
+
cognite/neat/_issues/warnings/_properties.py,sha256=PWACBtbMEeWuSp1tcgoGmTHS2Nd-rJ4I-t5mEewzexc,3206
|
|
71
73
|
cognite/neat/_issues/warnings/_resources.py,sha256=oyKVzwpMKFMaG4A-ei-5md4ap7rvvSA5RW7ZTJVwC68,3552
|
|
72
|
-
cognite/neat/_issues/warnings/user_modeling.py,sha256=
|
|
74
|
+
cognite/neat/_issues/warnings/user_modeling.py,sha256=V6ZzRVGMxiNq9EeIqzohLxTsBEsVGdyicDDM28hNTPQ,4139
|
|
73
75
|
cognite/neat/_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
|
-
cognite/neat/_rules/_constants.py,sha256=
|
|
75
|
-
cognite/neat/_rules/_shared.py,sha256=
|
|
76
|
-
cognite/neat/_rules/analysis/__init__.py,sha256=
|
|
77
|
-
cognite/neat/_rules/analysis/_base.py,sha256=
|
|
78
|
-
cognite/neat/_rules/analysis/_dms.py,sha256=k9OrN6kRCcdPr8GCJDRXyF0nNXmBYJQDtoGqw7R87po,2204
|
|
79
|
-
cognite/neat/_rules/analysis/_information.py,sha256=F3fAsQS8gLTfyy4z4t4cNaoMqU9TyDRzEOMzid6FJDc,10727
|
|
76
|
+
cognite/neat/_rules/_constants.py,sha256=XRcbXDyVlm9WkcMyJJUi8SfpLDWZTqERU7RMgZo3TSk,5922
|
|
77
|
+
cognite/neat/_rules/_shared.py,sha256=XPC1NhkzYoSew0_F7JC_J6chNFLaC_rjfPpfcMcYzfc,1349
|
|
78
|
+
cognite/neat/_rules/analysis/__init__.py,sha256=0Y7KiXpzrwOIU7GVlC3zlizj1TXe6sodAJzMh1rTZLE,62
|
|
79
|
+
cognite/neat/_rules/analysis/_base.py,sha256=naqyccPPbRFQdzwpR-sNvRgbeJzzFcJdCQJ5xwmLYxU,23404
|
|
80
80
|
cognite/neat/_rules/catalog/__init__.py,sha256=dwDB8b-5GKZuwVyPuiwsH0EaK2FY9-wJrkTjKoL8KE4,250
|
|
81
81
|
cognite/neat/_rules/catalog/classic_model.xlsx,sha256=YkocpkKypizjsWYwOdn5yzIz_BSl8T8SQLxgm4GIjLQ,15014
|
|
82
82
|
cognite/neat/_rules/catalog/hello_world_pump.xlsx,sha256=4Fv9qyv7ARHBXSIh-PiOUHcYrtgznKyR2PZCdEBlA0o,17071
|
|
83
|
-
cognite/neat/_rules/catalog/info-rules-imf.xlsx,sha256=
|
|
83
|
+
cognite/neat/_rules/catalog/info-rules-imf.xlsx,sha256=vrE5g8vBtsGpwJqygxG3t9I3x4SUAyQsi1vtWfZ8QW4,53682
|
|
84
84
|
cognite/neat/_rules/exporters/__init__.py,sha256=IYBa0DIYlx8cFItgYRw9W4FY_LmVEjuaqMz3JORZZX0,1204
|
|
85
85
|
cognite/neat/_rules/exporters/_base.py,sha256=VkNMy8wsH-x4tAjS44cXgzzNH0CM2k_4RhkMwK50J7g,2284
|
|
86
86
|
cognite/neat/_rules/exporters/_rules2dms.py,sha256=7I3a8ZPwkIBQAClQbMjJ2D2aIITY-OBVUD-8hirCmzM,19183
|
|
87
|
-
cognite/neat/_rules/exporters/_rules2excel.py,sha256=
|
|
88
|
-
cognite/neat/_rules/exporters/_rules2instance_template.py,sha256=
|
|
89
|
-
cognite/neat/_rules/exporters/_rules2ontology.py,sha256=
|
|
87
|
+
cognite/neat/_rules/exporters/_rules2excel.py,sha256=zI3uyb42Efxm9o4ZG3St3TUZSUx4kD_Bt25txvxZHNc,13682
|
|
88
|
+
cognite/neat/_rules/exporters/_rules2instance_template.py,sha256=gI0tWFKzAhuFtnxVA7A9_AGYyL9lH_Yst-OYPNtTguA,5937
|
|
89
|
+
cognite/neat/_rules/exporters/_rules2ontology.py,sha256=8GIawhTeNIS59zWYX2j3F63Ix9-xNGxgTzU1HiGkN98,22105
|
|
90
90
|
cognite/neat/_rules/exporters/_rules2yaml.py,sha256=ggaPR8FO8PwZk1_nhwb5wVHk_C4s6qh1RrlbPkNcbBo,3160
|
|
91
91
|
cognite/neat/_rules/exporters/_validation.py,sha256=DVJGdNNU2WtAFgUg0h4SWVhveRErEPOcYdT65y5toV0,682
|
|
92
92
|
cognite/neat/_rules/importers/__init__.py,sha256=KiTNglSK6OVCdvPiGmO2dTKEGQJWT5Yxa6XWqm7YClQ,1408
|
|
93
|
-
cognite/neat/_rules/importers/_base.py,sha256=
|
|
94
|
-
cognite/neat/_rules/importers/_dms2rules.py,sha256=
|
|
93
|
+
cognite/neat/_rules/importers/_base.py,sha256=yLrrOgjtkSPfLACmtRXGlHmaeGkk0kGnowregWbIPUo,1940
|
|
94
|
+
cognite/neat/_rules/importers/_dms2rules.py,sha256=34ts_ohJVtbHa6tKWu_G_m7YeqSoRo5M9FFZ85yfbHA,22774
|
|
95
95
|
cognite/neat/_rules/importers/_dtdl2rules/__init__.py,sha256=CNR-sUihs2mnR1bPMKs3j3L4ds3vFTsrl6YycExZTfU,68
|
|
96
96
|
cognite/neat/_rules/importers/_dtdl2rules/_unit_lookup.py,sha256=wW4saKva61Q_i17guY0dc4OseJDQfqHy_QZBtm0OD6g,12134
|
|
97
97
|
cognite/neat/_rules/importers/_dtdl2rules/dtdl_converter.py,sha256=j38U0um1ZWI-yRvEUR3z33vOvMCYXJxSO9L_B7m9xDE,11707
|
|
98
|
-
cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py,sha256=
|
|
98
|
+
cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py,sha256=nJRl47WsoDOrNUX9r_lf8KOXC2cmcz9bRSoeXk3eNDI,6107
|
|
99
99
|
cognite/neat/_rules/importers/_dtdl2rules/spec.py,sha256=SjvgEoxrUgWOAx1-2gru8UvW0HuFgUA9LRcrRu31TaU,12155
|
|
100
100
|
cognite/neat/_rules/importers/_rdf/__init__.py,sha256=2alnwoYVj1-F_M0R2NFFp7A9pZUbViJngygOydlC45Y,239
|
|
101
101
|
cognite/neat/_rules/importers/_rdf/_base.py,sha256=c8BvHdNRdirLJ7KcGH71osbn2dF8xoVkrCpVYbac4b0,5686
|
|
102
102
|
cognite/neat/_rules/importers/_rdf/_imf2rules.py,sha256=M5hfWZUhoCgXFlr8QNfogNCI2pxzqqAvTJII4yA8xJw,3723
|
|
103
|
-
cognite/neat/_rules/importers/_rdf/_inference2rules.py,sha256=
|
|
103
|
+
cognite/neat/_rules/importers/_rdf/_inference2rules.py,sha256=tzKPANrl4Pe5mH9UuPtFf-c2nUss9lt-Jvi5IyNL0C4,28661
|
|
104
104
|
cognite/neat/_rules/importers/_rdf/_owl2rules.py,sha256=gTMe94DC9xe8NR9KNVHTMTshg_NzVuN1v8Lz95BUshI,3392
|
|
105
|
-
cognite/neat/_rules/importers/_rdf/_shared.py,sha256=
|
|
106
|
-
cognite/neat/_rules/importers/_spreadsheet2rules.py,sha256=
|
|
105
|
+
cognite/neat/_rules/importers/_rdf/_shared.py,sha256=kufv_VxwBzU6MLJF1jZhTTJ6nvPd7mrRVj21wjb0kLw,5868
|
|
106
|
+
cognite/neat/_rules/importers/_spreadsheet2rules.py,sha256=wjB7RVevjvXL3gaL1SGEW411ie76ZrFbe9fngzO-ncQ,10977
|
|
107
107
|
cognite/neat/_rules/importers/_yaml2rules.py,sha256=k2oDgz--mxFVeyqQG3uvyYcb0BkFHwKHdBYHVaxtAEc,3721
|
|
108
108
|
cognite/neat/_rules/models/__init__.py,sha256=tf6tyWiYO0eC2PHCcpy208dwOHjEi9hg0sEaQLcB3uA,1024
|
|
109
109
|
cognite/neat/_rules/models/_base_input.py,sha256=kAVI6QYAzsgQ79eLPc_hANJjl-o1e9IKeD7lF61ru9Y,6656
|
|
110
|
-
cognite/neat/_rules/models/_base_rules.py,sha256=
|
|
111
|
-
cognite/neat/_rules/models/_rdfpath.py,sha256=clZGAzulIFKV2rzwoVZpLRlQUEyrAaiM7SjOoj1KUnY,11948
|
|
110
|
+
cognite/neat/_rules/models/_base_rules.py,sha256=2jvkHZpPLanZHZAXz-IO8EZhb2whjzuB0vniPkWHBFk,14987
|
|
112
111
|
cognite/neat/_rules/models/_types.py,sha256=6fHLiVPRlk5QsFjmvDFFqw1htPcPp-RfnUzYoMWNfeg,5418
|
|
113
|
-
cognite/neat/_rules/models/data_types.py,sha256=
|
|
112
|
+
cognite/neat/_rules/models/data_types.py,sha256=157IlIAuzZfLUsEXBx8AKwszxztk_Ogqny4W-hmik94,10013
|
|
114
113
|
cognite/neat/_rules/models/dms/__init__.py,sha256=fRaUH0IwG0YwWd_DNKM6j-jHHFyiIVz4_8DPiS1KR0Y,695
|
|
115
|
-
cognite/neat/_rules/models/dms/_exporter.py,sha256=
|
|
116
|
-
cognite/neat/_rules/models/dms/_rules.py,sha256=
|
|
117
|
-
cognite/neat/_rules/models/dms/_rules_input.py,sha256=
|
|
118
|
-
cognite/neat/_rules/models/dms/_validation.py,sha256=
|
|
114
|
+
cognite/neat/_rules/models/dms/_exporter.py,sha256=tQeRZg0xHSTjG4BGB1BxNdewWaPVIi_8cAp0Mh0Isa4,27894
|
|
115
|
+
cognite/neat/_rules/models/dms/_rules.py,sha256=dY4JYAtoy_TbYf1DIi1RYWjqoYxpR9FeVTXRJe9IfC0,21509
|
|
116
|
+
cognite/neat/_rules/models/dms/_rules_input.py,sha256=a7Wfq6KR-L3yjc9J_aX1PUQZSJ7JISuOxziaqcKx0vY,13722
|
|
117
|
+
cognite/neat/_rules/models/dms/_validation.py,sha256=L_R5FAw2hBPgnWeaujgCQ5uPkiuGS6CXYz9FmYEpnTE,32148
|
|
119
118
|
cognite/neat/_rules/models/entities/__init__.py,sha256=Hlucp3LyV6ncLl79aqRTbSy2qgiGzoyN8x54D_zaJCY,1469
|
|
120
119
|
cognite/neat/_rules/models/entities/_constants.py,sha256=g52-pFP_Qghp86NYk76pLDM52b3T4MXMztxhpeDW3Oc,344
|
|
121
|
-
cognite/neat/_rules/models/entities/_loaders.py,sha256=
|
|
122
|
-
cognite/neat/_rules/models/entities/_multi_value.py,sha256=
|
|
123
|
-
cognite/neat/_rules/models/entities/_single_value.py,sha256=
|
|
120
|
+
cognite/neat/_rules/models/entities/_loaders.py,sha256=OQDbz5ANMQ_7ZcdMIBdTR94BoCpWrBA2KBH3fCW0JQo,2728
|
|
121
|
+
cognite/neat/_rules/models/entities/_multi_value.py,sha256=xJyh0-aAbKYlgvmnk2lkKTHMBKMY2bZ97L4rd0tBRBg,2754
|
|
122
|
+
cognite/neat/_rules/models/entities/_single_value.py,sha256=ODRUD5T1Upyd6Pijaouq9EG9Lg2wRFHcS_TBmZ3EhrM,19852
|
|
124
123
|
cognite/neat/_rules/models/entities/_types.py,sha256=df9rnXJJKciv2Bp-Ve2q4xdEJt6WWniq12Z0hW2d6sk,1917
|
|
125
|
-
cognite/neat/_rules/models/entities/_wrapped.py,sha256=
|
|
124
|
+
cognite/neat/_rules/models/entities/_wrapped.py,sha256=bx7rpCD1GJ4KG3ObzjV349P1ExFJIOOXZzzs2TO049U,7677
|
|
126
125
|
cognite/neat/_rules/models/information/__init__.py,sha256=lV7l8RTfWBvN_DFkzea8OzADjq0rZGgWe_0Fiwtfje0,556
|
|
127
|
-
cognite/neat/_rules/models/information/_rules.py,sha256=
|
|
128
|
-
cognite/neat/_rules/models/information/_rules_input.py,sha256=
|
|
129
|
-
cognite/neat/_rules/models/information/_validation.py,sha256=
|
|
126
|
+
cognite/neat/_rules/models/information/_rules.py,sha256=BOFRHpxB7IAXv21a7Hae2QU4pS1YdhPoQbt3-wYv9FU,13805
|
|
127
|
+
cognite/neat/_rules/models/information/_rules_input.py,sha256=Du4Ll1K7DxCKbBGfez02vSyB4VuYBwrsE8oKSG4nktM,6045
|
|
128
|
+
cognite/neat/_rules/models/information/_validation.py,sha256=8o1rQ8lGY5yXP-ZiDX64opx7mHZGofHSxr-6972xEmI,12170
|
|
130
129
|
cognite/neat/_rules/models/mapping/__init__.py,sha256=T68Hf7rhiXa7b03h4RMwarAmkGnB-Bbhc1H07b2PyC4,100
|
|
131
130
|
cognite/neat/_rules/models/mapping/_classic2core.py,sha256=AhLWoXk4PlBVA6SgBtY9dcLcpqEMaYcsiEatI19miPk,1211
|
|
132
131
|
cognite/neat/_rules/models/mapping/_classic2core.yaml,sha256=jodkmcTborWJmG3At16OChtnol696X6D4lgAa7aaQ78,20491
|
|
133
|
-
cognite/neat/_rules/transformers/__init__.py,sha256=
|
|
132
|
+
cognite/neat/_rules/transformers/__init__.py,sha256=vp6OQnRUGdIrPVDOsY_tM2KBzis-IldaoVkAQEFgvVM,1563
|
|
134
133
|
cognite/neat/_rules/transformers/_base.py,sha256=9LnjKbYIf9238PQXedkTZsMXAyEND6glUD187iEaHfc,2783
|
|
135
|
-
cognite/neat/_rules/transformers/_converters.py,sha256
|
|
134
|
+
cognite/neat/_rules/transformers/_converters.py,sha256=-Tp7CTqNWVDENil-y5QVnh5EUgFbmVI7V-SaaIhtwAI,85966
|
|
136
135
|
cognite/neat/_rules/transformers/_mapping.py,sha256=lf-RKN__5Bg3-tZjEOCa1Sf_JtM_ScQ_TYcnciEnaYQ,18189
|
|
137
|
-
cognite/neat/_rules/transformers/_verification.py,sha256=
|
|
136
|
+
cognite/neat/_rules/transformers/_verification.py,sha256=coZjoLqdfS8yrPP62T_xEKrDZc9ETbPWrLuwEVBSLZQ,4370
|
|
138
137
|
cognite/neat/_session/__init__.py,sha256=fxQ5URVlUnmEGYyB8Baw7IDq-uYacqkigbc4b-Pr9Fw,58
|
|
139
|
-
cognite/neat/_session/_base.py,sha256=
|
|
138
|
+
cognite/neat/_session/_base.py,sha256=qU3twqQrps6H9HQVlS6mUlnHcHcSYFyXWhn6d2N9nho,12050
|
|
140
139
|
cognite/neat/_session/_collector.py,sha256=RcOGY0DjTCCKJt9j_p0gnQXn4omhsIX2G8Aq3ZFHIt4,4218
|
|
141
140
|
cognite/neat/_session/_create.py,sha256=doDCbDIWMbHCYe3cyk1obQaFdYJjvARg3X4lRUVicCk,7214
|
|
142
141
|
cognite/neat/_session/_drop.py,sha256=gOkDAnddASpFxYxkPjlTyhkpNfnmDEj94GRI8tnHFR0,4167
|
|
142
|
+
cognite/neat/_session/_explore.py,sha256=hrL0ASLtEXLlZn0dgDsKNySO10qEMBT8cE8mti2lOws,1561
|
|
143
143
|
cognite/neat/_session/_fix.py,sha256=gpmbJ4TbB_v2nw4fEA2Qtf0ifO3UDEMHGdztha28S_U,898
|
|
144
|
-
cognite/neat/_session/_inspect.py,sha256=
|
|
144
|
+
cognite/neat/_session/_inspect.py,sha256=qoBAfCQnzC40ef91gxJmhonWo1Kr_VEjBb2KhbCOO_s,10084
|
|
145
145
|
cognite/neat/_session/_mapping.py,sha256=AkQwmqYH-0EgqoXHqCFwJY92hNSGzfojOelhVFlqH4c,2655
|
|
146
|
-
cognite/neat/_session/_prepare.py,sha256=
|
|
147
|
-
cognite/neat/_session/_read.py,sha256=
|
|
148
|
-
cognite/neat/_session/_set.py,sha256=
|
|
149
|
-
cognite/neat/_session/_show.py,sha256=
|
|
150
|
-
cognite/neat/_session/_state.py,sha256=
|
|
151
|
-
cognite/neat/_session/
|
|
146
|
+
cognite/neat/_session/_prepare.py,sha256=BZ1NurenrsZDU4tg629wnt1Iuw_zVLRA58FNTQMYS9I,12636
|
|
147
|
+
cognite/neat/_session/_read.py,sha256=kULWbdP9T5jR9bW8S09Ix0aGRxN6PtcMrDy_IFJTycM,24928
|
|
148
|
+
cognite/neat/_session/_set.py,sha256=dCZ5zEmNAw8tiqOGT7-EigSXOIGlfVP2ldA7nmC8LJ8,4451
|
|
149
|
+
cognite/neat/_session/_show.py,sha256=2lnkud996ouwf6-aKGvU0cU0ttfMeQ3vcb__g_7Yko4,10539
|
|
150
|
+
cognite/neat/_session/_state.py,sha256=CPyjYbgUe6uUnCG6h-UqDtdIaWKVLjY4lAz4ar2_75A,4222
|
|
151
|
+
cognite/neat/_session/_subset.py,sha256=-uwSBM2-PsKgky4VtQCSUuSRNJHLE54MVnRdVxvzKAE,2113
|
|
152
|
+
cognite/neat/_session/_to.py,sha256=3bZGaXAXFvgzmNPmOtjzLiJLSlRXXaD6vYp4Cotx9Ks,18692
|
|
152
153
|
cognite/neat/_session/_wizard.py,sha256=9idlzhZy54h2Iwupe9iXKX3RDb5jJQuBZFEouni50L0,1476
|
|
153
154
|
cognite/neat/_session/engine/__init__.py,sha256=D3MxUorEs6-NtgoICqtZ8PISQrjrr4dvca6n48bu_bI,120
|
|
154
155
|
cognite/neat/_session/engine/_import.py,sha256=1QxA2_EK613lXYAHKQbZyw2yjo5P9XuiX4Z6_6-WMNQ,169
|
|
@@ -157,7 +158,7 @@ cognite/neat/_session/engine/_load.py,sha256=LcoYVthQyCzLWKzRE_75_nElS-n_eMWSPAg
|
|
|
157
158
|
cognite/neat/_session/exceptions.py,sha256=XCLVaEe7SMIyNW7mwt0WF7_e5K8KfV9yHkEtsjL60Tg,3182
|
|
158
159
|
cognite/neat/_shared.py,sha256=Ov59SWYboRRsncB_5V1ZC_BAoACfNLjo80vqE5Ru6wo,2325
|
|
159
160
|
cognite/neat/_store/__init__.py,sha256=RrvuZrMdezqun5dOrwHWSk26kampZcvqiHBqSFumkEE,130
|
|
160
|
-
cognite/neat/_store/_graph_store.py,sha256=
|
|
161
|
+
cognite/neat/_store/_graph_store.py,sha256=mWWax09ZTOUbFOpX8Gxq9yTOyduEebMvVddQ0-FvDwc,17141
|
|
161
162
|
cognite/neat/_store/_provenance.py,sha256=0HeWyzvfCTxQiG2PygLLqWpdCAooVsFRckpGsnJbwzk,7260
|
|
162
163
|
cognite/neat/_store/_rules_store.py,sha256=R-bkiNiwqGQ9udrEmamvuEidQsemFpGBif1zmf4H-QA,17713
|
|
163
164
|
cognite/neat/_store/exceptions.py,sha256=fbed_CGDdYU4oELgCL0_c5d85HGrUiYvXmL2D0WIDww,1593
|
|
@@ -167,18 +168,18 @@ cognite/neat/_utils/auxiliary.py,sha256=WFOycFgoYipvDmtGvn6ZNH3H8iNZmHamrfe2kXRb
|
|
|
167
168
|
cognite/neat/_utils/collection_.py,sha256=JvYLSR6Cf8PIKGhr8HKRvep0U-z0980jbnIM_g-5I5I,2366
|
|
168
169
|
cognite/neat/_utils/graph_transformations_report.py,sha256=rjEy4XMvOygFL4UgnYOmFW6AHxaU9IXep-dmYc5654c,1230
|
|
169
170
|
cognite/neat/_utils/io_.py,sha256=D2Mg8sOxfBoDg3fC0jBzaxO3vkXmr0QvZSgYIv6xRkM,386
|
|
170
|
-
cognite/neat/_utils/rdf_.py,sha256=
|
|
171
|
+
cognite/neat/_utils/rdf_.py,sha256=v4m8DD9dcHkALSx6wStC2h3kj-e3BmhxJT20fydtw7g,9897
|
|
171
172
|
cognite/neat/_utils/reader/__init__.py,sha256=fPkrNB_9hLB7CyHTCFV_xEbIfOMqUQzNly5JN33-QfM,146
|
|
172
173
|
cognite/neat/_utils/reader/_base.py,sha256=Q35hz8tqAiQiELjE4DsDDKQHLtRmSTrty4Gep9rg_CU,5444
|
|
173
|
-
cognite/neat/_utils/spreadsheet.py,sha256=
|
|
174
|
-
cognite/neat/_utils/text.py,sha256=
|
|
174
|
+
cognite/neat/_utils/spreadsheet.py,sha256=Z2R2qcN0oYE3BLMCE9cbmCwi2rPMGKJ3u21jzzIoZg0,4279
|
|
175
|
+
cognite/neat/_utils/text.py,sha256=BFJoEOQBFgpelysL92FdF0OVRVFl0q9tRNoz-oRanNc,7779
|
|
175
176
|
cognite/neat/_utils/time_.py,sha256=O30LUiDH9TdOYz8_a9pFqTtJdg8vEjC3qHCk8xZblG8,345
|
|
176
|
-
cognite/neat/_utils/upload.py,sha256=
|
|
177
|
+
cognite/neat/_utils/upload.py,sha256=xWtM6mFuD2QYQHaZ7zCAuGptbEpPIxcH-raWQu93-Ug,5845
|
|
177
178
|
cognite/neat/_utils/xml_.py,sha256=FQkq84u35MUsnKcL6nTMJ9ajtG9D5i1u4VBnhGqP2DQ,1710
|
|
178
|
-
cognite/neat/_version.py,sha256=
|
|
179
|
+
cognite/neat/_version.py,sha256=ookCHacS5DUzQfvBNXF00u5NsZMfnEnoGOnWpAeN_8w,46
|
|
179
180
|
cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
180
|
-
cognite_neat-0.
|
|
181
|
-
cognite_neat-0.
|
|
182
|
-
cognite_neat-0.
|
|
183
|
-
cognite_neat-0.
|
|
184
|
-
cognite_neat-0.
|
|
181
|
+
cognite_neat-0.111.0.dist-info/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
|
|
182
|
+
cognite_neat-0.111.0.dist-info/METADATA,sha256=zie24cyFm7Rw3fvs5BERbelGcQ2ITtX_Qsvm9N5hFFo,5361
|
|
183
|
+
cognite_neat-0.111.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
184
|
+
cognite_neat-0.111.0.dist-info/entry_points.txt,sha256=SsQlnl8SNMSSjE3acBI835JYFtsIinLSbVmHmMEXv6E,51
|
|
185
|
+
cognite_neat-0.111.0.dist-info/RECORD,,
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import re
|
|
2
|
-
from typing import cast
|
|
3
|
-
|
|
4
|
-
from rdflib import Graph, URIRef
|
|
5
|
-
|
|
6
|
-
from cognite.neat._rules.analysis import InformationAnalysis
|
|
7
|
-
from cognite.neat._rules.models._rdfpath import (
|
|
8
|
-
Hop,
|
|
9
|
-
RDFPath,
|
|
10
|
-
SelfReferenceProperty,
|
|
11
|
-
SingleProperty,
|
|
12
|
-
Traversal,
|
|
13
|
-
)
|
|
14
|
-
from cognite.neat._rules.models.entities import ClassEntity
|
|
15
|
-
from cognite.neat._rules.models.information import InformationProperty, InformationRules
|
|
16
|
-
from cognite.neat._utils.collection_ import most_occurring_element
|
|
17
|
-
|
|
18
|
-
from ._shared import Triple, hop2property_path
|
|
19
|
-
|
|
20
|
-
_QUERY_TEMPLATE = """CONSTRUCT {{ {graph_template} }}
|
|
21
|
-
WHERE {{ {bind_instance_id}
|
|
22
|
-
{graph_pattern}
|
|
23
|
-
}}"""
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def build_construct_query(
|
|
27
|
-
class_: ClassEntity,
|
|
28
|
-
graph: Graph,
|
|
29
|
-
rules: InformationRules,
|
|
30
|
-
properties_optional: bool = True,
|
|
31
|
-
instance_id: URIRef | None = None,
|
|
32
|
-
) -> str | None:
|
|
33
|
-
"""Builds a CONSTRUCT query for a given class and rules and optionally filters by class instances.
|
|
34
|
-
|
|
35
|
-
Args:
|
|
36
|
-
class_ : The class entity for which the query is generated.
|
|
37
|
-
graph : The graph containing instances of classes.
|
|
38
|
-
rules : The information rules to use for query generation.
|
|
39
|
-
properties_optional : Whether to make all properties optional. Defaults to True.
|
|
40
|
-
class_instances : List of class instances to filter by. Defaults to None (no filter, return all instances).
|
|
41
|
-
|
|
42
|
-
Returns:
|
|
43
|
-
str: CONSTRUCT query.
|
|
44
|
-
|
|
45
|
-
!!! note "On CONSTRUCT Query"
|
|
46
|
-
CONSTRUCT query is composed of two parts: graph template and graph pattern.
|
|
47
|
-
Graph template is used the shape of instance acquired using graph pattern.
|
|
48
|
-
This allows us to create a new graph with the new shape without actually modifying
|
|
49
|
-
the original graph, or creating new instances.
|
|
50
|
-
|
|
51
|
-
The CONSTRUCT query is far less forgiving than the SELECT query. It will not return
|
|
52
|
-
anything if one of the properties that define the "shape" of the class instance is missing.
|
|
53
|
-
This is the reason why there is an option to make all properties optional, so that
|
|
54
|
-
the query will return all instances that have at least one property defined.
|
|
55
|
-
"""
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
transformations := InformationAnalysis(rules)
|
|
59
|
-
.class_property_pairs(only_rdfpath=True, consider_inheritance=True)
|
|
60
|
-
.get(class_, None)
|
|
61
|
-
):
|
|
62
|
-
templates, patterns = to_construct_triples(
|
|
63
|
-
graph, list(transformations.values()), rules.prefixes, properties_optional
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
return _QUERY_TEMPLATE.format(
|
|
67
|
-
bind_instance_id=(f"BIND(<{instance_id}> AS ?instance)" if instance_id else ""),
|
|
68
|
-
graph_template="\n".join(triples2sparql_statement(templates)),
|
|
69
|
-
graph_pattern="\n".join(triples2sparql_statement(patterns)),
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
else:
|
|
73
|
-
return None
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def to_construct_triples(
|
|
77
|
-
graph: Graph,
|
|
78
|
-
transformations: list[InformationProperty],
|
|
79
|
-
prefixes: dict,
|
|
80
|
-
properties_optional: bool = True,
|
|
81
|
-
) -> tuple[list[Triple], list[Triple]]:
|
|
82
|
-
"""Converts transformations of a class to CONSTRUCT triples which are used to generate CONSTRUCT query
|
|
83
|
-
|
|
84
|
-
Args:
|
|
85
|
-
graph: Graph containing instances of classes (used for property inference for hops)
|
|
86
|
-
transformations : List of transformations to use to form triples
|
|
87
|
-
prefixes : Dictionary of prefixes for namespaces
|
|
88
|
-
properties_optional : Flag indicating if properties should be optional. Defaults to True.
|
|
89
|
-
|
|
90
|
-
Returns:
|
|
91
|
-
tuple: Tuple of triples that define graph template and graph pattern parts of CONSTRUCT query
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
!!! note "Purely inherited transformations"
|
|
95
|
-
Assumption that neat makes is that in case of purely inherited transformations
|
|
96
|
-
we will type instance with class to which transformation belongs to.
|
|
97
|
-
|
|
98
|
-
Otherwise we will type instance with class that is most occurring in non-inherited
|
|
99
|
-
transformations.
|
|
100
|
-
|
|
101
|
-
"""
|
|
102
|
-
# TODO: Add handling of UNIONs in rules
|
|
103
|
-
|
|
104
|
-
templates = []
|
|
105
|
-
patterns = []
|
|
106
|
-
non_inherited_starting_rdf_types = []
|
|
107
|
-
|
|
108
|
-
for transformation in transformations:
|
|
109
|
-
traversal = cast(RDFPath, transformation.instance_source).traversal
|
|
110
|
-
|
|
111
|
-
# keeping track of starting rdf types of non-inherited transformations/properties
|
|
112
|
-
if isinstance(traversal, Traversal) and not transformation.inherited:
|
|
113
|
-
non_inherited_starting_rdf_types.append(traversal.class_.id)
|
|
114
|
-
|
|
115
|
-
graph_template_triple = Triple(
|
|
116
|
-
subject="?instance",
|
|
117
|
-
predicate=f"{transformation.class_.prefix}:{transformation.property_}",
|
|
118
|
-
object=f"?{re.sub(r'[^_a-zA-Z0-9/_]', '_', str(transformation.property_).lower())}",
|
|
119
|
-
optional=False,
|
|
120
|
-
)
|
|
121
|
-
templates.append(graph_template_triple)
|
|
122
|
-
|
|
123
|
-
# use case AllReferences: binding instance to certain rdf property
|
|
124
|
-
if isinstance(traversal, SelfReferenceProperty):
|
|
125
|
-
graph_pattern_triple = Triple(
|
|
126
|
-
subject="BIND(?instance",
|
|
127
|
-
predicate="AS",
|
|
128
|
-
object=f"{graph_template_triple.object})",
|
|
129
|
-
optional=False,
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
# use case SingleProperty: simple property traversal
|
|
133
|
-
elif isinstance(traversal, SingleProperty):
|
|
134
|
-
graph_pattern_triple = Triple(
|
|
135
|
-
subject=graph_template_triple.subject,
|
|
136
|
-
predicate=traversal.property.id,
|
|
137
|
-
object=graph_template_triple.object,
|
|
138
|
-
optional=(True if properties_optional else not transformation.is_mandatory),
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
# use case Hop: property traversal with multiple hops turned into property path
|
|
142
|
-
# see: https://www.oxfordsemantic.tech/faqs/what-is-a-property-path
|
|
143
|
-
elif isinstance(traversal, Hop):
|
|
144
|
-
graph_pattern_triple = Triple(
|
|
145
|
-
subject="?instance",
|
|
146
|
-
predicate=hop2property_path(graph, traversal, prefixes),
|
|
147
|
-
object=graph_template_triple.object,
|
|
148
|
-
optional=(True if properties_optional else not transformation.is_mandatory),
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
# other type of rdfpaths are skipped
|
|
152
|
-
else:
|
|
153
|
-
continue
|
|
154
|
-
|
|
155
|
-
patterns.append(graph_pattern_triple)
|
|
156
|
-
|
|
157
|
-
# Add first triple for graph pattern stating type of object
|
|
158
|
-
# we use most occurring here to pull out most occurring rdf type of the starting
|
|
159
|
-
# node of the transformation, or the class itself to which the transformation is
|
|
160
|
-
# defined for.
|
|
161
|
-
# This is safeguard in case there are multiple classes in the graph pattern
|
|
162
|
-
patterns.insert(
|
|
163
|
-
0,
|
|
164
|
-
Triple(
|
|
165
|
-
subject="?instance",
|
|
166
|
-
predicate="a",
|
|
167
|
-
object=(
|
|
168
|
-
most_occurring_element(non_inherited_starting_rdf_types)
|
|
169
|
-
if non_inherited_starting_rdf_types
|
|
170
|
-
else str(transformation.class_)
|
|
171
|
-
),
|
|
172
|
-
optional=False,
|
|
173
|
-
),
|
|
174
|
-
)
|
|
175
|
-
|
|
176
|
-
return templates, patterns
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
def triples2sparql_statement(triples: list[Triple]):
|
|
180
|
-
return [
|
|
181
|
-
(
|
|
182
|
-
f"OPTIONAL {{ {triple.subject} {triple.predicate} {triple.object} . }}"
|
|
183
|
-
if triple.optional
|
|
184
|
-
else f"{triple.subject} {triple.predicate} {triple.object} ."
|
|
185
|
-
)
|
|
186
|
-
for triple in triples
|
|
187
|
-
]
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from collections.abc import Iterable
|
|
3
|
-
from typing import ClassVar, cast
|
|
4
|
-
|
|
5
|
-
from pydantic import BaseModel, ConfigDict, Field
|
|
6
|
-
from rdflib import Graph, Literal, Namespace
|
|
7
|
-
from rdflib.term import URIRef
|
|
8
|
-
|
|
9
|
-
from cognite.neat._constants import get_default_prefixes_and_namespaces
|
|
10
|
-
from cognite.neat._rules.models._rdfpath import (
|
|
11
|
-
Hop,
|
|
12
|
-
Step,
|
|
13
|
-
)
|
|
14
|
-
from cognite.neat._utils.rdf_ import remove_namespace_from_uri, uri_to_short_form
|
|
15
|
-
|
|
16
|
-
if sys.version_info >= (3, 11):
|
|
17
|
-
from typing import Self
|
|
18
|
-
else:
|
|
19
|
-
from typing_extensions import Self
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class Triple(BaseModel):
|
|
23
|
-
model_config: ClassVar[ConfigDict] = ConfigDict(
|
|
24
|
-
populate_by_name=True, arbitrary_types_allowed=True, strict=False, extra="allow"
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
subject: str | URIRef
|
|
28
|
-
predicate: str | URIRef
|
|
29
|
-
object: str | URIRef | Literal | None = None
|
|
30
|
-
optional: bool = Field(
|
|
31
|
-
description="Indicates whether a triple is optional, used when building SPARQL query",
|
|
32
|
-
default=False,
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
@classmethod
|
|
36
|
-
def from_rdflib_triple(cls, triple: tuple[URIRef, URIRef, URIRef | Literal]) -> Self:
|
|
37
|
-
return cls(subject=triple[0], predicate=triple[1], object=triple[2])
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def generate_prefix_header(prefixes: dict[str, Namespace] | None = None) -> str:
|
|
41
|
-
"""Generate prefix header which is added to SPARQL query and allows for shorten query statements
|
|
42
|
-
|
|
43
|
-
Parameters
|
|
44
|
-
----------
|
|
45
|
-
prefixes : dict
|
|
46
|
-
Dict containing prefix - namespace pairs, defaults to internal set of prefixes
|
|
47
|
-
|
|
48
|
-
Returns
|
|
49
|
-
-------
|
|
50
|
-
str
|
|
51
|
-
Prefix header
|
|
52
|
-
"""
|
|
53
|
-
|
|
54
|
-
prefixes = prefixes or get_default_prefixes_and_namespaces()
|
|
55
|
-
|
|
56
|
-
return "".join(f"PREFIX {key}:<{value}>\n" for key, value in prefixes.items())
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def get_predicate_id(
|
|
60
|
-
graph: Graph,
|
|
61
|
-
subject_type_id: str,
|
|
62
|
-
object_type_id: str,
|
|
63
|
-
prefixes: dict[str, Namespace] | None = None,
|
|
64
|
-
) -> URIRef:
|
|
65
|
-
"""Returns predicate (aka property) URI (i.e., ID) that connects subject and object
|
|
66
|
-
|
|
67
|
-
Parameters
|
|
68
|
-
----------
|
|
69
|
-
graph : Graph
|
|
70
|
-
Data model graph or data model instance (aka knowledge graph)
|
|
71
|
-
subject_type_id : str
|
|
72
|
-
ID of subject type (aka subject class)
|
|
73
|
-
object_type_id : str
|
|
74
|
-
ID of object type (aka object class)
|
|
75
|
-
prefixes : dict, optional
|
|
76
|
-
Dict containing prefix - namespace pairs, defaults to internal set of prefixes
|
|
77
|
-
|
|
78
|
-
Returns
|
|
79
|
-
-------
|
|
80
|
-
URIRef
|
|
81
|
-
ID of predicate (aka property) connecting subject and object
|
|
82
|
-
"""
|
|
83
|
-
|
|
84
|
-
prefixes = prefixes or get_default_prefixes_and_namespaces()
|
|
85
|
-
|
|
86
|
-
query = """
|
|
87
|
-
|
|
88
|
-
SELECT ?predicateTypeID
|
|
89
|
-
WHERE {
|
|
90
|
-
?subjectInstanceID a subjectTypeID .
|
|
91
|
-
?objectInstanceID a objectTypeID .
|
|
92
|
-
?subjectInstanceID ?predicateTypeID ?objectInstanceID .
|
|
93
|
-
} LIMIT 1"""
|
|
94
|
-
|
|
95
|
-
query = query.replace("insertPrefixes", generate_prefix_header(prefixes))
|
|
96
|
-
final_query = query.replace("subjectTypeID", subject_type_id).replace("objectTypeID", object_type_id)
|
|
97
|
-
res = list(cast(tuple, graph.query(final_query)))
|
|
98
|
-
|
|
99
|
-
if len(res) != 1:
|
|
100
|
-
raise ValueError("Subject and Object must have exactly 1 relation!")
|
|
101
|
-
|
|
102
|
-
return res[0][0]
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def hop2property_path(
|
|
106
|
-
graph: Graph,
|
|
107
|
-
hop: Hop,
|
|
108
|
-
prefixes: dict[str, Namespace] | None = None,
|
|
109
|
-
) -> str:
|
|
110
|
-
"""Converts hop to property path string
|
|
111
|
-
|
|
112
|
-
Parameters
|
|
113
|
-
----------
|
|
114
|
-
graph : Graph
|
|
115
|
-
Graph containing instances of classes
|
|
116
|
-
hop : Hop
|
|
117
|
-
Hop to convert
|
|
118
|
-
prefixes : dict[str, Namespace]
|
|
119
|
-
Dictionary of prefixes to use for compression and predicate querying
|
|
120
|
-
|
|
121
|
-
Returns
|
|
122
|
-
-------
|
|
123
|
-
str
|
|
124
|
-
Property path string for hop traversal (e.g. ^rdf:type/rdfs:subClassOf)
|
|
125
|
-
"""
|
|
126
|
-
prefixes = prefixes if prefixes else get_default_prefixes_and_namespaces()
|
|
127
|
-
|
|
128
|
-
# setting previous step to origin, as we are starting from there
|
|
129
|
-
previous_step = Step(class_=hop.class_, direction="origin")
|
|
130
|
-
|
|
131
|
-
# add triples for all steps until destination
|
|
132
|
-
property_path = ""
|
|
133
|
-
for current_step in hop.traversal:
|
|
134
|
-
sub_entity, obj_entity = (
|
|
135
|
-
(current_step, previous_step) if current_step.direction == "source" else (previous_step, current_step)
|
|
136
|
-
)
|
|
137
|
-
|
|
138
|
-
predicate_raw = get_predicate_id(graph, sub_entity.class_.id, obj_entity.class_.id, prefixes)
|
|
139
|
-
|
|
140
|
-
predicate = uri_to_short_form(predicate_raw, prefixes)
|
|
141
|
-
|
|
142
|
-
predicate = f"^{predicate}" if current_step.direction == "source" else predicate
|
|
143
|
-
property_path += f"{predicate}/"
|
|
144
|
-
|
|
145
|
-
previous_step = current_step
|
|
146
|
-
|
|
147
|
-
if previous_step.property:
|
|
148
|
-
return property_path + previous_step.property.id
|
|
149
|
-
else:
|
|
150
|
-
# removing "/" at the end of property path if there is no property at the end
|
|
151
|
-
return property_path[:-1]
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def triples2dictionary(triples: Iterable[tuple[URIRef, URIRef, str | URIRef]]) -> dict[URIRef, dict[str, list[str]]]:
|
|
155
|
-
"""Converts list of triples to dictionary"""
|
|
156
|
-
dictionary: dict[URIRef, dict[str, list[str]]] = {}
|
|
157
|
-
for triple in triples:
|
|
158
|
-
id_: str
|
|
159
|
-
property_: str
|
|
160
|
-
value: str
|
|
161
|
-
uri: URIRef
|
|
162
|
-
|
|
163
|
-
id_, property_, value = remove_namespace_from_uri(triple) # type: ignore[misc]
|
|
164
|
-
uri = triple[0]
|
|
165
|
-
|
|
166
|
-
if uri not in dictionary:
|
|
167
|
-
dictionary[uri] = {"external_id": [id_]}
|
|
168
|
-
|
|
169
|
-
if property_ not in dictionary[uri]:
|
|
170
|
-
dictionary[uri][property_] = [value]
|
|
171
|
-
else:
|
|
172
|
-
dictionary[uri][property_].append(value)
|
|
173
|
-
return dictionary
|