cognite-neat 0.92.1__tar.gz → 0.92.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 (224) hide show
  1. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/PKG-INFO +1 -1
  2. cognite_neat-0.92.3/cognite/neat/_version.py +1 -0
  3. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/queries/_base.py +52 -16
  4. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/analysis/_information.py +50 -5
  5. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/examples/__init__.py +1 -0
  6. cognite_neat-0.92.3/cognite/neat/rules/examples/info-rules-imf.xlsx +0 -0
  7. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/exporters/_rules2excel.py +15 -0
  8. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_base.py +8 -3
  9. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_spreadsheet2rules.py +34 -0
  10. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/_base_input.py +16 -6
  11. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/_base_rules.py +8 -6
  12. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/dms/_rules.py +3 -3
  13. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/entities/_single_value.py +9 -0
  14. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/information/_rules.py +3 -3
  15. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/store/_base.py +23 -5
  16. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/pyproject.toml +1 -1
  17. cognite_neat-0.92.1/cognite/neat/_version.py +0 -1
  18. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/LICENSE +0 -0
  19. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/README.md +0 -0
  20. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/__init__.py +0 -0
  21. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/_shared.py +0 -0
  22. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/__init__.py +0 -0
  23. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/asgi/metrics.py +0 -0
  24. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/configuration.py +0 -0
  25. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/context_manager/__init__.py +0 -0
  26. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/context_manager/manager.py +0 -0
  27. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/data_classes/__init__.py +0 -0
  28. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/data_classes/rest.py +0 -0
  29. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/explorer.py +0 -0
  30. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/routers/configuration.py +0 -0
  31. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/routers/crud.py +0 -0
  32. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/routers/metrics.py +0 -0
  33. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/routers/workflows.py +0 -0
  34. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/utils/__init__.py +0 -0
  35. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/utils/data_mapping.py +0 -0
  36. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/utils/logging.py +0 -0
  37. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/api/utils/query_templates.py +0 -0
  38. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/main.py +0 -0
  39. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/monitoring/__init__.py +0 -0
  40. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/monitoring/metrics.py +0 -0
  41. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/index.html +0 -0
  42. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
  43. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/README.md +0 -0
  44. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
  45. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
  46. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
  47. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
  48. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
  49. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
  50. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
  51. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
  52. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
  53. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
  54. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
  55. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
  56. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
  57. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
  58. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
  59. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/config.py +0 -0
  60. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/constants.py +0 -0
  61. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/__init__.py +0 -0
  62. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/_shared.py +0 -0
  63. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/_tracking/__init__.py +0 -0
  64. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/_tracking/base.py +0 -0
  65. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/_tracking/log.py +0 -0
  66. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  67. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  68. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/examples/__init__.py +0 -0
  69. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  70. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/__init__.py +0 -0
  71. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_base.py +0 -0
  72. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_classic_cdf/__init__.py +0 -0
  73. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_classic_cdf/_assets.py +0 -0
  74. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_classic_cdf/_base.py +0 -0
  75. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_classic_cdf/_classic.py +0 -0
  76. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_classic_cdf/_data_sets.py +0 -0
  77. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_classic_cdf/_events.py +0 -0
  78. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_classic_cdf/_files.py +0 -0
  79. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_classic_cdf/_labels.py +0 -0
  80. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_classic_cdf/_relationships.py +0 -0
  81. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_classic_cdf/_sequences.py +0 -0
  82. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_classic_cdf/_timeseries.py +0 -0
  83. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_dexpi.py +0 -0
  84. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_dms.py +0 -0
  85. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_iodd.py +0 -0
  86. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_mock_graph_generator.py +0 -0
  87. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/extractors/_rdf_file.py +0 -0
  88. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/loaders/__init__.py +0 -0
  89. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/loaders/_base.py +0 -0
  90. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/loaders/_rdf2asset.py +0 -0
  91. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/loaders/_rdf2dms.py +0 -0
  92. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/models.py +0 -0
  93. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/queries/__init__.py +0 -0
  94. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/queries/_construct.py +0 -0
  95. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/queries/_shared.py +0 -0
  96. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/transformers/__init__.py +0 -0
  97. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/transformers/_base.py +0 -0
  98. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/transformers/_classic_cdf.py +0 -0
  99. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/graph/transformers/_rdfpath.py +0 -0
  100. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/__init__.py +0 -0
  101. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/_base.py +0 -0
  102. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/errors/__init__.py +0 -0
  103. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/errors/_external.py +0 -0
  104. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/errors/_general.py +0 -0
  105. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/errors/_properties.py +0 -0
  106. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/errors/_resources.py +0 -0
  107. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/errors/_workflow.py +0 -0
  108. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/formatters.py +0 -0
  109. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/warnings/__init__.py +0 -0
  110. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/warnings/_external.py +0 -0
  111. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/warnings/_general.py +0 -0
  112. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/warnings/_models.py +0 -0
  113. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/warnings/_properties.py +0 -0
  114. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/warnings/_resources.py +0 -0
  115. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/issues/warnings/user_modeling.py +0 -0
  116. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/py.typed +0 -0
  117. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/__init__.py +0 -0
  118. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/_shared.py +0 -0
  119. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/analysis/__init__.py +0 -0
  120. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/analysis/_asset.py +0 -0
  121. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/analysis/_base.py +0 -0
  122. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/examples/wind-energy.owl +0 -0
  123. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/exporters/__init__.py +0 -0
  124. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/exporters/_base.py +0 -0
  125. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/exporters/_rules2dms.py +0 -0
  126. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/exporters/_rules2ontology.py +0 -0
  127. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
  128. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/exporters/_validation.py +0 -0
  129. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/__init__.py +0 -0
  130. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_dms2rules.py +0 -0
  131. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
  132. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
  133. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
  134. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
  135. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
  136. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/__init__.py +0 -0
  137. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_imf2rules/__init__.py +0 -0
  138. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2classes.py +0 -0
  139. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2metadata.py +0 -0
  140. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2properties.py +0 -0
  141. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2rules.py +0 -0
  142. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_inference2rules.py +0 -0
  143. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_owl2rules/__init__.py +0 -0
  144. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2classes.py +0 -0
  145. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2metadata.py +0 -0
  146. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2properties.py +0 -0
  147. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2rules.py +0 -0
  148. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_rdf/_shared.py +0 -0
  149. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/importers/_yaml2rules.py +0 -0
  150. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/__init__.py +0 -0
  151. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/_rdfpath.py +0 -0
  152. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/_types.py +0 -0
  153. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/asset/__init__.py +0 -0
  154. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/asset/_rules.py +0 -0
  155. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/asset/_rules_input.py +0 -0
  156. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/asset/_validation.py +0 -0
  157. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/data_types.py +0 -0
  158. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/dms/__init__.py +0 -0
  159. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/dms/_exporter.py +0 -0
  160. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/dms/_rules_input.py +0 -0
  161. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/dms/_schema.py +0 -0
  162. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/dms/_validation.py +0 -0
  163. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/domain.py +0 -0
  164. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/entities/__init__.py +0 -0
  165. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/entities/_constants.py +0 -0
  166. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/entities/_loaders.py +0 -0
  167. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/entities/_multi_value.py +0 -0
  168. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/entities/_types.py +0 -0
  169. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/entities/_wrapped.py +0 -0
  170. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/information/__init__.py +0 -0
  171. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/information/_rules_input.py +0 -0
  172. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/models/information/_validation.py +0 -0
  173. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/transformers/__init__.py +0 -0
  174. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/transformers/_base.py +0 -0
  175. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/transformers/_converters.py +0 -0
  176. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/transformers/_map_onto.py +0 -0
  177. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/transformers/_pipelines.py +0 -0
  178. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/rules/transformers/_verification.py +0 -0
  179. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/store/__init__.py +0 -0
  180. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/store/_provenance.py +0 -0
  181. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/__init__.py +0 -0
  182. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/auth.py +0 -0
  183. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/auxiliary.py +0 -0
  184. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/cdf/__init__.py +0 -0
  185. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/cdf/data_classes.py +0 -0
  186. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/cdf/loaders/__init__.py +0 -0
  187. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/cdf/loaders/_base.py +0 -0
  188. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/cdf/loaders/_data_modeling.py +0 -0
  189. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/cdf/loaders/_ingestion.py +0 -0
  190. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/collection_.py +0 -0
  191. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/rdf_.py +0 -0
  192. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/regex_patterns.py +0 -0
  193. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/spreadsheet.py +0 -0
  194. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/text.py +0 -0
  195. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/time_.py +0 -0
  196. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/upload.py +0 -0
  197. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/utils/xml_.py +0 -0
  198. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/__init__.py +0 -0
  199. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/base.py +0 -0
  200. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/cdf_store.py +0 -0
  201. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
  202. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -0
  203. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
  204. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
  205. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  206. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/manager.py +0 -0
  207. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/model.py +0 -0
  208. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/__init__.py +0 -0
  209. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/data_contracts.py +0 -0
  210. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/lib/__init__.py +0 -0
  211. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
  212. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
  213. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
  214. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
  215. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +0 -0
  216. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/lib/current/rules_importer.py +0 -0
  217. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
  218. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
  219. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
  220. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps/step_model.py +0 -0
  221. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/steps_registry.py +0 -0
  222. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/tasks.py +0 -0
  223. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/triggers.py +0 -0
  224. {cognite_neat-0.92.1 → cognite_neat-0.92.3}/cognite/neat/workflows/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cognite-neat
3
- Version: 0.92.1
3
+ Version: 0.92.3
4
4
  Summary: Knowledge graph transformation
5
5
  Home-page: https://cognite-neat.readthedocs-hosted.com/
6
6
  License: Apache-2.0
@@ -0,0 +1 @@
1
+ __version__ = "0.92.3"
@@ -7,7 +7,7 @@ from rdflib import Literal as RdfLiteral
7
7
  from rdflib.query import ResultRow
8
8
 
9
9
  from cognite.neat.graph.models import InstanceType
10
- from cognite.neat.rules.models.entities import ClassEntity
10
+ from cognite.neat.rules.models.entities import ClassEntity, EntityTypes
11
11
  from cognite.neat.rules.models.information import InformationRules
12
12
  from cognite.neat.utils.rdf_ import remove_namespace_from_uri
13
13
 
@@ -98,13 +98,18 @@ class Queries:
98
98
  def describe(
99
99
  self,
100
100
  instance_id: URIRef,
101
+ instance_type: str | None = None,
101
102
  property_renaming_config: dict | None = None,
103
+ property_types: dict[str, EntityTypes] | None = None,
102
104
  ) -> tuple[str, dict[str | InstanceType, list[str]]] | None:
103
105
  """DESCRIBE instance for a given class from the graph store
104
106
 
105
107
  Args:
106
108
  instance_id: Instance id for which we want to generate query
107
- property_renaming_config: Dictionary to rename properties, default None
109
+ instance_type: Type of the instance, default None (will be inferred from triples)
110
+ property_renaming_config: Dictionary to rename properties, default None (no renaming)
111
+ property_types: Dictionary of property types, default None (helper for removal of namespace)
112
+
108
113
 
109
114
  Returns:
110
115
  Dictionary of instance properties
@@ -119,21 +124,52 @@ class Queries:
119
124
  "null",
120
125
  ]:
121
126
  continue
122
- # we are skipping deep validation with Pydantic to remove namespace here
123
- # as it reduces time to process triples by 10-15x
124
- value = remove_namespace_from_uri(object_, validation="prefix")
125
-
126
- # use-case: calling describe without renaming properties
127
- # losing the namespace from the predicate!
128
- if not property_renaming_config and predicate != RDF.type:
129
- property_values[remove_namespace_from_uri(predicate, validation="prefix")].append(value)
130
- elif predicate == RDF.type:
131
- property_values[RDF.type].append(value)
132
- # use-case: calling describe with renaming properties
133
- # renaming the property to the new name, if the property is defined
134
- # in the RULES sheet
135
- elif property_renaming_config and (property_ := property_renaming_config.get(predicate, None)):
127
+
128
+ # set property
129
+ if property_renaming_config and predicate != RDF.type:
130
+ property_ = property_renaming_config.get(
131
+ predicate, remove_namespace_from_uri(predicate, validation="prefix")
132
+ )
133
+ elif not property_renaming_config and predicate != RDF.type:
134
+ property_ = remove_namespace_from_uri(predicate, validation="prefix")
135
+ else:
136
+ property_ = RDF.type
137
+
138
+ # set value
139
+ # if it is URIRef and property type is object property, we need to remove namespace
140
+ # if it URIref but we are doing this into data type property, we do not remove namespace
141
+ # case 1 for RDF type we remove namespace
142
+ if property_ == RDF.type:
143
+ value = remove_namespace_from_uri(object_, validation="prefix")
144
+
145
+ # case 2 for define object properties we remove namespace
146
+ elif (
147
+ isinstance(object_, URIRef)
148
+ and property_types
149
+ and property_types.get(property_, None) == EntityTypes.object_property
150
+ ):
151
+ value = remove_namespace_from_uri(object_, validation="prefix")
152
+
153
+ # case 3 when property type is not defined and returned value is URIRef we remove namespace
154
+ elif isinstance(object_, URIRef) and not property_types:
155
+ value = remove_namespace_from_uri(object_, validation="prefix")
156
+
157
+ # case 4 for data type properties we do not remove namespace but keep the entire value
158
+ # but we drop the datatype part, and keep everything to be string (data loader will do the conversion)
159
+ # for value type it expects (if possible)
160
+ else:
161
+ value = str(object_)
162
+
163
+ # add type to the dictionary
164
+ if predicate != RDF.type:
136
165
  property_values[property_].append(value)
166
+ else:
167
+ # guarding against multiple rdf:type values as this is not allowed in CDF
168
+ if RDF.type not in property_values:
169
+ property_values[RDF.type].append(instance_type if instance_type else value)
170
+ else:
171
+ # we should not have multiple rdf:type values
172
+ continue
137
173
 
138
174
  if property_values:
139
175
  return (
@@ -1,4 +1,3 @@
1
- import logging
2
1
  import warnings
3
2
  from typing import Any, cast
4
3
 
@@ -12,12 +11,13 @@ from cognite.neat.rules.models._rdfpath import (
12
11
  SelfReferenceProperty,
13
12
  SingleProperty,
14
13
  )
15
- from cognite.neat.rules.models.entities import ClassEntity, ReferenceEntity
14
+ from cognite.neat.rules.models.entities import ClassEntity, EntityTypes, ReferenceEntity
16
15
  from cognite.neat.rules.models.information import (
17
16
  InformationClass,
18
17
  InformationProperty,
19
18
  InformationRules,
20
19
  )
20
+ from cognite.neat.utils.collection_ import most_occurring_element
21
21
  from cognite.neat.utils.rdf_ import get_inheritance_path
22
22
 
23
23
  from ._base import BaseAnalysis
@@ -105,6 +105,26 @@ class InformationAnalysis(BaseAnalysis[InformationRules, InformationClass, Infor
105
105
 
106
106
  return property_renaming_configuration
107
107
 
108
+ def property_types(self, class_: ClassEntity) -> dict[str, EntityTypes]:
109
+ property_types = {}
110
+ if definitions := self.class_property_pairs(consider_inheritance=True).get(class_, None):
111
+ for property_id, definition in definitions.items():
112
+ property_types[property_id] = definition.type_
113
+
114
+ return property_types
115
+
116
+ def most_occurring_class_in_transformations(self, class_: ClassEntity) -> ClassEntity | None:
117
+ classes = []
118
+ if class_property_pairs := self.class_property_pairs(consider_inheritance=True, only_rdfpath=True).get(
119
+ class_, None
120
+ ):
121
+ for property_ in class_property_pairs.values():
122
+ classes.append(cast(RDFPath, property_.transformation).traversal.class_)
123
+
124
+ return cast(ClassEntity, most_occurring_element(classes))
125
+ else:
126
+ return None
127
+
108
128
  def subset_rules(self, desired_classes: set[ClassEntity]) -> InformationRules:
109
129
  """
110
130
  Subset rules to only include desired classes and their properties.
@@ -148,11 +168,9 @@ class InformationAnalysis(BaseAnalysis[InformationRules, InformationClass, Infor
148
168
  possible_classes = possible_classes.union(parents)
149
169
 
150
170
  if not possible_classes:
151
- logging.error("None of the desired classes are defined in the data model!")
152
171
  raise ValueError("None of the desired classes are defined in the data model!")
153
172
 
154
173
  if impossible_classes:
155
- logging.warning(f"Could not find the following classes defined in the data model: {impossible_classes}")
156
174
  warnings.warn(
157
175
  f"Could not find the following classes defined in the data model: {impossible_classes}",
158
176
  stacklevel=2,
@@ -165,7 +183,6 @@ class InformationAnalysis(BaseAnalysis[InformationRules, InformationClass, Infor
165
183
  "properties": [],
166
184
  }
167
185
 
168
- logging.info(f"Reducing data model to only include the following classes: {possible_classes}")
169
186
  for class_ in possible_classes:
170
187
  reduced_data_model["classes"].append(class_as_dict[str(class_.suffix)])
171
188
 
@@ -181,3 +198,31 @@ class InformationAnalysis(BaseAnalysis[InformationRules, InformationClass, Infor
181
198
  warnings.warn(f"Reduced data model is not complete: {e}", stacklevel=2)
182
199
  reduced_data_model["metadata"].schema_ = SchemaCompleteness.partial
183
200
  return type(self.rules).model_construct(**reduced_data_model)
201
+
202
+ def class_uri(self, class_: ClassEntity) -> URIRef | None:
203
+ """Get URI for a class entity based on the rules.
204
+
205
+ Args:
206
+ class_: instance of ClassEntity
207
+
208
+ Returns:
209
+ URIRef of the class entity or None if not found
210
+ """
211
+
212
+ # we need to handle optional renamings and we do this
213
+ # by checking if the most occurring class in transformations alternatively
214
+ # in cases when we are not specifying transformations we default to the class entity
215
+ if not (most_frequent_class := self.most_occurring_class_in_transformations(class_)):
216
+ most_frequent_class = class_
217
+
218
+ # case 1 class prefix in rules.prefixes
219
+ if most_frequent_class.prefix in self.rules.prefixes:
220
+ return self.rules.prefixes[cast(str, most_frequent_class.prefix)][most_frequent_class.suffix]
221
+
222
+ # case 2 class prefix equal to rules.metadata.prefix
223
+ elif most_frequent_class.prefix == self.rules.metadata.prefix:
224
+ return self.rules.metadata.namespace[most_frequent_class.suffix]
225
+
226
+ # case 3 when class prefix is not found in prefixes of rules
227
+ else:
228
+ return None
@@ -7,3 +7,4 @@ from pathlib import Path
7
7
 
8
8
  _EXAMPLES = Path(__file__).parent
9
9
  wind_energy_ontology = _EXAMPLES / "wind-energy.owl"
10
+ imf_info_rules = _EXAMPLES / "info-rules-imf.xlsx"
@@ -11,6 +11,7 @@ from openpyxl import Workbook
11
11
  from openpyxl.cell import MergedCell
12
12
  from openpyxl.styles import Alignment, Border, Font, PatternFill, Side
13
13
  from openpyxl.worksheet.worksheet import Worksheet
14
+ from rdflib import Namespace
14
15
 
15
16
  from cognite.neat.rules._shared import VerifiedRules
16
17
  from cognite.neat.rules.models import (
@@ -22,6 +23,7 @@ from cognite.neat.rules.models import (
22
23
  from cognite.neat.rules.models.dms import DMSMetadata
23
24
  from cognite.neat.rules.models.domain import DomainMetadata
24
25
  from cognite.neat.rules.models.information import InformationMetadata
26
+ from cognite.neat.rules.models.information._rules import InformationRules
25
27
 
26
28
  from ._base import BaseExporter
27
29
 
@@ -133,6 +135,9 @@ class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
133
135
  self._write_sheets(workbook, dumped_reference_rules, rules, sheet_prefix="Ref")
134
136
  self._write_metadata_sheet(workbook, dumped_reference_rules["Metadata"], sheet_prefix="Ref")
135
137
 
138
+ if isinstance(rules, InformationRules) and rules.prefixes:
139
+ self._write_prefixes_sheet(workbook, rules.prefixes)
140
+
136
141
  if self._styling_level > 0:
137
142
  self._adjust_column_widths(workbook)
138
143
 
@@ -209,6 +214,16 @@ class ExcelExporter(BaseExporter[VerifiedRules, Workbook]):
209
214
  for cell in metadata_sheet["A"]:
210
215
  cell.font = Font(bold=True, size=12)
211
216
 
217
+ def _write_prefixes_sheet(self, workbook: Workbook, prefixes: dict[str, Namespace]) -> None:
218
+ metadata_sheet = workbook.create_sheet("Prefixes")
219
+ metadata_sheet.append(["Prefix", "Namespace"])
220
+ for key, value in prefixes.items():
221
+ metadata_sheet.append([key, value])
222
+
223
+ if self._styling_level > 1:
224
+ for cell in metadata_sheet["A"]:
225
+ cell.font = Font(bold=True, size=12)
226
+
212
227
  @classmethod
213
228
  def _get_item_class(cls, annotation: GenericAlias) -> type[SheetRow]:
214
229
  if not isinstance(annotation, GenericAlias):
@@ -1,8 +1,7 @@
1
- import getpass
2
1
  import warnings
3
2
  from abc import ABC, abstractmethod
4
3
  from collections.abc import Iterator
5
- from contextlib import contextmanager
4
+ from contextlib import contextmanager, suppress
6
5
  from datetime import datetime
7
6
  from typing import Any, Generic, Literal
8
7
 
@@ -25,6 +24,12 @@ class BaseImporter(ABC, Generic[T_InputRules]):
25
24
  raise NotImplementedError()
26
25
 
27
26
  def _default_metadata(self) -> dict[str, Any]:
27
+ creator = "UNKNOWN"
28
+ with suppress(KeyError, ImportError):
29
+ import getpass
30
+
31
+ creator = getpass.getuser()
32
+
28
33
  return {
29
34
  "prefix": "neat",
30
35
  "schema": "partial",
@@ -33,7 +38,7 @@ class BaseImporter(ABC, Generic[T_InputRules]):
33
38
  "title": "Neat Imported Data Model",
34
39
  "created": datetime.now().replace(microsecond=0).isoformat(),
35
40
  "updated": datetime.now().replace(microsecond=0).isoformat(),
36
- "creator": getpass.getuser(),
41
+ "creator": creator,
37
42
  "description": f"Imported using {type(self).__name__}",
38
43
  }
39
44
 
@@ -11,6 +11,7 @@ from typing import Literal, cast
11
11
  import pandas as pd
12
12
  from cognite.client.utils._importing import local_import
13
13
  from pandas import ExcelFile
14
+ from rdflib import Namespace
14
15
 
15
16
  from cognite.neat.issues import IssueList
16
17
  from cognite.neat.issues.errors import (
@@ -19,6 +20,7 @@ from cognite.neat.issues.errors import (
19
20
  FileReadError,
20
21
  PropertyDefinitionDuplicatedError,
21
22
  )
23
+ from cognite.neat.issues.warnings import FileMissingRequiredFieldWarning
22
24
  from cognite.neat.rules._shared import ReadRules, T_InputRules
23
25
  from cognite.neat.rules.models import (
24
26
  INPUT_RULES_BY_ROLE,
@@ -93,6 +95,7 @@ class ReadResult:
93
95
  sheets: dict[str, dict | list]
94
96
  read_info_by_sheet: dict[str, SpreadsheetRead]
95
97
  metadata: MetadataRaw
98
+ prefixes: dict[str, Namespace] | None = None
96
99
 
97
100
  @property
98
101
  def role(self) -> RoleTypes:
@@ -122,6 +125,10 @@ class SpreadsheetReader:
122
125
  def metadata_sheet_name(self) -> str:
123
126
  return f"{self._sheet_prefix}Metadata"
124
127
 
128
+ @property
129
+ def prefixes_sheet_name(self) -> str:
130
+ return "Prefixes"
131
+
125
132
  @property
126
133
  def seen_sheets(self) -> set[str]:
127
134
  if not self._seen_files:
@@ -149,6 +156,14 @@ class SpreadsheetReader:
149
156
  return None
150
157
  sheets["Metadata"] = dict(metadata)
151
158
 
159
+ # Special case for reading prefixes as they are suppose to be read only once
160
+ if (
161
+ self.prefixes_sheet_name in excel_file.sheet_names
162
+ and not self._sheet_prefix
163
+ and (prefixes := self._read_prefixes(excel_file, filepath))
164
+ ):
165
+ sheets["Prefixes"] = prefixes
166
+
152
167
  return ReadResult(sheets, read_info_by_sheet, metadata)
153
168
 
154
169
  def _read_metadata(self, excel_file: ExcelFile, filepath: Path) -> MetadataRaw | None:
@@ -163,6 +178,25 @@ class SpreadsheetReader:
163
178
  return None
164
179
  return metadata
165
180
 
181
+ def _read_prefixes(self, excel_file: ExcelFile, filepath: Path) -> dict[str, Namespace] | None:
182
+ if self.prefixes_sheet_name not in excel_file.sheet_names:
183
+ return None
184
+
185
+ else:
186
+ prefixes = {}
187
+
188
+ for row in read_individual_sheet(excel_file, "Prefixes", expected_headers=["Prefix", "Namespace"]):
189
+ if "Prefix" in row and "Namespace" in row:
190
+ prefixes[row["Prefix"]] = row["Namespace"]
191
+ else:
192
+ if "Prefix" not in row:
193
+ self.issue_list.append(FileMissingRequiredFieldWarning(filepath, "prefixes", "prefix"))
194
+ if "Namespace" not in row:
195
+ self.issue_list.append(FileMissingRequiredFieldWarning(filepath, "prefixes", "namespace"))
196
+ return None
197
+
198
+ return prefixes
199
+
166
200
  def _read_sheets(
167
201
  self, excel_file: ExcelFile, read_role: RoleTypes
168
202
  ) -> tuple[dict[str, dict | list] | None, dict[str, SpreadsheetRead]]:
@@ -66,11 +66,15 @@ class InputRules(Generic[T_BaseRules], ABC):
66
66
  candidate = type_
67
67
  elif isinstance(type_, GenericAlias) and type_.__origin__ is list and is_dataclass(type_.__args__[0]):
68
68
  candidate = type_.__args__[0]
69
+
70
+ # this handles prefixes
71
+ elif isinstance(type_, GenericAlias) and type_.__origin__ is dict:
72
+ candidate = type_
69
73
  else:
70
74
  continue
71
75
 
72
- if hasattr(candidate, "_load"):
73
- output[field_.name] = candidate
76
+ output[field_.name] = candidate
77
+
74
78
  return output
75
79
 
76
80
  @classmethod
@@ -88,10 +92,16 @@ class InputRules(Generic[T_BaseRules], ABC):
88
92
  else:
89
93
  continue
90
94
 
91
- if isinstance(value, dict):
92
- args[field_name] = field_type._load(value) # type: ignore[attr-defined]
93
- elif isinstance(value, list) and value and isinstance(value[0], dict):
94
- args[field_name] = [field_type._load(item) for item in value] # type: ignore[attr-defined]
95
+ # Handles the case where the field is a dataclass
96
+ if hasattr(field_type, "_load"):
97
+ if isinstance(value, dict):
98
+ args[field_name] = field_type._load(value) # type: ignore[attr-defined]
99
+ elif isinstance(value, list) and value and isinstance(value[0], dict):
100
+ args[field_name] = [field_type._load(item) for item in value] # type: ignore[attr-defined]
101
+ # Handles the case where the field holds non-dataclass values, e.g. a prefixes dict
102
+ else:
103
+ args[field_name] = value
104
+
95
105
  return cls(**args)
96
106
 
97
107
  def _dataclass_fields(self) -> list[Field]:
@@ -108,6 +108,14 @@ class SchemaModel(BaseModel):
108
108
  """Returns a set of mandatory fields for the model."""
109
109
  return _get_required_fields(cls, use_alias)
110
110
 
111
+ @field_validator("*", mode="before")
112
+ def strip_string(cls, value: Any) -> Any:
113
+ if isinstance(value, str):
114
+ return value.strip()
115
+ elif isinstance(value, list):
116
+ return [entry.strip() if isinstance(entry, str) else entry for entry in value]
117
+ return value
118
+
111
119
 
112
120
  class BaseMetadata(SchemaModel):
113
121
  """
@@ -279,12 +287,6 @@ class BaseRules(SchemaModel, ABC):
279
287
 
280
288
 
281
289
  class SheetRow(SchemaModel):
282
- @field_validator("*", mode="before")
283
- def strip_string(cls, value: Any) -> Any:
284
- if isinstance(value, str):
285
- return value.strip()
286
- return value
287
-
288
290
  @abstractmethod
289
291
  def _identifier(self) -> tuple[Hashable, ...]:
290
292
  raise NotImplementedError()
@@ -98,15 +98,15 @@ class DMSMetadata(BaseMetadata):
98
98
 
99
99
  @field_validator("schema_", mode="plain")
100
100
  def as_enum_schema(cls, value: str) -> SchemaCompleteness:
101
- return SchemaCompleteness(value)
101
+ return SchemaCompleteness(value.strip())
102
102
 
103
103
  @field_validator("extension", mode="plain")
104
104
  def as_enum_extension(cls, value: str) -> ExtensionCategory:
105
- return ExtensionCategory(value)
105
+ return ExtensionCategory(value.strip())
106
106
 
107
107
  @field_validator("data_model_type", mode="plain")
108
108
  def as_enum_model_type(cls, value: str) -> DataModelType:
109
- return DataModelType(value)
109
+ return DataModelType(value.strip())
110
110
 
111
111
  @field_validator("description", mode="before")
112
112
  def nan_as_none(cls, value):
@@ -17,6 +17,7 @@ from cognite.client.data_classes.data_modeling.ids import (
17
17
  from pydantic import (
18
18
  BaseModel,
19
19
  Field,
20
+ field_validator,
20
21
  model_serializer,
21
22
  model_validator,
22
23
  )
@@ -97,6 +98,14 @@ class Entity(BaseModel, extra="ignore"):
97
98
  def as_str(self) -> str:
98
99
  return str(self)
99
100
 
101
+ @field_validator("*", mode="before")
102
+ def strip_string(cls, value: Any) -> Any:
103
+ if isinstance(value, str):
104
+ return value.strip()
105
+ elif isinstance(value, list):
106
+ return [entry.strip() if isinstance(entry, str) else entry for entry in value]
107
+ return value
108
+
100
109
  @classmethod
101
110
  def _parse(cls, raw: str, defaults: dict) -> dict:
102
111
  if not (result := ENTITY_PATTERN.match(raw)):
@@ -100,15 +100,15 @@ class InformationMetadata(BaseMetadata):
100
100
 
101
101
  @field_validator("schema_", mode="plain")
102
102
  def as_enum_schema(cls, value: str) -> SchemaCompleteness:
103
- return SchemaCompleteness(value)
103
+ return SchemaCompleteness(value.strip())
104
104
 
105
105
  @field_validator("extension", mode="plain")
106
106
  def as_enum_extension(cls, value: str) -> ExtensionCategory:
107
- return ExtensionCategory(value)
107
+ return ExtensionCategory(value.strip())
108
108
 
109
109
  @field_validator("data_model_type", mode="plain")
110
110
  def as_enum_model_type(cls, value: str) -> DataModelType:
111
- return DataModelType(value)
111
+ return DataModelType(value.strip())
112
112
 
113
113
  def as_identifier(self) -> str:
114
114
  return f"{self.prefix}:{self.name}"
@@ -186,9 +186,17 @@ class NeatGraphStore:
186
186
  warnings.warn("Desired type not found in graph!", stacklevel=2)
187
187
  return None
188
188
 
189
- analysis = InformationAnalysis(self.rules)
190
- has_hop_transformations = analysis.has_hop_transformations()
191
- has_self_reference_transformations = analysis.has_self_reference_property_transformations()
189
+ if not (class_uri := InformationAnalysis(self.rules).class_uri(class_entity)):
190
+ warnings.warn(
191
+ f"Class {class_} does not have namespace defined for prefix {class_entity.prefix} Rules!",
192
+ stacklevel=2,
193
+ )
194
+ return None
195
+
196
+ has_hop_transformations = InformationAnalysis(self.rules).has_hop_transformations()
197
+ has_self_reference_transformations = InformationAnalysis(
198
+ self.rules
199
+ ).has_self_reference_property_transformations()
192
200
  if has_hop_transformations or has_self_reference_transformations:
193
201
  msg = (
194
202
  f"Rules contain [{'Hop' if has_hop_transformations else '' }"
@@ -205,12 +213,22 @@ class NeatGraphStore:
205
213
  )
206
214
  return None
207
215
 
208
- instance_ids = self.queries.list_instances_ids_of_class(self.rules.metadata.namespace[class_])
216
+ # get all the instances for give class_uri
217
+ instance_ids = self.queries.list_instances_ids_of_class(class_uri)
209
218
 
219
+ # get potential property renaming config
210
220
  property_renaming_config = InformationAnalysis(self.rules).define_property_renaming_config(class_entity)
211
221
 
222
+ # get property types to guide process of removing or not namespaces from results
223
+ property_types = InformationAnalysis(self.rules).property_types(class_entity)
224
+
212
225
  for instance_id in instance_ids:
213
- if res := self.queries.describe(instance_id, property_renaming_config):
226
+ if res := self.queries.describe(
227
+ instance_id=instance_id,
228
+ instance_type=class_,
229
+ property_renaming_config=property_renaming_config,
230
+ property_types=property_types,
231
+ ):
214
232
  yield res
215
233
 
216
234
  def _parse_file(
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cognite-neat"
3
- version = "0.92.1"
3
+ version = "0.92.3"
4
4
  readme = "README.md"
5
5
  description = "Knowledge graph transformation"
6
6
  authors = [
@@ -1 +0,0 @@
1
- __version__ = "0.92.1"
File without changes
File without changes