cognite-neat 0.97.0__tar.gz → 0.97.2__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 (283) hide show
  1. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/PKG-INFO +2 -2
  2. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/loaders/_base.py +8 -1
  3. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/loaders/_rdf2dms.py +35 -15
  4. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/__init__.py +4 -0
  5. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/_base.py +48 -0
  6. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/errors/_general.py +3 -1
  7. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/_types.py +24 -16
  8. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/transformers/_verification.py +2 -49
  9. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/_base.py +45 -26
  10. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/_inspect.py +12 -2
  11. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/_prepare.py +4 -2
  12. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/_set.py +12 -4
  13. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/_show.py +13 -0
  14. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/_to.py +34 -7
  15. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/auth.py +4 -3
  16. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/upload.py +20 -0
  17. cognite_neat-0.97.2/cognite/neat/_version.py +2 -0
  18. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/pyproject.toml +3 -2
  19. cognite_neat-0.97.0/cognite/neat/_version.py +0 -2
  20. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/LICENSE +0 -0
  21. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/README.md +0 -0
  22. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/__init__.py +0 -0
  23. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/__init__.py +0 -0
  24. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/asgi/metrics.py +0 -0
  25. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/configuration.py +0 -0
  26. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/context_manager/__init__.py +0 -0
  27. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/context_manager/manager.py +0 -0
  28. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/data_classes/__init__.py +0 -0
  29. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/data_classes/rest.py +0 -0
  30. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/explorer.py +0 -0
  31. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/routers/configuration.py +0 -0
  32. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/routers/crud.py +0 -0
  33. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/routers/metrics.py +0 -0
  34. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/routers/workflows.py +0 -0
  35. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/utils/__init__.py +0 -0
  36. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/utils/data_mapping.py +0 -0
  37. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/utils/logging.py +0 -0
  38. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/api/utils/query_templates.py +0 -0
  39. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/main.py +0 -0
  40. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/monitoring/__init__.py +0 -0
  41. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/monitoring/metrics.py +0 -0
  42. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/index.html +0 -0
  43. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/.gitignore +0 -0
  44. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/README.md +0 -0
  45. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/asset-manifest.json +0 -0
  46. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/favicon.ico +0 -0
  47. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/img/architect-icon.svg +0 -0
  48. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/img/developer-icon.svg +0 -0
  49. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/img/sme-icon.svg +0 -0
  50. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/index.html +0 -0
  51. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/logo192.png +0 -0
  52. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/manifest.json +0 -0
  53. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/robots.txt +0 -0
  54. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
  55. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
  56. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
  57. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
  58. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
  59. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
  60. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/package-lock.json +0 -0
  61. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/package.json +0 -0
  62. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
  63. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +0 -0
  64. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +0 -0
  65. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +0 -0
  66. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/public/index.html +0 -0
  67. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
  68. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/public/manifest.json +0 -0
  69. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/public/robots.txt +0 -0
  70. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/App.css +0 -0
  71. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/App.js +0 -0
  72. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/App.test.js +0 -0
  73. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +0 -0
  74. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +0 -0
  75. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +0 -0
  76. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +0 -0
  77. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +0 -0
  78. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +0 -0
  79. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +0 -0
  80. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +0 -0
  81. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +0 -0
  82. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +0 -0
  83. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +0 -0
  84. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/index.css +0 -0
  85. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/index.js +0 -0
  86. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/logo.svg +0 -0
  87. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +0 -0
  88. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/setupTests.js +0 -0
  89. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +0 -0
  90. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +0 -0
  91. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +0 -0
  92. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +0 -0
  93. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +0 -0
  94. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_app/ui/neat-app/tsconfig.json +0 -0
  95. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_config.py +0 -0
  96. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_constants.py +0 -0
  97. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/__init__.py +0 -0
  98. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/_shared.py +0 -0
  99. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/_tracking/__init__.py +0 -0
  100. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/_tracking/base.py +0 -0
  101. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/_tracking/log.py +0 -0
  102. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  103. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  104. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/examples/__init__.py +0 -0
  105. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  106. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/__init__.py +0 -0
  107. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_base.py +0 -0
  108. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_classic_cdf/__init__.py +0 -0
  109. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_classic_cdf/_assets.py +0 -0
  110. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_classic_cdf/_base.py +0 -0
  111. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_classic_cdf/_classic.py +0 -0
  112. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_classic_cdf/_data_sets.py +0 -0
  113. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_classic_cdf/_events.py +0 -0
  114. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_classic_cdf/_files.py +0 -0
  115. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_classic_cdf/_labels.py +0 -0
  116. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +0 -0
  117. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +0 -0
  118. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_classic_cdf/_timeseries.py +0 -0
  119. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_dexpi.py +0 -0
  120. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_dms.py +0 -0
  121. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_iodd.py +0 -0
  122. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_mock_graph_generator.py +0 -0
  123. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/extractors/_rdf_file.py +0 -0
  124. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/loaders/__init__.py +0 -0
  125. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/loaders/_rdf2asset.py +0 -0
  126. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/queries/__init__.py +0 -0
  127. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/queries/_base.py +0 -0
  128. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/queries/_construct.py +0 -0
  129. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/queries/_shared.py +0 -0
  130. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/transformers/__init__.py +0 -0
  131. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/transformers/_base.py +0 -0
  132. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/transformers/_classic_cdf.py +0 -0
  133. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/transformers/_iodd.py +0 -0
  134. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/transformers/_prune_graph.py +0 -0
  135. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/transformers/_rdfpath.py +0 -0
  136. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_graph/transformers/_value_type.py +0 -0
  137. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/errors/__init__.py +0 -0
  138. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/errors/_external.py +0 -0
  139. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/errors/_properties.py +0 -0
  140. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/errors/_resources.py +0 -0
  141. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/errors/_workflow.py +0 -0
  142. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/formatters.py +0 -0
  143. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/warnings/__init__.py +0 -0
  144. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/warnings/_external.py +0 -0
  145. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/warnings/_general.py +0 -0
  146. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/warnings/_models.py +0 -0
  147. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/warnings/_properties.py +0 -0
  148. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/warnings/_resources.py +0 -0
  149. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_issues/warnings/user_modeling.py +0 -0
  150. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/__init__.py +0 -0
  151. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/_constants.py +0 -0
  152. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/_shared.py +0 -0
  153. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/analysis/__init__.py +0 -0
  154. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/analysis/_asset.py +0 -0
  155. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/analysis/_base.py +0 -0
  156. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/analysis/_dms.py +0 -0
  157. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/analysis/_information.py +0 -0
  158. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/catalog/__init__.py +0 -0
  159. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
  160. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/exporters/__init__.py +0 -0
  161. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/exporters/_base.py +0 -0
  162. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/exporters/_rules2dms.py +0 -0
  163. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/exporters/_rules2excel.py +0 -0
  164. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/exporters/_rules2instance_template.py +0 -0
  165. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/exporters/_rules2ontology.py +0 -0
  166. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/exporters/_rules2yaml.py +0 -0
  167. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/exporters/_validation.py +0 -0
  168. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/__init__.py +0 -0
  169. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_base.py +0 -0
  170. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_dms2rules.py +0 -0
  171. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_dtdl2rules/__init__.py +0 -0
  172. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
  173. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
  174. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
  175. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_dtdl2rules/spec.py +0 -0
  176. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/__init__.py +0 -0
  177. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_base.py +0 -0
  178. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_imf2rules/__init__.py +0 -0
  179. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2classes.py +0 -0
  180. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2metadata.py +0 -0
  181. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2properties.py +0 -0
  182. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2rules.py +0 -0
  183. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_inference2rules.py +0 -0
  184. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_owl2rules/__init__.py +0 -0
  185. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2classes.py +0 -0
  186. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2metadata.py +0 -0
  187. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2properties.py +0 -0
  188. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2rules.py +0 -0
  189. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_rdf/_shared.py +0 -0
  190. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_spreadsheet2rules.py +0 -0
  191. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/importers/_yaml2rules.py +0 -0
  192. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/__init__.py +0 -0
  193. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/_base_input.py +0 -0
  194. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/_base_rules.py +0 -0
  195. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/_rdfpath.py +0 -0
  196. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/asset/__init__.py +0 -0
  197. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/asset/_rules.py +0 -0
  198. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/asset/_rules_input.py +0 -0
  199. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/asset/_validation.py +0 -0
  200. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/data_types.py +0 -0
  201. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/dms/__init__.py +0 -0
  202. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/dms/_exporter.py +0 -0
  203. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/dms/_rules.py +0 -0
  204. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/dms/_rules_input.py +0 -0
  205. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/dms/_schema.py +0 -0
  206. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/dms/_validation.py +0 -0
  207. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/domain.py +0 -0
  208. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/entities/__init__.py +0 -0
  209. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/entities/_constants.py +0 -0
  210. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/entities/_loaders.py +0 -0
  211. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/entities/_multi_value.py +0 -0
  212. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/entities/_single_value.py +0 -0
  213. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/entities/_types.py +0 -0
  214. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/entities/_wrapped.py +0 -0
  215. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/information/__init__.py +0 -0
  216. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/information/_rules.py +0 -0
  217. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/information/_rules_input.py +0 -0
  218. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/information/_validation.py +0 -0
  219. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/mapping/__init__.py +0 -0
  220. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/mapping/_base.py +0 -0
  221. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/models/mapping/_classic2core.py +0 -0
  222. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/transformers/__init__.py +0 -0
  223. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/transformers/_base.py +0 -0
  224. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/transformers/_converters.py +0 -0
  225. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/transformers/_mapping.py +0 -0
  226. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_rules/transformers/_pipelines.py +0 -0
  227. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/__init__.py +0 -0
  228. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/_read.py +0 -0
  229. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/_state.py +0 -0
  230. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/_wizard.py +0 -0
  231. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/engine/__init__.py +0 -0
  232. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/engine/_import.py +0 -0
  233. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/engine/_interface.py +0 -0
  234. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/engine/_load.py +0 -0
  235. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_session/exceptions.py +0 -0
  236. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_shared.py +0 -0
  237. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_store/__init__.py +0 -0
  238. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_store/_base.py +0 -0
  239. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_store/_provenance.py +0 -0
  240. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/__init__.py +0 -0
  241. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/auxiliary.py +0 -0
  242. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/cdf/__init__.py +0 -0
  243. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/cdf/data_classes.py +0 -0
  244. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/cdf/loaders/__init__.py +0 -0
  245. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/cdf/loaders/_base.py +0 -0
  246. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/cdf/loaders/_data_modeling.py +0 -0
  247. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/cdf/loaders/_ingestion.py +0 -0
  248. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/collection_.py +0 -0
  249. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/rdf_.py +0 -0
  250. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/reader/__init__.py +0 -0
  251. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/reader/_base.py +0 -0
  252. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/spreadsheet.py +0 -0
  253. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/text.py +0 -0
  254. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/time_.py +0 -0
  255. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_utils/xml_.py +0 -0
  256. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/__init__.py +0 -0
  257. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/base.py +0 -0
  258. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/cdf_store.py +0 -0
  259. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/examples/Export_DMS/workflow.yaml +0 -0
  260. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -0
  261. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/examples/Import_DMS/workflow.yaml +0 -0
  262. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/examples/Validate_Rules/workflow.yaml +0 -0
  263. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  264. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/manager.py +0 -0
  265. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/model.py +0 -0
  266. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/__init__.py +0 -0
  267. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/data_contracts.py +0 -0
  268. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/lib/__init__.py +0 -0
  269. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/lib/current/__init__.py +0 -0
  270. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/lib/current/graph_extractor.py +0 -0
  271. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/lib/current/graph_loader.py +0 -0
  272. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/lib/current/graph_store.py +0 -0
  273. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/lib/current/rules_exporter.py +0 -0
  274. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/lib/current/rules_importer.py +0 -0
  275. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/lib/current/rules_validator.py +0 -0
  276. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/lib/io/__init__.py +0 -0
  277. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/lib/io/io_steps.py +0 -0
  278. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps/step_model.py +0 -0
  279. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/steps_registry.py +0 -0
  280. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/tasks.py +0 -0
  281. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/triggers.py +0 -0
  282. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/_workflows/utils.py +0 -0
  283. {cognite_neat-0.97.0 → cognite_neat-0.97.2}/cognite/neat/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cognite-neat
3
- Version: 0.97.0
3
+ Version: 0.97.2
4
4
  Summary: Knowledge graph transformation
5
5
  Home-page: https://cognite-neat.readthedocs-hosted.com/
6
6
  License: Apache-2.0
@@ -28,7 +28,7 @@ Requires-Dist: google-api-python-client ; extra == "google"
28
28
  Requires-Dist: google-auth-oauthlib ; extra == "google"
29
29
  Requires-Dist: gspread ; extra == "google"
30
30
  Requires-Dist: jsonpath-python (>=1.0.6,<2.0.0)
31
- Requires-Dist: lxml (>=5.3.0,<6.0.0)
31
+ Requires-Dist: lxml (>=5.3.0,<6.0.0) ; extra == "all"
32
32
  Requires-Dist: mkdocs ; extra == "docs"
33
33
  Requires-Dist: mkdocs-autorefs (>=0.5.0,<0.6.0) ; extra == "docs"
34
34
  Requires-Dist: mkdocs-git-authors-plugin ; extra == "docs"
@@ -51,7 +51,14 @@ class CDFLoader(BaseLoader[T_Output]):
51
51
  def load_into_cdf(
52
52
  self, client: CogniteClient, dry_run: bool = False, check_client: bool = True
53
53
  ) -> UploadResultList:
54
- return UploadResultList(self.load_into_cdf_iterable(client, dry_run, check_client))
54
+ upload_result_by_name: dict[str, UploadResult] = {}
55
+ for upload_result in self.load_into_cdf_iterable(client, dry_run, check_client):
56
+ if last_result := upload_result_by_name.get(upload_result.name):
57
+ upload_result_by_name[upload_result.name] = last_result.merge(upload_result)
58
+ else:
59
+ upload_result_by_name[upload_result.name] = upload_result
60
+
61
+ return UploadResultList(upload_result_by_name.values())
55
62
 
56
63
  def load_into_cdf_iterable(
57
64
  self, client: CogniteClient, dry_run: bool = False, check_client: bool = True
@@ -1,3 +1,4 @@
1
+ import itertools
1
2
  import json
2
3
  from collections.abc import Iterable, Sequence
3
4
  from pathlib import Path
@@ -295,9 +296,24 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
295
296
  dry_run: bool,
296
297
  read_issues: IssueList,
297
298
  ) -> Iterable[UploadResult]:
299
+ nodes: list[dm.NodeApply] = []
300
+ edges: list[dm.EdgeApply] = []
301
+ source_by_node_id: dict[dm.NodeId, str] = {}
302
+ source_by_edge_id: dict[dm.EdgeId, str] = {}
303
+ for item in items:
304
+ if isinstance(item, dm.NodeApply):
305
+ nodes.append(item)
306
+ if item.sources:
307
+ source_by_node_id[item.as_id()] = item.sources[0].source.external_id
308
+ else:
309
+ source_by_node_id[item.as_id()] = "node"
310
+ elif isinstance(item, dm.EdgeApply):
311
+ edges.append(item)
312
+ if item.sources:
313
+ source_by_edge_id[item.as_id()] = item.sources[0].source.external_id
314
+ else:
315
+ source_by_edge_id[item.as_id()] = "edge"
298
316
  try:
299
- nodes = [item for item in items if isinstance(item, dm.NodeApply)]
300
- edges = [item for item in items if isinstance(item, dm.EdgeApply)]
301
317
  upserted = client.data_modeling.instances.apply(
302
318
  nodes,
303
319
  edges,
@@ -312,19 +328,23 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
312
328
  result.created.update(item.as_id() for item in e.successful)
313
329
  yield result
314
330
  else:
315
- for instance_type, instances in {
316
- "Nodes": upserted.nodes,
317
- "Edges": upserted.edges,
318
- }.items():
319
- result = UploadResult[InstanceId](name=instance_type, issues=read_issues)
320
- for instance in instances: # type: ignore[attr-defined]
321
- if instance.was_modified and instance.created_time == instance.last_updated_time:
322
- result.created.add(instance.as_id())
323
- elif instance.was_modified:
324
- result.changed.add(instance.as_id())
325
- else:
326
- result.unchanged.add(instance.as_id())
327
- yield result
331
+ for instances, ids_by_source in [
332
+ (upserted.nodes, source_by_node_id),
333
+ (upserted.edges, source_by_edge_id),
334
+ ]:
335
+ for name, subinstances in itertools.groupby(
336
+ sorted(instances, key=lambda i: ids_by_source[i.as_id()]), # type: ignore[call-overload, index, attr-defined]
337
+ key=lambda i: ids_by_source[i.as_id()], # type: ignore[index]
338
+ ):
339
+ result = UploadResult(name=name, issues=read_issues)
340
+ for instance in subinstances: # type: ignore[attr-defined]
341
+ if instance.was_modified and instance.created_time == instance.last_updated_time:
342
+ result.created.add(instance.as_id())
343
+ elif instance.was_modified:
344
+ result.changed.add(instance.as_id())
345
+ else:
346
+ result.unchanged.add(instance.as_id())
347
+ yield result
328
348
 
329
349
 
330
350
  def _get_field_value_types(cls, info):
@@ -3,12 +3,14 @@ as some helper classes to handle them like NeatIssueList"""
3
3
 
4
4
  from ._base import (
5
5
  DefaultWarning,
6
+ FutureResult,
6
7
  IssueList,
7
8
  MultiValueError,
8
9
  NeatError,
9
10
  NeatIssue,
10
11
  NeatIssueList,
11
12
  NeatWarning,
13
+ catch_issues,
12
14
  catch_warnings,
13
15
  )
14
16
 
@@ -21,4 +23,6 @@ __all__ = [
21
23
  "IssueList",
22
24
  "MultiValueError",
23
25
  "catch_warnings",
26
+ "catch_issues",
27
+ "FutureResult",
24
28
  ]
@@ -18,6 +18,7 @@ from cognite.client.data_classes.data_modeling import (
18
18
  PropertyId,
19
19
  ViewId,
20
20
  )
21
+ from pydantic import ValidationError
21
22
  from pydantic_core import ErrorDetails
22
23
 
23
24
  from cognite.neat._utils.spreadsheet import SpreadsheetRead
@@ -398,6 +399,10 @@ class NeatIssueList(list, Sequence[T_NeatIssue], ABC):
398
399
  """Return all the warnings in this list."""
399
400
  return type(self)([issue for issue in self if isinstance(issue, NeatWarning)]) # type: ignore[misc]
400
401
 
402
+ def has_error_type(self, error_type: type[NeatError]) -> bool:
403
+ """Return True if this list contains any errors of the given type."""
404
+ return any(isinstance(issue, error_type) for issue in self)
405
+
401
406
  def as_errors(self, operation: str = "Operation failed") -> ExceptionGroup:
402
407
  """Return an ExceptionGroup with all the errors in this list."""
403
408
  return ExceptionGroup(
@@ -473,3 +478,46 @@ def catch_warnings(
473
478
  finally:
474
479
  if warning_logger and issues is not None:
475
480
  issues.extend([warning_cls.from_warning(warning) for warning in warning_logger]) # type: ignore[misc]
481
+
482
+
483
+ class FutureResult:
484
+ def __init__(self) -> None:
485
+ self._result: Literal["success", "failure", "pending"] = "pending"
486
+
487
+ @property
488
+ def result(self) -> Literal["success", "failure", "pending"]:
489
+ return self._result
490
+
491
+
492
+ @contextmanager
493
+ def catch_issues(
494
+ issues: IssueList,
495
+ error_cls: type[NeatError] = NeatError,
496
+ warning_cls: type[NeatWarning] = NeatWarning,
497
+ error_args: dict[str, Any] | None = None,
498
+ ) -> Iterator[FutureResult]:
499
+ """This is an internal help function to handle issues and warnings.
500
+
501
+ Args:
502
+ issues: The issues list to append to.
503
+ error_cls: The class used to convert errors to issues.
504
+ warning_cls: The class used to convert warnings to issues.
505
+
506
+ Returns:
507
+ FutureResult: A future result object that can be used to check the result of the context manager.
508
+ """
509
+ with catch_warnings(issues, warning_cls):
510
+ future_result = FutureResult()
511
+ try:
512
+ yield future_result
513
+ except ValidationError as e:
514
+ issues.extend(error_cls.from_pydantic_errors(e.errors(), **(error_args or {})))
515
+ future_result._result = "failure"
516
+ except MultiValueError as e:
517
+ issues.extend(e.errors)
518
+ future_result._result = "failure"
519
+ except NeatError as e:
520
+ issues.append(e)
521
+ future_result._result = "failure"
522
+ else:
523
+ future_result._result = "success"
@@ -19,10 +19,12 @@ class NeatTypeError(NeatError, TypeError):
19
19
 
20
20
  @dataclass(unsafe_hash=True)
21
21
  class RegexViolationError(NeatError, ValueError):
22
- """Value, {value} failed regex, {regex}, validation. Make sure that the name follows the regex pattern."""
22
+ """Value, {value} in {location} failed regex, {regex}, validation.
23
+ Make sure that the name follows the regex pattern."""
23
24
 
24
25
  value: str
25
26
  regex: str
27
+ location: str
26
28
 
27
29
 
28
30
  @dataclass(unsafe_hash=True)
@@ -76,13 +76,17 @@ NamespaceType = Annotated[
76
76
  PrefixType = Annotated[
77
77
  str,
78
78
  StringConstraints(pattern=PREFIX_COMPLIANCE_REGEX),
79
- _custom_error(lambda _, value: RegexViolationError(value, PREFIX_COMPLIANCE_REGEX)),
79
+ _custom_error(
80
+ lambda _, value: RegexViolationError(value, PREFIX_COMPLIANCE_REGEX, "prefix entry in metadata"),
81
+ ),
80
82
  ]
81
83
 
82
84
  DataModelExternalIdType = Annotated[
83
85
  str,
84
86
  StringConstraints(pattern=DATA_MODEL_COMPLIANCE_REGEX),
85
- _custom_error(lambda _, value: RegexViolationError(value, DATA_MODEL_COMPLIANCE_REGEX)),
87
+ _custom_error(
88
+ lambda _, value: RegexViolationError(value, DATA_MODEL_COMPLIANCE_REGEX, "external ID entry in metadata")
89
+ ),
86
90
  ]
87
91
 
88
92
 
@@ -90,15 +94,15 @@ VersionType = Annotated[
90
94
  str,
91
95
  BeforeValidator(str),
92
96
  StringConstraints(pattern=VERSION_COMPLIANCE_REGEX),
93
- _custom_error(lambda _, value: RegexViolationError(value, VERSION_COMPLIANCE_REGEX)),
97
+ _custom_error(lambda _, value: RegexViolationError(value, VERSION_COMPLIANCE_REGEX, "version entry in metadata")),
94
98
  ]
95
99
 
96
100
 
97
- def _external_id_validation_factory(entity_type: EntityTypes):
101
+ def _external_id_validation_factory(entity_type: EntityTypes, location: str):
98
102
  def _external_id_validation(value: str) -> str:
99
103
  compiled_regex = PATTERNS.entity_pattern(entity_type)
100
104
  if not compiled_regex.match(value):
101
- raise RegexViolationError(value, compiled_regex.pattern)
105
+ raise RegexViolationError(value, compiled_regex.pattern, location)
102
106
  if PATTERNS.more_than_one_alphanumeric.search(value):
103
107
  warnings.warn(
104
108
  RegexViolationWarning(
@@ -116,36 +120,40 @@ def _external_id_validation_factory(entity_type: EntityTypes):
116
120
 
117
121
  SpaceType = Annotated[
118
122
  str,
119
- AfterValidator(_external_id_validation_factory(EntityTypes.space)),
123
+ AfterValidator(_external_id_validation_factory(EntityTypes.space, "space entry in metadata")),
120
124
  ]
121
125
 
122
126
  InformationPropertyType = Annotated[
123
127
  str,
124
- AfterValidator(_external_id_validation_factory(EntityTypes.information_property)),
128
+ AfterValidator(_external_id_validation_factory(EntityTypes.information_property, "Property column in properties")),
125
129
  ]
126
130
  DmsPropertyType = Annotated[
127
131
  str,
128
- AfterValidator(_external_id_validation_factory(EntityTypes.dms_property)),
132
+ AfterValidator(_external_id_validation_factory(EntityTypes.dms_property, "Property column in properties")),
129
133
  ]
130
134
 
131
135
 
132
- def _entity_validation(value: Entities) -> Entities:
136
+ def _entity_validation(value: Entities, location: str) -> Entities:
133
137
  suffix_regex = PATTERNS.entity_pattern(value.type_)
134
138
  if not suffix_regex.match(value.suffix):
135
- raise RegexViolationError(str(value), suffix_regex.pattern)
139
+ raise RegexViolationError(str(value), suffix_regex.pattern, location)
136
140
  return value
137
141
 
138
142
 
139
- ClassEntityType = Annotated[ClassEntity, AfterValidator(_entity_validation)]
140
- ViewEntityType = Annotated[ViewEntity, AfterValidator(_entity_validation)]
141
- ContainerEntityType = Annotated[ContainerEntity, AfterValidator(_entity_validation)]
143
+ ClassEntityType = Annotated[ClassEntity, AfterValidator(lambda v: _entity_validation(v, "the Class column"))]
144
+ ViewEntityType = Annotated[ViewEntity, AfterValidator(lambda v: _entity_validation(v, "the View column"))]
145
+ ContainerEntityType = Annotated[
146
+ ContainerEntity, AfterValidator(lambda v: _entity_validation(v, "the Container column"))
147
+ ]
142
148
 
143
149
 
144
- def _multi_value_type_validation(value: MultiValueTypeInfo) -> MultiValueTypeInfo:
150
+ def _multi_value_type_validation(value: MultiValueTypeInfo, location: str) -> MultiValueTypeInfo:
145
151
  for type_ in value.types:
146
152
  if isinstance(type_, ClassEntity):
147
- _entity_validation(type_)
153
+ _entity_validation(type_, location)
148
154
  return value
149
155
 
150
156
 
151
- MultiValueTypeType = Annotated[MultiValueTypeInfo, AfterValidator(_multi_value_type_validation)]
157
+ MultiValueTypeType = Annotated[
158
+ MultiValueTypeInfo, AfterValidator(lambda v: _multi_value_type_validation(v, "the Value Type column"))
159
+ ]
@@ -1,11 +1,7 @@
1
1
  from abc import ABC
2
- from collections.abc import Iterator
3
- from contextlib import contextmanager
4
2
  from typing import Any, Literal
5
3
 
6
- from pydantic import ValidationError
7
-
8
- from cognite.neat._issues import IssueList, MultiValueError, NeatError, NeatWarning, catch_warnings
4
+ from cognite.neat._issues import IssueList, NeatError, NeatWarning, catch_issues
9
5
  from cognite.neat._issues.errors import NeatTypeError
10
6
  from cognite.neat._rules._shared import (
11
7
  InputRules,
@@ -45,7 +41,7 @@ class VerificationTransformer(RulesTransformer[T_InputRules, T_VerifiedRules], A
45
41
  if isinstance(rules, ReadRules):
46
42
  error_args = rules.read_context
47
43
  verified_rules: T_VerifiedRules | None = None
48
- with _catch_issues(issues, NeatError, NeatWarning, error_args) as future:
44
+ with catch_issues(issues, NeatError, NeatWarning, error_args) as future:
49
45
  rules_cls = self._get_rules_cls(in_)
50
46
  verified_rules = rules_cls.model_validate(in_.dump()) # type: ignore[assignment]
51
47
 
@@ -92,46 +88,3 @@ class VerifyAnyRules(VerificationTransformer[InputRules, VerifiedRules]):
92
88
  return DomainRules
93
89
  else:
94
90
  raise NeatTypeError(f"Unsupported rules type: {type(in_)}")
95
-
96
-
97
- class _FutureResult:
98
- def __init__(self) -> None:
99
- self._result: Literal["success", "failure", "pending"] = "pending"
100
-
101
- @property
102
- def result(self) -> Literal["success", "failure", "pending"]:
103
- return self._result
104
-
105
-
106
- @contextmanager
107
- def _catch_issues(
108
- issues: IssueList,
109
- error_cls: type[NeatError] = NeatError,
110
- warning_cls: type[NeatWarning] = NeatWarning,
111
- error_args: dict[str, Any] | None = None,
112
- ) -> Iterator[_FutureResult]:
113
- """This is an internal help function to handle issues and warnings.
114
-
115
- Args:
116
- issues: The issues list to append to.
117
- error_cls: The class used to convert errors to issues.
118
- warning_cls: The class used to convert warnings to issues.
119
-
120
- Returns:
121
- FutureResult: A future result object that can be used to check the result of the context manager.
122
- """
123
- with catch_warnings(issues, warning_cls):
124
- future_result = _FutureResult()
125
- try:
126
- yield future_result
127
- except ValidationError as e:
128
- issues.extend(error_cls.from_pydantic_errors(e.errors(), **(error_args or {})))
129
- future_result._result = "failure"
130
- except MultiValueError as e:
131
- issues.extend(e.errors)
132
- future_result._result = "failure"
133
- except NeatError as e:
134
- issues.append(e)
135
- future_result._result = "failure"
136
- else:
137
- future_result._result = "success"
@@ -5,9 +5,10 @@ from cognite.client import CogniteClient
5
5
  from cognite.client import data_modeling as dm
6
6
 
7
7
  from cognite.neat import _version
8
- from cognite.neat._issues import IssueList
8
+ from cognite.neat._issues import IssueList, catch_issues
9
+ from cognite.neat._issues.errors import RegexViolationError
9
10
  from cognite.neat._rules import importers
10
- from cognite.neat._rules._shared import ReadRules
11
+ from cognite.neat._rules._shared import ReadRules, VerifiedRules
11
12
  from cognite.neat._rules.importers._rdf._base import DEFAULT_NON_EXISTING_NODE_TYPE
12
13
  from cognite.neat._rules.models import DMSRules
13
14
  from cognite.neat._rules.models.data_types import AnyURI
@@ -15,6 +16,7 @@ from cognite.neat._rules.models.entities._single_value import UnknownEntity
15
16
  from cognite.neat._rules.models.information._rules import InformationRules
16
17
  from cognite.neat._rules.models.information._rules_input import InformationInputRules
17
18
  from cognite.neat._rules.transformers import ConvertToRules, VerifyAnyRules
19
+ from cognite.neat._rules.transformers._converters import ConversionTransformer
18
20
  from cognite.neat._store._provenance import (
19
21
  INSTANCES_ENTITY,
20
22
  Change,
@@ -85,35 +87,52 @@ class NeatSession:
85
87
  print("You can inspect the issues with the .inspect.issues(...) method.")
86
88
  return output.issues
87
89
 
88
- def convert(self, target: Literal["dms", "information"]) -> None:
90
+ def convert(self, target: Literal["dms", "information"]) -> IssueList:
89
91
  start = datetime.now(timezone.utc)
90
- if target == "dms":
91
- source_id, info_rules = self._state.data_model.last_verified_information_rules
92
- converter = ConvertToRules(DMSRules)
93
- converted_rules = converter.transform(info_rules).rules
94
- elif target == "information":
95
- source_id, dms_rules = self._state.data_model.last_verified_dms_rules
96
- converter = ConvertToRules(InformationRules)
97
- converted_rules = converter.transform(dms_rules).rules
98
- else:
99
- raise NeatSessionError(f"Target {target} not supported.")
92
+ issues = IssueList()
93
+ converter: ConversionTransformer | None = None
94
+ converted_rules: VerifiedRules | None = None
95
+ with catch_issues(issues):
96
+ if target == "dms":
97
+ source_id, info_rules = self._state.data_model.last_verified_information_rules
98
+ converter = ConvertToRules(DMSRules)
99
+ converted_rules = converter.transform(info_rules).rules
100
+ elif target == "information":
101
+ source_id, dms_rules = self._state.data_model.last_verified_dms_rules
102
+ converter = ConvertToRules(InformationRules)
103
+ converted_rules = converter.transform(dms_rules).rules
104
+ else:
105
+ # Session errors are not caught by the catch_issues context manager
106
+ raise NeatSessionError(f"Target {target} not supported.")
107
+
100
108
  end = datetime.now(timezone.utc)
109
+ if issues:
110
+ self._state.data_model.issue_lists.append(issues)
101
111
 
102
- # Provenance
103
- change = Change.from_rules_activity(
104
- converted_rules,
105
- converter.agent,
106
- start,
107
- end,
108
- f"Converted data model {source_id} to {converted_rules.id_}",
109
- self._state.data_model.provenance.source_entity(source_id)
110
- or self._state.data_model.provenance.target_entity(source_id),
111
- )
112
+ if converted_rules is not None and converter is not None:
113
+ # Provenance
114
+ change = Change.from_rules_activity(
115
+ converted_rules,
116
+ converter.agent,
117
+ start,
118
+ end,
119
+ f"Converted data model {source_id} to {converted_rules.id_}",
120
+ self._state.data_model.provenance.source_entity(source_id)
121
+ or self._state.data_model.provenance.target_entity(source_id),
122
+ )
123
+
124
+ self._state.data_model.write(converted_rules, change)
112
125
 
113
- self._state.data_model.write(converted_rules, change)
126
+ if self._verbose and not issues.has_errors:
127
+ print(f"Rules converted to {target}")
128
+ else:
129
+ print("Conversion failed.")
130
+ if issues:
131
+ print("You can inspect the issues with the .inspect.issues(...) method.")
132
+ if issues.has_error_type(RegexViolationError):
133
+ print("You can use .prepare. to try to fix the issues")
114
134
 
115
- if self._verbose:
116
- print(f"Rules converted to {target}")
135
+ return issues
117
136
 
118
137
  def infer(
119
138
  self,
@@ -173,8 +173,18 @@ class InspectUploadOutcome:
173
173
  continue
174
174
  lines.append(f"#### {key}")
175
175
  if isinstance(value, list):
176
- for v in value:
177
- lines.append(f" * {v}")
176
+ total = len(value)
177
+ for i, v in enumerate(value):
178
+ if key in ["created", "updated", "changed"]:
179
+ if i < 50:
180
+ lines.append(f" * {v}")
181
+ elif i == 50 and total > 50:
182
+ lines.append(f" * ... {total-50} more")
183
+ elif i == 50 and total == 50:
184
+ lines.append(f" * {v}")
185
+ else:
186
+ lines.append(f" * {v}")
187
+
178
188
  else:
179
189
  lines.append(f" * {value}")
180
190
 
@@ -148,7 +148,8 @@ class DataModelPrepareAPI:
148
148
  f"Prepared data model {data_model_id} to be enterprise data "
149
149
  f"model on top of {rules.metadata.as_data_model_id()}"
150
150
  ),
151
- self._state.data_model.provenance.source_entity(source_id),
151
+ self._state.data_model.provenance.source_entity(source_id)
152
+ or self._state.data_model.provenance.target_entity(source_id),
152
153
  )
153
154
 
154
155
  self._state.data_model.write(output.rules, change)
@@ -202,7 +203,8 @@ class DataModelPrepareAPI:
202
203
  f"Prepared data model {data_model_id} to be solution data model "
203
204
  f"on top of {rules.metadata.as_data_model_id()}"
204
205
  ),
205
- self._state.data_model.provenance.source_entity(source_id),
206
+ self._state.data_model.provenance.source_entity(source_id)
207
+ or self._state.data_model.provenance.target_entity(source_id),
206
208
  )
207
209
 
208
210
  self._state.data_model.write(output.rules, change)
@@ -2,11 +2,12 @@ from datetime import datetime, timezone
2
2
 
3
3
  from cognite.client import data_modeling as dm
4
4
 
5
+ from cognite.neat._constants import COGNITE_MODELS
5
6
  from cognite.neat._rules.transformers import SetIDDMSModel
6
7
  from cognite.neat._store._provenance import Change
7
8
 
8
9
  from ._state import SessionState
9
- from .exceptions import intercept_session_exceptions
10
+ from .exceptions import NeatSessionError, intercept_session_exceptions
10
11
 
11
12
 
12
13
  @intercept_session_exceptions
@@ -20,6 +21,12 @@ class SetAPI:
20
21
  if res := self._state.data_model.last_verified_dms_rules:
21
22
  source_id, rules = res
22
23
 
24
+ if rules.metadata.as_data_model_id() in COGNITE_MODELS:
25
+ raise NeatSessionError(
26
+ "Cannot change the data model ID of a Cognite Data Model in NeatSession"
27
+ " due to temporarily issue with the reverse direct relation interpretation"
28
+ )
29
+
23
30
  start = datetime.now(timezone.utc)
24
31
  transformer = SetIDDMSModel(new_model_id)
25
32
  output = transformer.transform(rules)
@@ -27,15 +34,16 @@ class SetAPI:
27
34
 
28
35
  # Provenance
29
36
  change = Change.from_rules_activity(
30
- output,
37
+ output.rules,
31
38
  transformer.agent,
32
39
  start,
33
40
  end,
34
41
  "Changed data model id",
35
- self._state.data_model.provenance.source_entity(source_id),
42
+ self._state.data_model.provenance.source_entity(source_id)
43
+ or self._state.data_model.provenance.target_entity(source_id),
36
44
  )
37
45
 
38
- self._state.data_model.write(output, change)
46
+ self._state.data_model.write(output.rules, change)
39
47
  if self._verbose:
40
48
  print(f"Data model ID set to {new_model_id}")
41
49
  else:
@@ -293,6 +293,19 @@ class ShowInstanceAPI(ShowBaseAPI):
293
293
  self._state = state
294
294
 
295
295
  def __call__(self) -> Any:
296
+ if IN_PYODIDE:
297
+ raise NeatSessionError(
298
+ "Instances visualization not available if neat is run in PYODIDE as "
299
+ "PYODIDE dues not support oxigraph storage for NeatSession."
300
+ "Try running neat in regular Jupyter notebook and set [bold]NeatSession(storage='oxigraph')[/bold]."
301
+ )
302
+
303
+ if not self._state.instances.store_type == "oxigraph":
304
+ raise NeatSessionError(
305
+ "Visualization is only available for Oxigraph store. "
306
+ 'Try setting [bold]NeatSession(storage="oxigraph")[/bold] enable Oxigraph store.'
307
+ )
308
+
296
309
  if not self._state.instances.store.graph:
297
310
  raise NeatSessionError("No instances available. Try using [bold].read[/bold] to load instances.")
298
311
 
@@ -2,12 +2,14 @@ from pathlib import Path
2
2
  from typing import Any, Literal, overload
3
3
 
4
4
  from cognite.client import CogniteClient
5
+ from cognite.client.data_classes.data_modeling import SpaceApply
5
6
 
6
7
  from cognite.neat._graph import loaders
7
8
  from cognite.neat._issues import IssueList, catch_warnings
8
9
  from cognite.neat._rules import exporters
9
- from cognite.neat._session._wizard import space_wizard
10
- from cognite.neat._utils.upload import UploadResultCore
10
+ from cognite.neat._rules._constants import PATTERNS
11
+ from cognite.neat._rules._shared import VerifiedRules
12
+ from cognite.neat._utils.upload import UploadResultCore, UploadResultList
11
13
 
12
14
  from ._state import SessionState
13
15
  from .exceptions import NeatSessionError, intercept_session_exceptions
@@ -23,9 +25,24 @@ class ToAPI:
23
25
  def excel(
24
26
  self,
25
27
  io: Any,
28
+ model: Literal["dms", "information", "logical", "physical"] | None,
26
29
  ) -> None:
30
+ """Export the verified data model to Excel.
31
+
32
+ Args:
33
+ io: The file path or file-like object to write the Excel file to.
34
+ model: The format of the data model to export. Defaults to None.
35
+ """
27
36
  exporter = exporters.ExcelExporter()
28
- exporter.export_to_file(self._state.data_model.last_verified_rule[1], Path(io))
37
+ rules: VerifiedRules
38
+ if model == "information" or model == "logical":
39
+ rules = self._state.data_model.last_verified_information_rules[1]
40
+ elif model == "dms" or model == "physical":
41
+ rules = self._state.data_model.last_verified_dms_rules[1]
42
+ else:
43
+ rules = self._state.data_model.last_verified_rule[1]
44
+
45
+ exporter.export_to_file(rules, Path(io))
29
46
  return None
30
47
 
31
48
  @overload
@@ -50,19 +67,29 @@ class CDFToAPI:
50
67
  self._state = state
51
68
  self._verbose = verbose
52
69
 
53
- def instances(self, space: str | None = None):
70
+ def instances(self, space: str | None = None) -> UploadResultList:
54
71
  if not self._client:
55
72
  raise NeatSessionError("No CDF client provided!")
56
73
 
74
+ space = space or f"{self._state.data_model.last_verified_dms_rules[1].metadata.space}_instances"
75
+
76
+ if space and space == self._state.data_model.last_verified_dms_rules[1].metadata.space:
77
+ raise NeatSessionError("Space for instances must be different from the data model space.")
78
+ elif not PATTERNS.space_compliance.match(str(space)):
79
+ raise NeatSessionError("Please provide a valid space name. {PATTERNS.space_compliance.pattern}")
80
+
81
+ if not self._client.data_modeling.spaces.retrieve(space):
82
+ self._client.data_modeling.spaces.apply(SpaceApply(space=space))
83
+
57
84
  loader = loaders.DMSLoader.from_rules(
58
85
  self._state.data_model.last_verified_dms_rules[1],
59
86
  self._state.instances.store,
60
- space_wizard(space=space),
87
+ instance_space=space,
61
88
  )
62
89
  result = loader.load_into_cdf(self._client)
63
90
  self._state.instances.outcome.append(result)
64
- print("You can inspect the details with the .inspect.instances.outcome(...) method.")
65
- return loader.load_into_cdf(self._client)
91
+ print("You can inspect the details with the .inspect.outcome.instances(...) method.")
92
+ return result
66
93
 
67
94
  def data_model(
68
95
  self,