cognite-neat 0.92.2__py3-none-any.whl → 0.93.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cognite-neat might be problematic. Click here for more details.

Files changed (289) hide show
  1. cognite/neat/__init__.py +3 -2
  2. cognite/neat/{app → _app}/api/configuration.py +9 -7
  3. cognite/neat/_app/api/context_manager/__init__.py +3 -0
  4. cognite/neat/{app → _app}/api/context_manager/manager.py +1 -1
  5. cognite/neat/{app → _app}/api/explorer.py +5 -5
  6. cognite/neat/{app → _app}/api/routers/configuration.py +2 -2
  7. cognite/neat/{app → _app}/api/routers/crud.py +4 -4
  8. cognite/neat/{app → _app}/api/routers/workflows.py +7 -7
  9. cognite/neat/{app → _app}/main.py +1 -1
  10. cognite/neat/_app/ui/neat-app/package-lock.json +18306 -0
  11. cognite/neat/_app/ui/neat-app/package.json +62 -0
  12. cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
  13. cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +116 -0
  14. cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +112 -0
  15. cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +34 -0
  16. cognite/neat/_app/ui/neat-app/public/index.html +43 -0
  17. cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
  18. cognite/neat/_app/ui/neat-app/public/manifest.json +25 -0
  19. cognite/neat/_app/ui/neat-app/public/robots.txt +3 -0
  20. cognite/neat/_app/ui/neat-app/src/App.css +38 -0
  21. cognite/neat/_app/ui/neat-app/src/App.js +17 -0
  22. cognite/neat/_app/ui/neat-app/src/App.test.js +8 -0
  23. cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +70 -0
  24. cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +43 -0
  25. cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +124 -0
  26. cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +63 -0
  27. cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +511 -0
  28. cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +36 -0
  29. cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +56 -0
  30. cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +60 -0
  31. cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +112 -0
  32. cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +67 -0
  33. cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +79 -0
  34. cognite/neat/_app/ui/neat-app/src/index.css +13 -0
  35. cognite/neat/_app/ui/neat-app/src/index.js +13 -0
  36. cognite/neat/_app/ui/neat-app/src/logo.svg +1 -0
  37. cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +13 -0
  38. cognite/neat/_app/ui/neat-app/src/setupTests.js +5 -0
  39. cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +388 -0
  40. cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +61 -0
  41. cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +184 -0
  42. cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +180 -0
  43. cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +570 -0
  44. cognite/neat/_app/ui/neat-app/tsconfig.json +27 -0
  45. cognite/neat/{config.py → _config.py} +3 -3
  46. cognite/neat/{constants.py → _constants.py} +13 -5
  47. cognite/neat/_graph/_shared.py +34 -0
  48. cognite/neat/{graph → _graph}/_tracking/base.py +1 -1
  49. cognite/neat/{graph → _graph}/_tracking/log.py +1 -1
  50. cognite/neat/{graph → _graph}/extractors/__init__.py +5 -0
  51. cognite/neat/{graph → _graph}/extractors/_base.py +2 -2
  52. cognite/neat/{graph → _graph}/extractors/_classic_cdf/_assets.py +1 -1
  53. cognite/neat/{graph → _graph}/extractors/_classic_cdf/_base.py +4 -4
  54. cognite/neat/{graph → _graph}/extractors/_classic_cdf/_classic.py +5 -5
  55. cognite/neat/{graph → _graph}/extractors/_classic_cdf/_data_sets.py +1 -1
  56. cognite/neat/{graph → _graph}/extractors/_classic_cdf/_events.py +1 -1
  57. cognite/neat/{graph → _graph}/extractors/_classic_cdf/_files.py +1 -1
  58. cognite/neat/{graph → _graph}/extractors/_classic_cdf/_labels.py +1 -1
  59. cognite/neat/{graph → _graph}/extractors/_classic_cdf/_relationships.py +2 -2
  60. cognite/neat/{graph → _graph}/extractors/_classic_cdf/_sequences.py +1 -1
  61. cognite/neat/{graph → _graph}/extractors/_classic_cdf/_timeseries.py +1 -1
  62. cognite/neat/{graph → _graph}/extractors/_dexpi.py +5 -5
  63. cognite/neat/{graph → _graph}/extractors/_dms.py +3 -3
  64. cognite/neat/_graph/extractors/_iodd.py +402 -0
  65. cognite/neat/{graph → _graph}/extractors/_mock_graph_generator.py +9 -8
  66. cognite/neat/_graph/extractors/_rdf_file.py +49 -0
  67. cognite/neat/{graph → _graph}/loaders/_base.py +5 -5
  68. cognite/neat/{graph → _graph}/loaders/_rdf2asset.py +11 -10
  69. cognite/neat/{graph → _graph}/loaders/_rdf2dms.py +10 -10
  70. cognite/neat/{graph → _graph}/queries/_base.py +91 -19
  71. cognite/neat/{graph → _graph}/queries/_construct.py +5 -5
  72. cognite/neat/{graph → _graph}/queries/_shared.py +3 -3
  73. cognite/neat/{graph → _graph}/transformers/__init__.py +6 -0
  74. cognite/neat/{graph → _graph}/transformers/_classic_cdf.py +135 -3
  75. cognite/neat/_graph/transformers/_iodd.py +25 -0
  76. cognite/neat/_graph/transformers/_prune_graph.py +126 -0
  77. cognite/neat/{graph → _graph}/transformers/_rdfpath.py +3 -3
  78. cognite/neat/_graph/transformers/_value_type.py +66 -0
  79. cognite/neat/{issues → _issues}/_base.py +32 -17
  80. cognite/neat/{issues → _issues}/errors/__init__.py +1 -1
  81. cognite/neat/{issues → _issues}/errors/_external.py +8 -8
  82. cognite/neat/{issues → _issues}/errors/_general.py +5 -5
  83. cognite/neat/{issues → _issues}/errors/_properties.py +7 -7
  84. cognite/neat/{issues → _issues}/errors/_resources.py +11 -11
  85. cognite/neat/{issues → _issues}/errors/_workflow.py +5 -5
  86. cognite/neat/{issues → _issues}/warnings/__init__.py +1 -1
  87. cognite/neat/{issues → _issues}/warnings/_external.py +5 -5
  88. cognite/neat/{issues → _issues}/warnings/_general.py +4 -4
  89. cognite/neat/{issues → _issues}/warnings/_models.py +10 -10
  90. cognite/neat/{issues → _issues}/warnings/_properties.py +6 -6
  91. cognite/neat/{issues → _issues}/warnings/_resources.py +5 -5
  92. cognite/neat/{issues → _issues}/warnings/user_modeling.py +9 -9
  93. cognite/neat/_rules/_constants.py +190 -0
  94. cognite/neat/{rules → _rules}/_shared.py +5 -5
  95. cognite/neat/_rules/analysis/__init__.py +5 -0
  96. cognite/neat/{rules → _rules}/analysis/_asset.py +5 -5
  97. cognite/neat/{rules → _rules}/analysis/_base.py +5 -5
  98. cognite/neat/_rules/analysis/_dms.py +43 -0
  99. cognite/neat/{rules → _rules}/analysis/_information.py +12 -6
  100. cognite/neat/_rules/catalog/__init__.py +6 -0
  101. cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
  102. cognite/neat/{rules → _rules}/exporters/__init__.py +2 -0
  103. cognite/neat/{rules → _rules}/exporters/_base.py +3 -3
  104. cognite/neat/{rules → _rules}/exporters/_rules2dms.py +5 -5
  105. cognite/neat/{rules → _rules}/exporters/_rules2excel.py +26 -7
  106. cognite/neat/_rules/exporters/_rules2instance_template.py +152 -0
  107. cognite/neat/{rules → _rules}/exporters/_rules2ontology.py +10 -9
  108. cognite/neat/{rules → _rules}/exporters/_rules2yaml.py +1 -3
  109. cognite/neat/{rules → _rules}/exporters/_validation.py +2 -2
  110. cognite/neat/{rules → _rules}/importers/_base.py +3 -3
  111. cognite/neat/{rules → _rules}/importers/_dms2rules.py +9 -9
  112. cognite/neat/{rules → _rules}/importers/_dtdl2rules/dtdl_converter.py +7 -7
  113. cognite/neat/{rules → _rules}/importers/_dtdl2rules/dtdl_importer.py +9 -9
  114. cognite/neat/{rules → _rules}/importers/_dtdl2rules/spec.py +1 -1
  115. cognite/neat/_rules/importers/_rdf/_base.py +144 -0
  116. cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2classes.py +1 -1
  117. cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2metadata.py +4 -4
  118. cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2properties.py +2 -1
  119. cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2rules.py +8 -39
  120. cognite/neat/{rules → _rules}/importers/_rdf/_inference2rules.py +33 -106
  121. cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2classes.py +1 -1
  122. cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2metadata.py +5 -5
  123. cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2properties.py +1 -1
  124. cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2rules.py +39 -0
  125. cognite/neat/{rules → _rules}/importers/_rdf/_shared.py +4 -4
  126. cognite/neat/{rules → _rules}/importers/_spreadsheet2rules.py +40 -6
  127. cognite/neat/{rules → _rules}/importers/_yaml2rules.py +5 -5
  128. cognite/neat/{rules → _rules}/models/__init__.py +5 -5
  129. cognite/neat/{rules → _rules}/models/_base_input.py +30 -11
  130. cognite/neat/{rules → _rules}/models/_base_rules.py +22 -8
  131. cognite/neat/{rules → _rules}/models/_rdfpath.py +1 -1
  132. cognite/neat/_rules/models/_types.py +151 -0
  133. cognite/neat/{rules → _rules}/models/asset/_rules.py +4 -4
  134. cognite/neat/{rules → _rules}/models/asset/_rules_input.py +4 -4
  135. cognite/neat/{rules → _rules}/models/asset/_validation.py +7 -7
  136. cognite/neat/{rules → _rules}/models/data_types.py +15 -12
  137. cognite/neat/{rules → _rules}/models/dms/_exporter.py +60 -12
  138. cognite/neat/{rules → _rules}/models/dms/_rules.py +29 -26
  139. cognite/neat/{rules → _rules}/models/dms/_rules_input.py +4 -4
  140. cognite/neat/{rules → _rules}/models/dms/_schema.py +15 -14
  141. cognite/neat/{rules → _rules}/models/dms/_validation.py +8 -8
  142. cognite/neat/{rules → _rules}/models/domain.py +6 -6
  143. cognite/neat/{rules → _rules}/models/entities/__init__.py +1 -2
  144. cognite/neat/_rules/models/entities/_constants.py +15 -0
  145. cognite/neat/{rules → _rules}/models/entities/_loaders.py +2 -2
  146. cognite/neat/{rules → _rules}/models/entities/_multi_value.py +15 -2
  147. cognite/neat/{rules → _rules}/models/entities/_single_value.py +16 -4
  148. cognite/neat/{rules → _rules}/models/information/_rules.py +37 -25
  149. cognite/neat/{rules → _rules}/models/information/_rules_input.py +3 -3
  150. cognite/neat/{rules → _rules}/models/information/_validation.py +6 -5
  151. cognite/neat/_rules/models/mapping/__init__.py +4 -0
  152. cognite/neat/_rules/models/mapping/_base.py +131 -0
  153. cognite/neat/_rules/models/mapping/_classic2core.py +150 -0
  154. cognite/neat/{rules → _rules}/transformers/__init__.py +15 -2
  155. cognite/neat/{rules → _rules}/transformers/_base.py +3 -3
  156. cognite/neat/{rules → _rules}/transformers/_converters.py +289 -20
  157. cognite/neat/{rules/transformers/_map_onto.py → _rules/transformers/_mapping.py} +46 -4
  158. cognite/neat/{rules → _rules}/transformers/_pipelines.py +4 -4
  159. cognite/neat/{rules → _rules}/transformers/_verification.py +10 -4
  160. cognite/neat/_session/__init__.py +3 -0
  161. cognite/neat/_session/_base.py +86 -0
  162. cognite/neat/_session/_prepare.py +61 -0
  163. cognite/neat/_session/_read.py +118 -0
  164. cognite/neat/_session/_show.py +96 -0
  165. cognite/neat/_session/_state.py +69 -0
  166. cognite/neat/_session/_to.py +70 -0
  167. cognite/neat/_session/_wizard.py +39 -0
  168. cognite/neat/_session/exceptions.py +42 -0
  169. cognite/neat/{store → _store}/_base.py +63 -32
  170. cognite/neat/{store → _store}/_provenance.py +11 -1
  171. cognite/neat/{utils → _utils}/auth.py +14 -3
  172. cognite/neat/{utils → _utils}/auxiliary.py +1 -1
  173. cognite/neat/{utils → _utils}/cdf/loaders/_data_modeling.py +8 -2
  174. cognite/neat/{utils → _utils}/cdf/loaders/_ingestion.py +1 -1
  175. cognite/neat/{utils → _utils}/upload.py +1 -1
  176. cognite/neat/_version.py +1 -1
  177. cognite/neat/_workflows/__init__.py +17 -0
  178. cognite/neat/{workflows → _workflows}/base.py +10 -10
  179. cognite/neat/{workflows → _workflows}/cdf_store.py +3 -3
  180. cognite/neat/{workflows → _workflows}/examples/Export_DMS/workflow.yaml +89 -89
  181. cognite/neat/{workflows → _workflows}/manager.py +6 -6
  182. cognite/neat/{workflows → _workflows}/steps/data_contracts.py +3 -3
  183. cognite/neat/{workflows → _workflows}/steps/lib/current/graph_extractor.py +8 -31
  184. cognite/neat/{workflows → _workflows}/steps/lib/current/graph_loader.py +4 -4
  185. cognite/neat/{workflows → _workflows}/steps/lib/current/graph_store.py +4 -4
  186. cognite/neat/{workflows → _workflows}/steps/lib/current/rules_exporter.py +8 -8
  187. cognite/neat/{workflows → _workflows}/steps/lib/current/rules_importer.py +13 -13
  188. cognite/neat/{workflows → _workflows}/steps/lib/current/rules_validator.py +8 -8
  189. cognite/neat/{workflows → _workflows}/steps/lib/io/io_steps.py +3 -3
  190. cognite/neat/{workflows → _workflows}/steps/step_model.py +3 -3
  191. cognite/neat/{workflows → _workflows}/steps_registry.py +9 -9
  192. cognite/neat/{workflows → _workflows}/tasks.py +1 -1
  193. cognite/neat/{workflows → _workflows}/triggers.py +2 -2
  194. {cognite_neat-0.92.2.dist-info → cognite_neat-0.93.0.dist-info}/METADATA +6 -2
  195. cognite_neat-0.93.0.dist-info/RECORD +276 -0
  196. {cognite_neat-0.92.2.dist-info → cognite_neat-0.93.0.dist-info}/WHEEL +1 -1
  197. cognite_neat-0.93.0.dist-info/entry_points.txt +3 -0
  198. cognite/neat/app/api/context_manager/__init__.py +0 -3
  199. cognite/neat/graph/_shared.py +0 -5
  200. cognite/neat/graph/extractors/_iodd.py +0 -160
  201. cognite/neat/graph/extractors/_rdf_file.py +0 -26
  202. cognite/neat/rules/analysis/__init__.py +0 -6
  203. cognite/neat/rules/examples/__init__.py +0 -10
  204. cognite/neat/rules/examples/info-rules-imf.xlsx +0 -0
  205. cognite/neat/rules/examples/wind-energy.owl +0 -1511
  206. cognite/neat/rules/importers/_rdf/_owl2rules/_owl2rules.py +0 -65
  207. cognite/neat/rules/models/_types.py +0 -96
  208. cognite/neat/rules/models/entities/_constants.py +0 -73
  209. cognite/neat/utils/regex_patterns.py +0 -58
  210. cognite/neat/workflows/__init__.py +0 -12
  211. cognite_neat-0.92.2.dist-info/RECORD +0 -224
  212. cognite_neat-0.92.2.dist-info/entry_points.txt +0 -3
  213. /cognite/neat/{app → _app}/api/__init__.py +0 -0
  214. /cognite/neat/{app → _app}/api/asgi/metrics.py +0 -0
  215. /cognite/neat/{app → _app}/api/data_classes/__init__.py +0 -0
  216. /cognite/neat/{app → _app}/api/data_classes/rest.py +0 -0
  217. /cognite/neat/{app → _app}/api/routers/metrics.py +0 -0
  218. /cognite/neat/{app → _app}/api/utils/__init__.py +0 -0
  219. /cognite/neat/{app → _app}/api/utils/data_mapping.py +0 -0
  220. /cognite/neat/{app → _app}/api/utils/logging.py +0 -0
  221. /cognite/neat/{app → _app}/api/utils/query_templates.py +0 -0
  222. /cognite/neat/{app → _app}/monitoring/__init__.py +0 -0
  223. /cognite/neat/{app → _app}/monitoring/metrics.py +0 -0
  224. /cognite/neat/{app → _app}/ui/index.html +0 -0
  225. /cognite/neat/{app → _app}/ui/neat-app/.gitignore +0 -0
  226. /cognite/neat/{app → _app}/ui/neat-app/README.md +0 -0
  227. /cognite/neat/{app → _app}/ui/neat-app/build/asset-manifest.json +0 -0
  228. /cognite/neat/{app → _app}/ui/neat-app/build/favicon.ico +0 -0
  229. /cognite/neat/{app → _app}/ui/neat-app/build/img/architect-icon.svg +0 -0
  230. /cognite/neat/{app → _app}/ui/neat-app/build/img/developer-icon.svg +0 -0
  231. /cognite/neat/{app → _app}/ui/neat-app/build/img/sme-icon.svg +0 -0
  232. /cognite/neat/{app → _app}/ui/neat-app/build/index.html +0 -0
  233. /cognite/neat/{app → _app}/ui/neat-app/build/logo192.png +0 -0
  234. /cognite/neat/{app → _app}/ui/neat-app/build/manifest.json +0 -0
  235. /cognite/neat/{app → _app}/ui/neat-app/build/robots.txt +0 -0
  236. /cognite/neat/{app → _app}/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
  237. /cognite/neat/{app → _app}/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
  238. /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
  239. /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
  240. /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
  241. /cognite/neat/{app → _app}/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
  242. /cognite/neat/{graph → _graph}/__init__.py +0 -0
  243. /cognite/neat/{graph → _graph}/_tracking/__init__.py +0 -0
  244. /cognite/neat/{graph → _graph}/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  245. /cognite/neat/{graph → _graph}/examples/Knowledge-Graph-Nordic44.xml +0 -0
  246. /cognite/neat/{graph → _graph}/examples/__init__.py +0 -0
  247. /cognite/neat/{graph → _graph}/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  248. /cognite/neat/{graph → _graph}/extractors/_classic_cdf/__init__.py +0 -0
  249. /cognite/neat/{graph → _graph}/loaders/__init__.py +0 -0
  250. /cognite/neat/{graph → _graph}/models.py +0 -0
  251. /cognite/neat/{graph → _graph}/queries/__init__.py +0 -0
  252. /cognite/neat/{graph → _graph}/transformers/_base.py +0 -0
  253. /cognite/neat/{issues → _issues}/__init__.py +0 -0
  254. /cognite/neat/{issues → _issues}/formatters.py +0 -0
  255. /cognite/neat/{rules → _rules}/__init__.py +0 -0
  256. /cognite/neat/{rules → _rules}/importers/__init__.py +0 -0
  257. /cognite/neat/{rules → _rules}/importers/_dtdl2rules/__init__.py +0 -0
  258. /cognite/neat/{rules → _rules}/importers/_dtdl2rules/_unit_lookup.py +0 -0
  259. /cognite/neat/{rules → _rules}/importers/_rdf/__init__.py +0 -0
  260. /cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/__init__.py +0 -0
  261. /cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/__init__.py +0 -0
  262. /cognite/neat/{rules → _rules}/models/asset/__init__.py +0 -0
  263. /cognite/neat/{rules → _rules}/models/dms/__init__.py +0 -0
  264. /cognite/neat/{rules → _rules}/models/entities/_types.py +0 -0
  265. /cognite/neat/{rules → _rules}/models/entities/_wrapped.py +0 -0
  266. /cognite/neat/{rules → _rules}/models/information/__init__.py +0 -0
  267. /cognite/neat/{store → _store}/__init__.py +0 -0
  268. /cognite/neat/{utils → _utils}/__init__.py +0 -0
  269. /cognite/neat/{utils → _utils}/cdf/__init__.py +0 -0
  270. /cognite/neat/{utils → _utils}/cdf/data_classes.py +0 -0
  271. /cognite/neat/{utils → _utils}/cdf/loaders/__init__.py +0 -0
  272. /cognite/neat/{utils → _utils}/cdf/loaders/_base.py +0 -0
  273. /cognite/neat/{utils → _utils}/collection_.py +0 -0
  274. /cognite/neat/{utils → _utils}/rdf_.py +0 -0
  275. /cognite/neat/{utils → _utils}/spreadsheet.py +0 -0
  276. /cognite/neat/{utils → _utils}/text.py +0 -0
  277. /cognite/neat/{utils → _utils}/time_.py +0 -0
  278. /cognite/neat/{utils → _utils}/xml_.py +0 -0
  279. /cognite/neat/{workflows → _workflows}/examples/Export_Semantic_Data_Model/workflow.yaml +0 -0
  280. /cognite/neat/{workflows → _workflows}/examples/Import_DMS/workflow.yaml +0 -0
  281. /cognite/neat/{workflows → _workflows}/examples/Validate_Rules/workflow.yaml +0 -0
  282. /cognite/neat/{workflows → _workflows}/examples/Validate_Solution_Model/workflow.yaml +0 -0
  283. /cognite/neat/{workflows → _workflows}/model.py +0 -0
  284. /cognite/neat/{workflows → _workflows}/steps/__init__.py +0 -0
  285. /cognite/neat/{workflows → _workflows}/steps/lib/__init__.py +0 -0
  286. /cognite/neat/{workflows → _workflows}/steps/lib/current/__init__.py +0 -0
  287. /cognite/neat/{workflows → _workflows}/steps/lib/io/__init__.py +0 -0
  288. /cognite/neat/{workflows → _workflows}/utils.py +0 -0
  289. {cognite_neat-0.92.2.dist-info → cognite_neat-0.93.0.dist-info}/LICENSE +0 -0
@@ -1,19 +1,19 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import Generic
3
3
 
4
- from cognite.neat.issues._base import ResourceType
4
+ from cognite.neat._issues._base import ResourceType
5
5
 
6
6
  from ._resources import ResourceNeatWarning, T_Identifier, T_ReferenceIdentifier
7
7
 
8
8
 
9
- @dataclass(frozen=True)
9
+ @dataclass(unsafe_hash=True)
10
10
  class PropertyWarning(ResourceNeatWarning[T_Identifier]):
11
11
  """Base class for property warnings {resource_type} with identifier {identifier}.{property_name}"""
12
12
 
13
13
  property_name: str
14
14
 
15
15
 
16
- @dataclass(frozen=True)
16
+ @dataclass(unsafe_hash=True)
17
17
  class PropertyTypeNotSupportedWarning(PropertyWarning[T_Identifier]):
18
18
  """The {resource_type} with identifier {identifier} has a property {property_name}
19
19
  of unsupported type {property_type}. This will be ignored."""
@@ -21,7 +21,7 @@ class PropertyTypeNotSupportedWarning(PropertyWarning[T_Identifier]):
21
21
  property_type: str
22
22
 
23
23
 
24
- @dataclass(frozen=True)
24
+ @dataclass(unsafe_hash=True)
25
25
  class PropertyNotFoundWarning(PropertyWarning, Generic[T_Identifier, T_ReferenceIdentifier]):
26
26
  """The {resource_type} with identifier {identifier} does not have a property {property_name} referred
27
27
  to by {referred_type} {referred_by} does not exist. This will be ignored.
@@ -32,7 +32,7 @@ class PropertyNotFoundWarning(PropertyWarning, Generic[T_Identifier, T_Reference
32
32
  referred_type: ResourceType
33
33
 
34
34
 
35
- @dataclass(frozen=True)
35
+ @dataclass(unsafe_hash=True)
36
36
  class PropertyDefinitionDuplicatedWarning(PropertyWarning[T_Identifier]):
37
37
  """Got multiple values for the {resource_type} {identifier}.{property_name} {values}.
38
38
  {default_action}"""
@@ -44,7 +44,7 @@ class PropertyDefinitionDuplicatedWarning(PropertyWarning[T_Identifier]):
44
44
  recommended_action: str | None = None
45
45
 
46
46
 
47
- @dataclass(frozen=True)
47
+ @dataclass(unsafe_hash=True)
48
48
  class PropertyValueTypeUndefinedWarning(PropertyWarning[T_Identifier]):
49
49
  """The {resource_type} with identifier {identifier} has a property {property_name}
50
50
  which has undefined value type. This may result in unexpected behavior when exporting rules.
@@ -1,11 +1,11 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import Generic
3
3
 
4
- from cognite.neat.issues._base import NeatWarning, ResourceType, T_Identifier, T_ReferenceIdentifier
4
+ from cognite.neat._issues._base import NeatWarning, ResourceType, T_Identifier, T_ReferenceIdentifier
5
5
 
6
6
 
7
7
  # Name ResourceNeatWarning to avoid conflicts with the built-in ResourceWarning
8
- @dataclass(frozen=True)
8
+ @dataclass(unsafe_hash=True)
9
9
  class ResourceNeatWarning(NeatWarning, Generic[T_Identifier]):
10
10
  """Base class for resource warnings {resource_type} with identifier {identifier}"""
11
11
 
@@ -13,7 +13,7 @@ class ResourceNeatWarning(NeatWarning, Generic[T_Identifier]):
13
13
  resource_type: ResourceType
14
14
 
15
15
 
16
- @dataclass(frozen=True)
16
+ @dataclass(unsafe_hash=True)
17
17
  class ResourceNotFoundWarning(ResourceNeatWarning, Generic[T_Identifier, T_ReferenceIdentifier]):
18
18
  """The {resource_type} with identifier {identifier} referred by {referred_type} {referred_by} does not exist.
19
19
  This will be ignored."""
@@ -24,7 +24,7 @@ class ResourceNotFoundWarning(ResourceNeatWarning, Generic[T_Identifier, T_Refer
24
24
  referred_type: str
25
25
 
26
26
 
27
- @dataclass(frozen=True)
27
+ @dataclass(unsafe_hash=True)
28
28
  class ResourcesDuplicatedWarning(NeatWarning, Generic[T_Identifier]):
29
29
  """Duplicated {resource_type} with identifiers {resources} were found. {default_action}"""
30
30
 
@@ -35,7 +35,7 @@ class ResourcesDuplicatedWarning(NeatWarning, Generic[T_Identifier]):
35
35
  default_action: str
36
36
 
37
37
 
38
- @dataclass(frozen=True)
38
+ @dataclass(unsafe_hash=True)
39
39
  class ResourceRetrievalWarning(NeatWarning, Generic[T_Identifier]):
40
40
  """Failed to retrieve {resource_type} with identifiers {resources}. Continuing without
41
41
  these resources."""
@@ -7,7 +7,7 @@ from dataclasses import dataclass
7
7
 
8
8
  from cognite.client.data_classes.data_modeling import ContainerId, ViewId
9
9
 
10
- from cognite.neat.constants import DMS_CONTAINER_PROPERTY_SIZE_LIMIT
10
+ from cognite.neat._constants import DMS_CONTAINER_PROPERTY_SIZE_LIMIT
11
11
 
12
12
  from ._models import UserModelingWarning
13
13
 
@@ -23,7 +23,7 @@ __all__ = [
23
23
  ]
24
24
 
25
25
 
26
- @dataclass(frozen=True)
26
+ @dataclass(unsafe_hash=True)
27
27
  class DirectRelationMissingSourceWarning(UserModelingWarning):
28
28
  """The view {view_id}.{prop_name} is a direct relation without a source.
29
29
  Direct relations in views should point to a single other view, if not, you end up
@@ -35,7 +35,7 @@ class DirectRelationMissingSourceWarning(UserModelingWarning):
35
35
  prop_name: str
36
36
 
37
37
 
38
- @dataclass(frozen=True)
38
+ @dataclass(unsafe_hash=True)
39
39
  class ParentInDifferentSpaceWarning(UserModelingWarning):
40
40
  """The view {view_id} has multiple parents in different spaces.
41
41
  Neat recommends maximum one implementation of a view from another space."""
@@ -45,7 +45,7 @@ class ParentInDifferentSpaceWarning(UserModelingWarning):
45
45
  view_id: ViewId
46
46
 
47
47
 
48
- @dataclass(frozen=True)
48
+ @dataclass(unsafe_hash=True)
49
49
  class EmptyContainerWarning(UserModelingWarning):
50
50
  """Container {container_id} is empty and will be skipped.
51
51
  The container does not have any properties."""
@@ -55,7 +55,7 @@ class EmptyContainerWarning(UserModelingWarning):
55
55
  container_id: ContainerId
56
56
 
57
57
 
58
- @dataclass(frozen=True)
58
+ @dataclass(unsafe_hash=True)
59
59
  class HasDataFilterOnNoPropertiesViewWarning(UserModelingWarning):
60
60
  """Cannot set hasData filter on view {view_id}.
61
61
  The view does not have properties in any containers.
@@ -66,7 +66,7 @@ class HasDataFilterOnNoPropertiesViewWarning(UserModelingWarning):
66
66
  view_id: ViewId
67
67
 
68
68
 
69
- @dataclass(frozen=True)
69
+ @dataclass(unsafe_hash=True)
70
70
  class NodeTypeFilterOnParentViewWarning(UserModelingWarning):
71
71
  """Setting a node type filter on parent view {view_id}.
72
72
  This is not recommended as parent views are typically used for multiple types of nodes."""
@@ -76,7 +76,7 @@ class NodeTypeFilterOnParentViewWarning(UserModelingWarning):
76
76
  view_id: ViewId
77
77
 
78
78
 
79
- @dataclass(frozen=True)
79
+ @dataclass(unsafe_hash=True)
80
80
  class HasDataFilterOnViewWithReferencesWarning(UserModelingWarning):
81
81
  """Setting a hasData filter on view {view_id} which references other views {references}.
82
82
  This is not recommended as it will lead to no nodes being returned when querying the solution view.
@@ -88,7 +88,7 @@ class HasDataFilterOnViewWithReferencesWarning(UserModelingWarning):
88
88
  references: frozenset[ViewId]
89
89
 
90
90
 
91
- @dataclass(frozen=True)
91
+ @dataclass(unsafe_hash=True)
92
92
  class ViewPropertyLimitWarning(UserModelingWarning):
93
93
  """The number of properties in the {view_id} view is {count} which
94
94
  is more than the API limit {limit} properties.
@@ -102,7 +102,7 @@ class ViewPropertyLimitWarning(UserModelingWarning):
102
102
  limit: int = DMS_CONTAINER_PROPERTY_SIZE_LIMIT
103
103
 
104
104
 
105
- @dataclass(frozen=True)
105
+ @dataclass(unsafe_hash=True)
106
106
  class NotNeatSupportedFilterWarning(UserModelingWarning):
107
107
  """The view {view_id} uses a non-standard filter.
108
108
  This will not be validated by Neat, and is thus not recommended.
@@ -0,0 +1,190 @@
1
+ import re
2
+ import sys
3
+ from functools import cached_property
4
+
5
+ if sys.version_info >= (3, 11):
6
+ from enum import StrEnum
7
+ else:
8
+ from backports.strenum import StrEnum
9
+
10
+
11
+ class EntityTypes(StrEnum):
12
+ view_non_versioned = "view_non_versioned"
13
+ subject = "subject"
14
+ predicate = "predicate"
15
+ object = "object"
16
+ class_ = "class"
17
+ parent_class = "parent_class"
18
+ property_ = "property"
19
+ dms_property = "dms_property"
20
+ information_property = "information_property"
21
+ object_property = "ObjectProperty"
22
+ data_property = "DatatypeProperty"
23
+ annotation_property = "AnnotationProperty"
24
+ object_value_type = "object_value_type"
25
+ data_value_type = "data_value_type" # these are strings, floats, ...
26
+ xsd_value_type = "xsd_value_type"
27
+ dms_value_type = "dms_value_type"
28
+ dms_node = "dms_node"
29
+ view = "view"
30
+ reference_entity = "reference_entity"
31
+ container = "container"
32
+ datamodel = "datamodel"
33
+ undefined = "undefined"
34
+ multi_value_type = "multi_value_type"
35
+ asset = "asset"
36
+ relationship = "relationship"
37
+ edge = "edge"
38
+ reverse = "reverse"
39
+ unit = "unit"
40
+ version = "version"
41
+ prefix = "prefix"
42
+ space = "space"
43
+
44
+
45
+ def get_reserved_words() -> dict[str, list[str]]:
46
+ return {
47
+ "class": ["Class", "class"],
48
+ "view": [
49
+ "Query",
50
+ "Mutation",
51
+ "Subscription",
52
+ "String",
53
+ "Int32",
54
+ "Int64",
55
+ "Int",
56
+ "Float32",
57
+ "Float64",
58
+ "Float",
59
+ "Timestamp",
60
+ "JSONObject",
61
+ "Date",
62
+ "Numeric",
63
+ "Boolean",
64
+ "PageInfo",
65
+ "File",
66
+ "Sequence",
67
+ "TimeSeries",
68
+ ],
69
+ "property": [
70
+ "property",
71
+ "space",
72
+ "externalId",
73
+ "createdTime",
74
+ "lastUpdatedTime",
75
+ "deletedTime",
76
+ "edge_id",
77
+ "node_id",
78
+ "project_id",
79
+ "property_group",
80
+ "seq",
81
+ "tg_table_name",
82
+ "extensions",
83
+ ],
84
+ "space": ["space", "cdf", "dms", "pg3", "shared", "system", "node", "edge"],
85
+ }
86
+
87
+
88
+ ENTITY_PATTERN = re.compile(r"^(?P<prefix>.*?):?(?P<suffix>[^(:]*)(\((?P<content>.+)\))?$")
89
+
90
+
91
+ # REGEX FOR VALIDATIONS
92
+ MORE_THAN_ONE_NONE_ALPHANUMERIC_REGEX = r"([_-]{2,})"
93
+ PREFIX_COMPLIANCE_REGEX = r"^([a-zA-Z]+)([a-zA-Z0-9]*[_-]{0,1}[a-zA-Z0-9_-]*)([a-zA-Z0-9]*)$"
94
+
95
+ SPACE_COMPLIANCE_REGEX = (
96
+ rf"(?!^({'|'.join(get_reserved_words()['space'])})$)" r"(^[a-zA-Z][a-zA-Z0-9_-]{0,41}[a-zA-Z0-9]?$)"
97
+ )
98
+
99
+
100
+ DATA_MODEL_COMPLIANCE_REGEX = r"^[a-zA-Z]([a-zA-Z0-9_]{0,253}[a-zA-Z0-9])?$"
101
+
102
+ VIEW_ID_COMPLIANCE_REGEX = (
103
+ rf"(?!^({'|'.join(get_reserved_words()['view'])})$)" r"(^[a-zA-Z][a-zA-Z0-9_]{0,253}[a-zA-Z0-9]?$)"
104
+ )
105
+ DMS_PROPERTY_ID_COMPLIANCE_REGEX = (
106
+ rf"(?!^({'|'.join(get_reserved_words()['property'])})$)" r"(^[a-zA-Z][a-zA-Z0-9_]{0,253}[a-zA-Z0-9]?$)"
107
+ )
108
+ CLASS_ID_COMPLIANCE_REGEX = (
109
+ rf"(?!^({'|'.join(get_reserved_words()['class'])})$)" r"(^[a-zA-Z][a-zA-Z0-9._-]{0,253}[a-zA-Z0-9]?$)"
110
+ )
111
+
112
+ INFORMATION_PROPERTY_ID_COMPLIANCE_REGEX = (
113
+ r"^(\*)|(?!^(Property|property)$)(^[a-zA-Z][a-zA-Z0-9._-]{0,253}[a-zA-Z0-9]?$)"
114
+ )
115
+ VERSION_COMPLIANCE_REGEX = r"^[a-zA-Z0-9]([.a-zA-Z0-9_-]{0,41}[a-zA-Z0-9])?$"
116
+
117
+
118
+ # This pattern ignores commas inside brackets
119
+ SPLIT_ON_COMMA_PATTERN = re.compile(r",(?![^(]*\))")
120
+ # This pattern ignores equal signs inside brackets
121
+ SPLIT_ON_EQUAL_PATTERN = re.compile(r"=(?![^(]*\))")
122
+
123
+
124
+ class _Patterns:
125
+ @cached_property
126
+ def more_than_one_alphanumeric(self) -> re.Pattern:
127
+ return re.compile(MORE_THAN_ONE_NONE_ALPHANUMERIC_REGEX)
128
+
129
+ @cached_property
130
+ def prefix_compliance(self) -> re.Pattern[str]:
131
+ return re.compile(PREFIX_COMPLIANCE_REGEX)
132
+
133
+ @cached_property
134
+ def space_compliance(self) -> re.Pattern[str]:
135
+ return re.compile(SPACE_COMPLIANCE_REGEX)
136
+
137
+ @cached_property
138
+ def view_id_compliance(self) -> re.Pattern[str]:
139
+ return re.compile(VIEW_ID_COMPLIANCE_REGEX)
140
+
141
+ @cached_property
142
+ def dms_property_id_compliance(self) -> re.Pattern[str]:
143
+ return re.compile(DMS_PROPERTY_ID_COMPLIANCE_REGEX)
144
+
145
+ @cached_property
146
+ def class_id_compliance(self) -> re.Pattern[str]:
147
+ return re.compile(CLASS_ID_COMPLIANCE_REGEX)
148
+
149
+ @cached_property
150
+ def information_property_id_compliance(self) -> re.Pattern[str]:
151
+ return re.compile(INFORMATION_PROPERTY_ID_COMPLIANCE_REGEX)
152
+
153
+ @cached_property
154
+ def version_compliance(self) -> re.Pattern[str]:
155
+ return re.compile(VERSION_COMPLIANCE_REGEX)
156
+
157
+ def entity_pattern(
158
+ self,
159
+ entity: EntityTypes,
160
+ ) -> re.Pattern:
161
+ if entity == EntityTypes.class_:
162
+ return self.class_id_compliance
163
+
164
+ elif entity == EntityTypes.information_property:
165
+ return self.information_property_id_compliance
166
+
167
+ elif entity == EntityTypes.view:
168
+ return self.view_id_compliance
169
+
170
+ # container regex same as view regex
171
+ elif entity == EntityTypes.container:
172
+ return self.view_id_compliance
173
+
174
+ elif entity == EntityTypes.dms_property:
175
+ return self.dms_property_id_compliance
176
+
177
+ elif entity == EntityTypes.version:
178
+ return self.version_compliance
179
+
180
+ elif entity == EntityTypes.prefix:
181
+ return self.prefix_compliance
182
+
183
+ elif entity == EntityTypes.space:
184
+ return self.space_compliance
185
+
186
+ else:
187
+ raise ValueError(f"Unsupported entity type {entity}")
188
+
189
+
190
+ PATTERNS = _Patterns()
@@ -2,16 +2,16 @@ from abc import ABC, abstractmethod
2
2
  from dataclasses import dataclass
3
3
  from typing import Any, Generic, TypeAlias, TypeVar
4
4
 
5
- from cognite.neat.issues import IssueList
6
- from cognite.neat.rules.models import (
5
+ from cognite.neat._issues import IssueList
6
+ from cognite.neat._rules.models import (
7
7
  AssetRules,
8
8
  DMSRules,
9
9
  DomainRules,
10
10
  InformationRules,
11
11
  )
12
- from cognite.neat.rules.models.asset._rules_input import AssetInputRules
13
- from cognite.neat.rules.models.dms._rules_input import DMSInputRules
14
- from cognite.neat.rules.models.information._rules_input import InformationInputRules
12
+ from cognite.neat._rules.models.asset._rules_input import AssetInputRules
13
+ from cognite.neat._rules.models.dms._rules_input import DMSInputRules
14
+ from cognite.neat._rules.models.information._rules_input import InformationInputRules
15
15
 
16
16
  VerifiedRules: TypeAlias = DomainRules | InformationRules | DMSRules | AssetRules
17
17
  InputRules: TypeAlias = AssetInputRules | DMSInputRules | InformationInputRules
@@ -0,0 +1,5 @@
1
+ from ._asset import AssetAnalysis
2
+ from ._dms import DMSAnalysis
3
+ from ._information import InformationAnalysis
4
+
5
+ __all__ = ["InformationAnalysis", "AssetAnalysis", "DMSAnalysis"]
@@ -2,14 +2,14 @@ import warnings
2
2
  from graphlib import TopologicalSorter
3
3
  from typing import cast
4
4
 
5
- from cognite.neat.rules.models import AssetRules
6
- from cognite.neat.rules.models._rdfpath import RDFPath
7
- from cognite.neat.rules.models.asset import AssetClass, AssetProperty
8
- from cognite.neat.rules.models.entities import (
5
+ from cognite.neat._rules._constants import EntityTypes
6
+ from cognite.neat._rules.models import AssetRules
7
+ from cognite.neat._rules.models._rdfpath import RDFPath
8
+ from cognite.neat._rules.models.asset import AssetClass, AssetProperty
9
+ from cognite.neat._rules.models.entities import (
9
10
  AssetEntity,
10
11
  AssetFields,
11
12
  ClassEntity,
12
- EntityTypes,
13
13
  ReferenceEntity,
14
14
  RelationshipEntity,
15
15
  )
@@ -9,15 +9,15 @@ from typing import Generic, TypeVar
9
9
  import pandas as pd
10
10
  from pydantic import BaseModel
11
11
 
12
- from cognite.neat.rules.models._base_rules import BaseRules
13
- from cognite.neat.rules.models._rdfpath import RDFPath
14
- from cognite.neat.rules.models.entities import (
12
+ from cognite.neat._rules.models._base_rules import BaseRules
13
+ from cognite.neat._rules.models._rdfpath import RDFPath
14
+ from cognite.neat._rules.models.entities import (
15
15
  ClassEntity,
16
16
  Entity,
17
17
  ReferenceEntity,
18
18
  )
19
- from cognite.neat.rules.models.information import InformationProperty
20
- from cognite.neat.utils.rdf_ import get_inheritance_path
19
+ from cognite.neat._rules.models.information import InformationProperty
20
+ from cognite.neat._utils.rdf_ import get_inheritance_path
21
21
 
22
22
  T_Rules = TypeVar("T_Rules", bound=BaseRules)
23
23
  T_Property = TypeVar("T_Property", bound=BaseModel)
@@ -0,0 +1,43 @@
1
+ from cognite.neat._constants import DMS_LISTABLE_PROPERTY_LIMIT
2
+ from cognite.neat._rules.models.dms import DMSProperty, DMSRules, DMSView
3
+ from cognite.neat._rules.models.entities import ReferenceEntity, ViewEntity
4
+
5
+ from ._base import BaseAnalysis
6
+
7
+
8
+ class DMSAnalysis(BaseAnalysis[DMSRules, DMSView, DMSProperty, ViewEntity, str]):
9
+ """Assumes analysis over only the complete schema"""
10
+
11
+ def _get_classes(self) -> list[DMSView]:
12
+ return list(self.rules.views)
13
+
14
+ def _get_properties(self) -> list[DMSProperty]:
15
+ return list(self.rules.properties)
16
+
17
+ def _get_reference(self, class_or_property: DMSView | DMSProperty) -> ReferenceEntity | None:
18
+ return class_or_property.reference if isinstance(class_or_property.reference, ReferenceEntity) else None
19
+
20
+ def _get_cls_entity(self, class_: DMSView | DMSProperty) -> ViewEntity:
21
+ return class_.view
22
+
23
+ def _get_prop_entity(self, property_: DMSProperty) -> str:
24
+ return property_.property_
25
+
26
+ def _get_cls_parents(self, class_: DMSView) -> list[ViewEntity] | None:
27
+ return list(class_.implements) if class_.implements else None
28
+
29
+ def _get_reference_rules(self) -> DMSRules | None:
30
+ return self.rules.reference
31
+
32
+ @classmethod
33
+ def _set_cls_entity(cls, property_: DMSProperty, class_: ViewEntity) -> None:
34
+ property_.view = class_
35
+
36
+ def _get_object(self, property_: DMSProperty) -> ViewEntity | None:
37
+ return property_.value_type if isinstance(property_.value_type, ViewEntity) else None
38
+
39
+ def _get_max_occurrence(self, property_: DMSProperty) -> int | float | None:
40
+ return DMS_LISTABLE_PROPERTY_LIMIT if property_.is_list else 1
41
+
42
+ def subset_rules(self, desired_classes: set[ViewEntity]) -> DMSRules:
43
+ raise NotImplementedError()
@@ -4,21 +4,23 @@ from typing import Any, cast
4
4
  from pydantic import ValidationError
5
5
  from rdflib import URIRef
6
6
 
7
- from cognite.neat.rules.models import SchemaCompleteness
8
- from cognite.neat.rules.models._rdfpath import (
7
+ from cognite.neat._rules._constants import EntityTypes
8
+ from cognite.neat._rules.models import SchemaCompleteness
9
+ from cognite.neat._rules.models._rdfpath import (
9
10
  Hop,
10
11
  RDFPath,
11
12
  SelfReferenceProperty,
12
13
  SingleProperty,
13
14
  )
14
- from cognite.neat.rules.models.entities import ClassEntity, EntityTypes, ReferenceEntity
15
- from cognite.neat.rules.models.information import (
15
+ from cognite.neat._rules.models.entities import ClassEntity, ReferenceEntity
16
+ from cognite.neat._rules.models.entities._multi_value import MultiValueTypeInfo
17
+ from cognite.neat._rules.models.information import (
16
18
  InformationClass,
17
19
  InformationProperty,
18
20
  InformationRules,
19
21
  )
20
- from cognite.neat.utils.collection_ import most_occurring_element
21
- from cognite.neat.utils.rdf_ import get_inheritance_path
22
+ from cognite.neat._utils.collection_ import most_occurring_element
23
+ from cognite.neat._utils.rdf_ import get_inheritance_path
22
24
 
23
25
  from ._base import BaseAnalysis
24
26
 
@@ -226,3 +228,7 @@ class InformationAnalysis(BaseAnalysis[InformationRules, InformationClass, Infor
226
228
  # case 3 when class prefix is not found in prefixes of rules
227
229
  else:
228
230
  return None
231
+
232
+ @property
233
+ def multi_value_properties(self) -> list[InformationProperty]:
234
+ return [prop_ for prop_ in self.rules.properties if isinstance(prop_.value_type, MultiValueTypeInfo)]
@@ -0,0 +1,6 @@
1
+ """Shortcut to rules catalog files"""
2
+
3
+ from pathlib import Path
4
+
5
+ _CATALOG = Path(__file__).parent
6
+ imf_attributes = _CATALOG / "info-rules-imf.xlsx"
@@ -1,6 +1,7 @@
1
1
  from ._base import BaseExporter, CDFExporter
2
2
  from ._rules2dms import DMSExporter
3
3
  from ._rules2excel import ExcelExporter
4
+ from ._rules2instance_template import InstanceTemplateExporter
4
5
  from ._rules2ontology import GraphExporter, OWLExporter, SemanticDataModelExporter, SHACLExporter
5
6
  from ._rules2yaml import YAMLExporter
6
7
 
@@ -14,6 +15,7 @@ __all__ = [
14
15
  "SHACLExporter",
15
16
  "ExcelExporter",
16
17
  "YAMLExporter",
18
+ "InstanceTemplateExporter",
17
19
  ]
18
20
 
19
21
 
@@ -5,9 +5,9 @@ from typing import Generic, TypeVar
5
5
 
6
6
  from cognite.client import CogniteClient
7
7
 
8
- from cognite.neat.rules._shared import T_VerifiedRules
9
- from cognite.neat.utils.auxiliary import class_html_doc
10
- from cognite.neat.utils.upload import UploadResult, UploadResultList
8
+ from cognite.neat._rules._shared import T_VerifiedRules
9
+ from cognite.neat._utils.auxiliary import class_html_doc
10
+ from cognite.neat._utils.upload import UploadResult, UploadResultList
11
11
 
12
12
  T_Export = TypeVar("T_Export")
13
13
 
@@ -15,13 +15,13 @@ from cognite.client.data_classes.data_modeling import (
15
15
  )
16
16
  from cognite.client.exceptions import CogniteAPIError
17
17
 
18
- from cognite.neat.issues import IssueList
19
- from cognite.neat.issues.warnings import (
18
+ from cognite.neat._issues import IssueList
19
+ from cognite.neat._issues.warnings import (
20
20
  PrincipleOneModelOneSpaceWarning,
21
21
  ResourceRetrievalWarning,
22
22
  )
23
- from cognite.neat.rules.models.dms import DMSRules, DMSSchema, PipelineSchema
24
- from cognite.neat.utils.cdf.loaders import (
23
+ from cognite.neat._rules.models.dms import DMSRules, DMSSchema, PipelineSchema
24
+ from cognite.neat._utils.cdf.loaders import (
25
25
  ContainerLoader,
26
26
  DataModelingLoader,
27
27
  DataModelLoader,
@@ -32,7 +32,7 @@ from cognite.neat.utils.cdf.loaders import (
32
32
  TransformationLoader,
33
33
  ViewLoader,
34
34
  )
35
- from cognite.neat.utils.upload import UploadResult
35
+ from cognite.neat._utils.upload import UploadResult
36
36
 
37
37
  from ._base import CDFExporter
38
38
 
@@ -11,20 +11,24 @@ from openpyxl import Workbook
11
11
  from openpyxl.cell import MergedCell
12
12
  from openpyxl.styles import Alignment, Border, Font, PatternFill, Side
13
13
  from openpyxl.worksheet.worksheet import Worksheet
14
+ from rdflib import Namespace
14
15
 
15
- from cognite.neat.rules._shared import VerifiedRules
16
- from cognite.neat.rules.models import (
16
+ from cognite.neat._rules._shared import VerifiedRules
17
+ from cognite.neat._rules.models import (
17
18
  DataModelType,
18
19
  ExtensionCategory,
19
20
  SchemaCompleteness,
20
21
  SheetRow,
21
22
  )
22
- from cognite.neat.rules.models.dms import DMSMetadata
23
- from cognite.neat.rules.models.domain import DomainMetadata
24
- from cognite.neat.rules.models.information import InformationMetadata
23
+ from cognite.neat._rules.models.dms import DMSMetadata
24
+ from cognite.neat._rules.models.domain import DomainMetadata
25
+ from cognite.neat._rules.models.information import InformationMetadata
26
+ from cognite.neat._rules.models.information._rules import InformationRules
25
27
 
26
28
  from ._base import BaseExporter
27
29
 
30
+ MAX_COLUMN_WIDTH = 70.0
31
+
28
32
 
29
33
  class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
30
34
  """Export rules to Excel.
@@ -133,6 +137,9 @@ class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
133
137
  self._write_sheets(workbook, dumped_reference_rules, rules, sheet_prefix="Ref")
134
138
  self._write_metadata_sheet(workbook, dumped_reference_rules["Metadata"], sheet_prefix="Ref")
135
139
 
140
+ if isinstance(rules, InformationRules) and rules.prefixes:
141
+ self._write_prefixes_sheet(workbook, rules.prefixes)
142
+
136
143
  if self._styling_level > 0:
137
144
  self._adjust_column_widths(workbook)
138
145
 
@@ -209,6 +216,16 @@ class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
209
216
  for cell in metadata_sheet["A"]:
210
217
  cell.font = Font(bold=True, size=12)
211
218
 
219
+ def _write_prefixes_sheet(self, workbook: Workbook, prefixes: dict[str, Namespace]) -> None:
220
+ metadata_sheet = workbook.create_sheet("Prefixes")
221
+ metadata_sheet.append(["Prefix", "Namespace"])
222
+ for key, value in prefixes.items():
223
+ metadata_sheet.append([key, value])
224
+
225
+ if self._styling_level > 1:
226
+ for cell in metadata_sheet["A"]:
227
+ cell.font = Font(bold=True, size=12)
228
+
212
229
  @classmethod
213
230
  def _get_item_class(cls, annotation: GenericAlias) -> type[SheetRow]:
214
231
  if not isinstance(annotation, GenericAlias):
@@ -236,7 +253,9 @@ class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
236
253
  selected_column = column_cells[1]
237
254
 
238
255
  current = sheet.column_dimensions[selected_column.column_letter].width or (max_length + 0.5)
239
- sheet.column_dimensions[selected_column.column_letter].width = max(current, max_length + 0.5)
256
+ sheet.column_dimensions[selected_column.column_letter].width = min(
257
+ max(current, max_length + 0.5), MAX_COLUMN_WIDTH
258
+ )
240
259
  return None
241
260
 
242
261
 
@@ -274,7 +293,7 @@ class _MetadataCreator:
274
293
 
275
294
  new_metadata = self._create_new_info(now)
276
295
  if isinstance(metadata, DMSMetadata):
277
- from cognite.neat.rules.transformers._converters import _InformationRulesConverter
296
+ from cognite.neat._rules.transformers._converters import _InformationRulesConverter
278
297
 
279
298
  output_metadata: DMSMetadata | InformationMetadata = _InformationRulesConverter._convert_metadata_to_dms(
280
299
  new_metadata