cognite-neat 0.108.0__tar.gz → 0.109.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/PKG-INFO +1 -1
  2. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_constants.py +1 -1
  3. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_classic_cdf/_classic.py +8 -4
  4. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/queries/_base.py +4 -0
  5. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/transformers/__init__.py +3 -3
  6. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/transformers/_base.py +4 -4
  7. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/transformers/_classic_cdf.py +13 -13
  8. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/transformers/_prune_graph.py +3 -3
  9. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/transformers/_rdfpath.py +3 -4
  10. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/transformers/_value_type.py +23 -16
  11. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/errors/__init__.py +2 -0
  12. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/errors/_external.py +8 -0
  13. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/warnings/_resources.py +1 -1
  14. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/exporters/_rules2yaml.py +1 -1
  15. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_rdf/_inference2rules.py +179 -118
  16. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/_base_rules.py +9 -8
  17. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/dms/_exporter.py +5 -4
  18. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/transformers/__init__.py +4 -3
  19. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/transformers/_base.py +6 -1
  20. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/transformers/_converters.py +436 -361
  21. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/transformers/_mapping.py +4 -4
  22. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/_base.py +71 -69
  23. cognite_neat-0.109.0/cognite/neat/_session/_create.py +133 -0
  24. cognite_neat-0.109.0/cognite/neat/_session/_drop.py +103 -0
  25. cognite_neat-0.109.0/cognite/neat/_session/_fix.py +28 -0
  26. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/_inspect.py +19 -5
  27. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/_mapping.py +8 -8
  28. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/_prepare.py +3 -247
  29. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/_read.py +78 -4
  30. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/_set.py +34 -12
  31. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/_show.py +14 -41
  32. cognite_neat-0.109.0/cognite/neat/_session/_state.py +100 -0
  33. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/_to.py +7 -3
  34. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/exceptions.py +7 -1
  35. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_store/_graph_store.py +14 -13
  36. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_store/_provenance.py +36 -20
  37. cognite_neat-0.109.0/cognite/neat/_store/_rules_store.py +386 -0
  38. cognite_neat-0.109.0/cognite/neat/_store/exceptions.py +59 -0
  39. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/auth.py +4 -2
  40. cognite_neat-0.109.0/cognite/neat/_version.py +2 -0
  41. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/pyproject.toml +1 -1
  42. cognite_neat-0.108.0/cognite/neat/_session/_drop.py +0 -49
  43. cognite_neat-0.108.0/cognite/neat/_session/_state.py +0 -103
  44. cognite_neat-0.108.0/cognite/neat/_store/_rules_store.py +0 -507
  45. cognite_neat-0.108.0/cognite/neat/_store/exceptions.py +0 -23
  46. cognite_neat-0.108.0/cognite/neat/_version.py +0 -2
  47. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/LICENSE +0 -0
  48. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/README.md +0 -0
  49. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/__init__.py +0 -0
  50. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_client/__init__.py +0 -0
  51. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_client/_api/__init__.py +0 -0
  52. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_client/_api/data_modeling_loaders.py +0 -0
  53. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_client/_api/schema.py +0 -0
  54. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_client/_api_client.py +0 -0
  55. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_client/data_classes/__init__.py +0 -0
  56. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_client/data_classes/data_modeling.py +0 -0
  57. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_client/data_classes/neat_sequence.py +0 -0
  58. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_client/data_classes/schema.py +0 -0
  59. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_client/testing.py +0 -0
  60. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_config.py +0 -0
  61. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/__init__.py +0 -0
  62. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/_shared.py +0 -0
  63. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/_tracking/__init__.py +0 -0
  64. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/_tracking/base.py +0 -0
  65. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/_tracking/log.py +0 -0
  66. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  67. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  68. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/examples/__init__.py +0 -0
  69. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  70. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/__init__.py +0 -0
  71. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_base.py +0 -0
  72. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_classic_cdf/__init__.py +0 -0
  73. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_classic_cdf/_assets.py +0 -0
  74. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_classic_cdf/_base.py +0 -0
  75. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_classic_cdf/_data_sets.py +0 -0
  76. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_classic_cdf/_events.py +0 -0
  77. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_classic_cdf/_files.py +0 -0
  78. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_classic_cdf/_labels.py +0 -0
  79. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +0 -0
  80. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +0 -0
  81. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_classic_cdf/_timeseries.py +0 -0
  82. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_dexpi.py +0 -0
  83. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_dms.py +0 -0
  84. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_dms_graph.py +0 -0
  85. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_iodd.py +0 -0
  86. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_mock_graph_generator.py +0 -0
  87. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/extractors/_rdf_file.py +0 -0
  88. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/loaders/__init__.py +0 -0
  89. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/loaders/_base.py +0 -0
  90. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/loaders/_rdf2dms.py +0 -0
  91. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/queries/__init__.py +0 -0
  92. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/queries/_construct.py +0 -0
  93. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/queries/_shared.py +0 -0
  94. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_graph/transformers/_iodd.py +0 -0
  95. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/__init__.py +0 -0
  96. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/_base.py +0 -0
  97. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/errors/_general.py +0 -0
  98. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/errors/_properties.py +0 -0
  99. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/errors/_resources.py +0 -0
  100. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/errors/_workflow.py +0 -0
  101. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/formatters.py +0 -0
  102. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/warnings/__init__.py +0 -0
  103. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/warnings/_external.py +0 -0
  104. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/warnings/_general.py +0 -0
  105. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/warnings/_models.py +0 -0
  106. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/warnings/_properties.py +0 -0
  107. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_issues/warnings/user_modeling.py +0 -0
  108. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/__init__.py +0 -0
  109. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/_constants.py +0 -0
  110. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/_shared.py +0 -0
  111. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/analysis/__init__.py +0 -0
  112. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/analysis/_base.py +0 -0
  113. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/analysis/_dms.py +0 -0
  114. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/analysis/_information.py +0 -0
  115. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/catalog/__init__.py +0 -0
  116. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/catalog/classic_model.xlsx +0 -0
  117. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/catalog/hello_world_pump.xlsx +0 -0
  118. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
  119. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/exporters/__init__.py +0 -0
  120. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/exporters/_base.py +0 -0
  121. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/exporters/_rules2dms.py +0 -0
  122. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/exporters/_rules2excel.py +0 -0
  123. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/exporters/_rules2instance_template.py +0 -0
  124. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/exporters/_rules2ontology.py +0 -0
  125. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/exporters/_validation.py +0 -0
  126. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/__init__.py +0 -0
  127. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_base.py +0 -0
  128. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_dms2rules.py +0 -0
  129. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_dtdl2rules/__init__.py +0 -0
  130. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
  131. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
  132. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
  133. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_dtdl2rules/spec.py +0 -0
  134. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_rdf/__init__.py +0 -0
  135. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_rdf/_base.py +0 -0
  136. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_rdf/_imf2rules.py +0 -0
  137. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_rdf/_owl2rules.py +0 -0
  138. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_rdf/_shared.py +0 -0
  139. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_spreadsheet2rules.py +0 -0
  140. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/importers/_yaml2rules.py +0 -0
  141. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/__init__.py +0 -0
  142. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/_base_input.py +0 -0
  143. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/_rdfpath.py +0 -0
  144. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/_types.py +0 -0
  145. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/data_types.py +0 -0
  146. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/dms/__init__.py +0 -0
  147. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/dms/_rules.py +0 -0
  148. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/dms/_rules_input.py +0 -0
  149. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/dms/_validation.py +0 -0
  150. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/entities/__init__.py +0 -0
  151. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/entities/_constants.py +0 -0
  152. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/entities/_loaders.py +0 -0
  153. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/entities/_multi_value.py +0 -0
  154. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/entities/_single_value.py +0 -0
  155. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/entities/_types.py +0 -0
  156. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/entities/_wrapped.py +0 -0
  157. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/information/__init__.py +0 -0
  158. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/information/_rules.py +0 -0
  159. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/information/_rules_input.py +0 -0
  160. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/information/_validation.py +0 -0
  161. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/mapping/__init__.py +0 -0
  162. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/mapping/_classic2core.py +0 -0
  163. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/models/mapping/_classic2core.yaml +0 -0
  164. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_rules/transformers/_verification.py +0 -0
  165. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/__init__.py +0 -0
  166. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/_collector.py +0 -0
  167. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/_wizard.py +0 -0
  168. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/engine/__init__.py +0 -0
  169. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/engine/_import.py +0 -0
  170. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/engine/_interface.py +0 -0
  171. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_session/engine/_load.py +0 -0
  172. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_shared.py +0 -0
  173. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_store/__init__.py +0 -0
  174. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/__init__.py +0 -0
  175. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/auxiliary.py +0 -0
  176. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/collection_.py +0 -0
  177. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/graph_transformations_report.py +0 -0
  178. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/io_.py +0 -0
  179. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/rdf_.py +0 -0
  180. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/reader/__init__.py +0 -0
  181. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/reader/_base.py +0 -0
  182. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/spreadsheet.py +0 -0
  183. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/text.py +0 -0
  184. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/time_.py +0 -0
  185. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/upload.py +0 -0
  186. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/_utils/xml_.py +0 -0
  187. {cognite_neat-0.108.0 → cognite_neat-0.109.0}/cognite/neat/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: cognite-neat
3
- Version: 0.108.0
3
+ Version: 0.109.0
4
4
  Summary: Knowledge graph transformation
5
5
  License: Apache-2.0
6
6
  Author: Nikola Vasiljevic
@@ -86,8 +86,8 @@ class NEAT(DefinedNamespace):
86
86
  _fail = True
87
87
  _NS = Namespace("http://thisisneat.io/internal/")
88
88
 
89
- type: URIRef # type property used to express a type of a subject
90
89
  UnknownType: URIRef # Unknown type used to express that the type of a subject is unknown
90
+ EmptyType: URIRef # Empty type used to express that the type of a subject is empty
91
91
 
92
92
 
93
93
  def get_default_prefixes_and_namespaces() -> dict[str, Namespace]:
@@ -369,8 +369,12 @@ class ClassicGraphExtractor(KnowledgeGraphExtractor):
369
369
 
370
370
  def _lookup_dataset(self, dataset_id: int) -> str:
371
371
  if dataset_id not in self._dataset_external_ids_by_id:
372
- if (dataset := self._client.data_sets.retrieve(id=dataset_id)) and dataset.external_id:
373
- self._dataset_external_ids_by_id[dataset_id] = dataset.external_id
374
- else:
375
- raise KeyError(f"Could not find dataset with id {dataset_id}.")
372
+ try:
373
+ if (dataset := self._client.data_sets.retrieve(id=dataset_id)) and dataset.external_id:
374
+ self._dataset_external_ids_by_id[dataset_id] = dataset.external_id
375
+ else:
376
+ raise KeyError(f"Could not find dataset with id {dataset_id}.")
377
+ except CogniteAPIError as e:
378
+ warnings.warn(CDFAuthWarning("lookup dataset", str(e)), stacklevel=2)
379
+ return f"{InstanceIdPrefix.data_set}{dataset_id}"
376
380
  return self._dataset_external_ids_by_id[dataset_id]
@@ -185,6 +185,10 @@ class Queries:
185
185
  query = f"ASK WHERE {{ ?s ?p ?o . FILTER(STRSTARTS(STR(?p), STR(<{namespace}>))) }}"
186
186
  return bool(self.graph(named_graph).query(query))
187
187
 
188
+ def has_data(self) -> bool:
189
+ """Check if the graph store has data"""
190
+ return cast(bool, next(iter(self.dataset.query("ASK WHERE { ?s ?p ?o }"))))
191
+
188
192
  def has_type(self, type_: URIRef, named_graph: URIRef | None = None) -> bool:
189
193
  """Check if a type exists in the graph store
190
194
 
@@ -17,7 +17,7 @@ from ._prune_graph import (
17
17
  PruneTypes,
18
18
  )
19
19
  from ._rdfpath import AddSelfReferenceProperty, MakeConnectionOnExactMatch
20
- from ._value_type import ConnectionToLiteral, ConvertLiteral, LiteralToEntity, SetNeatType, SplitMultiValueProperty
20
+ from ._value_type import ConnectionToLiteral, ConvertLiteral, LiteralToEntity, SetType, SplitMultiValueProperty
21
21
 
22
22
  __all__ = [
23
23
  "AddAssetDepth",
@@ -38,7 +38,7 @@ __all__ = [
38
38
  "PruneInstancesOfUnknownType",
39
39
  "PruneTypes",
40
40
  "RelationshipAsEdgeTransformer",
41
- "SetNeatType",
41
+ "SetType",
42
42
  "SplitMultiValueProperty",
43
43
  ]
44
44
 
@@ -63,5 +63,5 @@ Transformers = (
63
63
  | ConnectionToLiteral
64
64
  | BaseTransformerStandardised
65
65
  | LookupRelationshipSourceTarget
66
- | SetNeatType
66
+ | SetType
67
67
  )
@@ -12,14 +12,14 @@ from cognite.neat._shared import Triple
12
12
  from cognite.neat._utils.collection_ import iterate_progress_bar_if_above_config_threshold
13
13
  from cognite.neat._utils.graph_transformations_report import GraphTransformationResult
14
14
 
15
- To_Add_Triples: TypeAlias = list[Triple]
16
- To_Remove_Triples: TypeAlias = list[Triple]
15
+ To_Add_Triples: TypeAlias = set[Triple]
16
+ To_Remove_Triples: TypeAlias = set[Triple]
17
17
 
18
18
 
19
19
  @dataclasses.dataclass
20
20
  class RowTransformationOutput:
21
- remove_triples: To_Remove_Triples = dataclasses.field(default_factory=list)
22
- add_triples: To_Add_Triples = dataclasses.field(default_factory=list)
21
+ remove_triples: To_Remove_Triples = dataclasses.field(default_factory=set)
22
+ add_triples: To_Add_Triples = dataclasses.field(default_factory=set)
23
23
  instances_removed_count: int = 0
24
24
  instances_added_count: int = 0
25
25
  instances_modified_count: int = 0
@@ -63,11 +63,11 @@ class AddAssetDepth(BaseTransformerStandardised):
63
63
  row_output = RowTransformationOutput()
64
64
  subject, object = query_result_row
65
65
 
66
- row_output.add_triples.append(cast(Triple, (subject, DEFAULT_NAMESPACE.depth, object)))
66
+ row_output.add_triples.add(cast(Triple, (subject, DEFAULT_NAMESPACE.depth, object)))
67
67
 
68
68
  if self.depth_typing and (type_ := self.depth_typing.get(int(object), None)):
69
- row_output.remove_triples.append(cast(Triple, (subject, RDF.type, self.asset_type)))
70
- row_output.add_triples.append(cast(Triple, (subject, RDF.type, DEFAULT_NAMESPACE[type_])))
69
+ row_output.remove_triples.add(cast(Triple, (subject, RDF.type, self.asset_type)))
70
+ row_output.add_triples.add(cast(Triple, (subject, RDF.type, DEFAULT_NAMESPACE[type_])))
71
71
 
72
72
  row_output.instances_modified_count += 1
73
73
 
@@ -128,7 +128,7 @@ class BaseAssetConnector(BaseTransformerStandardised, ABC):
128
128
  row_output = RowTransformationOutput()
129
129
  subject, object = query_result_row
130
130
 
131
- row_output.add_triples.append(cast(Triple, (subject, self.asset_to_resource_connection, object)))
131
+ row_output.add_triples.add(cast(Triple, (subject, self.asset_to_resource_connection, object)))
132
132
 
133
133
  row_output.instances_modified_count += 1
134
134
 
@@ -305,12 +305,12 @@ class AssetRelationshipConnector(BaseTransformerStandardised):
305
305
  row_output = RowTransformationOutput()
306
306
  source, relationship, target = query_result_row
307
307
 
308
- row_output.add_triples.append(cast(Triple, (source, DEFAULT_NAMESPACE.relationship, target)))
309
- row_output.add_triples.append(cast(Triple, (relationship, DEFAULT_NAMESPACE.source, source)))
310
- row_output.add_triples.append(cast(Triple, (relationship, DEFAULT_NAMESPACE.target, target)))
308
+ row_output.add_triples.add(cast(Triple, (source, DEFAULT_NAMESPACE.relationship, target)))
309
+ row_output.add_triples.add(cast(Triple, (relationship, DEFAULT_NAMESPACE.source, source)))
310
+ row_output.add_triples.add(cast(Triple, (relationship, DEFAULT_NAMESPACE.target, target)))
311
311
 
312
- row_output.remove_triples.append(cast(Triple, (relationship, self.relationship_source_xid_prop, None)))
313
- row_output.remove_triples.append(cast(Triple, (relationship, self.relationship_target_xid_prop, None)))
312
+ row_output.remove_triples.add(cast(Triple, (relationship, self.relationship_source_xid_prop, None)))
313
+ row_output.remove_triples.add(cast(Triple, (relationship, self.relationship_target_xid_prop, None)))
314
314
 
315
315
  row_output.instances_modified_count += 2
316
316
 
@@ -578,10 +578,10 @@ WHERE {{
578
578
  warnings.warn(ResourceNotFoundWarning(target, "class", str(instance), "class"), stacklevel=2)
579
579
  return output
580
580
 
581
- output.remove_triples.append((instance, self._namespace.sourceExternalId, source))
582
- output.remove_triples.append((instance, self._namespace.targetExternalId, target))
583
- output.add_triples.append((instance, self._namespace.sourceExternalId, source_id))
584
- output.add_triples.append((instance, self._namespace.targetExternalId, target_id))
581
+ output.remove_triples.add((instance, self._namespace.sourceExternalId, source))
582
+ output.remove_triples.add((instance, self._namespace.targetExternalId, target))
583
+ output.add_triples.add((instance, self._namespace.sourceExternalId, source_id))
584
+ output.add_triples.add((instance, self._namespace.targetExternalId, target_id))
585
585
  output.instances_modified_count += 1
586
586
  return output
587
587
 
@@ -237,7 +237,7 @@ class PruneTypes(BaseTransformerStandardised):
237
237
  row_output = RowTransformationOutput()
238
238
 
239
239
  (subject,) = query_result_row
240
- row_output.remove_triples.append((subject, None, None)) # type: ignore
240
+ row_output.remove_triples.add((subject, None, None)) # type: ignore
241
241
  row_output.instances_removed_count = 1
242
242
 
243
243
  return row_output
@@ -272,7 +272,7 @@ class PruneDeadEndEdges(BaseTransformerStandardised):
272
272
 
273
273
  def operation(self, row: ResultRow) -> RowTransformationOutput:
274
274
  row_output = RowTransformationOutput()
275
- row_output.remove_triples.append(cast(Triple, row))
275
+ row_output.remove_triples.add(cast(Triple, row))
276
276
  row_output.instances_modified_count = 1
277
277
 
278
278
  return row_output
@@ -307,7 +307,7 @@ class PruneInstancesOfUnknownType(BaseTransformerStandardised):
307
307
  def operation(self, query_result_row: ResultRow) -> RowTransformationOutput:
308
308
  row_output = RowTransformationOutput()
309
309
  (subject,) = query_result_row
310
- row_output.remove_triples.append(cast(Triple, (subject, None, None)))
310
+ row_output.remove_triples.add(cast(Triple, (subject, None, None)))
311
311
  row_output.instances_removed_count = 1
312
312
 
313
313
  return row_output
@@ -7,7 +7,6 @@ from rdflib.query import ResultRow
7
7
  from cognite.neat._rules.analysis import InformationAnalysis
8
8
  from cognite.neat._rules.models._rdfpath import RDFPath, SingleProperty
9
9
  from cognite.neat._rules.models.information import InformationRules
10
- from cognite.neat._shared import Triple
11
10
  from cognite.neat._utils.rdf_ import get_namespace, remove_namespace_from_uri
12
11
 
13
12
  from ._base import BaseTransformer, BaseTransformerStandardised, RowTransformationOutput
@@ -76,7 +75,7 @@ class MakeConnectionOnExactMatch(BaseTransformerStandardised):
76
75
  self.object_type = object_type
77
76
  self.object_predicate = object_predicate
78
77
  subject_namespace = Namespace(get_namespace(subject_type))
79
- self.connection = (
78
+ self.connection: URIRef = (
80
79
  subject_namespace[quote(connection.strip())]
81
80
  if isinstance(connection, str)
82
81
  else connection or subject_namespace[remove_namespace_from_uri(self.object_type).lower()]
@@ -125,8 +124,8 @@ class MakeConnectionOnExactMatch(BaseTransformerStandardised):
125
124
  def operation(self, query_result_row: ResultRow) -> RowTransformationOutput:
126
125
  row_output = RowTransformationOutput()
127
126
 
128
- subject, object = query_result_row
127
+ subject, object = cast(tuple[URIRef, URIRef], query_result_row)
129
128
 
130
- row_output.add_triples.append(cast(Triple, (subject, self.connection, object)))
129
+ row_output.add_triples.add((subject, self.connection, object))
131
130
  row_output.instances_modified_count += 1
132
131
  return row_output
@@ -4,7 +4,7 @@ from typing import Any, cast
4
4
  from urllib.parse import quote
5
5
 
6
6
  import rdflib
7
- from rdflib import RDF, Literal, Namespace, URIRef
7
+ from rdflib import RDF, RDFS, Literal, Namespace, URIRef
8
8
  from rdflib.query import ResultRow
9
9
 
10
10
  from cognite.neat._constants import NEAT
@@ -78,8 +78,8 @@ class SplitMultiValueProperty(BaseTransformerStandardised):
78
78
 
79
79
  new_property = URIRef(f"{old_property}_{remove_namespace_from_uri(value_type)}")
80
80
 
81
- row_output.add_triples.append(cast(Triple, (subject, new_property, object)))
82
- row_output.remove_triples.append(cast(Triple, (subject, old_property, object)))
81
+ row_output.add_triples.add(cast(Triple, (subject, new_property, object)))
82
+ row_output.remove_triples.add(cast(Triple, (subject, old_property, object)))
83
83
 
84
84
  row_output.instances_modified_count += 1
85
85
 
@@ -143,8 +143,8 @@ class ConvertLiteral(BaseTransformerStandardised):
143
143
  PropertyDataTypeConversionWarning(str(instance), self._type_name, self._property_name, str(e)),
144
144
  stacklevel=2,
145
145
  )
146
- row_output.add_triples.append((instance, self.subject_predicate, rdflib.Literal(converted_value))) # type: ignore[arg-type]
147
- row_output.remove_triples.append((instance, self.subject_predicate, literal)) # type: ignore[arg-type]
146
+ row_output.add_triples.add((instance, self.subject_predicate, rdflib.Literal(converted_value))) # type: ignore[arg-type]
147
+ row_output.remove_triples.add((instance, self.subject_predicate, literal)) # type: ignore[arg-type]
148
148
  row_output.instances_modified_count += 1
149
149
 
150
150
  return row_output
@@ -221,15 +221,15 @@ class LiteralToEntity(BaseTransformerStandardised):
221
221
  namespace = Namespace(get_namespace(instance)) # type: ignore[arg-type]
222
222
  entity_type = namespace[self.entity_type]
223
223
  new_entity = namespace[f"{self.entity_type}_{quote(value)!s}"]
224
- row_output.add_triples.append((new_entity, RDF.type, entity_type))
224
+ row_output.add_triples.add((new_entity, RDF.type, entity_type))
225
225
  row_output.instances_added_count += 1 # we add one new entity
226
226
 
227
227
  if self.new_property is not None:
228
- row_output.add_triples.append((new_entity, namespace[self.new_property], rdflib.Literal(value))) # type: ignore[arg-type]
228
+ row_output.add_triples.add((new_entity, namespace[self.new_property], rdflib.Literal(value))) # type: ignore[arg-type]
229
229
  row_output.instances_modified_count += 1 # we modify the new entity
230
230
 
231
- row_output.add_triples.append((instance, self.subject_predicate, new_entity)) # type: ignore[arg-type]
232
- row_output.remove_triples.append((instance, self.subject_predicate, literal)) # type: ignore[arg-type]
231
+ row_output.add_triples.add((instance, self.subject_predicate, new_entity)) # type: ignore[arg-type]
232
+ row_output.remove_triples.add((instance, self.subject_predicate, literal)) # type: ignore[arg-type]
233
233
  row_output.instances_modified_count += 1 # we modify the old entity
234
234
 
235
235
  return row_output
@@ -300,18 +300,22 @@ class ConnectionToLiteral(BaseTransformerStandardised):
300
300
  instance, object_entity = cast(tuple[URIRef, URIRef], query_result_row)
301
301
  value = remove_namespace_from_uri(object_entity)
302
302
 
303
- row_output.add_triples.append((instance, self.subject_predicate, rdflib.Literal(value)))
304
- row_output.remove_triples.append((instance, self.subject_predicate, object_entity))
303
+ row_output.add_triples.add((instance, self.subject_predicate, rdflib.Literal(value)))
304
+ row_output.remove_triples.add((instance, self.subject_predicate, object_entity))
305
305
  row_output.instances_modified_count += 1
306
306
 
307
307
  return row_output
308
308
 
309
309
 
310
- class SetNeatType(BaseTransformerStandardised):
311
- description = "Set the sub type of an instance based on the property"
310
+ class SetType(BaseTransformerStandardised):
311
+ description = "Set the type of an instance based on a property"
312
312
 
313
313
  def __init__(
314
- self, subject_type: URIRef, subject_predicate: URIRef, drop_property: bool, namespace: Namespace | None = None
314
+ self,
315
+ subject_type: URIRef,
316
+ subject_predicate: URIRef,
317
+ drop_property: bool = False,
318
+ namespace: Namespace | None = None,
315
319
  ) -> None:
316
320
  self.subject_type = subject_type
317
321
  self.subject_predicate = subject_predicate
@@ -350,9 +354,12 @@ class SetNeatType(BaseTransformerStandardised):
350
354
 
351
355
  instance, object_literal = cast(tuple[URIRef, Literal], query_result_row)
352
356
  if self.drop_property:
353
- row_output.remove_triples.append((instance, self.subject_predicate, object_literal))
357
+ row_output.remove_triples.add((instance, self.subject_predicate, object_literal))
354
358
 
355
- row_output.add_triples.append((instance, NEAT.type, self._namespace[str(object_literal.toPython())]))
359
+ row_output.remove_triples.add((instance, RDF.type, self.subject_type))
360
+ new_type = self._namespace[quote(object_literal.toPython())]
361
+ row_output.add_triples.add((instance, RDF.type, new_type))
362
+ row_output.add_triples.add((new_type, RDFS.subClassOf, self.subject_type))
356
363
  row_output.instances_modified_count += 1
357
364
 
358
365
  return row_output
@@ -9,6 +9,7 @@ from ._external import (
9
9
  FileReadError,
10
10
  FileTypeUnexpectedError,
11
11
  NeatYamlError,
12
+ OxigraphStorageLockedError,
12
13
  )
13
14
  from ._general import NeatImportError, NeatTypeError, NeatValueError, RegexViolationError
14
15
  from ._properties import (
@@ -51,6 +52,7 @@ __all__ = [
51
52
  "NeatTypeError",
52
53
  "NeatValueError",
53
54
  "NeatYamlError",
55
+ "OxigraphStorageLockedError",
54
56
  "PropertyDefinitionDuplicatedError",
55
57
  "PropertyDefinitionError",
56
58
  "PropertyMappingDuplicatedError",
@@ -23,6 +23,14 @@ class FileReadError(NeatError, RuntimeError):
23
23
  reason: str
24
24
 
25
25
 
26
+ @dataclass(unsafe_hash=True)
27
+ class OxigraphStorageLockedError(NeatError, RuntimeError):
28
+ """Oxigraph on-disk storage locked at the path {filepath}"""
29
+
30
+ fix = "Delete LOCK file in the {filepath} folder to unlock the storage or use another storage path"
31
+ filepath: Path
32
+
33
+
26
34
  @dataclass(unsafe_hash=True)
27
35
  class FileNotFoundNeatError(NeatError, FileNotFoundError):
28
36
  """File {filepath} not found"""
@@ -21,7 +21,7 @@ class ResourceRegexViolationWarning(ResourceNeatWarning):
21
21
 
22
22
  fix = (
23
23
  "Either export the data model and make the necessary changes manually"
24
- " or run prepare.data_model.cdf_compliant_external_ids."
24
+ " or run fix.data_model.cdf_compliant_external_ids."
25
25
  )
26
26
 
27
27
  location: str
@@ -72,7 +72,7 @@ class YAMLExporter(BaseExporter[VerifiedRules, str]):
72
72
  """
73
73
  # model_dump_json ensures that the output is in JSON format,
74
74
  # if we don't do this, we will get Enums and other types that are not serializable to YAML
75
- json_output = rules.dump(mode="json", exclude_none=True, exclude_unset=True)
75
+ json_output = rules.dump(mode="json", sort=True, exclude_none=True, exclude_unset=True)
76
76
  if self.output == "json":
77
77
  return json.dumps(json_output)
78
78
  elif self.output == "yaml":