cognite-neat 0.81.4__tar.gz → 0.81.6__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 (305) hide show
  1. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/PKG-INFO +1 -1
  2. cognite_neat-0.81.6/cognite/neat/_version.py +1 -0
  3. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_dexpi.py +29 -8
  4. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/stores/_base.py +39 -0
  5. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/stores/_provenance.py +2 -2
  6. cognite_neat-0.81.6/cognite/neat/graph/transformers/__init__.py +5 -0
  7. cognite_neat-0.81.6/cognite/neat/graph/transformers/_base.py +14 -0
  8. cognite_neat-0.81.6/cognite/neat/graph/transformers/_classic_cdf.py +59 -0
  9. cognite_neat-0.81.6/cognite/neat/legacy/graph/extractors/_dexpi.py +49 -0
  10. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_graph2rules.py +5 -2
  11. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/pyproject.toml +1 -1
  12. cognite_neat-0.81.4/cognite/neat/_version.py +0 -1
  13. cognite_neat-0.81.4/cognite/neat/legacy/graph/extractors/_dexpi.py +0 -314
  14. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/LICENSE +0 -0
  15. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/README.md +0 -0
  16. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/__init__.py +0 -0
  17. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/__init__.py +0 -0
  18. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/asgi/metrics.py +0 -0
  19. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/configuration.py +0 -0
  20. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/context_manager/__init__.py +0 -0
  21. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/context_manager/manager.py +0 -0
  22. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/data_classes/__init__.py +0 -0
  23. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/data_classes/rest.py +0 -0
  24. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/explorer.py +0 -0
  25. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/routers/configuration.py +0 -0
  26. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/routers/core.py +0 -0
  27. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/routers/crud.py +0 -0
  28. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/routers/data_exploration.py +0 -0
  29. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/routers/metrics.py +0 -0
  30. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/routers/rules.py +0 -0
  31. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/routers/workflows.py +0 -0
  32. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/utils/__init__.py +0 -0
  33. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/utils/data_mapping.py +0 -0
  34. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/utils/logging.py +0 -0
  35. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/api/utils/query_templates.py +0 -0
  36. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/main.py +0 -0
  37. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/monitoring/__init__.py +0 -0
  38. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/monitoring/metrics.py +0 -0
  39. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/index.html +0 -0
  40. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
  41. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/README.md +0 -0
  42. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
  43. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
  44. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
  45. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
  46. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
  47. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
  48. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
  49. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
  50. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
  51. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css +0 -0
  52. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css.map +0 -0
  53. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js +0 -0
  54. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.LICENSE.txt +0 -0
  55. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.map +0 -0
  56. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
  57. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/config.py +0 -0
  58. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/constants.py +0 -0
  59. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/exceptions.py +0 -0
  60. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/__init__.py +0 -0
  61. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/_shared.py +0 -0
  62. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/_tracking/__init__.py +0 -0
  63. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/_tracking/base.py +0 -0
  64. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/_tracking/log.py +0 -0
  65. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  66. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  67. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/examples/__init__.py +0 -0
  68. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  69. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/exceptions.py +0 -0
  70. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/__init__.py +0 -0
  71. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_base.py +0 -0
  72. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_classic_cdf/__init__.py +0 -0
  73. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_classic_cdf/_assets.py +0 -0
  74. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_classic_cdf/_events.py +0 -0
  75. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_classic_cdf/_files.py +0 -0
  76. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_classic_cdf/_labels.py +0 -0
  77. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_classic_cdf/_relationships.py +0 -0
  78. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_classic_cdf/_sequences.py +0 -0
  79. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_classic_cdf/_timeseries.py +0 -0
  80. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_mock_graph_generator.py +0 -0
  81. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/extractors/_rdf_file.py +0 -0
  82. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/issues/__init__.py +0 -0
  83. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/issues/loader.py +0 -0
  84. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/loaders/__init__.py +0 -0
  85. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/loaders/_base.py +0 -0
  86. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/loaders/_rdf2dms.py +0 -0
  87. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/models.py +0 -0
  88. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/stores/__init__.py +0 -0
  89. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/graph/stores/_oxrdflib.py +0 -0
  90. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/issues.py +0 -0
  91. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/__init__.py +0 -0
  92. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/__init__.py +0 -0
  93. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  94. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  95. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/examples/__init__.py +0 -0
  96. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  97. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/exceptions.py +0 -0
  98. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/extractors/__init__.py +0 -0
  99. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/extractors/_base.py +0 -0
  100. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/extractors/_graph_capturing_sheet.py +0 -0
  101. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +0 -0
  102. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/loaders/__init__.py +0 -0
  103. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/loaders/_asset_loader.py +0 -0
  104. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/loaders/_base.py +0 -0
  105. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/loaders/_exceptions.py +0 -0
  106. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/loaders/core/__init__.py +0 -0
  107. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/loaders/core/labels.py +0 -0
  108. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/loaders/core/models.py +0 -0
  109. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +0 -0
  110. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +0 -0
  111. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/loaders/rdf_to_dms.py +0 -0
  112. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/loaders/validator.py +0 -0
  113. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/models.py +0 -0
  114. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/stores/__init__.py +0 -0
  115. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/stores/_base.py +0 -0
  116. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/stores/_graphdb_store.py +0 -0
  117. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/stores/_memory_store.py +0 -0
  118. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/stores/_oxigraph_store.py +0 -0
  119. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/stores/_oxrdflib.py +0 -0
  120. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/stores/_rdf_to_graph.py +0 -0
  121. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/transformations/__init__.py +0 -0
  122. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/transformations/entity_matcher.py +0 -0
  123. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/transformations/query_generator/__init__.py +0 -0
  124. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/transformations/query_generator/sparql.py +0 -0
  125. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/graph/transformations/transformer.py +0 -0
  126. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/__init__.py +0 -0
  127. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/analysis.py +0 -0
  128. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-TNT.xlsx +0 -0
  129. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
  130. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/examples/__init__.py +0 -0
  131. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/examples/power-grid-containers.yaml +0 -0
  132. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/examples/power-grid-example.xlsx +0 -0
  133. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/examples/power-grid-model.yaml +0 -0
  134. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/examples/rules-template.xlsx +0 -0
  135. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
  136. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/examples/skos-rules.xlsx +0 -0
  137. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
  138. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/examples/wind-energy.owl +0 -0
  139. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exceptions.py +0 -0
  140. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/__init__.py +0 -0
  141. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/_base.py +0 -0
  142. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/_core/__init__.py +0 -0
  143. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/_core/rules2labels.py +0 -0
  144. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/_rules2dms.py +0 -0
  145. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/_rules2excel.py +0 -0
  146. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/_rules2graphql.py +0 -0
  147. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/_rules2ontology.py +0 -0
  148. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/_rules2pydantic_models.py +0 -0
  149. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/_rules2rules.py +0 -0
  150. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/_rules2triples.py +0 -0
  151. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/exporters/_validation.py +0 -0
  152. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/__init__.py +0 -0
  153. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_base.py +0 -0
  154. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_dict2rules.py +0 -0
  155. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_dms2rules.py +0 -0
  156. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_json2rules.py +0 -0
  157. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_owl2rules/__init__.py +0 -0
  158. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2classes.py +0 -0
  159. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2metadata.py +0 -0
  160. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2properties.py +0 -0
  161. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2rules.py +0 -0
  162. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_spreadsheet2rules.py +0 -0
  163. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_xsd2rules.py +0 -0
  164. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/importers/_yaml2rules.py +0 -0
  165. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/models/__init__.py +0 -0
  166. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/models/_base.py +0 -0
  167. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/models/raw_rules.py +0 -0
  168. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/models/rdfpath.py +0 -0
  169. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/models/rules.py +0 -0
  170. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/models/tables.py +0 -0
  171. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/rules/models/value_types.py +0 -0
  172. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +0 -0
  173. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
  174. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
  175. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
  176. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +0 -0
  177. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
  178. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +0 -0
  179. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  180. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
  181. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
  182. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/py.typed +0 -0
  183. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/__init__.py +0 -0
  184. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/_shared.py +0 -0
  185. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/analysis/__init__.py +0 -0
  186. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/analysis/_base.py +0 -0
  187. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/analysis/_information_rules.py +0 -0
  188. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/examples/__init__.py +0 -0
  189. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/examples/wind-energy.owl +0 -0
  190. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/exceptions.py +0 -0
  191. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/exporters/__init__.py +0 -0
  192. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/exporters/_base.py +0 -0
  193. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/exporters/_rules2dms.py +0 -0
  194. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/exporters/_rules2excel.py +0 -0
  195. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/exporters/_rules2ontology.py +0 -0
  196. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
  197. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/exporters/_validation.py +0 -0
  198. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/__init__.py +0 -0
  199. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_base.py +0 -0
  200. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_dms2rules.py +0 -0
  201. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
  202. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
  203. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
  204. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
  205. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
  206. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_inference2rules.py +0 -0
  207. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_owl2rules/__init__.py +0 -0
  208. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_owl2rules/_owl2classes.py +0 -0
  209. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +0 -0
  210. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_owl2rules/_owl2properties.py +0 -0
  211. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_owl2rules/_owl2rules.py +0 -0
  212. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_spreadsheet2rules.py +0 -0
  213. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/importers/_yaml2rules.py +0 -0
  214. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/issues/__init__.py +0 -0
  215. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/issues/base.py +0 -0
  216. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/issues/dms.py +0 -0
  217. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/issues/fileread.py +0 -0
  218. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/issues/formatters.py +0 -0
  219. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/issues/importing.py +0 -0
  220. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/issues/spreadsheet.py +0 -0
  221. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/issues/spreadsheet_file.py +0 -0
  222. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/__init__.py +0 -0
  223. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/_base.py +0 -0
  224. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/_constants.py +0 -0
  225. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/_rdfpath.py +0 -0
  226. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/_types/__init__.py +0 -0
  227. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/_types/_base.py +0 -0
  228. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/_types/_field.py +0 -0
  229. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/data_types.py +0 -0
  230. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/dms/__init__.py +0 -0
  231. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/dms/_converter.py +0 -0
  232. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/dms/_exporter.py +0 -0
  233. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/dms/_rules.py +0 -0
  234. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/dms/_rules_input.py +0 -0
  235. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/dms/_schema.py +0 -0
  236. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/dms/_serializer.py +0 -0
  237. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/dms/_validation.py +0 -0
  238. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/domain.py +0 -0
  239. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/entities.py +0 -0
  240. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/information/__init__.py +0 -0
  241. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/information/_converter.py +0 -0
  242. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/information/_rules.py +0 -0
  243. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/information/_rules_input.py +0 -0
  244. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/information/_serializer.py +0 -0
  245. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/information/_validation.py +0 -0
  246. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/rules/models/wrapped_entities.py +0 -0
  247. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/__init__.py +0 -0
  248. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/auxiliary.py +0 -0
  249. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/cdf.py +0 -0
  250. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/cdf_classes.py +0 -0
  251. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/cdf_loaders/__init__.py +0 -0
  252. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/cdf_loaders/_base.py +0 -0
  253. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/cdf_loaders/_data_modeling.py +0 -0
  254. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/cdf_loaders/_ingestion.py +0 -0
  255. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/cdf_loaders/data_classes.py +0 -0
  256. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/exceptions.py +0 -0
  257. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/spreadsheet.py +0 -0
  258. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/text.py +0 -0
  259. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/upload.py +0 -0
  260. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/utils.py +0 -0
  261. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/utils/xml.py +0 -0
  262. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/__init__.py +0 -0
  263. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/_exceptions.py +0 -0
  264. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/base.py +0 -0
  265. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/cdf_store.py +0 -0
  266. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
  267. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
  268. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
  269. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
  270. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
  271. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
  272. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
  273. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  274. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
  275. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
  276. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/manager.py +0 -0
  277. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/migration/__init__.py +0 -0
  278. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/migration/steps.py +0 -0
  279. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/migration/wf_manifests.py +0 -0
  280. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/model.py +0 -0
  281. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/__init__.py +0 -0
  282. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/data_contracts.py +0 -0
  283. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/__init__.py +0 -0
  284. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
  285. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
  286. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
  287. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
  288. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +0 -0
  289. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/current/rules_importer.py +0 -0
  290. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
  291. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
  292. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
  293. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/legacy/__init__.py +0 -0
  294. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/legacy/graph_contextualization.py +0 -0
  295. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/legacy/graph_extractor.py +0 -0
  296. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/legacy/graph_loader.py +0 -0
  297. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/legacy/graph_store.py +0 -0
  298. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/legacy/graph_transformer.py +0 -0
  299. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/legacy/rules_exporter.py +0 -0
  300. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/lib/legacy/rules_importer.py +0 -0
  301. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps/step_model.py +0 -0
  302. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/steps_registry.py +0 -0
  303. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/tasks.py +0 -0
  304. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/cognite/neat/workflows/triggers.py +0 -0
  305. {cognite_neat-0.81.4 → cognite_neat-0.81.6}/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.81.4
3
+ Version: 0.81.6
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.81.6"
@@ -13,6 +13,7 @@ from cognite.neat.utils.utils import as_neat_compliant_uri
13
13
  from cognite.neat.utils.xml import get_children, iterate_tree
14
14
 
15
15
  DEXPI = Namespace("http://sandbox.dexpi.org/rdl/")
16
+ QUDT = Namespace("https://qudt.org/vocab/unit/")
16
17
 
17
18
 
18
19
  class DexpiExtractor(BaseExtractor):
@@ -130,6 +131,11 @@ class DexpiExtractor(BaseExtractor):
130
131
  """Converts an XML element to triples."""
131
132
  triples: list[Triple] = []
132
133
 
134
+ # setting these to None this is the order of getting the type
135
+ component_class: str | None = None
136
+ component_name: str | None = None
137
+ tag: str | None = None
138
+
133
139
  # adding tag triple if exists
134
140
  if tag := element.tag:
135
141
  triples.append((id_, DEXPI.tag, Literal(str(tag))))
@@ -140,8 +146,16 @@ class DexpiExtractor(BaseExtractor):
140
146
  triples.append((id_, DEXPI.ComponentClass, Literal(component_class)))
141
147
  if component_name := attributes.get("ComponentName", None):
142
148
  triples.append((id_, DEXPI.ComponentName, Literal(component_name)))
143
- if type_ := attributes.get("ComponentClassURI", None):
144
- triples.append((id_, RDF.type, URIRef(type_)))
149
+ if component_class_uri := attributes.get("ComponentClassURI", None):
150
+ triples.append((id_, DEXPI.ComponentClassURI, URIRef(component_class_uri)))
151
+
152
+ triples.append(
153
+ (
154
+ id_,
155
+ RDF.type,
156
+ as_neat_compliant_uri(DEFAULT_NAMESPACE[component_class or component_name or tag or "Unknown"]),
157
+ )
158
+ )
145
159
 
146
160
  # add label triple
147
161
  if label := cls._get_element_label(element):
@@ -158,10 +172,17 @@ class DexpiExtractor(BaseExtractor):
158
172
  return triples
159
173
 
160
174
  @classmethod
161
- def _value_definition2literal(cls, definition: dict) -> Literal | None:
175
+ def _value_definition2literal(cls, definition: dict, make_unit_datatype: bool = False) -> Literal | None:
162
176
  if "Value" not in definition or "Format" not in definition:
163
177
  return None
164
178
 
179
+ if "Units" in definition and "Value" in definition:
180
+ if make_unit_datatype and "UnitsURI" in definition:
181
+ return Literal(definition["Value"], datatype=URIRef(definition["UnitsURI"]))
182
+
183
+ else:
184
+ return Literal(definition["Value"], datatype=XSD.float)
185
+
165
186
  # case: when language is present we create add language tag to the literal
166
187
  elif "Language" in definition and "Value" in definition:
167
188
  return Literal(definition["Value"], lang=definition["Language"])
@@ -202,11 +223,11 @@ class DexpiExtractor(BaseExtractor):
202
223
  if grandchildren := get_children(children[0], "GenericAttribute"):
203
224
  for generic_attribute in grandchildren:
204
225
  # extension for schema version 3.3, where "AttributeURI" is not included
205
- if "AttributeURI" in generic_attribute.attrib:
206
- if generic_attribute.attrib["AttributeURI"] not in attributes:
207
- attributes[generic_attribute.attrib["AttributeURI"]] = [generic_attribute.attrib]
208
-
226
+ if name := generic_attribute.attrib.get("Name", None):
227
+ attribute_uri = as_neat_compliant_uri(DEFAULT_NAMESPACE[name])
228
+ if attribute_uri not in attributes:
229
+ attributes[attribute_uri] = [generic_attribute.attrib]
209
230
  else:
210
- attributes[generic_attribute.attrib["AttributeURI"]].append(generic_attribute.attrib)
231
+ attributes[attribute_uri].append(generic_attribute.attrib)
211
232
 
212
233
  return attributes
@@ -9,9 +9,11 @@ from rdflib import RDF, Graph, Namespace, URIRef
9
9
  from rdflib.plugins.stores.sparqlstore import SPARQLUpdateStore
10
10
  from rdflib.query import ResultRow
11
11
 
12
+ from cognite.neat.constants import DEFAULT_NAMESPACE
12
13
  from cognite.neat.graph._shared import MIMETypes
13
14
  from cognite.neat.graph.extractors import RdfFileExtractor, TripleExtractors
14
15
  from cognite.neat.graph.models import Triple
16
+ from cognite.neat.graph.transformers import Transformers
15
17
  from cognite.neat.rules.models.information import InformationRules
16
18
  from cognite.neat.utils import remove_namespace
17
19
  from cognite.neat.utils.auxiliary import local_import
@@ -56,6 +58,9 @@ class NeatGraphStore:
56
58
 
57
59
  if self.rules and self.rules.prefixes:
58
60
  self._upsert_prefixes(self.rules.prefixes)
61
+ self.base_namespace = self.rules.metadata.namespace
62
+ else:
63
+ self.base_namespace = DEFAULT_NAMESPACE
59
64
 
60
65
  self.queries = _Queries(self)
61
66
 
@@ -206,6 +211,40 @@ class NeatGraphStore:
206
211
 
207
212
  check_commit(force_commit=True)
208
213
 
214
+ def transform(self, transformer: Transformers) -> None:
215
+ """Transforms the graph store using a transformer."""
216
+
217
+ missing_changes = [
218
+ change for change in transformer._need_changes if not self.provenance.activity_took_place(change)
219
+ ]
220
+ if self.provenance.activity_took_place(type(transformer).__name__) and transformer._use_only_once:
221
+ warnings.warn(
222
+ f"Cannot transform graph store with {type(transformer).__name__}, already applied",
223
+ stacklevel=2,
224
+ )
225
+ elif missing_changes:
226
+ warnings.warn(
227
+ (
228
+ f"Cannot transform graph store with {type(transformer).__name__}, "
229
+ f"missing one or more required changes [{', '.join(missing_changes)}]"
230
+ ),
231
+ stacklevel=2,
232
+ )
233
+
234
+ else:
235
+ _start = datetime.now(timezone.utc)
236
+ transformer.transform(self.graph)
237
+ self.provenance = Provenance(
238
+ [
239
+ Change.record(
240
+ activity=f"{type(transformer).__name__}",
241
+ start=_start,
242
+ end=datetime.now(timezone.utc),
243
+ description=transformer.description,
244
+ )
245
+ ]
246
+ )
247
+
209
248
 
210
249
  class _Queries:
211
250
  """Helper class for storing standard queries for the graph store."""
@@ -89,8 +89,8 @@ class Provenance(UserList[T_Change]):
89
89
  def __init__(self, changes: Sequence[T_Change] | None = None):
90
90
  super().__init__(changes or [])
91
91
 
92
- def did_this_happen(self, this: str) -> bool:
93
- return any(change.description == this for change in self)
92
+ def activity_took_place(self, activity: str) -> bool:
93
+ return any(change.activity.used == activity for change in self)
94
94
 
95
95
  def __delitem__(self, *args, **kwargs):
96
96
  raise TypeError("Cannot delete change from provenance")
@@ -0,0 +1,5 @@
1
+ from ._classic_cdf import AddAssetDepth
2
+
3
+ __all__ = ["AddAssetDepth"]
4
+
5
+ Transformers = AddAssetDepth
@@ -0,0 +1,14 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import ClassVar
3
+
4
+ from rdflib import Graph
5
+
6
+
7
+ class BaseTransformer(ABC):
8
+ description: str
9
+ _use_only_once: bool
10
+ _need_changes: ClassVar[frozenset[str]] = frozenset()
11
+
12
+ @abstractmethod
13
+ def transform(self, graph: Graph) -> None:
14
+ raise NotImplementedError()
@@ -0,0 +1,59 @@
1
+ from typing import cast
2
+
3
+ from rdflib import Graph, Literal, URIRef
4
+
5
+ from cognite.neat.constants import DEFAULT_NAMESPACE
6
+ from cognite.neat.graph.extractors import AssetsExtractor
7
+
8
+ from ._base import BaseTransformer
9
+
10
+
11
+ class AddAssetDepth(BaseTransformer):
12
+ description: str = "Adds depth of asset in the asset hierarchy to the graph"
13
+ _use_only_once: bool = True
14
+ _need_changes = frozenset({str(AssetsExtractor.__name__)})
15
+
16
+ _parent_template: str = """SELECT ?child ?parent WHERE {{
17
+ <{asset_id}> <{parent_prop}> ?child .
18
+ OPTIONAL{{?child <{parent_prop}>+ ?parent .}}}}"""
19
+
20
+ _root_template: str = """SELECT ?root WHERE {{
21
+ <{asset_id}> <{root_prop}> ?root .}}"""
22
+
23
+ def __init__(
24
+ self, asset_type: URIRef | None = None, root_prop: URIRef | None = None, parent_prop: URIRef | None = None
25
+ ):
26
+ self.asset_type = asset_type or DEFAULT_NAMESPACE.Asset
27
+ self.root_prop = root_prop or DEFAULT_NAMESPACE.root
28
+ self.parent_prop = parent_prop or DEFAULT_NAMESPACE.parent
29
+
30
+ def transform(self, graph: Graph) -> None:
31
+ """Adds depth of asset in the asset hierarchy to the graph."""
32
+ for result in graph.query(f"SELECT DISTINCT ?asset_id WHERE {{?asset_id a <{self.asset_type}>}}"):
33
+ asset_id = cast(tuple, result)[0]
34
+ if depth := self.get_depth(graph, asset_id, self.root_prop, self.parent_prop):
35
+ graph.add((asset_id, DEFAULT_NAMESPACE.depth, Literal(depth)))
36
+
37
+ @classmethod
38
+ def get_depth(
39
+ cls,
40
+ graph: Graph,
41
+ asset_id: URIRef,
42
+ root_prop: URIRef,
43
+ parent_prop: URIRef,
44
+ ) -> int | None:
45
+ """Get asset depth in the asset hierarchy."""
46
+
47
+ # Handles non-root assets
48
+ if res := list(graph.query(cls._parent_template.format(asset_id=asset_id, parent_prop=parent_prop))):
49
+ return len(cast(list[tuple], res)) + 2 if cast(list[tuple], res)[0][1] else 2
50
+
51
+ # Handles root assets
52
+ elif (
53
+ (res := list(graph.query(cls._root_template.format(asset_id=asset_id, root_prop=root_prop))))
54
+ and len(cast(list[tuple], res)) == 1
55
+ and cast(list[tuple], res)[0][0] == asset_id
56
+ ):
57
+ return 1
58
+ else:
59
+ return None
@@ -0,0 +1,49 @@
1
+ import xml.etree.ElementTree as ET
2
+ from pathlib import Path
3
+
4
+ from rdflib import Namespace
5
+
6
+ from cognite.neat.constants import PREFIXES
7
+ from cognite.neat.graph.extractors._dexpi import DexpiExtractor
8
+ from cognite.neat.legacy.graph.models import Triple
9
+
10
+ from ._base import BaseExtractor
11
+
12
+ _DEXPI_PREFIXES = {
13
+ "dexpi": Namespace("http://sandbox.dexpi.org/rdl/"),
14
+ "posccaesar": Namespace("http://data.posccaesar.org/rdl/"),
15
+ }
16
+
17
+
18
+ class DexpiXML(BaseExtractor):
19
+ """
20
+ DEXPI-XML extractor of RDF triples
21
+
22
+ Args:
23
+ filepath: File path to DEXPI XML file.
24
+ namespace: Optional custom namespace to use for extracted triples that define data
25
+ model instances. Defaults to http://purl.org/cognite/neat/.
26
+ """
27
+
28
+ def __init__(
29
+ self,
30
+ filepath: Path | str,
31
+ base_namespace: str | None = None,
32
+ ):
33
+ self.filepath = Path(filepath)
34
+ self.namespace = Namespace(base_namespace) if isinstance(base_namespace, str | Namespace) else PREFIXES["neat"]
35
+
36
+ def extract(self) -> set[Triple]:
37
+ """
38
+ Extracts RDF triples from the graph capturing sheet.
39
+
40
+ Returns:
41
+ List of RDF triples, represented as tuples `(subject, predicate, object)`, that define data model instances
42
+ """
43
+ if self.filepath is None:
44
+ raise ValueError("File path to the graph capturing sheet is not provided!")
45
+
46
+ root = ET.parse(self.filepath).getroot()
47
+
48
+ # removing legacy code by reusing the maintained version of DexpiExtractor
49
+ return set(DexpiExtractor(root, self.namespace).extract())
@@ -134,14 +134,17 @@ def _parse_properties_df(data_model: dict, prefixes: dict, parsing_config: dict
134
134
  for property_ in data_model[class_]["properties"]:
135
135
  for type_ in data_model[class_]["properties"][property_]["value_type"]:
136
136
  sanitized_property = to_dms_name(property_, "property")
137
+
138
+ max_count = max(data_model[class_]["properties"][property_]["occurrence"])
139
+
137
140
  property_rows.append(
138
141
  [
139
142
  sanitized_class,
140
143
  sanitized_property,
141
144
  None,
142
- type_,
145
+ to_dms_name(type_, "value-type"),
143
146
  0, # setting min count to 0 to be more flexible (all properties are optional)
144
- max(data_model[class_]["properties"][property_]["occurrence"]),
147
+ None if max_count > 1 else 1,
145
148
  "rdfpath",
146
149
  f'{data_model[class_]["uri"]}({data_model[class_]["properties"][property_]["uri"]})',
147
150
  str(prefixes[data_model[class_]["properties"][property_]["uri"].split(":")[0]]) + property_,
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cognite-neat"
3
- version = "0.81.4"
3
+ version = "0.81.6"
4
4
  readme = "README.md"
5
5
  description = "Knowledge graph transformation"
6
6
  authors = [
@@ -1 +0,0 @@
1
- __version__ = "0.81.4"
@@ -1,314 +0,0 @@
1
- import re
2
- import xml.etree.ElementTree as ET
3
- from pathlib import Path
4
- from xml.etree.ElementTree import Element
5
-
6
- from rdflib import OWL, RDF, RDFS, SKOS, XSD, Literal, Namespace, URIRef
7
-
8
- from cognite.neat.constants import PREFIXES
9
- from cognite.neat.legacy.graph.models import Triple
10
- from cognite.neat.legacy.rules.models._base import ALLOWED_PATTERN
11
- from cognite.neat.utils.utils import get_namespace, remove_namespace
12
- from cognite.neat.utils.xml import get_children, iterate_tree
13
-
14
- from ._base import BaseExtractor
15
-
16
- _DEXPI_PREFIXES = {
17
- "dexpi": Namespace("http://sandbox.dexpi.org/rdl/"),
18
- "posccaesar": Namespace("http://data.posccaesar.org/rdl/"),
19
- }
20
-
21
-
22
- class DexpiXML(BaseExtractor):
23
- """
24
- DEXPI-XML extractor of RDF triples
25
-
26
- Args:
27
- filepath: File path to DEXPI XML file.
28
- namespace: Optional custom namespace to use for extracted triples that define data
29
- model instances. Defaults to http://purl.org/cognite/neat/.
30
- """
31
-
32
- def __init__(
33
- self,
34
- filepath: Path | str,
35
- base_namespace: str | None = None,
36
- ):
37
- self.filepath = Path(filepath)
38
- self.namespace = Namespace(base_namespace) if isinstance(base_namespace, str | Namespace) else PREFIXES["neat"]
39
-
40
- def extract(self) -> set[Triple]:
41
- """
42
- Extracts RDF triples from the graph capturing sheet.
43
-
44
- Returns:
45
- List of RDF triples, represented as tuples `(subject, predicate, object)`, that define data model instances
46
- """
47
- if self.filepath is None:
48
- raise ValueError("File path to the graph capturing sheet is not provided!")
49
-
50
- root = ET.parse(self.filepath).getroot()
51
-
52
- nodes, edges = _extract_nodes_and_edges(root)
53
-
54
- self.nodes = nodes
55
-
56
- return _to_triples(nodes, edges, base_namespace=self.namespace)
57
-
58
-
59
- def _extract_nodes_and_edges(root: Element) -> tuple[dict, dict]:
60
- """Extract nodes and edges from an XML tree.
61
-
62
- Args:
63
- root: XML tree to extract nodes and edges from.
64
-
65
- Returns:
66
- Tuple of nodes and edges.
67
- """
68
- nodes: dict = {}
69
- edges: dict = {"associations": set(), "connections": set(), "children": set()}
70
-
71
- for element in iterate_tree(root):
72
- if (
73
- "ComponentClass" in element.attrib
74
- and element.attrib["ComponentClass"] != "Label"
75
- and "ID" in element.attrib
76
- ):
77
- id_ = element.attrib["ID"]
78
-
79
- # add header that contains things such as type
80
- nodes[id_] = {"header": element.attrib, "attributes": {}}
81
- nodes[id_]["header"]["tag"] = str(element.tag)
82
-
83
- # add human readable label of node (if exists)
84
- nodes = _add_node_label(id_, nodes, element)
85
-
86
- # add generic attributes of node
87
- nodes = _add_node_generic_attributes(id_, nodes, element)
88
-
89
- # edges scenario: <Connection> tag
90
- edges = _add_connection_edge(edges, element)
91
-
92
- # edges scenario: <Association> tag
93
- edges = _add_association_edge(id_, edges, element)
94
-
95
- # edge scenario: children elements of the element
96
- edges = _add_child_edge(id_, edges, element)
97
-
98
- return nodes, edges
99
-
100
-
101
- def _add_node_label(id_: str, nodes: dict, element: Element) -> dict:
102
- if children := get_children(element, "Label", 1):
103
- if grandchildren := get_children(children[0], "Text", 1):
104
- if "String" in grandchildren[0].attrib:
105
- nodes[id_]["header"]["label"] = grandchildren[0].attrib["String"]
106
- # extension for schema version 3.3, where text is used to "label" without a <label> parent
107
- elif children := get_children(element, "Text", 1):
108
- if "String" in children[0].attrib:
109
- nodes[id_]["header"]["label"] = children[0].attrib["String"]
110
-
111
- return nodes
112
-
113
-
114
- def _add_node_generic_attributes(id_: str, nodes: dict, element: Element) -> dict:
115
- if children := get_children(element, "GenericAttributes", 1):
116
- if grandchildren := get_children(children[0], "GenericAttribute"):
117
- for generic_attribute in grandchildren:
118
- # extension for schema version 3.3, where "AttributeURI" is not included
119
- if "AttributeURI" in generic_attribute.attrib:
120
- if generic_attribute.attrib["AttributeURI"] not in nodes[id_]:
121
- nodes[id_]["attributes"][generic_attribute.attrib["AttributeURI"]] = [generic_attribute.attrib]
122
- else:
123
- nodes[id_]["attributes"][generic_attribute.attrib["AttributeURI"]].append(
124
- generic_attribute.attrib
125
- )
126
-
127
- return nodes
128
-
129
-
130
- def _add_connection_edge(edges: dict, element: Element) -> dict:
131
- if "connections" not in edges:
132
- edges["connections"] = set()
133
-
134
- if connections := get_children(element, "Connection"):
135
- for connection in connections:
136
- if "FromID" in connection.attrib and "ToID" in connection.attrib:
137
- edges["connections"].add((connection.attrib["FromID"], "connection", connection.attrib["ToID"]))
138
-
139
- return edges
140
-
141
-
142
- def _add_association_edge(id_: str, edges: dict, element: Element) -> dict:
143
- if "associations" not in edges:
144
- edges["associations"] = set()
145
-
146
- if associations := get_children(element, "Association"):
147
- for association in associations:
148
- if "Type" in association.attrib and "ItemID" in association.attrib:
149
- association_type = "".join(
150
- [
151
- word.capitalize() if i != 0 else word
152
- for i, word in enumerate(association.attrib["Type"].split(" "))
153
- ]
154
- )
155
- edges["associations"].add((id_, f"{association_type}", association.attrib["ItemID"]))
156
-
157
- return edges
158
-
159
-
160
- def _add_child_edge(id_: str, edges: dict, element: Element) -> dict:
161
- if "children" not in edges:
162
- edges["children"] = set()
163
-
164
- for child in element:
165
- if "ID" in child.attrib and child.tag != "Label":
166
- edges["children"].add((id_, child.tag, child.attrib["ID"]))
167
-
168
- return edges
169
-
170
-
171
- def _to_triples(nodes: dict, edges: dict, base_namespace: Namespace) -> set[Triple]:
172
- """Convert nodes and edges to subject-predicate-object triples.
173
-
174
- Args:
175
- nodes: Nodes to convert to triples.
176
- edges: Edges to convert to triples.
177
-
178
- Returns:
179
- List of triples.
180
- """
181
- triples: set[Triple] = set()
182
-
183
- # Adding nodes and nodes attributes
184
- for id_, node in nodes.items():
185
- uri = URIRef(base_namespace + id_)
186
-
187
- # add header attribute triples
188
- triples = _add_header_triples(uri, triples, node["header"], "ComponentClassURI", RDF.type)
189
- triples = _add_header_triples(uri, triples, node["header"], "label", RDFS.label)
190
- triples = _add_header_triples(uri, triples, node["header"], "tag")
191
- triples = _add_header_triples(uri, triples, node["header"], "ComponentClass")
192
- triples = _add_header_triples(uri, triples, node["header"], "ComponentName")
193
-
194
- # add generic attribute triples
195
- for attribute, values in node["attributes"].items():
196
- attribute_uri, triples = _to_compliant_attribute_uri(URIRef(attribute), triples)
197
-
198
- for value in values:
199
- triples = _add_attribute_triples(uri, triples, attribute_uri, value)
200
-
201
- # Adding Edges
202
- triples = _add_edge_triples(edges["connections"], triples, "connections", base_namespace)
203
- triples = _add_edge_triples(edges["associations"], triples, "associations", base_namespace)
204
- triples = _add_edge_triples(edges["children"], triples, "children", base_namespace)
205
-
206
- return triples
207
-
208
-
209
- def _add_edge_triples(
210
- edges: set[tuple[str, str, str]], triples: set[Triple], edge_type: str, base_namespace: Namespace
211
- ) -> set[Triple]:
212
- """Convert edges to subject-predicate-object triples.
213
-
214
- Args:
215
- edges: Edges to convert to triples.
216
-
217
- Returns:
218
- List of triples.
219
- """
220
-
221
- for subject, predicate, object in edges:
222
- if edge_type != "connections":
223
- predicate_uri = _DEXPI_PREFIXES["dexpi"][f"{edge_type}/{predicate}"]
224
- else:
225
- predicate_uri = _DEXPI_PREFIXES["dexpi"][predicate]
226
-
227
- triples.add((URIRef(base_namespace + subject), predicate_uri, URIRef(base_namespace + object)))
228
-
229
- return triples
230
-
231
-
232
- def _add_header_triples(
233
- uri: URIRef, triples: set[Triple], attributes: dict, attribute: str, attribute_uri: URIRef | None = None
234
- ) -> set[Triple]:
235
- if attribute not in attributes:
236
- return triples
237
-
238
- attribute_uri = attribute_uri or _DEXPI_PREFIXES["dexpi"][attribute]
239
-
240
- if attribute in attributes and attribute_uri == RDF.type:
241
- triples.add((uri, attribute_uri, URIRef(attributes[attribute])))
242
- else:
243
- triples.add((uri, attribute_uri, Literal(attributes[attribute])))
244
-
245
- return triples
246
-
247
-
248
- def _to_compliant_attribute_uri(attribute_uri: URIRef, triples: set[Triple]) -> tuple[URIRef, set[Triple]]:
249
- namespace = get_namespace(attribute_uri)
250
- id_ = remove_namespace(attribute_uri)
251
- compliant_id = re.sub(ALLOWED_PATTERN, "", id_)
252
- compliant_attribute_uri = URIRef(f"{namespace}{compliant_id}")
253
-
254
- if attribute_uri != compliant_attribute_uri:
255
- triples.add(
256
- (
257
- compliant_attribute_uri,
258
- SKOS.exactMatch,
259
- attribute_uri,
260
- )
261
- )
262
- triples.add(
263
- (
264
- compliant_attribute_uri,
265
- RDFS.comment,
266
- Literal("Modified property URI to be compliant with NEAT internal representation"),
267
- )
268
- )
269
-
270
- return compliant_attribute_uri, triples
271
-
272
-
273
- def _add_attribute_triples(uri: URIRef, triples: set[Triple], attribute_uri, value: dict) -> set[Triple]:
274
- # case: when Value or Format is not present we skip the attribute since it is not formatted correctly
275
- if "Value" not in value or "Format" not in value:
276
- return triples
277
-
278
- # case: when unit is present we create a special datatype for it
279
- if "Units" in value:
280
- triples.update(_generate_datatype_triples(_DEXPI_PREFIXES["dexpi"], value))
281
- triples.add(
282
- (
283
- uri,
284
- attribute_uri,
285
- Literal(value["Value"], datatype=_DEXPI_PREFIXES["dexpi"][value["Units"]]),
286
- )
287
- )
288
-
289
- # case: when language is present we create add language tag to the literal
290
- elif "Language" in value and "Value" in value:
291
- triples.add((uri, attribute_uri, Literal(value["Value"], lang=value["Language"])))
292
-
293
- # case: when ValueURI is present we use it instead of Value
294
- elif "ValueURI" in value:
295
- triples.add((uri, attribute_uri, Literal(value["ValueURI"], datatype=XSD[value["Format"]])))
296
-
297
- # case: when Format is not string we make sure to add the datatype
298
- elif value["Format"].lower() != "string":
299
- triples.add((uri, attribute_uri, Literal(value["Value"], datatype=XSD[value["Format"]])))
300
-
301
- # case: when Format is string we add the literal without datatype (easier to read triples, less noise)
302
- else:
303
- triples.add((uri, attribute_uri, Literal(value["Value"])))
304
-
305
- return triples
306
-
307
-
308
- def _generate_datatype_triples(base_namespace: Namespace, unit_definition: dict) -> set[Triple]:
309
- return {
310
- (base_namespace[unit_definition["Units"]], RDF.type, RDFS.Datatype),
311
- (base_namespace[unit_definition["Units"]], RDFS.label, Literal(unit_definition["Units"])),
312
- (base_namespace[unit_definition["Units"]], OWL.equivalentClass, XSD[unit_definition["Format"]]),
313
- (base_namespace[unit_definition["Units"]], SKOS.exactMatch, URIRef(unit_definition["UnitsURI"])),
314
- }
File without changes
File without changes