cognite-neat 0.123.2__py3-none-any.whl → 0.127.30__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.
Files changed (333) hide show
  1. cognite/neat/__init__.py +2 -2
  2. cognite/neat/_client/__init__.py +4 -0
  3. cognite/neat/_client/api.py +8 -0
  4. cognite/neat/_client/client.py +21 -0
  5. cognite/neat/_client/config.py +40 -0
  6. cognite/neat/_client/containers_api.py +125 -0
  7. cognite/neat/_client/data_classes.py +44 -0
  8. cognite/neat/_client/data_model_api.py +115 -0
  9. cognite/neat/_client/spaces_api.py +115 -0
  10. cognite/neat/_client/statistics_api.py +24 -0
  11. cognite/neat/_client/views_api.py +129 -0
  12. cognite/neat/_config.py +185 -0
  13. cognite/neat/_data_model/_analysis.py +196 -0
  14. cognite/neat/_data_model/_constants.py +67 -0
  15. cognite/neat/_data_model/_identifiers.py +61 -0
  16. cognite/neat/_data_model/_shared.py +41 -0
  17. cognite/neat/_data_model/deployer/_differ.py +140 -0
  18. cognite/neat/_data_model/deployer/_differ_container.py +360 -0
  19. cognite/neat/_data_model/deployer/_differ_data_model.py +54 -0
  20. cognite/neat/_data_model/deployer/_differ_space.py +9 -0
  21. cognite/neat/_data_model/deployer/_differ_view.py +299 -0
  22. cognite/neat/_data_model/deployer/data_classes.py +529 -0
  23. cognite/neat/_data_model/deployer/deployer.py +401 -0
  24. cognite/neat/_data_model/exporters/__init__.py +15 -0
  25. cognite/neat/_data_model/exporters/_api_exporter.py +37 -0
  26. cognite/neat/_data_model/exporters/_base.py +24 -0
  27. cognite/neat/_data_model/exporters/_table_exporter/exporter.py +128 -0
  28. cognite/neat/_data_model/exporters/_table_exporter/workbook.py +409 -0
  29. cognite/neat/_data_model/exporters/_table_exporter/writer.py +421 -0
  30. cognite/neat/_data_model/importers/__init__.py +5 -0
  31. cognite/neat/_data_model/importers/_api_importer.py +166 -0
  32. cognite/neat/_data_model/importers/_base.py +16 -0
  33. cognite/neat/_data_model/importers/_table_importer/data_classes.py +295 -0
  34. cognite/neat/_data_model/importers/_table_importer/importer.py +192 -0
  35. cognite/neat/_data_model/importers/_table_importer/reader.py +1063 -0
  36. cognite/neat/_data_model/importers/_table_importer/source.py +94 -0
  37. cognite/neat/_data_model/models/conceptual/_base.py +18 -0
  38. cognite/neat/_data_model/models/conceptual/_concept.py +67 -0
  39. cognite/neat/_data_model/models/conceptual/_data_model.py +51 -0
  40. cognite/neat/_data_model/models/conceptual/_properties.py +104 -0
  41. cognite/neat/_data_model/models/conceptual/_property.py +105 -0
  42. cognite/neat/_data_model/models/dms/__init__.py +206 -0
  43. cognite/neat/_data_model/models/dms/_base.py +31 -0
  44. cognite/neat/_data_model/models/dms/_constants.py +48 -0
  45. cognite/neat/_data_model/models/dms/_constraints.py +42 -0
  46. cognite/neat/_data_model/models/dms/_container.py +159 -0
  47. cognite/neat/_data_model/models/dms/_data_model.py +95 -0
  48. cognite/neat/_data_model/models/dms/_data_types.py +195 -0
  49. cognite/neat/_data_model/models/dms/_http.py +28 -0
  50. cognite/neat/_data_model/models/dms/_indexes.py +30 -0
  51. cognite/neat/_data_model/models/dms/_limits.py +96 -0
  52. cognite/neat/_data_model/models/dms/_references.py +135 -0
  53. cognite/neat/_data_model/models/dms/_schema.py +18 -0
  54. cognite/neat/_data_model/models/dms/_space.py +48 -0
  55. cognite/neat/_data_model/models/dms/_types.py +17 -0
  56. cognite/neat/_data_model/models/dms/_view_filter.py +282 -0
  57. cognite/neat/_data_model/models/dms/_view_property.py +235 -0
  58. cognite/neat/_data_model/models/dms/_views.py +210 -0
  59. cognite/neat/_data_model/models/entities/__init__.py +50 -0
  60. cognite/neat/_data_model/models/entities/_base.py +101 -0
  61. cognite/neat/_data_model/models/entities/_constants.py +22 -0
  62. cognite/neat/_data_model/models/entities/_data_types.py +144 -0
  63. cognite/neat/_data_model/models/entities/_identifiers.py +61 -0
  64. cognite/neat/_data_model/models/entities/_parser.py +226 -0
  65. cognite/neat/_data_model/validation/dms/__init__.py +75 -0
  66. cognite/neat/_data_model/validation/dms/_ai_readiness.py +364 -0
  67. cognite/neat/_data_model/validation/dms/_base.py +307 -0
  68. cognite/neat/_data_model/validation/dms/_connections.py +638 -0
  69. cognite/neat/_data_model/validation/dms/_consistency.py +57 -0
  70. cognite/neat/_data_model/validation/dms/_containers.py +174 -0
  71. cognite/neat/_data_model/validation/dms/_limits.py +420 -0
  72. cognite/neat/_data_model/validation/dms/_orchestrator.py +222 -0
  73. cognite/neat/_data_model/validation/dms/_views.py +103 -0
  74. cognite/neat/_exceptions.py +56 -0
  75. cognite/neat/_issues.py +68 -0
  76. cognite/neat/_session/__init__.py +3 -0
  77. cognite/neat/_session/_html/_render.py +30 -0
  78. cognite/neat/_session/_html/static/__init__.py +8 -0
  79. cognite/neat/_session/_html/static/deployment.css +303 -0
  80. cognite/neat/_session/_html/static/deployment.js +150 -0
  81. cognite/neat/_session/_html/static/issues.css +211 -0
  82. cognite/neat/_session/_html/static/issues.js +168 -0
  83. cognite/neat/_session/_html/static/shared.css +186 -0
  84. cognite/neat/_session/_html/templates/__init__.py +4 -0
  85. cognite/neat/_session/_html/templates/deployment.html +75 -0
  86. cognite/neat/_session/_html/templates/issues.html +45 -0
  87. cognite/neat/_session/_issues.py +81 -0
  88. cognite/neat/_session/_opt.py +35 -0
  89. cognite/neat/_session/_physical.py +261 -0
  90. cognite/neat/_session/_result.py +236 -0
  91. cognite/neat/_session/_session.py +88 -0
  92. cognite/neat/_session/_usage_analytics/__init__.py +0 -0
  93. cognite/neat/_session/_usage_analytics/_collector.py +131 -0
  94. cognite/neat/_session/_usage_analytics/_constants.py +23 -0
  95. cognite/neat/_session/_usage_analytics/_storage.py +240 -0
  96. cognite/neat/_session/_wrappers.py +82 -0
  97. cognite/neat/_state_machine/__init__.py +10 -0
  98. cognite/neat/_state_machine/_base.py +37 -0
  99. cognite/neat/_state_machine/_states.py +52 -0
  100. cognite/neat/_store/__init__.py +3 -0
  101. cognite/neat/_store/_provenance.py +81 -0
  102. cognite/neat/_store/_store.py +156 -0
  103. cognite/neat/_utils/__init__.py +0 -0
  104. cognite/neat/_utils/_reader.py +194 -0
  105. cognite/neat/_utils/auxiliary.py +39 -0
  106. cognite/neat/_utils/collection.py +11 -0
  107. cognite/neat/_utils/http_client/__init__.py +39 -0
  108. cognite/neat/_utils/http_client/_client.py +245 -0
  109. cognite/neat/_utils/http_client/_config.py +19 -0
  110. cognite/neat/_utils/http_client/_data_classes.py +294 -0
  111. cognite/neat/_utils/http_client/_tracker.py +31 -0
  112. cognite/neat/_utils/text.py +71 -0
  113. cognite/neat/_utils/useful_types.py +37 -0
  114. cognite/neat/_utils/validation.py +154 -0
  115. cognite/neat/_version.py +1 -1
  116. cognite/neat/v0/__init__.py +0 -0
  117. cognite/neat/v0/core/__init__.py +0 -0
  118. cognite/neat/v0/core/_client/_api/__init__.py +0 -0
  119. cognite/neat/{core → v0/core}/_client/_api/data_modeling_loaders.py +86 -7
  120. cognite/neat/{core → v0/core}/_client/_api/neat_instances.py +5 -5
  121. cognite/neat/{core → v0/core}/_client/_api/schema.py +5 -5
  122. cognite/neat/{core → v0/core}/_client/_api/statistics.py +3 -3
  123. cognite/neat/{core → v0/core}/_client/_api_client.py +1 -1
  124. cognite/neat/v0/core/_client/data_classes/__init__.py +0 -0
  125. cognite/neat/{core → v0/core}/_client/data_classes/schema.py +4 -4
  126. cognite/neat/{core → v0/core}/_client/testing.py +1 -1
  127. cognite/neat/{core → v0/core}/_constants.py +10 -3
  128. cognite/neat/v0/core/_data_model/__init__.py +0 -0
  129. cognite/neat/{core → v0/core}/_data_model/_constants.py +9 -6
  130. cognite/neat/{core → v0/core}/_data_model/_shared.py +5 -5
  131. cognite/neat/{core → v0/core}/_data_model/analysis/_base.py +12 -8
  132. cognite/neat/{core → v0/core}/_data_model/exporters/__init__.py +1 -2
  133. cognite/neat/{core → v0/core}/_data_model/exporters/_base.py +7 -7
  134. cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2dms.py +9 -9
  135. cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2excel.py +13 -13
  136. cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2instance_template.py +4 -4
  137. cognite/neat/{core/_data_model/exporters/_data_model2ontology.py → v0/core/_data_model/exporters/_data_model2semantic_model.py} +126 -133
  138. cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2yaml.py +1 -1
  139. cognite/neat/{core → v0/core}/_data_model/importers/__init__.py +4 -6
  140. cognite/neat/{core → v0/core}/_data_model/importers/_base.py +5 -5
  141. cognite/neat/{core → v0/core}/_data_model/importers/_base_file_reader.py +2 -2
  142. cognite/neat/{core → v0/core}/_data_model/importers/_dict2data_model.py +6 -6
  143. cognite/neat/{core → v0/core}/_data_model/importers/_dms2data_model.py +19 -16
  144. cognite/neat/v0/core/_data_model/importers/_graph2data_model.py +299 -0
  145. cognite/neat/v0/core/_data_model/importers/_rdf/__init__.py +4 -0
  146. cognite/neat/{core → v0/core}/_data_model/importers/_rdf/_base.py +13 -13
  147. cognite/neat/{core → v0/core}/_data_model/importers/_rdf/_inference2rdata_model.py +14 -14
  148. cognite/neat/v0/core/_data_model/importers/_rdf/_owl2data_model.py +144 -0
  149. cognite/neat/v0/core/_data_model/importers/_rdf/_shared.py +255 -0
  150. cognite/neat/{core → v0/core}/_data_model/importers/_spreadsheet2data_model.py +94 -13
  151. cognite/neat/{core → v0/core}/_data_model/models/__init__.py +3 -3
  152. cognite/neat/{core → v0/core}/_data_model/models/_base_verified.py +5 -5
  153. cognite/neat/v0/core/_data_model/models/_import_contexts.py +82 -0
  154. cognite/neat/{core → v0/core}/_data_model/models/_types.py +5 -5
  155. cognite/neat/{core → v0/core}/_data_model/models/conceptual/_unverified.py +18 -12
  156. cognite/neat/v0/core/_data_model/models/conceptual/_validation.py +308 -0
  157. cognite/neat/{core → v0/core}/_data_model/models/conceptual/_verified.py +13 -11
  158. cognite/neat/{core → v0/core}/_data_model/models/data_types.py +14 -4
  159. cognite/neat/{core → v0/core}/_data_model/models/entities/__init__.py +6 -0
  160. cognite/neat/v0/core/_data_model/models/entities/_loaders.py +155 -0
  161. cognite/neat/{core → v0/core}/_data_model/models/entities/_multi_value.py +2 -2
  162. cognite/neat/v0/core/_data_model/models/entities/_restrictions.py +230 -0
  163. cognite/neat/{core → v0/core}/_data_model/models/entities/_single_value.py +121 -16
  164. cognite/neat/{core → v0/core}/_data_model/models/entities/_types.py +10 -0
  165. cognite/neat/{core → v0/core}/_data_model/models/mapping/_classic2core.py +5 -5
  166. cognite/neat/{core → v0/core}/_data_model/models/physical/__init__.py +1 -1
  167. cognite/neat/{core → v0/core}/_data_model/models/physical/_exporter.py +28 -21
  168. cognite/neat/{core → v0/core}/_data_model/models/physical/_unverified.py +141 -38
  169. cognite/neat/{core → v0/core}/_data_model/models/physical/_validation.py +190 -24
  170. cognite/neat/{core → v0/core}/_data_model/models/physical/_verified.py +135 -15
  171. cognite/neat/{core → v0/core}/_data_model/transformers/__init__.py +2 -0
  172. cognite/neat/{core → v0/core}/_data_model/transformers/_base.py +4 -4
  173. cognite/neat/{core → v0/core}/_data_model/transformers/_converters.py +39 -32
  174. cognite/neat/{core → v0/core}/_data_model/transformers/_mapping.py +7 -7
  175. cognite/neat/v0/core/_data_model/transformers/_union_conceptual.py +208 -0
  176. cognite/neat/{core → v0/core}/_data_model/transformers/_verification.py +7 -7
  177. cognite/neat/v0/core/_instances/__init__.py +0 -0
  178. cognite/neat/{core → v0/core}/_instances/_tracking/base.py +1 -1
  179. cognite/neat/{core → v0/core}/_instances/_tracking/log.py +1 -1
  180. cognite/neat/{core → v0/core}/_instances/extractors/__init__.py +1 -1
  181. cognite/neat/{core → v0/core}/_instances/extractors/_base.py +6 -6
  182. cognite/neat/v0/core/_instances/extractors/_classic_cdf/__init__.py +0 -0
  183. cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_base.py +7 -7
  184. cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_classic.py +12 -12
  185. cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_relationships.py +3 -3
  186. cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_sequences.py +2 -2
  187. cognite/neat/{core → v0/core}/_instances/extractors/_dict.py +6 -3
  188. cognite/neat/{core → v0/core}/_instances/extractors/_dms.py +6 -6
  189. cognite/neat/{core → v0/core}/_instances/extractors/_dms_graph.py +11 -11
  190. cognite/neat/{core → v0/core}/_instances/extractors/_mock_graph_generator.py +10 -10
  191. cognite/neat/{core → v0/core}/_instances/extractors/_raw.py +3 -3
  192. cognite/neat/{core → v0/core}/_instances/extractors/_rdf_file.py +7 -7
  193. cognite/neat/{core → v0/core}/_instances/loaders/_base.py +5 -5
  194. cognite/neat/{core → v0/core}/_instances/loaders/_rdf2dms.py +17 -17
  195. cognite/neat/{core → v0/core}/_instances/loaders/_rdf_to_instance_space.py +11 -11
  196. cognite/neat/{core → v0/core}/_instances/queries/_select.py +29 -3
  197. cognite/neat/{core → v0/core}/_instances/queries/_update.py +1 -1
  198. cognite/neat/{core → v0/core}/_instances/transformers/_base.py +4 -4
  199. cognite/neat/{core → v0/core}/_instances/transformers/_classic_cdf.py +6 -6
  200. cognite/neat/{core → v0/core}/_instances/transformers/_prune_graph.py +4 -4
  201. cognite/neat/{core → v0/core}/_instances/transformers/_rdfpath.py +1 -1
  202. cognite/neat/{core → v0/core}/_instances/transformers/_value_type.py +4 -4
  203. cognite/neat/{core → v0/core}/_issues/_base.py +11 -6
  204. cognite/neat/{core → v0/core}/_issues/_contextmanagers.py +8 -6
  205. cognite/neat/{core → v0/core}/_issues/_factory.py +11 -8
  206. cognite/neat/{core → v0/core}/_issues/errors/__init__.py +3 -1
  207. cognite/neat/{core → v0/core}/_issues/errors/_external.py +1 -1
  208. cognite/neat/{core → v0/core}/_issues/errors/_general.py +1 -1
  209. cognite/neat/{core → v0/core}/_issues/errors/_properties.py +12 -1
  210. cognite/neat/{core → v0/core}/_issues/errors/_resources.py +2 -2
  211. cognite/neat/{core → v0/core}/_issues/errors/_wrapper.py +7 -3
  212. cognite/neat/{core → v0/core}/_issues/warnings/__init__.py +5 -1
  213. cognite/neat/{core → v0/core}/_issues/warnings/_external.py +1 -1
  214. cognite/neat/{core → v0/core}/_issues/warnings/_general.py +1 -1
  215. cognite/neat/{core → v0/core}/_issues/warnings/_models.py +39 -4
  216. cognite/neat/{core → v0/core}/_issues/warnings/_properties.py +13 -2
  217. cognite/neat/{core → v0/core}/_issues/warnings/_resources.py +1 -1
  218. cognite/neat/{core → v0/core}/_issues/warnings/user_modeling.py +1 -1
  219. cognite/neat/{core → v0/core}/_store/_data_model.py +13 -12
  220. cognite/neat/{core → v0/core}/_store/_instance.py +45 -12
  221. cognite/neat/{core → v0/core}/_store/_provenance.py +3 -3
  222. cognite/neat/{core → v0/core}/_store/exceptions.py +4 -4
  223. cognite/neat/v0/core/_utils/__init__.py +0 -0
  224. cognite/neat/{core → v0/core}/_utils/auth.py +1 -1
  225. cognite/neat/{core → v0/core}/_utils/auxiliary.py +7 -1
  226. cognite/neat/{core → v0/core}/_utils/collection_.py +2 -2
  227. cognite/neat/{core → v0/core}/_utils/graph_transformations_report.py +1 -1
  228. cognite/neat/{core → v0/core}/_utils/rdf_.py +38 -14
  229. cognite/neat/{core → v0/core}/_utils/reader/_base.py +1 -1
  230. cognite/neat/{core → v0/core}/_utils/spreadsheet.py +22 -4
  231. cognite/neat/v0/core/_utils/tarjan.py +44 -0
  232. cognite/neat/{core → v0/core}/_utils/text.py +1 -1
  233. cognite/neat/{core → v0/core}/_utils/upload.py +3 -3
  234. cognite/neat/v0/plugins/__init__.py +4 -0
  235. cognite/neat/v0/plugins/_base.py +9 -0
  236. cognite/neat/v0/plugins/_data_model.py +48 -0
  237. cognite/neat/{plugins → v0/plugins}/_issues.py +1 -1
  238. cognite/neat/{plugins → v0/plugins}/_manager.py +7 -16
  239. cognite/neat/{session → v0/session}/_base.py +13 -10
  240. cognite/neat/{session → v0/session}/_collector.py +1 -1
  241. cognite/neat/v0/session/_diff.py +51 -0
  242. cognite/neat/{session → v0/session}/_drop.py +3 -3
  243. cognite/neat/{session → v0/session}/_explore.py +2 -2
  244. cognite/neat/{session → v0/session}/_fix.py +2 -2
  245. cognite/neat/{session → v0/session}/_inspect.py +3 -3
  246. cognite/neat/{session → v0/session}/_mapping.py +3 -3
  247. cognite/neat/{session → v0/session}/_plugin.py +4 -5
  248. cognite/neat/{session → v0/session}/_prepare.py +8 -8
  249. cognite/neat/{session → v0/session}/_read.py +33 -43
  250. cognite/neat/{session → v0/session}/_set.py +8 -8
  251. cognite/neat/{session → v0/session}/_show.py +5 -5
  252. cognite/neat/{session → v0/session}/_state.py +22 -8
  253. cognite/neat/{session → v0/session}/_subset.py +4 -4
  254. cognite/neat/{session → v0/session}/_template.py +11 -11
  255. cognite/neat/{session → v0/session}/_to.py +12 -12
  256. cognite/neat/{session → v0/session}/_wizard.py +1 -1
  257. cognite/neat/{session → v0/session}/engine/_load.py +1 -1
  258. cognite/neat/{session → v0/session}/exceptions.py +5 -5
  259. cognite/neat/v1.py +3 -0
  260. {cognite_neat-0.123.2.dist-info → cognite_neat-0.127.30.dist-info}/METADATA +9 -8
  261. cognite_neat-0.127.30.dist-info/RECORD +319 -0
  262. {cognite_neat-0.123.2.dist-info → cognite_neat-0.127.30.dist-info}/WHEEL +1 -1
  263. cognite/neat/core/_data_model/importers/_dtdl2data_model/__init__.py +0 -3
  264. cognite/neat/core/_data_model/importers/_dtdl2data_model/_unit_lookup.py +0 -224
  265. cognite/neat/core/_data_model/importers/_dtdl2data_model/dtdl_converter.py +0 -320
  266. cognite/neat/core/_data_model/importers/_dtdl2data_model/dtdl_importer.py +0 -155
  267. cognite/neat/core/_data_model/importers/_dtdl2data_model/spec.py +0 -363
  268. cognite/neat/core/_data_model/importers/_rdf/__init__.py +0 -5
  269. cognite/neat/core/_data_model/importers/_rdf/_imf2data_model.py +0 -98
  270. cognite/neat/core/_data_model/importers/_rdf/_owl2data_model.py +0 -87
  271. cognite/neat/core/_data_model/importers/_rdf/_shared.py +0 -168
  272. cognite/neat/core/_data_model/models/conceptual/_validation.py +0 -294
  273. cognite/neat/core/_data_model/models/entities/_loaders.py +0 -75
  274. cognite/neat/plugins/__init__.py +0 -3
  275. cognite/neat/plugins/data_model/importers/__init__.py +0 -5
  276. cognite/neat/plugins/data_model/importers/_base.py +0 -28
  277. cognite_neat-0.123.2.dist-info/RECORD +0 -197
  278. /cognite/neat/{core → _data_model}/__init__.py +0 -0
  279. /cognite/neat/{core/_client/_api → _data_model/deployer}/__init__.py +0 -0
  280. /cognite/neat/{core/_client/data_classes → _data_model/exporters/_table_exporter}/__init__.py +0 -0
  281. /cognite/neat/{core/_data_model → _data_model/importers/_table_importer}/__init__.py +0 -0
  282. /cognite/neat/{core/_instances → _data_model/models}/__init__.py +0 -0
  283. /cognite/neat/{core/_instances/extractors/_classic_cdf → _data_model/models/conceptual}/__init__.py +0 -0
  284. /cognite/neat/{core/_utils → _data_model/validation}/__init__.py +0 -0
  285. /cognite/neat/{plugins/data_model → _session/_html}/__init__.py +0 -0
  286. /cognite/neat/{core → v0/core}/_client/__init__.py +0 -0
  287. /cognite/neat/{core → v0/core}/_client/data_classes/data_modeling.py +0 -0
  288. /cognite/neat/{core → v0/core}/_client/data_classes/neat_sequence.py +0 -0
  289. /cognite/neat/{core → v0/core}/_client/data_classes/statistics.py +0 -0
  290. /cognite/neat/{core → v0/core}/_config.py +0 -0
  291. /cognite/neat/{core → v0/core}/_data_model/analysis/__init__.py +0 -0
  292. /cognite/neat/{core → v0/core}/_data_model/catalog/__init__.py +0 -0
  293. /cognite/neat/{core → v0/core}/_data_model/catalog/classic_model.xlsx +0 -0
  294. /cognite/neat/{core → v0/core}/_data_model/catalog/conceptual-imf-data-model.xlsx +0 -0
  295. /cognite/neat/{core → v0/core}/_data_model/catalog/hello_world_pump.xlsx +0 -0
  296. /cognite/neat/{core → v0/core}/_data_model/models/_base_unverified.py +0 -0
  297. /cognite/neat/{core → v0/core}/_data_model/models/conceptual/__init__.py +0 -0
  298. /cognite/neat/{core → v0/core}/_data_model/models/entities/_constants.py +0 -0
  299. /cognite/neat/{core → v0/core}/_data_model/models/entities/_wrapped.py +0 -0
  300. /cognite/neat/{core → v0/core}/_data_model/models/mapping/__init__.py +0 -0
  301. /cognite/neat/{core → v0/core}/_data_model/models/mapping/_classic2core.yaml +0 -0
  302. /cognite/neat/{core → v0/core}/_instances/_shared.py +0 -0
  303. /cognite/neat/{core → v0/core}/_instances/_tracking/__init__.py +0 -0
  304. /cognite/neat/{core → v0/core}/_instances/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  305. /cognite/neat/{core → v0/core}/_instances/examples/Knowledge-Graph-Nordic44.xml +0 -0
  306. /cognite/neat/{core → v0/core}/_instances/examples/__init__.py +0 -0
  307. /cognite/neat/{core → v0/core}/_instances/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  308. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_assets.py +0 -0
  309. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_data_sets.py +0 -0
  310. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_events.py +0 -0
  311. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_files.py +0 -0
  312. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_labels.py +0 -0
  313. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_timeseries.py +0 -0
  314. /cognite/neat/{core → v0/core}/_instances/loaders/__init__.py +0 -0
  315. /cognite/neat/{core → v0/core}/_instances/queries/__init__.py +0 -0
  316. /cognite/neat/{core → v0/core}/_instances/queries/_base.py +0 -0
  317. /cognite/neat/{core → v0/core}/_instances/queries/_queries.py +0 -0
  318. /cognite/neat/{core → v0/core}/_instances/transformers/__init__.py +0 -0
  319. /cognite/neat/{core → v0/core}/_issues/__init__.py +0 -0
  320. /cognite/neat/{core → v0/core}/_issues/formatters.py +0 -0
  321. /cognite/neat/{core → v0/core}/_shared.py +0 -0
  322. /cognite/neat/{core → v0/core}/_store/__init__.py +0 -0
  323. /cognite/neat/{core → v0/core}/_utils/io_.py +0 -0
  324. /cognite/neat/{core → v0/core}/_utils/reader/__init__.py +0 -0
  325. /cognite/neat/{core → v0/core}/_utils/time_.py +0 -0
  326. /cognite/neat/{core → v0/core}/_utils/xml_.py +0 -0
  327. /cognite/neat/{session → v0/session}/__init__.py +0 -0
  328. /cognite/neat/{session → v0/session}/_experimental.py +0 -0
  329. /cognite/neat/{session → v0/session}/_state/README.md +0 -0
  330. /cognite/neat/{session → v0/session}/engine/__init__.py +0 -0
  331. /cognite/neat/{session → v0/session}/engine/_import.py +0 -0
  332. /cognite/neat/{session → v0/session}/engine/_interface.py +0 -0
  333. {cognite_neat-0.123.2.dist-info → cognite_neat-0.127.30.dist-info}/licenses/LICENSE +0 -0
@@ -1,363 +0,0 @@
1
- """
2
- This is a pydantic validation implementation of the DTDL v2 and v3 specifications.
3
-
4
- The specs are taken from:
5
-
6
- * Spec v2: https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/DTDL.v2.md
7
- * Spec v3: https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v3/DTDL.v3.md
8
- """
9
-
10
- import re
11
- import warnings
12
- from abc import ABC
13
- from typing import TYPE_CHECKING, Any, ClassVar, Literal, TypeAlias
14
-
15
- from pydantic import BaseModel, Field, field_validator, model_serializer, model_validator
16
- from pydantic.fields import FieldInfo
17
-
18
- from cognite.neat.core._data_model.models.entities import ConceptEntity
19
-
20
- if TYPE_CHECKING:
21
- from pydantic.type_adapter import IncEx
22
-
23
-
24
- # Regex is from the spec: https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTMI/README.md#validation-regular-expressions
25
- _DTMI_REGEX = (
26
- r"^dtmi:(?:_+[A-Za-z0-9]|[A-Za-z])(?:[A-Za-z0-9_]*[A-Za-z0-9])?(?::(?:_+[A-Za-z0-9]|[A-Za-z])"
27
- r"(?:[A-Za-z0-9_]*[A-Za-z0-9])?)*(?:;[1-9][0-9]{0,8}(?:\.[1-9][0-9]{0,5})?)?$"
28
- )
29
-
30
- _DTMI_COMPILED = re.compile(_DTMI_REGEX)
31
-
32
-
33
- class DTMI(BaseModel):
34
- scheme: ClassVar[str] = "dtmi"
35
- path: list[str]
36
- version: str
37
-
38
- def as_concept_entity(self) -> ConceptEntity:
39
- return ConceptEntity(prefix="_".join(self.path[:-1]), suffix=self.path[-1], version=self.version)
40
-
41
- def __hash__(self) -> int:
42
- return hash(self.to_string())
43
-
44
- def __repr__(self) -> str:
45
- return self.to_string()
46
-
47
- @model_validator(mode="before")
48
- def from_string(cls, value: Any) -> Any:
49
- if not isinstance(value, str):
50
- return value
51
- if not _DTMI_COMPILED.match(value):
52
- raise ValueError(f"Invalid DTMI {value}")
53
- value = value.removeprefix(cls.scheme + ":")
54
- path_str, version = value.split(";", 1)
55
- return dict(path=path_str.split(":"), version=version)
56
-
57
- @model_serializer
58
- def to_string(self) -> str:
59
- return f"{self.scheme}:{':'.join(self.path)};{self.version}"
60
-
61
- if TYPE_CHECKING:
62
- # Ensure type checkers works correctly, ref
63
- # https://docs.pydantic.dev/latest/concepts/serialization/#overriding-the-return-type-when-dumping-a-model
64
- def model_dump( # type: ignore[override]
65
- self,
66
- *,
67
- mode: Literal["json", "python"] | str = "python",
68
- include: IncEx | None = None,
69
- exclude: IncEx | None = None,
70
- by_alias: bool = False,
71
- exclude_unset: bool = False,
72
- exclude_defaults: bool = False,
73
- exclude_none: bool = False,
74
- round_trip: bool = False,
75
- warnings: bool = True,
76
- ) -> str: ...
77
-
78
-
79
- IRI: TypeAlias = str
80
-
81
-
82
- class Unit(BaseModel, ABC):
83
- value: str
84
- semantic_type: str | None = Field(None, alias="semanticType")
85
- unit_type: str | None = Field(None, alias="unitType")
86
-
87
- def __hash__(self) -> int:
88
- return hash(self.to_string())
89
-
90
- def __repr__(self) -> str:
91
- return self.to_string()
92
-
93
- @model_validator(mode="before")
94
- def from_string(cls, value: Any) -> Any:
95
- if not isinstance(value, str):
96
- return value
97
- from ._unit_lookup import ENTRY_BY_UNIT
98
-
99
- if value not in ENTRY_BY_UNIT:
100
- return dict(unit=value)
101
- entry = ENTRY_BY_UNIT[value]
102
- return dict(
103
- value=value,
104
- semanticType=entry.semantic_type,
105
- unitType=entry.unit_type,
106
- )
107
-
108
- @model_serializer
109
- def to_string(self) -> str:
110
- return self.value
111
-
112
- if TYPE_CHECKING:
113
- # Ensure type checkers works correctly, ref
114
- # https://docs.pydantic.dev/latest/concepts/serialization/#overriding-the-return-type-when-dumping-a-model
115
- def model_dump( # type: ignore[override]
116
- self,
117
- *,
118
- mode: Literal["json", "python"] | str = "python",
119
- include: IncEx | None = None,
120
- exclude: IncEx | None = None,
121
- by_alias: bool = False,
122
- exclude_unset: bool = False,
123
- exclude_defaults: bool = False,
124
- exclude_none: bool = False,
125
- round_trip: bool = False,
126
- warnings: bool = True,
127
- ) -> str: ...
128
-
129
-
130
- class DTDLBase(BaseModel, ABC):
131
- type: ClassVar[str]
132
- spec_version: ClassVar[frozenset[str]]
133
- id_: DTMI | None = Field(None, alias="@id")
134
- comment: str | None = None
135
- display_name: str | None = Field(None, alias="displayName")
136
- description: str | None = None
137
-
138
- @property
139
- def identifier_with_fallback(self) -> str:
140
- return (self.id_.model_dump() if self.id_ else self.display_name) or "MISSING"
141
-
142
-
143
- PrimitiveSchema: TypeAlias = Literal[
144
- "boolean", "date", "dateTime", "double", "duration", "float", "integer", "long", "string", "time"
145
- ]
146
-
147
-
148
- class DTDLBaseWithName(DTDLBase, ABC):
149
- name: str
150
-
151
-
152
- class DTDLBaseWithSchema(DTDLBaseWithName, ABC):
153
- schema_: "Schema | DTMI | None" = Field(None, alias="schema") # type: ignore[assignment]
154
-
155
- @field_validator("schema_", mode="before")
156
- def select_schema_type(cls, value: Any) -> Any:
157
- if isinstance(value, dict) and (type_ := value.get("@type")):
158
- context = Interface.default_context
159
- spec_version = context.rsplit(";", maxsplit=1)[1]
160
- try:
161
- cls_by_type = DTDL_CLS_BY_TYPE_BY_SPEC[spec_version]
162
- except KeyError:
163
- raise ValueError(f"DTDL Spec v{spec_version} is not supported: {context}") from None
164
- if isinstance(type_, str) and (cls_ := cls_by_type.get(type_)) is not None:
165
- return cls_.model_validate(value)
166
- elif isinstance(type_, list) and len(type_) == 2 and (cls_ := cls_by_type.get(type_[0])) is not None:
167
- # In the spec v2, the type of Telemetry and Property can be a list of two strings,
168
- # [[Telemetry|Property, "Semantic Type"].
169
- from ._unit_lookup import UNIT_TYPE_BY_SEMANTIC_TYPE
170
-
171
- if unit_type := UNIT_TYPE_BY_SEMANTIC_TYPE.get(type_[1]) and "unit" in value:
172
- value["unit"] = {
173
- "value": value["unit"],
174
- "semanticType": type_[1],
175
- "unitType": unit_type,
176
- }
177
- return cls_.model_validate(value)
178
- return value
179
-
180
-
181
- class DTDLField(DTDLBaseWithSchema):
182
- type = "Field"
183
- spec_version = frozenset(["2", "3"])
184
-
185
-
186
- class Object(DTDLBase):
187
- type = "Object"
188
- spec_version = frozenset(["2", "3"])
189
- fields: list[DTDLField] | None = None
190
-
191
-
192
- class MapKey(DTDLBaseWithName):
193
- type = "MapKey"
194
- spec_version = frozenset(["2", "3"])
195
- schema_: str = Field(alias="schema")
196
-
197
-
198
- class MapValue(DTDLBaseWithSchema):
199
- type = "MapValue"
200
- spec_version = frozenset(["2", "3"])
201
-
202
-
203
- class Map(DTDLBase):
204
- type = "Map"
205
- spec_version = frozenset(["2", "3"])
206
- map_key: MapKey = Field(alias="mapKey")
207
- map_value: MapValue = Field(alias="mapValue")
208
-
209
-
210
- class EnumValue(DTDLBaseWithName):
211
- type = "EnumValue"
212
- spec_version = frozenset(["2", "3"])
213
- enum_value: str = Field(alias="enumValue")
214
-
215
-
216
- class Enum(DTDLBase):
217
- type = "Enum"
218
- spec_version = frozenset(["2", "3"])
219
- enum_values: list[EnumValue] = Field(alias="enumValues")
220
- value_schema: PrimitiveSchema = Field(alias="valueSchema")
221
-
222
-
223
- class Array(DTDLBase):
224
- type = "Array"
225
- spec_version = frozenset(["2", "3"])
226
- element_schema: "Schema" = Field(alias="elementSchema")
227
-
228
-
229
- ComplexSchema: TypeAlias = Array | Enum | Map | Object
230
-
231
- Schema: TypeAlias = PrimitiveSchema | ComplexSchema
232
-
233
-
234
- class Component(DTDLBaseWithSchema):
235
- type = "Component"
236
- spec_version = frozenset(["2", "3"])
237
- schema_: "Interface | DTMI" = Field(alias="schema") # type: ignore[assignment]
238
-
239
-
240
- class Property(DTDLBaseWithSchema):
241
- type = "Property"
242
- spec_version = frozenset(["3"])
243
- writable: bool | None = None
244
-
245
-
246
- class PropertyV2(Property):
247
- spec_version = frozenset(["2"])
248
- unit: Unit | None = None
249
-
250
-
251
- class Relationship(DTDLBaseWithName):
252
- type = "Relationship"
253
- spec_version = frozenset(["2", "3"])
254
- min_multiplicity: int | None = Field(None, alias="minMultiplicity", le=0, ge=0)
255
- max_multiplicity: int | None = Field(None, alias="maxMultiplicity", ge=1)
256
- properties: list[Property] | None = None
257
- target: DTMI | None = None
258
- writable: bool | None = None
259
-
260
-
261
- class CommandRequest(DTDLBaseWithSchema):
262
- type = "CommandRequest"
263
- spec_version = frozenset(["3"])
264
-
265
-
266
- class CommandResponse(DTDLBaseWithSchema):
267
- type = "CommandResponse"
268
- spec_version = frozenset(["3"])
269
-
270
-
271
- class CommandPayload(DTDLBaseWithSchema):
272
- type = "CommandPayload"
273
- spec_version = frozenset(["2"])
274
-
275
-
276
- class Command(DTDLBaseWithSchema):
277
- type = "Command"
278
- spec_version = frozenset(["3"])
279
- request: CommandRequest | None = None
280
- response: CommandResponse | None = None
281
-
282
-
283
- class CommandV2(DTDLBaseWithSchema):
284
- type = "Command"
285
- spec_version = frozenset(["2"])
286
- request: CommandPayload | None = None
287
- response: CommandPayload | None = None
288
-
289
-
290
- class Telemetry(DTDLBaseWithSchema):
291
- type = "Telemetry"
292
- spec_version = frozenset(["3"])
293
-
294
-
295
- class TelemetryV2(Telemetry):
296
- spec_version = frozenset(["2"])
297
- unit: Unit | None = None
298
-
299
-
300
- class Interface(DTDLBase):
301
- type = "Interface"
302
- spec_version = frozenset(["2", "3"])
303
- default_context: ClassVar[IRI] = Field(
304
- "dtmi:dtdl:context;3",
305
- description="This can be set directly on the class to change the default context used when parsing a document.",
306
- )
307
- id_: DTMI = Field(alias="@id") # type: ignore[assignment]
308
- context: IRI | None = Field(alias="@context")
309
- extends: list[DTMI] | None = None
310
- contents: list[Command | Component | Property | Relationship | Telemetry | DTMI | CommandV2] | None = None
311
- schemas: list[Array | Enum | Map | Object] | None = None
312
-
313
- @field_validator("context", mode="before")
314
- def list_to_string(cls, value: Any) -> Any:
315
- if isinstance(value, list) and len(value) == 1:
316
- return value[0]
317
- return value
318
-
319
- @field_validator("contents", "schemas", mode="before")
320
- def select_content_type(cls, value: Any, info: Any) -> Any:
321
- if not isinstance(value, list):
322
- return value
323
- context = info.data.get("@context", cls.default_context)
324
- if isinstance(context, FieldInfo):
325
- context = context.default
326
- spec_version = context.rsplit(";", maxsplit=1)[1]
327
- try:
328
- cls_by_type = DTDL_CLS_BY_TYPE_BY_SPEC[spec_version]
329
- except KeyError:
330
- raise ValueError(f"DTDL Spec v{spec_version} is not supported: {context}") from None
331
- output: list[DTDLBase] = []
332
- for item in value:
333
- if isinstance(item, dict) and (type_ := item.get("@type")):
334
- if isinstance(type_, str) and (cls_ := cls_by_type.get(type_)) is not None:
335
- item = cls_.model_validate(item)
336
- elif isinstance(type_, list) and len(type_) == 2 and (cls_ := cls_by_type.get(type_[0])) is not None:
337
- # In the spec v2, the type of Telemetry and Property can be a list of two strings,
338
- # [[Telemetry|Property, "Semantic Type"].
339
- from ._unit_lookup import UNIT_TYPE_BY_SEMANTIC_TYPE
340
-
341
- if (unit_type := UNIT_TYPE_BY_SEMANTIC_TYPE.get(type_[1])) and (unit := item.get("unit")):
342
- item["unit"] = {
343
- "value": unit,
344
- "semanticType": type_[1],
345
- "unitType": unit_type,
346
- }
347
- item = cls_.model_validate(item)
348
- else:
349
- warnings.warn(f"Invalid item {item} in {cls.__name__}.contents", stacklevel=2)
350
- output.append(item)
351
- return output
352
-
353
-
354
- DTDL_CLS_BY_TYPE_BY_SPEC: dict[str, dict[str, type[DTDLBase]]] = {}
355
- to_check = list(DTDLBase.__subclasses__())
356
- while to_check:
357
- cls = to_check.pop()
358
- to_check.extend(cls.__subclasses__())
359
- if ABC in cls.__bases__:
360
- continue
361
- for spec in cls.spec_version:
362
- DTDL_CLS_BY_TYPE_BY_SPEC.setdefault(spec, {})[cls.type] = cls
363
- del cls, to_check, spec
@@ -1,5 +0,0 @@
1
- from ._imf2data_model import IMFImporter
2
- from ._inference2rdata_model import InferenceImporter, SubclassInferenceImporter
3
- from ._owl2data_model import OWLImporter
4
-
5
- __all__ = ["IMFImporter", "InferenceImporter", "OWLImporter", "SubclassInferenceImporter"]
@@ -1,98 +0,0 @@
1
- """This module performs importing of various formats to one of serializations for which
2
- there are loaders to data model pydantic class."""
3
-
4
- from cognite.neat.core._data_model.importers._rdf._base import BaseRDFImporter
5
- from cognite.neat.core._data_model.importers._rdf._shared import (
6
- parse_concepts,
7
- parse_properties,
8
- )
9
-
10
- CLASSES_QUERY = """
11
- SELECT ?concept ?name ?description ?implements
12
- WHERE {{
13
- VALUES ?type {{ imf:BlockType imf:TerminalType imf:AttributeType }}
14
- ?concept a ?type .
15
-
16
- OPTIONAL {{?concept rdfs:subClassOf ?parent }}.
17
- OPTIONAL {{?concept rdfs:label|skos:prefLabel ?name }}.
18
- OPTIONAL {{?concept rdfs:comment|skos:definition ?description}}.
19
-
20
-
21
- # Add imf:Attribute as parent class when no parent is found
22
- BIND(IF(!bound(?parent) && ?type = imf:AttributeType, imf:Attribute, ?parent) AS ?implements)
23
-
24
- # FILTERS
25
- FILTER (!isBlank(?concept))
26
- FILTER (!bound(?implements) || !isBlank(?implements))
27
-
28
- FILTER (!bound(?name) || LANG(?name) = "" || LANGMATCHES(LANG(?name), "{language}"))
29
- FILTER (!bound(?description) || LANG(?description) = "" || LANGMATCHES(LANG(?description), "{language}"))
30
- }}
31
- """
32
-
33
- PROPERTIES_QUERY = """
34
- SELECT ?concept ?property_ ?name ?description ?value_type ?min_count ?max_count ?default
35
- WHERE
36
- {{
37
- # CASE 1: Handling Blocks and Terminals
38
- {{
39
- VALUES ?type {{ imf:BlockType imf:TerminalType }}
40
- ?concept a ?type ;
41
- sh:property ?propertyShape .
42
- ?propertyShape sh:path ?property_ .
43
-
44
- OPTIONAL {{ ?property_ skos:prefLabel ?name . }}
45
- OPTIONAL {{ ?property_ skos:definition ?description . }}
46
- OPTIONAL {{ ?property_ rdfs:range ?range . }}
47
-
48
- OPTIONAL {{ ?propertyShape sh:minCount ?min_count . }}
49
- OPTIONAL {{ ?propertyShape sh:maxCount ?max_count . }}
50
- OPTIONAL {{ ?propertyShape sh:hasValue ?default . }}
51
- OPTIONAL {{ ?propertyShape sh:class | sh:qualifiedValueShape/sh:class ?valueShape . }}
52
- }}
53
-
54
- UNION
55
-
56
- # CASE 2: Handling Attributes
57
- {{
58
- ?concept a imf:AttributeType .
59
- BIND(xsd:anyURI AS ?valueShape)
60
- BIND(imf:predicate AS ?property_)
61
- ?concept ?property_ ?defaultURI .
62
- BIND(STR(?defaultURI) AS ?default)
63
-
64
- }}
65
-
66
- # Set the value type for the property based on sh:class, sh:qualifiedValueType or rdfs:range
67
- BIND(IF(BOUND(?valueShape), ?valueShape, IF(BOUND(?range) , ?range , ?valueShape)) AS ?value_type)
68
-
69
- FILTER (!isBlank(?property_))
70
- FILTER (!bound(?concept) || !isBlank(?concept))
71
- FILTER (!bound(?name) || LANG(?name) = "" || LANGMATCHES(LANG(?name), "{language}"))
72
- FILTER (!bound(?description) || LANG(?description) = "" || LANGMATCHES(LANG(?description), "{language}"))
73
- }}
74
- """
75
-
76
-
77
- class IMFImporter(BaseRDFImporter):
78
- """Convert IMF Types provided as SHACL shapes to unverified data model."""
79
-
80
- @property
81
- def description(self) -> str:
82
- return f"IMF Types {self.source_name} read as unverified data model"
83
-
84
- def _to_data_model_components(
85
- self,
86
- ) -> dict:
87
- classes, issue_list = parse_concepts(self.graph, CLASSES_QUERY, self.language, self.issue_list)
88
- self.issue_list = issue_list
89
- properties, issue_list = parse_properties(self.graph, PROPERTIES_QUERY, self.language, self.issue_list)
90
- self.issue_list = issue_list
91
-
92
- components = {
93
- "Metadata": self._metadata,
94
- "Concepts": list(classes.values()) if classes else [],
95
- "Properties": list(properties.values()) if properties else [],
96
- }
97
-
98
- return components
@@ -1,87 +0,0 @@
1
- """This module performs importing of various formats to one of serializations for which
2
- there are loaders to data model pydantic class."""
3
-
4
- from cognite.neat.core._data_model.importers._rdf._base import BaseRDFImporter
5
- from cognite.neat.core._data_model.importers._rdf._shared import (
6
- parse_concepts,
7
- parse_properties,
8
- )
9
-
10
- CLASSES_QUERY = """SELECT ?concept ?name ?description ?implements
11
- WHERE {{
12
-
13
- ?concept a owl:Class .
14
- OPTIONAL {{?concept rdfs:subClassOf ?implements }}.
15
- OPTIONAL {{?concept rdfs:label|skos:prefLabel ?name }}.
16
- OPTIONAL {{?concept rdfs:comment|skos:definition ?description}} .
17
-
18
-
19
- FILTER (!isBlank(?concept ))
20
- FILTER (!bound(?implements) || !isBlank(?implements))
21
-
22
- FILTER (!bound(?name) || LANG(?name) = "" || LANGMATCHES(LANG(?name), "{language}"))
23
- FILTER (!bound(?description) || LANG(?description) = "" || LANGMATCHES(LANG(?description), "{language}"))
24
-
25
- }}
26
- """
27
-
28
- PROPERTIES_QUERY = """
29
-
30
- SELECT ?concept ?property_ ?name ?description ?value_type ?minCount ?maxCount ?default
31
- WHERE {{
32
- ?property_ a ?property_Type.
33
- FILTER (?property_Type IN (owl:ObjectProperty, owl:DatatypeProperty ) )
34
- OPTIONAL {{?property_ rdfs:domain ?concept }}.
35
- OPTIONAL {{?property_ rdfs:range ?value_type }}.
36
- OPTIONAL {{?property_ rdfs:label|skos:prefLabel ?name }}.
37
- OPTIONAL {{?property_ rdfs:comment|skos:definition ?description}}.
38
- OPTIONAL {{?property_ owl:maxCardinality ?maxCount}}.
39
- OPTIONAL {{?property_ owl:minCardinality ?minCount}}.
40
-
41
- # FILTERS
42
- FILTER (!isBlank(?property_))
43
- FILTER (!bound(?name) || LANG(?name) = "" || LANGMATCHES(LANG(?name), "{language}"))
44
- FILTER (!bound(?description) || LANG(?description) = "" || LANGMATCHES(LANG(?description), "{language}"))
45
- }}
46
- """
47
-
48
-
49
- class OWLImporter(BaseRDFImporter):
50
- """Convert OWL ontology to unverified data model.
51
-
52
- Args:
53
- filepath: Path to OWL ontology
54
-
55
- !!! Note
56
- OWL Ontologies are information models which completeness varies. As such, constructing functional
57
- data model directly will often be impossible, therefore the produced data model object will be ill formed.
58
- To avoid this, neat will automatically attempt to make the imported data model compliant by adding default
59
- values for missing information, attaching dangling properties to default containers based on the
60
- property type, etc.
61
-
62
- One has to be aware that NEAT will be opinionated about how to make the ontology
63
- compliant, and that the resulting data model may not be what you expect.
64
-
65
- """
66
-
67
- def _to_data_model_components(
68
- self,
69
- ) -> dict:
70
- concepts, issue_list = parse_concepts(self.graph, CLASSES_QUERY, self.language, self.issue_list)
71
- self.issue_list = issue_list
72
-
73
- # NeatError
74
- properties, issue_list = parse_properties(self.graph, PROPERTIES_QUERY, self.language, self.issue_list)
75
- self.issue_list = issue_list
76
-
77
- components = {
78
- "Metadata": self._metadata,
79
- "Concepts": list(concepts.values()) if concepts else [],
80
- "Properties": list(properties.values()) if properties else [],
81
- }
82
-
83
- return components
84
-
85
- @property
86
- def description(self) -> str:
87
- return f"Ontology {self.source_name} read as unverified data model"