cognite-neat 0.97.1__tar.gz → 0.97.3__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.1 → cognite_neat-0.97.3}/PKG-INFO +1 -1
  2. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/loaders/_base.py +8 -1
  3. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/loaders/_rdf2dms.py +35 -15
  4. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/queries/_base.py +25 -4
  5. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/__init__.py +4 -0
  6. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/_base.py +48 -0
  7. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/errors/_general.py +3 -1
  8. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/_types.py +24 -16
  9. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/dms/_validation.py +0 -15
  10. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/transformers/_verification.py +2 -49
  11. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/_base.py +48 -26
  12. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/_inspect.py +12 -2
  13. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/_prepare.py +34 -8
  14. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/_set.py +12 -4
  15. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/_to.py +34 -7
  16. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/auth.py +4 -3
  17. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/upload.py +20 -0
  18. cognite_neat-0.97.3/cognite/neat/_version.py +2 -0
  19. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/pyproject.toml +1 -1
  20. cognite_neat-0.97.1/cognite/neat/_version.py +0 -2
  21. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/LICENSE +0 -0
  22. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/README.md +0 -0
  23. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/__init__.py +0 -0
  24. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/__init__.py +0 -0
  25. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/asgi/metrics.py +0 -0
  26. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/configuration.py +0 -0
  27. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/context_manager/__init__.py +0 -0
  28. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/context_manager/manager.py +0 -0
  29. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/data_classes/__init__.py +0 -0
  30. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/data_classes/rest.py +0 -0
  31. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/explorer.py +0 -0
  32. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/routers/configuration.py +0 -0
  33. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/routers/crud.py +0 -0
  34. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/routers/metrics.py +0 -0
  35. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/routers/workflows.py +0 -0
  36. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/utils/__init__.py +0 -0
  37. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/utils/data_mapping.py +0 -0
  38. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/utils/logging.py +0 -0
  39. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/api/utils/query_templates.py +0 -0
  40. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/main.py +0 -0
  41. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/monitoring/__init__.py +0 -0
  42. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/monitoring/metrics.py +0 -0
  43. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/index.html +0 -0
  44. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/.gitignore +0 -0
  45. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/README.md +0 -0
  46. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/asset-manifest.json +0 -0
  47. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/favicon.ico +0 -0
  48. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/img/architect-icon.svg +0 -0
  49. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/img/developer-icon.svg +0 -0
  50. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/img/sme-icon.svg +0 -0
  51. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/index.html +0 -0
  52. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/logo192.png +0 -0
  53. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/manifest.json +0 -0
  54. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/robots.txt +0 -0
  55. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
  56. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
  57. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
  58. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
  59. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
  60. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
  61. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/package-lock.json +0 -0
  62. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/package.json +0 -0
  63. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
  64. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +0 -0
  65. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +0 -0
  66. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +0 -0
  67. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/public/index.html +0 -0
  68. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
  69. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/public/manifest.json +0 -0
  70. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/public/robots.txt +0 -0
  71. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/App.css +0 -0
  72. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/App.js +0 -0
  73. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/App.test.js +0 -0
  74. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +0 -0
  75. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +0 -0
  76. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +0 -0
  77. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +0 -0
  78. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +0 -0
  79. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +0 -0
  80. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +0 -0
  81. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +0 -0
  82. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +0 -0
  83. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +0 -0
  84. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +0 -0
  85. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/index.css +0 -0
  86. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/index.js +0 -0
  87. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/logo.svg +0 -0
  88. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +0 -0
  89. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/setupTests.js +0 -0
  90. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +0 -0
  91. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +0 -0
  92. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +0 -0
  93. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +0 -0
  94. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +0 -0
  95. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_app/ui/neat-app/tsconfig.json +0 -0
  96. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_config.py +0 -0
  97. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_constants.py +0 -0
  98. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/__init__.py +0 -0
  99. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/_shared.py +0 -0
  100. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/_tracking/__init__.py +0 -0
  101. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/_tracking/base.py +0 -0
  102. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/_tracking/log.py +0 -0
  103. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  104. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  105. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/examples/__init__.py +0 -0
  106. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  107. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/__init__.py +0 -0
  108. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_base.py +0 -0
  109. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_classic_cdf/__init__.py +0 -0
  110. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_classic_cdf/_assets.py +0 -0
  111. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_classic_cdf/_base.py +0 -0
  112. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_classic_cdf/_classic.py +0 -0
  113. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_classic_cdf/_data_sets.py +0 -0
  114. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_classic_cdf/_events.py +0 -0
  115. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_classic_cdf/_files.py +0 -0
  116. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_classic_cdf/_labels.py +0 -0
  117. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +0 -0
  118. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +0 -0
  119. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_classic_cdf/_timeseries.py +0 -0
  120. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_dexpi.py +0 -0
  121. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_dms.py +0 -0
  122. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_iodd.py +0 -0
  123. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_mock_graph_generator.py +0 -0
  124. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/extractors/_rdf_file.py +0 -0
  125. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/loaders/__init__.py +0 -0
  126. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/loaders/_rdf2asset.py +0 -0
  127. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/queries/__init__.py +0 -0
  128. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/queries/_construct.py +0 -0
  129. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/queries/_shared.py +0 -0
  130. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/transformers/__init__.py +0 -0
  131. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/transformers/_base.py +0 -0
  132. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/transformers/_classic_cdf.py +0 -0
  133. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/transformers/_iodd.py +0 -0
  134. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/transformers/_prune_graph.py +0 -0
  135. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/transformers/_rdfpath.py +0 -0
  136. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_graph/transformers/_value_type.py +0 -0
  137. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/errors/__init__.py +0 -0
  138. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/errors/_external.py +0 -0
  139. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/errors/_properties.py +0 -0
  140. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/errors/_resources.py +0 -0
  141. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/errors/_workflow.py +0 -0
  142. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/formatters.py +0 -0
  143. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/warnings/__init__.py +0 -0
  144. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/warnings/_external.py +0 -0
  145. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/warnings/_general.py +0 -0
  146. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/warnings/_models.py +0 -0
  147. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/warnings/_properties.py +0 -0
  148. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/warnings/_resources.py +0 -0
  149. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_issues/warnings/user_modeling.py +0 -0
  150. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/__init__.py +0 -0
  151. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/_constants.py +0 -0
  152. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/_shared.py +0 -0
  153. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/analysis/__init__.py +0 -0
  154. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/analysis/_asset.py +0 -0
  155. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/analysis/_base.py +0 -0
  156. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/analysis/_dms.py +0 -0
  157. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/analysis/_information.py +0 -0
  158. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/catalog/__init__.py +0 -0
  159. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
  160. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/exporters/__init__.py +0 -0
  161. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/exporters/_base.py +0 -0
  162. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/exporters/_rules2dms.py +0 -0
  163. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/exporters/_rules2excel.py +0 -0
  164. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/exporters/_rules2instance_template.py +0 -0
  165. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/exporters/_rules2ontology.py +0 -0
  166. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/exporters/_rules2yaml.py +0 -0
  167. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/exporters/_validation.py +0 -0
  168. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/__init__.py +0 -0
  169. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_base.py +0 -0
  170. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_dms2rules.py +0 -0
  171. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_dtdl2rules/__init__.py +0 -0
  172. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
  173. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
  174. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
  175. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_dtdl2rules/spec.py +0 -0
  176. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/__init__.py +0 -0
  177. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_base.py +0 -0
  178. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_imf2rules/__init__.py +0 -0
  179. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2classes.py +0 -0
  180. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2metadata.py +0 -0
  181. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2properties.py +0 -0
  182. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_imf2rules/_imf2rules.py +0 -0
  183. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_inference2rules.py +0 -0
  184. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_owl2rules/__init__.py +0 -0
  185. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2classes.py +0 -0
  186. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2metadata.py +0 -0
  187. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2properties.py +0 -0
  188. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2rules.py +0 -0
  189. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_rdf/_shared.py +0 -0
  190. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_spreadsheet2rules.py +0 -0
  191. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/importers/_yaml2rules.py +0 -0
  192. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/__init__.py +0 -0
  193. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/_base_input.py +0 -0
  194. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/_base_rules.py +0 -0
  195. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/_rdfpath.py +0 -0
  196. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/asset/__init__.py +0 -0
  197. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/asset/_rules.py +0 -0
  198. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/asset/_rules_input.py +0 -0
  199. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/asset/_validation.py +0 -0
  200. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/data_types.py +0 -0
  201. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/dms/__init__.py +0 -0
  202. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/dms/_exporter.py +0 -0
  203. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/dms/_rules.py +0 -0
  204. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/dms/_rules_input.py +0 -0
  205. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/dms/_schema.py +0 -0
  206. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/domain.py +0 -0
  207. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/entities/__init__.py +0 -0
  208. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/entities/_constants.py +0 -0
  209. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/entities/_loaders.py +0 -0
  210. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/entities/_multi_value.py +0 -0
  211. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/entities/_single_value.py +0 -0
  212. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/entities/_types.py +0 -0
  213. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/entities/_wrapped.py +0 -0
  214. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/information/__init__.py +0 -0
  215. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/information/_rules.py +0 -0
  216. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/information/_rules_input.py +0 -0
  217. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/information/_validation.py +0 -0
  218. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/mapping/__init__.py +0 -0
  219. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/mapping/_base.py +0 -0
  220. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/models/mapping/_classic2core.py +0 -0
  221. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/transformers/__init__.py +0 -0
  222. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/transformers/_base.py +0 -0
  223. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/transformers/_converters.py +0 -0
  224. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/transformers/_mapping.py +0 -0
  225. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_rules/transformers/_pipelines.py +0 -0
  226. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/__init__.py +0 -0
  227. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/_read.py +0 -0
  228. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/_show.py +0 -0
  229. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/_state.py +0 -0
  230. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/_wizard.py +0 -0
  231. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/engine/__init__.py +0 -0
  232. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/engine/_import.py +0 -0
  233. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/engine/_interface.py +0 -0
  234. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/engine/_load.py +0 -0
  235. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_session/exceptions.py +0 -0
  236. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_shared.py +0 -0
  237. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_store/__init__.py +0 -0
  238. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_store/_base.py +0 -0
  239. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_store/_provenance.py +0 -0
  240. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/__init__.py +0 -0
  241. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/auxiliary.py +0 -0
  242. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/cdf/__init__.py +0 -0
  243. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/cdf/data_classes.py +0 -0
  244. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/cdf/loaders/__init__.py +0 -0
  245. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/cdf/loaders/_base.py +0 -0
  246. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/cdf/loaders/_data_modeling.py +0 -0
  247. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/cdf/loaders/_ingestion.py +0 -0
  248. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/collection_.py +0 -0
  249. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/rdf_.py +0 -0
  250. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/reader/__init__.py +0 -0
  251. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/reader/_base.py +0 -0
  252. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/spreadsheet.py +0 -0
  253. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/text.py +0 -0
  254. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/time_.py +0 -0
  255. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_utils/xml_.py +0 -0
  256. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/__init__.py +0 -0
  257. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/base.py +0 -0
  258. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/cdf_store.py +0 -0
  259. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/examples/Export_DMS/workflow.yaml +0 -0
  260. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -0
  261. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/examples/Import_DMS/workflow.yaml +0 -0
  262. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/examples/Validate_Rules/workflow.yaml +0 -0
  263. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  264. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/manager.py +0 -0
  265. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/model.py +0 -0
  266. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/__init__.py +0 -0
  267. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/data_contracts.py +0 -0
  268. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/lib/__init__.py +0 -0
  269. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/lib/current/__init__.py +0 -0
  270. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/lib/current/graph_extractor.py +0 -0
  271. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/lib/current/graph_loader.py +0 -0
  272. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/lib/current/graph_store.py +0 -0
  273. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/lib/current/rules_exporter.py +0 -0
  274. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/lib/current/rules_importer.py +0 -0
  275. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/lib/current/rules_validator.py +0 -0
  276. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/lib/io/__init__.py +0 -0
  277. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/lib/io/io_steps.py +0 -0
  278. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps/step_model.py +0 -0
  279. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/steps_registry.py +0 -0
  280. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/tasks.py +0 -0
  281. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/triggers.py +0 -0
  282. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/cognite/neat/_workflows/utils.py +0 -0
  283. {cognite_neat-0.97.1 → cognite_neat-0.97.3}/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.1
3
+ Version: 0.97.3
4
4
  Summary: Knowledge graph transformation
5
5
  Home-page: https://cognite-neat.readthedocs-hosted.com/
6
6
  License: Apache-2.0
@@ -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):
@@ -42,6 +42,27 @@ class Queries:
42
42
  for res in list(self.graph.query(query_statement))
43
43
  ]
44
44
 
45
+ @property
46
+ def types(self) -> dict[URIRef, str]:
47
+ """Types and their short form in the graph"""
48
+ query = """SELECT DISTINCT ?type
49
+ WHERE {?s a ?type .}"""
50
+ return {type_: remove_namespace_from_uri(cast(URIRef, type_)) for (type_,) in list(self.graph.query(query))} # type: ignore[misc, index, arg-type]
51
+
52
+ def type_uri(self, type_: str) -> list[URIRef]:
53
+ """Get the URIRef of a type"""
54
+ return [k for k, v in self.types.items() if v == type_]
55
+
56
+ @property
57
+ def properties(self) -> dict[URIRef, str]:
58
+ query = """SELECT DISTINCT ?property
59
+ WHERE {?s ?property ?o . FILTER(?property != rdf:type)}"""
60
+ return {type_: remove_namespace_from_uri(cast(URIRef, type_)) for (type_,) in list(self.graph.query(query))} # type: ignore[misc, index, arg-type]
61
+
62
+ def property_uri(self, property_: str) -> list[URIRef]:
63
+ """Get the URIRef of a type"""
64
+ return [k for k, v in self.properties.items() if v == property_]
65
+
45
66
  def list_instances_ids_of_class(self, class_uri: URIRef, limit: int = -1) -> list[URIRef]:
46
67
  """Get instances ids for a given class
47
68
 
@@ -101,7 +122,7 @@ class Queries:
101
122
  # We cannot include the RDF.type in case there is a neat:type property
102
123
  return [remove_namespace_from_uri(list(triple)) for triple in result if triple[1] != RDF.type] # type: ignore[misc, index, arg-type]
103
124
 
104
- def types_with_property(self, property_uri: URIRef) -> list[URIRef]:
125
+ def type_with_property(self, type_: URIRef, property_uri: URIRef) -> bool:
105
126
  """Check if a property exists in the graph store
106
127
 
107
128
  Args:
@@ -110,8 +131,8 @@ class Queries:
110
131
  Returns:
111
132
  True if property exists, False otherwise
112
133
  """
113
- query = f"SELECT DISTINCT ?t WHERE {{ ?s <{property_uri}> ?o ; a ?t}} Limit 1"
114
- return cast(list[URIRef], [t[0] for t in self.graph.query(query)]) # type: ignore[index]
134
+ query = f"SELECT ?o WHERE {{ ?s a <{type_}> ; <{property_uri}> ?o .}} Limit 1"
135
+ return bool(list(self.graph.query(query)))
115
136
 
116
137
  def has_namespace(self, namespace: Namespace) -> bool:
117
138
  """Check if a namespace exists in the graph store
@@ -250,7 +271,7 @@ class Queries:
250
271
  result = self.graph.query(query)
251
272
 
252
273
  # We cannot include the RDF.type in case there is a neat:type property
253
- return [remove_namespace_from_uri(cast(ResultRow, triple)) for triple in result if triple[1] != RDF.type] # type: ignore[misc, index]
274
+ return [remove_namespace_from_uri(cast(ResultRow, triple)) for triple in result if triple[1] != RDF.type] # type: ignore[misc, index, arg-type]
254
275
  else:
255
276
  warnings.warn(
256
277
  "No rules found for the graph store, returning empty list.",
@@ -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
+ ]
@@ -157,21 +157,6 @@ class DMSPostValidation:
157
157
  )
158
158
  )
159
159
 
160
- # This sets the container definition for all the properties where it is not defined.
161
- # This allows the user to define the container only once.
162
- value_type = next(iter(value_types))
163
- list_definition = next(iter(list_definitions)) if list_definitions else None
164
- nullable_definition = next(iter(nullable_definitions)) if nullable_definitions else None
165
- default_definition = next(iter(default_definitions)) if default_definitions else None
166
- index_definition = next(iter(index_definitions)).split(",") if index_definitions else None
167
- constraint_definition = next(iter(constraint_definitions)).split(",") if constraint_definitions else None
168
- for _, prop in properties:
169
- prop.value_type = value_type
170
- prop.is_list = prop.is_list or list_definition
171
- prop.nullable = prop.nullable or nullable_definition
172
- prop.default = prop.default or default_definition
173
- prop.index = prop.index or index_definition
174
- prop.constraint = prop.constraint or constraint_definition
175
160
  self.issue_list.extend(errors)
176
161
 
177
162
  def _referenced_views_and_containers_are_existing_and_proper_size(self) -> None:
@@ -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,10 +16,12 @@ 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,
21
23
  )
24
+ from cognite.neat._utils.auth import _CLIENT_NAME
22
25
 
23
26
  from ._inspect import InspectAPI
24
27
  from ._prepare import PrepareAPI
@@ -49,6 +52,8 @@ class NeatSession:
49
52
  self.show = ShowAPI(self._state)
50
53
  self.set = SetAPI(self._state, verbose)
51
54
  self.inspect = InspectAPI(self._state)
55
+ if self._client is not None and self._client._config is not None:
56
+ self._client._config.client_name = _CLIENT_NAME
52
57
  if load_engine != "skip" and (engine_version := load_neat_engine(client, load_engine)):
53
58
  print(f"Neat Engine {engine_version} loaded.")
54
59
 
@@ -85,35 +90,52 @@ class NeatSession:
85
90
  print("You can inspect the issues with the .inspect.issues(...) method.")
86
91
  return output.issues
87
92
 
88
- def convert(self, target: Literal["dms", "information"]) -> None:
93
+ def convert(self, target: Literal["dms", "information"]) -> IssueList:
89
94
  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.")
95
+ issues = IssueList()
96
+ converter: ConversionTransformer | None = None
97
+ converted_rules: VerifiedRules | None = None
98
+ with catch_issues(issues):
99
+ if target == "dms":
100
+ source_id, info_rules = self._state.data_model.last_verified_information_rules
101
+ converter = ConvertToRules(DMSRules)
102
+ converted_rules = converter.transform(info_rules).rules
103
+ elif target == "information":
104
+ source_id, dms_rules = self._state.data_model.last_verified_dms_rules
105
+ converter = ConvertToRules(InformationRules)
106
+ converted_rules = converter.transform(dms_rules).rules
107
+ else:
108
+ # Session errors are not caught by the catch_issues context manager
109
+ raise NeatSessionError(f"Target {target} not supported.")
110
+
100
111
  end = datetime.now(timezone.utc)
112
+ if issues:
113
+ self._state.data_model.issue_lists.append(issues)
101
114
 
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
- )
115
+ if converted_rules is not None and converter is not None:
116
+ # Provenance
117
+ change = Change.from_rules_activity(
118
+ converted_rules,
119
+ converter.agent,
120
+ start,
121
+ end,
122
+ f"Converted data model {source_id} to {converted_rules.id_}",
123
+ self._state.data_model.provenance.source_entity(source_id)
124
+ or self._state.data_model.provenance.target_entity(source_id),
125
+ )
126
+
127
+ self._state.data_model.write(converted_rules, change)
112
128
 
113
- self._state.data_model.write(converted_rules, change)
129
+ if self._verbose and not issues.has_errors:
130
+ print(f"Rules converted to {target}")
131
+ else:
132
+ print("Conversion failed.")
133
+ if issues:
134
+ print("You can inspect the issues with the .inspect.issues(...) method.")
135
+ if issues.has_error_type(RegexViolationError):
136
+ print("You can use .prepare. to try to fix the issues")
114
137
 
115
- if self._verbose:
116
- print(f"Rules converted to {target}")
138
+ return issues
117
139
 
118
140
  def infer(
119
141
  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
 
@@ -12,7 +12,7 @@ from cognite.neat._rules.transformers import ReduceCogniteModel, ToCompliantEnti
12
12
  from cognite.neat._store._provenance import Change
13
13
 
14
14
  from ._state import SessionState
15
- from .exceptions import intercept_session_exceptions
15
+ from .exceptions import NeatSessionError, intercept_session_exceptions
16
16
 
17
17
 
18
18
  @intercept_session_exceptions
@@ -32,18 +32,18 @@ class InstancePrepareAPI:
32
32
 
33
33
  def make_connection_on_exact_match(
34
34
  self,
35
- source: tuple[URIRef, URIRef],
36
- target: tuple[URIRef, URIRef],
37
- connection: URIRef | None = None,
35
+ source: tuple[str, str],
36
+ target: tuple[str, str],
37
+ connection: str | None = None,
38
38
  limit: int | None = 100,
39
39
  ) -> None:
40
40
  """Make connection on exact match.
41
41
 
42
42
  Args:
43
- source: The source of the connection. A tuple of (rdf type, property) where
43
+ source: The source of the connection. A tuple of (type, property) where
44
44
  where property is the property that should be matched on the source
45
45
  to make the connection with the target.
46
- target: The target of the connection. A tuple of (rdf type, property) where
46
+ target: The target of the connection. A tuple of (type, property) where
47
47
  where property is the property that should be matched on the target
48
48
  to make the connection with the source.
49
49
 
@@ -51,11 +51,19 @@ class InstancePrepareAPI:
51
51
  will be made by lowercasing the target type.
52
52
  limit: The maximum number of connections to make. If None, all connections
53
53
 
54
+ !!! note "Make Connection on Exact Match"
55
+ This method will make a connection between the source and target based on the exact match:
56
+ (SourceType)-[sourceProperty]->(sourceValue) == (TargetType)-[targetProperty]->(targetValue)
57
+
58
+ The connection will be made by creating a new property on the source type that will contain the
59
+ target value, as follows:
60
+ (SourceType)-[connection]->(TargetType)
61
+
54
62
 
55
63
  """
56
64
 
57
- subject_type, subject_predicate = source
58
- object_type, object_predicate = target
65
+ subject_type, subject_predicate = self._get_type_and_property_uris(*source)
66
+ object_type, object_predicate = self._get_type_and_property_uris(*target)
59
67
 
60
68
  transformer = MakeConnectionOnExactMatch(
61
69
  subject_type,
@@ -68,6 +76,24 @@ class InstancePrepareAPI:
68
76
 
69
77
  self._state.instances.store.transform(transformer)
70
78
 
79
+ def _get_type_and_property_uris(self, type_: str, property_: str) -> tuple[URIRef, URIRef]:
80
+ type_uri = self._state.instances.store.queries.type_uri(type_)
81
+ property_uri = self._state.instances.store.queries.property_uri(property_)
82
+
83
+ if not type_uri:
84
+ raise NeatSessionError(f"Type {type_} does not exist in the graph.")
85
+ elif len(type_uri) > 1:
86
+ raise NeatSessionError(f"{type_} has multiple ids found in the graph: {','.join(type_uri)}.")
87
+
88
+ if not property_uri:
89
+ raise NeatSessionError(f"Property {property_} does not exist in the graph.")
90
+ elif len(type_uri) > 1:
91
+ raise NeatSessionError(f"{property_} has multiple ids found in the graph: {','.join(property_uri)}.")
92
+
93
+ if not self._state.instances.store.queries.type_with_property(type_uri[0], property_uri[0]):
94
+ raise NeatSessionError(f"Property {property_} is not defined for type {type_}. Cannot make connection")
95
+ return type_uri[0], property_uri[0]
96
+
71
97
 
72
98
  @intercept_session_exceptions
73
99
  class DataModelPrepareAPI: