cognite-neat 0.88.3__tar.gz → 0.89.0__tar.gz

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 (239) hide show
  1. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/PKG-INFO +1 -1
  2. cognite_neat-0.89.0/cognite/neat/_version.py +1 -0
  3. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/constants.py +3 -0
  4. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_mock_graph_generator.py +2 -1
  5. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/_base.py +2 -1
  6. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/__init__.py +2 -1
  7. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/_general.py +7 -0
  8. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/_models.py +1 -1
  9. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/user_modeling.py +1 -1
  10. cognite_neat-0.89.0/cognite/neat/rules/_shared.py +61 -0
  11. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/analysis/_base.py +1 -1
  12. cognite_neat-0.89.0/cognite/neat/rules/exporters/_base.py +40 -0
  13. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/_rules2dms.py +8 -18
  14. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/_rules2excel.py +5 -12
  15. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/_rules2ontology.py +9 -19
  16. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/_rules2yaml.py +3 -6
  17. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_base.py +7 -52
  18. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dms2rules.py +171 -115
  19. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +26 -18
  20. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +14 -30
  21. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2classes.py +7 -3
  22. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2metadata.py +3 -3
  23. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2properties.py +18 -11
  24. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2rules.py +9 -18
  25. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_inference2rules.py +10 -33
  26. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2rules.py +9 -20
  27. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_shared.py +1 -1
  28. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_spreadsheet2rules.py +22 -86
  29. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_yaml2rules.py +14 -41
  30. cognite_neat-0.89.0/cognite/neat/rules/models/__init__.py +46 -0
  31. cognite_neat-0.89.0/cognite/neat/rules/models/_base_input.py +162 -0
  32. cognite_neat-0.88.3/cognite/neat/rules/models/_base.py → cognite_neat-0.89.0/cognite/neat/rules/models/_base_rules.py +1 -12
  33. cognite_neat-0.89.0/cognite/neat/rules/models/asset/__init__.py +13 -0
  34. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/asset/_rules.py +2 -20
  35. cognite_neat-0.89.0/cognite/neat/rules/models/asset/_rules_input.py +96 -0
  36. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/asset/_validation.py +1 -1
  37. cognite_neat-0.89.0/cognite/neat/rules/models/data_types.py +388 -0
  38. cognite_neat-0.89.0/cognite/neat/rules/models/dms/__init__.py +30 -0
  39. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/dms/_exporter.py +72 -26
  40. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/dms/_rules.py +42 -155
  41. cognite_neat-0.89.0/cognite/neat/rules/models/dms/_rules_input.py +293 -0
  42. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/dms/_serializer.py +44 -3
  43. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/dms/_validation.py +3 -4
  44. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/domain.py +52 -1
  45. cognite_neat-0.89.0/cognite/neat/rules/models/entities/__init__.py +63 -0
  46. cognite_neat-0.89.0/cognite/neat/rules/models/entities/_constants.py +73 -0
  47. cognite_neat-0.89.0/cognite/neat/rules/models/entities/_loaders.py +76 -0
  48. cognite_neat-0.89.0/cognite/neat/rules/models/entities/_multi_value.py +67 -0
  49. cognite_neat-0.88.3/cognite/neat/rules/models/entities.py → cognite_neat-0.89.0/cognite/neat/rules/models/entities/_single_value.py +74 -232
  50. cognite_neat-0.89.0/cognite/neat/rules/models/entities/_types.py +86 -0
  51. cognite_neat-0.88.3/cognite/neat/rules/models/wrapped_entities.py → cognite_neat-0.89.0/cognite/neat/rules/models/entities/_wrapped.py +1 -1
  52. cognite_neat-0.89.0/cognite/neat/rules/models/information/__init__.py +18 -0
  53. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/information/_rules.py +3 -14
  54. cognite_neat-0.89.0/cognite/neat/rules/models/information/_rules_input.py +146 -0
  55. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/information/_validation.py +1 -1
  56. cognite_neat-0.89.0/cognite/neat/rules/transformers/__init__.py +21 -0
  57. cognite_neat-0.89.0/cognite/neat/rules/transformers/_base.py +81 -0
  58. cognite_neat-0.88.3/cognite/neat/rules/models/information/_converter.py → cognite_neat-0.89.0/cognite/neat/rules/transformers/_converters.py +216 -20
  59. cognite_neat-0.89.0/cognite/neat/rules/transformers/_map_onto.py +97 -0
  60. cognite_neat-0.89.0/cognite/neat/rules/transformers/_pipelines.py +61 -0
  61. cognite_neat-0.89.0/cognite/neat/rules/transformers/_verification.py +136 -0
  62. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/store/_provenance.py +10 -1
  63. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/cdf/data_classes.py +20 -0
  64. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/regex_patterns.py +6 -0
  65. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +106 -37
  66. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/rules_importer.py +24 -22
  67. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/pyproject.toml +1 -1
  68. cognite_neat-0.88.3/cognite/neat/_version.py +0 -1
  69. cognite_neat-0.88.3/cognite/neat/rules/_shared.py +0 -18
  70. cognite_neat-0.88.3/cognite/neat/rules/exporters/_base.py +0 -51
  71. cognite_neat-0.88.3/cognite/neat/rules/models/__init__.py +0 -30
  72. cognite_neat-0.88.3/cognite/neat/rules/models/_constants.py +0 -2
  73. cognite_neat-0.88.3/cognite/neat/rules/models/_types/__init__.py +0 -19
  74. cognite_neat-0.88.3/cognite/neat/rules/models/asset/__init__.py +0 -10
  75. cognite_neat-0.88.3/cognite/neat/rules/models/asset/_converter.py +0 -4
  76. cognite_neat-0.88.3/cognite/neat/rules/models/asset/_rules_input.py +0 -171
  77. cognite_neat-0.88.3/cognite/neat/rules/models/data_types.py +0 -282
  78. cognite_neat-0.88.3/cognite/neat/rules/models/dms/__init__.py +0 -18
  79. cognite_neat-0.88.3/cognite/neat/rules/models/dms/_converter.py +0 -143
  80. cognite_neat-0.88.3/cognite/neat/rules/models/dms/_rules_input.py +0 -361
  81. cognite_neat-0.88.3/cognite/neat/rules/models/information/__init__.py +0 -10
  82. cognite_neat-0.88.3/cognite/neat/rules/models/information/_rules_input.py +0 -293
  83. cognite_neat-0.88.3/cognite/neat/rules/transformers/_base.py +0 -15
  84. cognite_neat-0.88.3/cognite/neat/workflows/steps/lib/__init__.py +0 -0
  85. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/LICENSE +0 -0
  86. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/README.md +0 -0
  87. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/__init__.py +0 -0
  88. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/_shared.py +0 -0
  89. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/__init__.py +0 -0
  90. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/asgi/metrics.py +0 -0
  91. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/configuration.py +0 -0
  92. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/context_manager/__init__.py +0 -0
  93. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/context_manager/manager.py +0 -0
  94. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/data_classes/__init__.py +0 -0
  95. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/data_classes/rest.py +0 -0
  96. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/explorer.py +0 -0
  97. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/routers/configuration.py +0 -0
  98. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/routers/crud.py +0 -0
  99. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/routers/metrics.py +0 -0
  100. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/routers/workflows.py +0 -0
  101. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/utils/__init__.py +0 -0
  102. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/utils/data_mapping.py +0 -0
  103. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/utils/logging.py +0 -0
  104. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/api/utils/query_templates.py +0 -0
  105. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/main.py +0 -0
  106. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/monitoring/__init__.py +0 -0
  107. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/monitoring/metrics.py +0 -0
  108. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/index.html +0 -0
  109. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
  110. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/README.md +0 -0
  111. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
  112. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
  113. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
  114. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
  115. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
  116. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
  117. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
  118. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
  119. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
  120. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
  121. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
  122. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
  123. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
  124. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
  125. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
  126. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/config.py +0 -0
  127. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/__init__.py +0 -0
  128. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/_shared.py +0 -0
  129. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/_tracking/__init__.py +0 -0
  130. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/_tracking/base.py +0 -0
  131. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/_tracking/log.py +0 -0
  132. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  133. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  134. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/examples/__init__.py +0 -0
  135. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  136. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/__init__.py +0 -0
  137. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_base.py +0 -0
  138. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/__init__.py +0 -0
  139. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_assets.py +0 -0
  140. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_base.py +0 -0
  141. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_events.py +0 -0
  142. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_files.py +0 -0
  143. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_labels.py +0 -0
  144. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_relationships.py +0 -0
  145. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_sequences.py +0 -0
  146. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_classic_cdf/_timeseries.py +0 -0
  147. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_dexpi.py +0 -0
  148. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/extractors/_rdf_file.py +0 -0
  149. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/loaders/__init__.py +0 -0
  150. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/loaders/_base.py +0 -0
  151. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/loaders/_rdf2asset.py +0 -0
  152. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/loaders/_rdf2dms.py +0 -0
  153. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/models.py +0 -0
  154. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/queries/__init__.py +0 -0
  155. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/queries/_base.py +0 -0
  156. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/queries/_construct.py +0 -0
  157. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/queries/_shared.py +0 -0
  158. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/transformers/__init__.py +0 -0
  159. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/transformers/_base.py +0 -0
  160. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/transformers/_classic_cdf.py +0 -0
  161. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/graph/transformers/_rdfpath.py +0 -0
  162. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/__init__.py +0 -0
  163. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/_external.py +0 -0
  164. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/_properties.py +0 -0
  165. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/_resources.py +0 -0
  166. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/errors/_workflow.py +0 -0
  167. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/formatters.py +0 -0
  168. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/__init__.py +0 -0
  169. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/_external.py +0 -0
  170. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/_general.py +0 -0
  171. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/_properties.py +0 -0
  172. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/issues/warnings/_resources.py +0 -0
  173. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/py.typed +0 -0
  174. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/__init__.py +0 -0
  175. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/analysis/__init__.py +0 -0
  176. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/analysis/_asset.py +0 -0
  177. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/analysis/_information.py +0 -0
  178. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/examples/__init__.py +0 -0
  179. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/examples/wind-energy.owl +0 -0
  180. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/__init__.py +0 -0
  181. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/exporters/_validation.py +0 -0
  182. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/__init__.py +0 -0
  183. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
  184. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
  185. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
  186. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/__init__.py +0 -0
  187. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_imf2rules/__init__.py +0 -0
  188. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_owl2rules/__init__.py +0 -0
  189. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2classes.py +0 -0
  190. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2metadata.py +0 -0
  191. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2properties.py +0 -0
  192. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/_rdfpath.py +0 -0
  193. /cognite_neat-0.88.3/cognite/neat/rules/models/_types/_field.py → /cognite_neat-0.89.0/cognite/neat/rules/models/_types.py +0 -0
  194. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/asset/_serializer.py +0 -0
  195. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/dms/_schema.py +0 -0
  196. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/rules/models/information/_serializer.py +0 -0
  197. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/store/__init__.py +0 -0
  198. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/store/_base.py +0 -0
  199. {cognite_neat-0.88.3/cognite/neat/rules/transformers → cognite_neat-0.89.0/cognite/neat/utils}/__init__.py +0 -0
  200. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/auth.py +0 -0
  201. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/auxiliary.py +0 -0
  202. {cognite_neat-0.88.3/cognite/neat/utils → cognite_neat-0.89.0/cognite/neat/utils/cdf}/__init__.py +0 -0
  203. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/cdf/loaders/__init__.py +0 -0
  204. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/cdf/loaders/_base.py +0 -0
  205. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/cdf/loaders/_data_modeling.py +0 -0
  206. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/cdf/loaders/_ingestion.py +0 -0
  207. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/collection_.py +0 -0
  208. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/rdf_.py +0 -0
  209. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/spreadsheet.py +0 -0
  210. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/text.py +0 -0
  211. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/time_.py +0 -0
  212. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/upload.py +0 -0
  213. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/utils/xml_.py +0 -0
  214. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/__init__.py +0 -0
  215. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/base.py +0 -0
  216. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/cdf_store.py +0 -0
  217. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
  218. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
  219. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
  220. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  221. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
  222. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
  223. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/manager.py +0 -0
  224. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/model.py +0 -0
  225. {cognite_neat-0.88.3/cognite/neat/utils/cdf → cognite_neat-0.89.0/cognite/neat/workflows/steps}/__init__.py +0 -0
  226. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/data_contracts.py +0 -0
  227. {cognite_neat-0.88.3/cognite/neat/workflows/steps → cognite_neat-0.89.0/cognite/neat/workflows/steps/lib}/__init__.py +0 -0
  228. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
  229. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
  230. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
  231. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
  232. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
  233. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
  234. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
  235. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps/step_model.py +0 -0
  236. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/steps_registry.py +0 -0
  237. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/tasks.py +0 -0
  238. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/triggers.py +0 -0
  239. {cognite_neat-0.88.3 → cognite_neat-0.89.0}/cognite/neat/workflows/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cognite-neat
3
- Version: 0.88.3
3
+ Version: 0.89.0
4
4
  Summary: Knowledge graph transformation
5
5
  Home-page: https://cognite-neat.readthedocs-hosted.com/
6
6
  License: Apache-2.0
@@ -0,0 +1 @@
1
+ __version__ = "0.89.0"
@@ -30,3 +30,6 @@ def get_default_prefixes() -> dict[str, Namespace]:
30
30
  DEFAULT_URI = ""
31
31
 
32
32
  DEFAULT_DOCS_URL = "https://cognite-neat.readthedocs-hosted.com/en/latest/"
33
+
34
+ DMS_CONTAINER_PROPERTY_SIZE_LIMIT = 100
35
+ DMS_VIEW_CONTAINER_SIZE_LIMIT = 10
@@ -17,6 +17,7 @@ from cognite.neat.rules.models import DMSRules, InformationRules
17
17
  from cognite.neat.rules.models.data_types import DataType
18
18
  from cognite.neat.rules.models.entities import ClassEntity, EntityTypes
19
19
  from cognite.neat.rules.models.information import InformationProperty
20
+ from cognite.neat.rules.transformers import DMSToInformation
20
21
  from cognite.neat.utils.rdf_ import remove_namespace_from_uri
21
22
 
22
23
  from ._base import BaseExtractor
@@ -42,7 +43,7 @@ class MockGraphGenerator(BaseExtractor):
42
43
  allow_isolated_classes: bool = True,
43
44
  ):
44
45
  if isinstance(rules, DMSRules):
45
- self.rules = rules.as_information_rules()
46
+ self.rules = DMSToInformation().transform(rules).rules
46
47
  elif isinstance(rules, InformationRules):
47
48
  self.rules = rules
48
49
  else:
@@ -50,6 +50,7 @@ ResourceType: TypeAlias = (
50
50
  "data model",
51
51
  "edge",
52
52
  "node",
53
+ "enum collection",
53
54
  "unknown",
54
55
  ]
55
56
  # String to handle all unknown types in different importers.
@@ -339,7 +340,7 @@ class DefaultWarning(NeatWarning):
339
340
  T_NeatIssue = TypeVar("T_NeatIssue", bound=NeatIssue)
340
341
 
341
342
 
342
- class NeatIssueList(UserList[T_NeatIssue], ABC):
343
+ class NeatIssueList(UserList[T_NeatIssue], Sequence[T_NeatIssue], ABC):
343
344
  """This is a generic list of NeatIssues."""
344
345
 
345
346
  def __init__(self, issues: Sequence[T_NeatIssue] | None = None, title: str | None = None):
@@ -9,7 +9,7 @@ from ._external import (
9
9
  FileTypeUnexpectedError,
10
10
  NeatYamlError,
11
11
  )
12
- from ._general import NeatImportError, NeatValueError, RegexViolationError
12
+ from ._general import NeatImportError, NeatTypeError, NeatValueError, RegexViolationError
13
13
  from ._properties import (
14
14
  PropertyDefinitionDuplicatedError,
15
15
  PropertyDefinitionError,
@@ -67,6 +67,7 @@ __all__ = [
67
67
  "DefaultPydanticError",
68
68
  "PropertyMappingDuplicatedError",
69
69
  "RowError",
70
+ "NeatTypeError",
70
71
  ]
71
72
 
72
73
  _NEAT_ERRORS_BY_NAME = {error.__name__: error for error in _get_subclasses(NeatError, include_base=True)}
@@ -10,6 +10,13 @@ class NeatValueError(NeatError, ValueError):
10
10
  raw_message: str
11
11
 
12
12
 
13
+ @dataclass(frozen=True)
14
+ class NeatTypeError(NeatError, TypeError):
15
+ """{raw_message}"""
16
+
17
+ raw_message: str
18
+
19
+
13
20
  @dataclass(frozen=True)
14
21
  class RegexViolationError(NeatError, ValueError):
15
22
  """Value, {value} failed regex, {regex}, validation. Make sure that the name follows the regex pattern."""
@@ -4,8 +4,8 @@ from typing import ClassVar
4
4
 
5
5
  from cognite.client.data_classes.data_modeling import ViewId
6
6
 
7
+ from cognite.neat.constants import DMS_VIEW_CONTAINER_SIZE_LIMIT
7
8
  from cognite.neat.issues import NeatWarning
8
- from cognite.neat.rules.models._constants import DMS_VIEW_CONTAINER_SIZE_LIMIT
9
9
 
10
10
  _BASE_URL = "https://cognite-neat.readthedocs-hosted.com/en/latest/data-modeling-principles.html"
11
11
 
@@ -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.rules.models._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
 
@@ -0,0 +1,61 @@
1
+ from abc import ABC, abstractmethod
2
+ from dataclasses import dataclass
3
+ from typing import Any, Generic, TypeAlias, TypeVar
4
+
5
+ from cognite.neat.issues import IssueList
6
+ from cognite.neat.rules.models import (
7
+ AssetRules,
8
+ DMSRules,
9
+ DomainRules,
10
+ InformationRules,
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
15
+
16
+ VerifiedRules: TypeAlias = DomainRules | InformationRules | DMSRules | AssetRules
17
+ InputRules: TypeAlias = AssetInputRules | DMSInputRules | InformationInputRules
18
+ Rules: TypeAlias = (
19
+ AssetInputRules | DMSInputRules | InformationInputRules | DomainRules | InformationRules | DMSRules | AssetRules
20
+ )
21
+ T_Rules = TypeVar("T_Rules", bound=Rules)
22
+ T_VerifiedRules = TypeVar("T_VerifiedRules", bound=VerifiedRules)
23
+ T_InputRules = TypeVar("T_InputRules", bound=InputRules)
24
+
25
+
26
+ @dataclass
27
+ class OutRules(Generic[T_Rules], ABC):
28
+ """This is a base class for all rule states."""
29
+
30
+ @abstractmethod
31
+ def get_rules(self) -> T_Rules | None:
32
+ """Get the rules from the state."""
33
+ raise NotImplementedError()
34
+
35
+
36
+ @dataclass
37
+ class JustRules(OutRules[T_Rules]):
38
+ """This represents a rule that exists"""
39
+
40
+ rules: T_Rules
41
+
42
+ def get_rules(self) -> T_Rules:
43
+ return self.rules
44
+
45
+
46
+ @dataclass
47
+ class MaybeRules(OutRules[T_Rules]):
48
+ """This represents a rule that may or may not exist"""
49
+
50
+ rules: T_Rules | None
51
+ issues: IssueList
52
+
53
+ def get_rules(self) -> T_Rules | None:
54
+ return self.rules
55
+
56
+
57
+ @dataclass
58
+ class ReadRules(MaybeRules[T_Rules]):
59
+ """This represents a rule that does not exist"""
60
+
61
+ read_context: dict[str, Any]
@@ -9,7 +9,7 @@ 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 import BaseRules
12
+ from cognite.neat.rules.models._base_rules import BaseRules
13
13
  from cognite.neat.rules.models._rdfpath import RDFPath
14
14
  from cognite.neat.rules.models.entities import (
15
15
  ClassEntity,
@@ -0,0 +1,40 @@
1
+ from abc import ABC, abstractmethod
2
+ from collections.abc import Iterable
3
+ from pathlib import Path
4
+ from typing import Generic, TypeVar
5
+
6
+ from cognite.client import CogniteClient
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
11
+
12
+ T_Export = TypeVar("T_Export")
13
+
14
+
15
+ class BaseExporter(ABC, Generic[T_VerifiedRules, T_Export]):
16
+ _new_line = "\n"
17
+ _encoding = "utf-8"
18
+
19
+ @abstractmethod
20
+ def export_to_file(self, rules: T_VerifiedRules, filepath: Path) -> None:
21
+ raise NotImplementedError
22
+
23
+ @abstractmethod
24
+ def export(self, rules: T_VerifiedRules) -> T_Export:
25
+ raise NotImplementedError
26
+
27
+ @classmethod
28
+ def _repr_html_(cls) -> str:
29
+ return class_html_doc(cls, include_factory_methods=False)
30
+
31
+
32
+ class CDFExporter(BaseExporter[T_VerifiedRules, T_Export]):
33
+ @abstractmethod
34
+ def export_to_cdf_iterable(
35
+ self, rules: T_VerifiedRules, client: CogniteClient, dry_run: bool = False
36
+ ) -> Iterable[UploadResult]:
37
+ raise NotImplementedError
38
+
39
+ def export_to_cdf(self, rules: T_VerifiedRules, client: CogniteClient, dry_run: bool = False) -> UploadResultList:
40
+ return UploadResultList(self.export_to_cdf_iterable(rules, client, dry_run))
@@ -20,8 +20,6 @@ from cognite.neat.issues.warnings import (
20
20
  PrincipleOneModelOneSpaceWarning,
21
21
  ResourceRetrievalWarning,
22
22
  )
23
- from cognite.neat.rules._shared import VerifiedRules
24
- from cognite.neat.rules.models import InformationRules
25
23
  from cognite.neat.rules.models.dms import DMSRules, DMSSchema, PipelineSchema
26
24
  from cognite.neat.utils.cdf.loaders import (
27
25
  ContainerLoader,
@@ -41,7 +39,7 @@ from ._base import CDFExporter
41
39
  Component: TypeAlias = Literal["all", "spaces", "data_models", "views", "containers", "node_types"]
42
40
 
43
41
 
44
- class DMSExporter(CDFExporter[DMSSchema]):
42
+ class DMSExporter(CDFExporter[DMSRules, DMSSchema]):
45
43
  """Export rules to Cognite Data Fusion's Data Model Storage (DMS) service.
46
44
 
47
45
  Args:
@@ -82,7 +80,7 @@ class DMSExporter(CDFExporter[DMSSchema]):
82
80
  self.suppress_warnings = suppress_warnings
83
81
  self._schema: DMSSchema | None = None
84
82
 
85
- def export_to_file(self, rules: VerifiedRules, filepath: Path) -> None:
83
+ def export_to_file(self, rules: DMSRules, filepath: Path) -> None:
86
84
  """Export the rules to a file(s).
87
85
 
88
86
  If the file is a directory, the components will be exported to separate files, otherwise they will be
@@ -97,12 +95,12 @@ class DMSExporter(CDFExporter[DMSSchema]):
97
95
  else:
98
96
  self._export_to_zip_file(filepath, rules)
99
97
 
100
- def _export_to_directory(self, directory: Path, rules: VerifiedRules) -> None:
98
+ def _export_to_directory(self, directory: Path, rules: DMSRules) -> None:
101
99
  schema = self.export(rules)
102
100
  exclude = self._create_exclude_set()
103
101
  schema.to_directory(directory, exclude=exclude, new_line=self._new_line, encoding=self._encoding)
104
102
 
105
- def _export_to_zip_file(self, filepath: Path, rules: VerifiedRules) -> None:
103
+ def _export_to_zip_file(self, filepath: Path, rules: DMSRules) -> None:
106
104
  if filepath.suffix not in {".zip"}:
107
105
  warnings.warn("File extension is not .zip, adding it to the file name", stacklevel=2)
108
106
  filepath = filepath.with_suffix(".zip")
@@ -117,18 +115,10 @@ class DMSExporter(CDFExporter[DMSSchema]):
117
115
  exclude = {"spaces", "data_models", "views", "containers", "node_types"} - self.export_components
118
116
  return exclude
119
117
 
120
- def export(self, rules: VerifiedRules) -> DMSSchema:
121
- if isinstance(rules, DMSRules):
122
- dms_rules = rules
123
- elif isinstance(rules, InformationRules):
124
- dms_rules = rules.as_dms_rules()
125
- else:
126
- raise ValueError(f"{type(rules).__name__} cannot be exported to DMS")
127
- return dms_rules.as_schema(include_pipeline=self.export_pipeline, instance_space=self.instance_space)
118
+ def export(self, rules: DMSRules) -> DMSSchema:
119
+ return rules.as_schema(include_pipeline=self.export_pipeline, instance_space=self.instance_space)
128
120
 
129
- def delete_from_cdf(
130
- self, rules: VerifiedRules, client: CogniteClient, dry_run: bool = False
131
- ) -> Iterable[UploadResult]:
121
+ def delete_from_cdf(self, rules: DMSRules, client: CogniteClient, dry_run: bool = False) -> Iterable[UploadResult]:
132
122
  to_export = self._prepare_exporters(rules, client)
133
123
 
134
124
  # we need to reverse order in which we are picking up the items to delete
@@ -172,7 +162,7 @@ class DMSExporter(CDFExporter[DMSSchema]):
172
162
  )
173
163
 
174
164
  def export_to_cdf_iterable(
175
- self, rules: VerifiedRules, client: CogniteClient, dry_run: bool = False
165
+ self, rules: DMSRules, client: CogniteClient, dry_run: bool = False
176
166
  ) -> Iterable[UploadResult]:
177
167
  to_export = self._prepare_exporters(rules, client)
178
168
 
@@ -16,7 +16,6 @@ from cognite.neat.rules._shared import VerifiedRules
16
16
  from cognite.neat.rules.models import (
17
17
  DataModelType,
18
18
  ExtensionCategory,
19
- RoleTypes,
20
19
  SchemaCompleteness,
21
20
  SheetEntity,
22
21
  )
@@ -27,7 +26,7 @@ from cognite.neat.rules.models.information import InformationMetadata
27
26
  from ._base import BaseExporter
28
27
 
29
28
 
30
- class ExcelExporter(BaseExporter[Workbook]):
29
+ class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
31
30
  """Export rules to Excel.
32
31
 
33
32
  Args:
@@ -68,16 +67,14 @@ class ExcelExporter(BaseExporter[Workbook]):
68
67
  "Classes": "Definition of Classes",
69
68
  "Views": "Definition of Views",
70
69
  "Containers": "Definition of Containers",
70
+ "Nodes": "Definition of Nodes",
71
+ "Enum": "Definition of Enum Collections",
71
72
  }
72
73
  style_options = get_args(Style)
73
74
  dump_options = get_args(DumpOptions)
74
75
 
75
76
  def __init__(
76
- self,
77
- styling: Style = "default",
78
- output_role: RoleTypes | None = None,
79
- dump_as: DumpOptions = "user",
80
- new_model_id: tuple[str, str] | None = None,
77
+ self, styling: Style = "default", dump_as: DumpOptions = "user", new_model_id: tuple[str, str] | None = None
81
78
  ):
82
79
  if styling not in self.style_options:
83
80
  raise ValueError(f"Invalid styling: {styling}. Valid options are {self.style_options}")
@@ -85,7 +82,6 @@ class ExcelExporter(BaseExporter[Workbook]):
85
82
  raise ValueError(f"Invalid dump_as: {dump_as}. Valid options are {self.dump_options}")
86
83
  self.styling = styling
87
84
  self._styling_level = self.style_options.index(styling)
88
- self.output_role = output_role
89
85
  self.new_model_id = new_model_id
90
86
  self.dump_as = dump_as
91
87
 
@@ -99,7 +95,6 @@ class ExcelExporter(BaseExporter[Workbook]):
99
95
  return None
100
96
 
101
97
  def export(self, rules: VerifiedRules) -> Workbook:
102
- rules = self._convert_to_output_role(rules, self.output_role)
103
98
  workbook = Workbook()
104
99
  # Remove default sheet named "Sheet"
105
100
  workbook.remove(workbook["Sheet"])
@@ -279,9 +274,7 @@ class _MetadataCreator:
279
274
 
280
275
  new_metadata = self._create_new_info(now)
281
276
  if isinstance(metadata, DMSMetadata):
282
- from cognite.neat.rules.models.information._converter import (
283
- _InformationRulesConverter,
284
- )
277
+ from cognite.neat.rules.transformers._converters import _InformationRulesConverter
285
278
 
286
279
  output_metadata: DMSMetadata | InformationMetadata = _InformationRulesConverter._convert_metadata_to_dms(
287
280
  new_metadata
@@ -15,7 +15,6 @@ from cognite.neat.issues.errors import (
15
15
  )
16
16
  from cognite.neat.issues.warnings import PropertyDefinitionDuplicatedWarning
17
17
  from cognite.neat.rules.analysis import InformationAnalysis
18
- from cognite.neat.rules.models import DMSRules
19
18
  from cognite.neat.rules.models.data_types import DataType
20
19
  from cognite.neat.rules.models.entities import ClassEntity, EntityTypes
21
20
  from cognite.neat.rules.models.information import (
@@ -34,32 +33,30 @@ if sys.version_info >= (3, 11):
34
33
  else:
35
34
  from typing_extensions import Self
36
35
 
37
- from cognite.neat.rules._shared import VerifiedRules
38
36
 
39
-
40
- class GraphExporter(BaseExporter[Graph], ABC):
41
- def export_to_file(self, rules: VerifiedRules, filepath: Path) -> None:
37
+ class GraphExporter(BaseExporter[InformationRules, Graph], ABC):
38
+ def export_to_file(self, rules: InformationRules, filepath: Path) -> None:
42
39
  self.export(rules).serialize(destination=filepath, encoding=self._encoding, newline=self._new_line)
43
40
 
44
41
 
45
42
  class OWLExporter(GraphExporter):
46
- """Exports rules to an OWL ontology."""
43
+ """Exports verified information rules to an OWL ontology."""
47
44
 
48
- def export(self, rules: VerifiedRules) -> Graph:
45
+ def export(self, rules: InformationRules) -> Graph:
49
46
  return Ontology.from_rules(rules).as_owl()
50
47
 
51
48
 
52
49
  class SHACLExporter(GraphExporter):
53
50
  """Exports rules to a SHACL graph."""
54
51
 
55
- def export(self, rules: VerifiedRules) -> Graph:
52
+ def export(self, rules: InformationRules) -> Graph:
56
53
  return Ontology.from_rules(rules).as_shacl()
57
54
 
58
55
 
59
56
  class SemanticDataModelExporter(GraphExporter):
60
- """Exports rules to a semantic data model."""
57
+ """Exports verified information rules to a semantic data model."""
61
58
 
62
- def export(self, rules: VerifiedRules) -> Graph:
59
+ def export(self, rules: InformationRules) -> Graph:
63
60
  return Ontology.from_rules(rules).as_semantic_data_model()
64
61
 
65
62
 
@@ -86,23 +83,16 @@ class Ontology(OntologyModel):
86
83
  prefixes: dict[str, Namespace]
87
84
 
88
85
  @classmethod
89
- def from_rules(cls, input_rules: VerifiedRules) -> Self:
86
+ def from_rules(cls, rules: InformationRules) -> Self:
90
87
  """
91
88
  Generates an ontology from a set of transformation rules.
92
89
 
93
90
  Args:
94
- input_rules: The rules to generate the ontology from.
91
+ rules: The rules to generate the ontology from.
95
92
 
96
93
  Returns:
97
94
  An instance of Ontology.
98
95
  """
99
- if isinstance(input_rules, InformationRules):
100
- rules = input_rules
101
- elif isinstance(input_rules, DMSRules):
102
- rules = input_rules.as_information_rules()
103
- else:
104
- raise ValueError(f"{type(input_rules).__name__} cannot be exported to Ontology")
105
-
106
96
  if duplicates := duplicated_properties(rules.properties):
107
97
  errors = []
108
98
  for (class_, property_), definitions in duplicates.items():
@@ -6,13 +6,12 @@ from typing import Literal, get_args
6
6
  import yaml
7
7
 
8
8
  from cognite.neat.rules._shared import VerifiedRules
9
- from cognite.neat.rules.models import RoleTypes
10
9
 
11
10
  from ._base import BaseExporter
12
11
 
13
12
 
14
- class YAMLExporter(BaseExporter[str]):
15
- """Export rules to YAML.
13
+ class YAMLExporter(BaseExporter[VerifiedRules, str]):
14
+ """Export rules (Information, DMS or Domain) to YAML.
16
15
 
17
16
  Args:
18
17
  files: The number of files to output. Defaults to "single".
@@ -38,14 +37,13 @@ class YAMLExporter(BaseExporter[str]):
38
37
  file_option = get_args(Files)
39
38
  format_option = get_args(Format)
40
39
 
41
- def __init__(self, files: Files = "single", output: Format = "yaml", output_role: RoleTypes | None = None):
40
+ def __init__(self, files: Files = "single", output: Format = "yaml"):
42
41
  if files not in self.file_option:
43
42
  raise ValueError(f"Invalid files: {files}. Valid options are {self.file_option}")
44
43
  if output not in self.format_option:
45
44
  raise ValueError(f"Invalid output: {output}. Valid options are {self.format_option}")
46
45
  self.files = files
47
46
  self.output = output
48
- self.output_role = output_role
49
47
 
50
48
  def export_to_file(self, rules: VerifiedRules, filepath: Path) -> None:
51
49
  """Exports transformation rules to YAML/JSON file(s)."""
@@ -66,7 +64,6 @@ class YAMLExporter(BaseExporter[str]):
66
64
  Returns:
67
65
  str: The rules in YAML (or JSON) format.
68
66
  """
69
- rules = self._convert_to_output_role(rules, self.output_role)
70
67
  # model_dump_json ensures that the output is in JSON format,
71
68
  # if we don't do this, we will get Enums and other types that are not serializable to YAML
72
69
  json_output = rules.dump(mode="json")
@@ -4,72 +4,27 @@ from abc import ABC, abstractmethod
4
4
  from collections.abc import Iterator
5
5
  from contextlib import contextmanager
6
6
  from datetime import datetime
7
- from typing import Any, Literal, overload
7
+ from typing import Any, Generic, Literal
8
8
 
9
9
  from pydantic import ValidationError
10
10
  from rdflib import Namespace
11
11
 
12
12
  from cognite.neat.issues import IssueList, NeatError, NeatWarning
13
- from cognite.neat.rules._shared import VerifiedRules
14
- from cognite.neat.rules.models import AssetRules, DMSRules, InformationRules, RoleTypes
13
+ from cognite.neat.rules._shared import ReadRules, T_InputRules
15
14
  from cognite.neat.utils.auxiliary import class_html_doc
16
15
 
17
16
 
18
- class BaseImporter(ABC):
17
+ class BaseImporter(ABC, Generic[T_InputRules]):
19
18
  """
20
19
  BaseImporter class which all importers inherit from.
21
20
  """
22
21
 
23
- @overload
24
- def to_rules(self, errors: Literal["raise"], role: RoleTypes | None = None) -> VerifiedRules: ...
25
-
26
- @overload
27
- def to_rules(
28
- self, errors: Literal["continue"] = "continue", role: RoleTypes | None = None
29
- ) -> tuple[VerifiedRules | None, IssueList]: ...
30
-
31
22
  @abstractmethod
32
- def to_rules(
33
- self,
34
- errors: Literal["raise", "continue"] = "continue",
35
- role: RoleTypes | None = None,
36
- ) -> tuple[VerifiedRules | None, IssueList] | VerifiedRules:
37
- """
38
- Creates `Rules` object from the data for target role.
39
- """
40
- ...
41
-
42
- @classmethod
43
- def _to_output(
44
- cls,
45
- rules: VerifiedRules,
46
- issues: IssueList,
47
- errors: Literal["raise", "continue"] = "continue",
48
- role: RoleTypes | None = None,
49
- ) -> tuple[VerifiedRules | None, IssueList] | VerifiedRules:
50
- """Converts the rules to the output format."""
51
-
52
- if rules.metadata.role is role or role is None:
53
- output = rules
54
- elif isinstance(rules, DMSRules) or isinstance(rules, AssetRules) and role is RoleTypes.information:
55
- output = rules.as_information_rules()
56
- elif isinstance(rules, InformationRules) or isinstance(rules, AssetRules) and role is RoleTypes.dms:
57
- output = rules.as_dms_rules()
58
- else:
59
- raise NotImplementedError(f"Role {role} is not supported for {type(rules).__name__} rules")
60
-
61
- if errors == "raise":
62
- return output
63
- else:
64
- return output, issues
65
-
66
- @classmethod
67
- def _return_or_raise(cls, issue_list: IssueList, errors: Literal["raise", "continue"]) -> tuple[None, IssueList]:
68
- if errors == "raise":
69
- raise issue_list.as_errors()
70
- return None, issue_list
23
+ def to_rules(self) -> ReadRules[T_InputRules]:
24
+ """Creates `Rules` object from the data for target role."""
25
+ raise NotImplementedError()
71
26
 
72
- def _default_metadata(self):
27
+ def _default_metadata(self) -> dict[str, Any]:
73
28
  return {
74
29
  "prefix": "neat",
75
30
  "schema": "partial",