cognite-neat 0.105.0__tar.gz → 0.105.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cognite-neat might be problematic. Click here for more details.

Files changed (179) hide show
  1. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/PKG-INFO +2 -2
  2. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_constants.py +1 -0
  3. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/loaders/_rdf2dms.py +19 -4
  4. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/transformers/_classic_cdf.py +150 -89
  5. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/transformers/_rdfpath.py +14 -15
  6. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/warnings/__init__.py +2 -0
  7. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/warnings/_properties.py +11 -0
  8. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/auth.py +35 -15
  9. cognite_neat-0.105.2/cognite/neat/_version.py +2 -0
  10. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/pyproject.toml +3 -3
  11. cognite_neat-0.105.0/cognite/neat/_version.py +0 -2
  12. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/LICENSE +0 -0
  13. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/README.md +0 -0
  14. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/__init__.py +0 -0
  15. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_client/__init__.py +0 -0
  16. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_client/_api/__init__.py +0 -0
  17. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_client/_api/data_modeling_loaders.py +0 -0
  18. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_client/_api/schema.py +0 -0
  19. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_client/_api_client.py +0 -0
  20. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_client/data_classes/__init__.py +0 -0
  21. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_client/data_classes/data_modeling.py +0 -0
  22. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_client/data_classes/neat_sequence.py +0 -0
  23. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_client/data_classes/schema.py +0 -0
  24. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_client/testing.py +0 -0
  25. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_config.py +0 -0
  26. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/__init__.py +0 -0
  27. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/_shared.py +0 -0
  28. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/_tracking/__init__.py +0 -0
  29. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/_tracking/base.py +0 -0
  30. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/_tracking/log.py +0 -0
  31. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  32. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  33. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/examples/__init__.py +0 -0
  34. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  35. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/__init__.py +0 -0
  36. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_base.py +0 -0
  37. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_classic_cdf/__init__.py +0 -0
  38. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_classic_cdf/_assets.py +0 -0
  39. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_classic_cdf/_base.py +0 -0
  40. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_classic_cdf/_classic.py +0 -0
  41. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_classic_cdf/_data_sets.py +0 -0
  42. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_classic_cdf/_events.py +0 -0
  43. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_classic_cdf/_files.py +0 -0
  44. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_classic_cdf/_labels.py +0 -0
  45. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_classic_cdf/_relationships.py +0 -0
  46. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +0 -0
  47. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_classic_cdf/_timeseries.py +0 -0
  48. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_dexpi.py +0 -0
  49. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_dms.py +0 -0
  50. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_iodd.py +0 -0
  51. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_mock_graph_generator.py +0 -0
  52. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/extractors/_rdf_file.py +0 -0
  53. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/loaders/__init__.py +0 -0
  54. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/loaders/_base.py +0 -0
  55. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/queries/__init__.py +0 -0
  56. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/queries/_base.py +0 -0
  57. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/queries/_construct.py +0 -0
  58. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/queries/_shared.py +0 -0
  59. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/transformers/__init__.py +0 -0
  60. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/transformers/_base.py +0 -0
  61. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/transformers/_iodd.py +0 -0
  62. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/transformers/_prune_graph.py +0 -0
  63. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_graph/transformers/_value_type.py +0 -0
  64. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/__init__.py +0 -0
  65. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/_base.py +0 -0
  66. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/errors/__init__.py +0 -0
  67. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/errors/_external.py +0 -0
  68. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/errors/_general.py +0 -0
  69. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/errors/_properties.py +0 -0
  70. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/errors/_resources.py +0 -0
  71. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/errors/_workflow.py +0 -0
  72. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/formatters.py +0 -0
  73. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/warnings/_external.py +0 -0
  74. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/warnings/_general.py +0 -0
  75. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/warnings/_models.py +0 -0
  76. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/warnings/_resources.py +0 -0
  77. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_issues/warnings/user_modeling.py +0 -0
  78. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/__init__.py +0 -0
  79. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/_constants.py +0 -0
  80. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/_shared.py +0 -0
  81. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/analysis/__init__.py +0 -0
  82. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/analysis/_base.py +0 -0
  83. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/analysis/_dms.py +0 -0
  84. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/analysis/_information.py +0 -0
  85. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/catalog/__init__.py +0 -0
  86. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/catalog/hello_world_pump.xlsx +0 -0
  87. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
  88. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/exporters/__init__.py +0 -0
  89. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/exporters/_base.py +0 -0
  90. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/exporters/_rules2dms.py +0 -0
  91. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/exporters/_rules2excel.py +0 -0
  92. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/exporters/_rules2instance_template.py +0 -0
  93. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/exporters/_rules2ontology.py +0 -0
  94. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/exporters/_rules2yaml.py +0 -0
  95. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/exporters/_validation.py +0 -0
  96. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/__init__.py +0 -0
  97. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_base.py +0 -0
  98. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_dms2rules.py +0 -0
  99. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_dtdl2rules/__init__.py +0 -0
  100. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
  101. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
  102. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
  103. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_dtdl2rules/spec.py +0 -0
  104. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_rdf/__init__.py +0 -0
  105. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_rdf/_base.py +0 -0
  106. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_rdf/_imf2rules.py +0 -0
  107. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_rdf/_inference2rules.py +0 -0
  108. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_rdf/_owl2rules.py +0 -0
  109. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_rdf/_shared.py +0 -0
  110. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_spreadsheet2rules.py +0 -0
  111. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/importers/_yaml2rules.py +0 -0
  112. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/__init__.py +0 -0
  113. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/_base_input.py +0 -0
  114. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/_base_rules.py +0 -0
  115. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/_rdfpath.py +0 -0
  116. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/_types.py +0 -0
  117. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/data_types.py +0 -0
  118. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/dms/__init__.py +0 -0
  119. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/dms/_exporter.py +0 -0
  120. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/dms/_rules.py +0 -0
  121. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/dms/_rules_input.py +0 -0
  122. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/dms/_validation.py +0 -0
  123. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/entities/__init__.py +0 -0
  124. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/entities/_constants.py +0 -0
  125. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/entities/_loaders.py +0 -0
  126. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/entities/_multi_value.py +0 -0
  127. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/entities/_single_value.py +0 -0
  128. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/entities/_types.py +0 -0
  129. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/entities/_wrapped.py +0 -0
  130. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/information/__init__.py +0 -0
  131. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/information/_rules.py +0 -0
  132. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/information/_rules_input.py +0 -0
  133. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/information/_validation.py +0 -0
  134. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/mapping/__init__.py +0 -0
  135. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/mapping/_classic2core.py +0 -0
  136. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/models/mapping/_classic2core.yaml +0 -0
  137. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/transformers/__init__.py +0 -0
  138. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/transformers/_base.py +0 -0
  139. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/transformers/_converters.py +0 -0
  140. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/transformers/_mapping.py +0 -0
  141. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_rules/transformers/_verification.py +0 -0
  142. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/__init__.py +0 -0
  143. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_base.py +0 -0
  144. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_collector.py +0 -0
  145. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_drop.py +0 -0
  146. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_inspect.py +0 -0
  147. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_mapping.py +0 -0
  148. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_prepare.py +0 -0
  149. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_read.py +0 -0
  150. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_set.py +0 -0
  151. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_show.py +0 -0
  152. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_state.py +0 -0
  153. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_to.py +0 -0
  154. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/_wizard.py +0 -0
  155. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/engine/__init__.py +0 -0
  156. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/engine/_import.py +0 -0
  157. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/engine/_interface.py +0 -0
  158. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/engine/_load.py +0 -0
  159. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_session/exceptions.py +0 -0
  160. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_shared.py +0 -0
  161. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_store/__init__.py +0 -0
  162. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_store/_graph_store.py +0 -0
  163. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_store/_provenance.py +0 -0
  164. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_store/_rules_store.py +0 -0
  165. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_store/exceptions.py +0 -0
  166. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/__init__.py +0 -0
  167. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/auxiliary.py +0 -0
  168. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/collection_.py +0 -0
  169. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/graph_transformations_report.py +0 -0
  170. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/io_.py +0 -0
  171. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/rdf_.py +0 -0
  172. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/reader/__init__.py +0 -0
  173. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/reader/_base.py +0 -0
  174. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/spreadsheet.py +0 -0
  175. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/text.py +0 -0
  176. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/time_.py +0 -0
  177. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/upload.py +0 -0
  178. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/_utils/xml_.py +0 -0
  179. {cognite_neat-0.105.0 → cognite_neat-0.105.2}/cognite/neat/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: cognite-neat
3
- Version: 0.105.0
3
+ Version: 0.105.2
4
4
  Summary: Knowledge graph transformation
5
5
  Home-page: https://cognite-neat.readthedocs-hosted.com/
6
6
  License: Apache-2.0
@@ -20,7 +20,7 @@ Provides-Extra: oxi
20
20
  Provides-Extra: service
21
21
  Requires-Dist: PyYAML
22
22
  Requires-Dist: backports.strenum (>=1.2,<2.0) ; python_version < "3.11"
23
- Requires-Dist: cognite-sdk (>=7.54.6,<8.0.0)
23
+ Requires-Dist: cognite-sdk (>=7.71.2,<8.0.0)
24
24
  Requires-Dist: elementpath (>=4.0.0,<5.0.0)
25
25
  Requires-Dist: exceptiongroup (>=1.1.3,<2.0.0) ; python_version < "3.11"
26
26
  Requires-Dist: fastapi (>=0,<1) ; extra == "service" or extra == "all"
@@ -103,6 +103,7 @@ DEFAULT_DOCS_URL = "https://cognite-neat.readthedocs-hosted.com/en/latest/"
103
103
 
104
104
  DMS_CONTAINER_PROPERTY_SIZE_LIMIT = 100
105
105
  DMS_VIEW_CONTAINER_SIZE_LIMIT = 10
106
+ DMS_DIRECT_RELATION_LIST_LIMIT = 100
106
107
 
107
108
  _ASSET_ROOT_PROPERTY = {
108
109
  "connection": "direct",
@@ -1,10 +1,11 @@
1
1
  import itertools
2
2
  import json
3
+ import warnings
3
4
  from collections import defaultdict
4
5
  from collections.abc import Iterable, Sequence
5
6
  from graphlib import TopologicalSorter
6
7
  from pathlib import Path
7
- from typing import Any, get_args
8
+ from typing import Any, cast, get_args
8
9
 
9
10
  import yaml
10
11
  from cognite.client import CogniteClient
@@ -19,7 +20,7 @@ from pydantic import BaseModel, ValidationInfo, create_model, field_validator
19
20
  from rdflib import RDF, URIRef
20
21
 
21
22
  from cognite.neat._client import NeatClient
22
- from cognite.neat._constants import is_readonly_property
23
+ from cognite.neat._constants import DMS_DIRECT_RELATION_LIST_LIMIT, is_readonly_property
23
24
  from cognite.neat._graph._tracking import LogTracker, Tracker
24
25
  from cognite.neat._issues import IssueList, NeatIssue, NeatIssueList
25
26
  from cognite.neat._issues.errors import (
@@ -28,7 +29,7 @@ from cognite.neat._issues.errors import (
28
29
  ResourceDuplicatedError,
29
30
  ResourceRetrievalError,
30
31
  )
31
- from cognite.neat._issues.warnings import PropertyTypeNotSupportedWarning
32
+ from cognite.neat._issues.warnings import PropertyDirectRelationLimitWarning, PropertyTypeNotSupportedWarning
32
33
  from cognite.neat._rules.analysis._dms import DMSAnalysis
33
34
  from cognite.neat._rules.models import DMSRules
34
35
  from cognite.neat._rules.models.data_types import _DATA_TYPE_BY_DMS_TYPE, Json
@@ -373,7 +374,21 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
373
374
  def parse_direct_relation(cls, value: list, info: ValidationInfo) -> dict | list[dict]:
374
375
  # We validate above that we only get one value for single direct relations.
375
376
  if list.__name__ in _get_field_value_types(cls, info):
376
- return [{"space": self.instance_space, "externalId": remove_namespace_from_uri(v)} for v in value]
377
+ result = [{"space": self.instance_space, "externalId": remove_namespace_from_uri(v)} for v in value]
378
+ if len(result) <= DMS_DIRECT_RELATION_LIST_LIMIT:
379
+ return result
380
+ warnings.warn(
381
+ PropertyDirectRelationLimitWarning(
382
+ identifier="unknown",
383
+ resource_type="view property",
384
+ property_name=cast(str, cls.model_fields[info.field_name].alias or info.field_name),
385
+ limit=DMS_DIRECT_RELATION_LIST_LIMIT,
386
+ ),
387
+ stacklevel=2,
388
+ )
389
+ # To get deterministic results, we sort by space and externalId
390
+ result.sort(key=lambda x: (x["space"], x["externalId"]))
391
+ return result[:DMS_DIRECT_RELATION_LIST_LIMIT]
377
392
  elif value:
378
393
  return {"space": self.instance_space, "externalId": remove_namespace_from_uri(value[0])}
379
394
  return {}
@@ -1,4 +1,3 @@
1
- import textwrap
2
1
  import warnings
3
2
  from abc import ABC
4
3
  from collections.abc import Callable, Iterable
@@ -6,6 +5,7 @@ from functools import lru_cache
6
5
  from typing import cast
7
6
 
8
7
  from rdflib import RDF, Graph, Literal, Namespace, URIRef
8
+ from rdflib.query import ResultRow
9
9
 
10
10
  from cognite.neat._constants import CLASSIC_CDF_NAMESPACE, DEFAULT_NAMESPACE
11
11
  from cognite.neat._graph import extractors
@@ -14,158 +14,219 @@ from cognite.neat._utils.collection_ import iterate_progress_bar
14
14
  from cognite.neat._utils.rdf_ import (
15
15
  Triple,
16
16
  add_triples_in_batch,
17
+ get_namespace,
17
18
  remove_instance_ids_in_batch,
18
19
  remove_namespace_from_uri,
19
20
  )
20
21
 
21
- from ._base import BaseTransformer
22
+ from ._base import BaseTransformer, BaseTransformerStandardised, RowTransformationOutput
22
23
 
23
24
 
24
- # TODO: standardise
25
- class AddAssetDepth(BaseTransformer):
26
- description: str = "Adds depth of asset in the asset hierarchy to the graph"
25
+ class AddAssetDepth(BaseTransformerStandardised):
26
+ description: str = "Adds depth of asset in the asset hierarchy and optionally types asset based on depth"
27
27
  _use_only_once: bool = True
28
28
  _need_changes = frozenset({str(extractors.AssetsExtractor.__name__)})
29
29
 
30
- _parent_template: str = """SELECT ?child ?parent WHERE {{
31
- <{asset_id}> <{parent_prop}> ?child .
32
- OPTIONAL{{?child <{parent_prop}>+ ?parent .}}}}"""
33
-
34
- _root_template: str = """SELECT ?root WHERE {{
35
- <{asset_id}> <{root_prop}> ?root .}}"""
36
-
37
30
  def __init__(
38
31
  self,
39
32
  asset_type: URIRef | None = None,
40
- root_prop: URIRef | None = None,
41
33
  parent_prop: URIRef | None = None,
42
34
  depth_typing: dict[int, str] | None = None,
43
35
  ):
44
36
  self.asset_type = asset_type or DEFAULT_NAMESPACE.Asset
45
- self.root_prop = root_prop or DEFAULT_NAMESPACE.rootId
46
37
  self.parent_prop = parent_prop or DEFAULT_NAMESPACE.parentId
47
38
  self.depth_typing = depth_typing
48
39
 
49
- def transform(self, graph: Graph) -> None:
50
- """Adds depth of asset in the asset hierarchy to the graph."""
51
- for result in graph.query(f"SELECT DISTINCT ?asset_id WHERE {{?asset_id a <{self.asset_type}>}}"):
52
- asset_id = cast(tuple, result)[0]
53
- if depth := self.get_depth(graph, asset_id, self.root_prop, self.parent_prop):
54
- graph.add((asset_id, DEFAULT_NAMESPACE.depth, Literal(depth)))
55
-
56
- if self.depth_typing and (type_ := self.depth_typing.get(depth, None)):
57
- # remove existing type
58
- graph.remove((asset_id, RDF.type, None))
59
-
60
- # add new type
61
- graph.add((asset_id, RDF.type, DEFAULT_NAMESPACE[type_]))
62
-
63
- @classmethod
64
- def get_depth(
65
- cls,
66
- graph: Graph,
67
- asset_id: URIRef,
68
- root_prop: URIRef,
69
- parent_prop: URIRef,
70
- ) -> int | None:
71
- """Get asset depth in the asset hierarchy."""
72
-
73
- # Handles non-root assets
74
- if result := list(graph.query(cls._parent_template.format(asset_id=asset_id, parent_prop=parent_prop))):
75
- return len(cast(list[tuple], result)) + 2 if cast(list[tuple], result)[0][1] else 2
76
-
77
- # Handles root assets
78
- elif (
79
- (result := list(graph.query(cls._root_template.format(asset_id=asset_id, root_prop=root_prop))))
80
- and len(cast(list[tuple], result)) == 1
81
- and cast(list[tuple], result)[0][0] == asset_id
82
- ):
83
- return 1
84
- else:
85
- return None
40
+ def _iterate_query(self) -> str:
41
+ query = """SELECT ?asset (IF(?isRoot, 0, COUNT(?parent)) AS ?parentCount)
42
+ WHERE {{
43
+ ?asset a <{asset_type}> .
44
+ OPTIONAL {{ ?asset <{parent_prop}>+ ?parent . }}
45
+ BIND(IF(BOUND(?parent), false, true) AS ?isRoot)}}
46
+ GROUP BY ?asset ?isRoot
47
+ ORDER BY DESC(?parentCount)"""
48
+
49
+ return query.format(
50
+ asset_type=self.asset_type,
51
+ parent_prop=self.parent_prop,
52
+ )
86
53
 
54
+ def _count_query(self) -> str:
55
+ query = """SELECT (COUNT(?asset) as ?count)
56
+ WHERE {{ ?asset a <{asset_type}> . }}"""
87
57
 
88
- # TODO: standardise
89
- class BaseAssetConnector(BaseTransformer, ABC):
90
- _asset_type: URIRef = DEFAULT_NAMESPACE.Asset
91
- _item_type: URIRef
92
- _default_attribute: URIRef
93
- _connection_type: URIRef
58
+ return query.format(asset_type=self.asset_type)
94
59
 
95
- _select_item_ids = "SELECT DISTINCT ?item_id WHERE {{?item_id a <{item_type}>}}"
96
- _select_connected_assets: str = textwrap.dedent("""SELECT ?asset_id WHERE {{
97
- <{item_id}> <{attribute}> ?asset_id .
98
- ?asset_id a <{asset_type}>}}""")
60
+ def operation(self, query_result_row: ResultRow) -> RowTransformationOutput:
61
+ row_output = RowTransformationOutput()
62
+ subject, object = query_result_row
99
63
 
100
- def __init__(self, attribute: URIRef | None = None) -> None:
101
- self._attribute = attribute or self._default_attribute
64
+ row_output.add_triples.append(cast(Triple, (subject, DEFAULT_NAMESPACE.depth, object)))
102
65
 
103
- def transform(self, graph: Graph) -> None:
104
- for item_id, *_ in graph.query(self._select_item_ids.format(item_type=self._item_type)): # type: ignore[misc]
105
- triples: list[Triple] = []
106
- for asset_id, *_ in graph.query( # type: ignore[misc]
107
- self._select_connected_assets.format(
108
- item_id=item_id, attribute=self._attribute, asset_type=self._asset_type
109
- )
110
- ):
111
- triples.append((asset_id, self._connection_type, item_id)) # type: ignore[arg-type]
112
- add_triples_in_batch(graph, triples)
66
+ if self.depth_typing and (type_ := self.depth_typing.get(int(object), None)):
67
+ row_output.remove_triples.append(cast(Triple, (subject, RDF.type, self.asset_type)))
68
+ row_output.add_triples.append(cast(Triple, (subject, RDF.type, DEFAULT_NAMESPACE[type_])))
69
+
70
+ row_output.instances_modified_count += 1
71
+
72
+ return row_output
73
+
74
+
75
+ class BaseAssetConnector(BaseTransformerStandardised, ABC):
76
+ description: str = "Connects assets to other cognite resources, thus forming bi-directional connection"
77
+ _use_only_once: bool = True
78
+
79
+ def _count_query(self) -> str:
80
+ query = """SELECT (COUNT(?asset) as ?count)
81
+ WHERE {{
82
+ ?resource a <{resource_type}> .
83
+ ?resource <{connection}> ?asset .
84
+ ?asset a <{asset_type}> .
85
+ }}"""
86
+
87
+ return query.format(
88
+ asset_type=self.asset_type,
89
+ resource_type=self.resource_type,
90
+ connection=self.resource_to_asset_connection,
91
+ )
92
+
93
+ def _iterate_query(self) -> str:
94
+ query = """SELECT ?asset ?resource
95
+ WHERE {{
96
+ ?resource a <{resource_type}> .
97
+ ?resource <{connection}> ?asset .
98
+ ?asset a <{asset_type}> .
99
+ }}"""
100
+
101
+ return query.format(
102
+ asset_type=self.asset_type,
103
+ resource_type=self.resource_type,
104
+ connection=self.resource_to_asset_connection,
105
+ )
106
+
107
+ def __init__(
108
+ self,
109
+ resource_to_asset_connection: URIRef,
110
+ resource_type: URIRef,
111
+ asset_to_resource_connection: URIRef | None = None,
112
+ asset_type: URIRef | None = None,
113
+ ) -> None:
114
+ self.asset_type = asset_type or DEFAULT_NAMESPACE.Asset
115
+ self.resource_to_asset_connection = resource_to_asset_connection
116
+ self.resource_type = resource_type
117
+
118
+ if asset_to_resource_connection:
119
+ self.asset_to_resource_connection = asset_to_resource_connection
120
+ else:
121
+ namespace = Namespace(get_namespace(resource_type))
122
+ type_ = remove_namespace_from_uri(resource_type)
123
+ self.asset_to_resource_connection = namespace[type_[0].lower() + type_[1:]]
124
+
125
+ def operation(self, query_result_row: ResultRow) -> RowTransformationOutput:
126
+ row_output = RowTransformationOutput()
127
+ subject, object = query_result_row
128
+
129
+ row_output.add_triples.append(cast(Triple, (subject, self.asset_to_resource_connection, object)))
130
+
131
+ row_output.instances_modified_count += 1
132
+
133
+ return row_output
113
134
 
114
135
 
115
136
  class AssetTimeSeriesConnector(BaseAssetConnector):
116
137
  description: str = "Connects assets to timeseries, thus forming bi-directional connection"
117
- _use_only_once: bool = True
118
138
  _need_changes = frozenset(
119
139
  {
120
140
  str(extractors.AssetsExtractor.__name__),
121
141
  str(extractors.TimeSeriesExtractor.__name__),
122
142
  }
123
143
  )
124
- _item_type = DEFAULT_NAMESPACE.TimeSeries
125
- _default_attribute = DEFAULT_NAMESPACE.assetId
126
- _connection_type = DEFAULT_NAMESPACE.timeSeries
144
+
145
+ def __init__(
146
+ self,
147
+ resource_to_asset_connection: URIRef | None = None,
148
+ resource_type: URIRef | None = None,
149
+ asset_to_resource_connection: URIRef | None = None,
150
+ asset_type: URIRef | None = None,
151
+ ):
152
+ super().__init__(
153
+ resource_to_asset_connection=resource_to_asset_connection or DEFAULT_NAMESPACE.assetId,
154
+ resource_type=resource_type or DEFAULT_NAMESPACE.TimeSeries,
155
+ asset_to_resource_connection=asset_to_resource_connection or DEFAULT_NAMESPACE.timeSeries,
156
+ asset_type=asset_type or DEFAULT_NAMESPACE.Asset,
157
+ )
127
158
 
128
159
 
129
160
  class AssetSequenceConnector(BaseAssetConnector):
130
161
  description: str = "Connects assets to sequences, thus forming bi-directional connection"
131
- _use_only_once: bool = True
132
162
  _need_changes = frozenset(
133
163
  {
134
164
  str(extractors.AssetsExtractor.__name__),
135
165
  str(extractors.SequencesExtractor.__name__),
136
166
  }
137
167
  )
138
- _item_type = DEFAULT_NAMESPACE.Sequence
139
- _default_attribute = DEFAULT_NAMESPACE.assetId
140
- _connection_type = DEFAULT_NAMESPACE.sequence
168
+
169
+ def __init__(
170
+ self,
171
+ resource_to_asset_connection: URIRef | None = None,
172
+ resource_type: URIRef | None = None,
173
+ asset_to_resource_connection: URIRef | None = None,
174
+ asset_type: URIRef | None = None,
175
+ ):
176
+ super().__init__(
177
+ resource_to_asset_connection=resource_to_asset_connection or DEFAULT_NAMESPACE.assetId,
178
+ resource_type=resource_type or DEFAULT_NAMESPACE.Sequence,
179
+ asset_to_resource_connection=asset_to_resource_connection or DEFAULT_NAMESPACE.sequence,
180
+ asset_type=asset_type or DEFAULT_NAMESPACE.Asset,
181
+ )
141
182
 
142
183
 
143
184
  class AssetFileConnector(BaseAssetConnector):
144
185
  description: str = "Connects assets to files, thus forming bi-directional connection"
145
- _use_only_once: bool = True
146
186
  _need_changes = frozenset(
147
187
  {
148
188
  str(extractors.AssetsExtractor.__name__),
149
189
  str(extractors.FilesExtractor.__name__),
150
190
  }
151
191
  )
152
- _item_type = DEFAULT_NAMESPACE.File
153
- _default_attribute = DEFAULT_NAMESPACE.assetIds
154
- _connection_type = DEFAULT_NAMESPACE.file
192
+
193
+ def __init__(
194
+ self,
195
+ resource_to_asset_connection: URIRef | None = None,
196
+ resource_type: URIRef | None = None,
197
+ asset_to_resource_connection: URIRef | None = None,
198
+ asset_type: URIRef | None = None,
199
+ ):
200
+ super().__init__(
201
+ resource_to_asset_connection=resource_to_asset_connection or DEFAULT_NAMESPACE.assetIds,
202
+ resource_type=resource_type or DEFAULT_NAMESPACE.File,
203
+ asset_to_resource_connection=asset_to_resource_connection or DEFAULT_NAMESPACE.file,
204
+ asset_type=asset_type or DEFAULT_NAMESPACE.Asset,
205
+ )
155
206
 
156
207
 
157
208
  class AssetEventConnector(BaseAssetConnector):
158
209
  description: str = "Connects assets to events, thus forming bi-directional connection"
159
- _use_only_once: bool = True
160
210
  _need_changes = frozenset(
161
211
  {
162
212
  str(extractors.AssetsExtractor.__name__),
163
213
  str(extractors.EventsExtractor.__name__),
164
214
  }
165
215
  )
166
- _item_type = DEFAULT_NAMESPACE.Event
167
- _default_attribute = DEFAULT_NAMESPACE.assetIds
168
- _connection_type = DEFAULT_NAMESPACE.event
216
+
217
+ def __init__(
218
+ self,
219
+ resource_to_asset_connection: URIRef | None = None,
220
+ resource_type: URIRef | None = None,
221
+ asset_to_resource_connection: URIRef | None = None,
222
+ asset_type: URIRef | None = None,
223
+ ):
224
+ super().__init__(
225
+ resource_to_asset_connection=resource_to_asset_connection or DEFAULT_NAMESPACE.assetIds,
226
+ resource_type=resource_type or DEFAULT_NAMESPACE.Event,
227
+ asset_to_resource_connection=asset_to_resource_connection or DEFAULT_NAMESPACE.event,
228
+ asset_type=asset_type or DEFAULT_NAMESPACE.Asset,
229
+ )
169
230
 
170
231
 
171
232
  # TODO: standardise
@@ -1,15 +1,14 @@
1
1
  from typing import cast
2
2
  from urllib.parse import quote
3
3
 
4
- from rdflib import Graph, URIRef
4
+ from rdflib import Graph, Namespace, URIRef
5
5
  from rdflib.query import ResultRow
6
6
 
7
- from cognite.neat._constants import DEFAULT_NAMESPACE
8
7
  from cognite.neat._rules.analysis import InformationAnalysis
9
8
  from cognite.neat._rules.models._rdfpath import RDFPath, SingleProperty
10
9
  from cognite.neat._rules.models.information import InformationRules
11
10
  from cognite.neat._shared import Triple
12
- from cognite.neat._utils.rdf_ import remove_namespace_from_uri
11
+ from cognite.neat._utils.rdf_ import get_namespace, remove_namespace_from_uri
13
12
 
14
13
  from ._base import BaseTransformer, BaseTransformerStandardised, RowTransformationOutput
15
14
 
@@ -76,11 +75,11 @@ class MakeConnectionOnExactMatch(BaseTransformerStandardised):
76
75
  self.subject_predicate = subject_predicate
77
76
  self.object_type = object_type
78
77
  self.object_predicate = object_predicate
79
-
78
+ subject_namespace = Namespace(get_namespace(subject_type))
80
79
  self.connection = (
81
- DEFAULT_NAMESPACE[quote(connection.strip())]
80
+ subject_namespace[quote(connection.strip())]
82
81
  if isinstance(connection, str)
83
- else connection or DEFAULT_NAMESPACE[remove_namespace_from_uri(self.object_type).lower()]
82
+ else connection or subject_namespace[remove_namespace_from_uri(self.object_type).lower()]
84
83
  )
85
84
 
86
85
  self.limit = limit
@@ -88,10 +87,10 @@ class MakeConnectionOnExactMatch(BaseTransformerStandardised):
88
87
  def _iterate_query(self) -> str:
89
88
  query = """SELECT DISTINCT ?subject ?object
90
89
  WHERE {{
91
- ?subject a <{subject_type}> .
92
- ?subject <{subject_predicate}> ?value .
93
- ?object <{object_predicate}> ?value .
94
- ?object a <{object_type}> .
90
+ ?subject a <{subject_type}> ;
91
+ <{subject_predicate}> ?value .
92
+ ?object a <{object_type}> ;
93
+ <{object_predicate}> ?value .
95
94
  }}"""
96
95
 
97
96
  if self.limit and isinstance(self.limit, int) and self.limit > 0:
@@ -105,12 +104,12 @@ class MakeConnectionOnExactMatch(BaseTransformerStandardised):
105
104
  )
106
105
 
107
106
  def _count_query(self) -> str:
108
- query = """SELECT (COUNT(DISTINCT (?subject ?object)) as ?count)
107
+ query = """SELECT (COUNT(DISTINCT ?subject) as ?count)
109
108
  WHERE {{
110
- ?subject a <{subject_type}> .
111
- ?subject <{subject_predicate}> ?value .
112
- ?object <{object_predicate}> ?value .
113
- ?object a <{object_type}> .
109
+ ?subject a <{subject_type}> ;
110
+ <{subject_predicate}> ?value .
111
+ ?object a <{object_type}> ;
112
+ <{object_predicate}> ?value .
114
113
  }}"""
115
114
 
116
115
  if self.limit and isinstance(self.limit, int) and self.limit > 0:
@@ -28,6 +28,7 @@ from ._models import (
28
28
  from ._properties import (
29
29
  PropertyDataTypeConversionWarning,
30
30
  PropertyDefinitionDuplicatedWarning,
31
+ PropertyDirectRelationLimitWarning,
31
32
  PropertyNotFoundWarning,
32
33
  PropertyOverwritingWarning,
33
34
  PropertySkippedWarning,
@@ -64,6 +65,7 @@ __all__ = [
64
65
  "PrincipleSolutionBuildsOnEnterpriseWarning",
65
66
  "PropertyDataTypeConversionWarning",
66
67
  "PropertyDefinitionDuplicatedWarning",
68
+ "PropertyDirectRelationLimitWarning",
67
69
  "PropertyNotFoundWarning",
68
70
  "PropertyOverwritingWarning",
69
71
  "PropertySkippedWarning",
@@ -1,6 +1,7 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import Generic
3
3
 
4
+ from cognite.neat._constants import DMS_DIRECT_RELATION_LIST_LIMIT
4
5
  from cognite.neat._issues._base import ResourceType
5
6
 
6
7
  from ._resources import ResourceNeatWarning, T_Identifier, T_ReferenceIdentifier
@@ -77,3 +78,13 @@ class PropertyDataTypeConversionWarning(PropertyWarning[T_Identifier]):
77
78
  """The {resource_type} with identifier {identifier} failed to convert the property {property_name}: {error}"""
78
79
 
79
80
  error: str
81
+
82
+
83
+ @dataclass(unsafe_hash=True)
84
+ class PropertyDirectRelationLimitWarning(PropertyWarning[T_Identifier]):
85
+ """The listable direct relation property {property_name} in the {resource_type} with identifier {identifier}
86
+ has more than {limit} relations. The relations will be sorted by (space, externalId) and truncated."""
87
+
88
+ resource_type = "view"
89
+
90
+ limit: int = DMS_DIRECT_RELATION_LIST_LIMIT
@@ -23,8 +23,9 @@ def get_cognite_client(env_file_name: str) -> CogniteClient:
23
23
  be prompted to enter them.
24
24
 
25
25
  Args:
26
- env_file_name: The name of the .env file to look for in the repository root. If the file is found, the variables
27
- will be loaded from the file. If the file is not found, the user will be prompted to enter the variables.
26
+ env_file_name: The name of the .env file to look for in the repository root / current working directory. If
27
+ the file is found, the variables will be loaded from the file. If the file is not found, the user will
28
+ be prompted to enter the variables and the file will be created.
28
29
 
29
30
  Returns:
30
31
  CogniteClient: A CogniteClient instance.
@@ -40,26 +41,44 @@ def get_cognite_client(env_file_name: str) -> CogniteClient:
40
41
  client = variables.get_client()
41
42
  print(f"Found {env_file_name} file in repository root. Loaded variables from {env_file_name} file.")
42
43
  return client
44
+ elif (Path.cwd() / env_file_name).exists():
45
+ with suppress(KeyError, FileNotFoundError, TypeError):
46
+ variables = _from_dotenv(Path.cwd() / env_file_name)
47
+ client = variables.get_client()
48
+ print(
49
+ f"Found {env_file_name} file in current working directory. Loaded variables from {env_file_name} file."
50
+ )
51
+ return client
43
52
  # Then try to load from environment variables
44
53
  with suppress(KeyError):
45
54
  variables = EnvironmentVariables.create_from_environ()
55
+ print("Loaded variables from environment variables.")
46
56
  return variables.get_client()
47
57
  # If not found, prompt the user
48
58
  variables = _prompt_user()
49
59
  if repo_root and _env_in_gitignore(repo_root, env_file_name):
50
- local_import("rich", "jupyter")
51
- from rich.prompt import Prompt
52
-
53
60
  env_file = repo_root / env_file_name
54
- answer = Prompt.ask(
55
- f"Do you store the variables in an {env_file_name} file in the repository root for easy reuse?",
56
- choices=["y", "n"],
57
- )
58
- if env_file.exists():
59
- answer = Prompt.ask(f"{env_file} already exists. Overwrite?", choices=["y", "n"])
60
- if answer == "y":
61
- env_file.write_text(variables.create_env_file())
62
- print(f"Created {env_file_name} file in repository root.")
61
+ location = "repository root"
62
+ elif repo_root:
63
+ # We do not offer to create the file in the repository root if it is in .gitignore
64
+ # as an inexperienced user might accidentally commit it.
65
+ print("Cannot create .env file in repository root as there is no .env entry in the .gitignore.")
66
+ return variables.get_client()
67
+ else:
68
+ env_file = Path.cwd() / env_file_name
69
+ location = "current working directory"
70
+ local_import("rich", "jupyter")
71
+ from rich.prompt import Prompt
72
+
73
+ answer = Prompt.ask(
74
+ f"Do you store the variables in an {env_file_name} file in the {location} for easy reuse?",
75
+ choices=["y", "n"],
76
+ )
77
+ if env_file.exists():
78
+ answer = Prompt.ask(f"{env_file} already exists. Overwrite?", choices=["y", "n"])
79
+ if answer == "y":
80
+ env_file.write_text(variables.create_env_file())
81
+ print(f"Created {env_file_name} file in {location}.")
63
82
 
64
83
  return variables.get_client()
65
84
 
@@ -320,7 +339,8 @@ def _prompt_cluster_and_project() -> EnvironmentVariables:
320
339
  def _repo_root() -> Path | None:
321
340
  with suppress(Exception):
322
341
  result = subprocess.run("git rev-parse --show-toplevel".split(), stdout=subprocess.PIPE)
323
- return Path(result.stdout.decode().strip())
342
+ if (output := result.stdout.decode().strip()) != "":
343
+ return Path(output)
324
344
  return None
325
345
 
326
346
 
@@ -0,0 +1,2 @@
1
+ __version__ = "0.105.2"
2
+ __engine__ = "^2.0.3"
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cognite-neat"
3
- version = "0.105.0"
3
+ version = "0.105.2"
4
4
  readme = "README.md"
5
5
  description = "Knowledge graph transformation"
6
6
  authors = [
@@ -53,7 +53,7 @@ neat = "cognite.neat._app.main:run"
53
53
  python = "^3.10"
54
54
  # Core dependencies
55
55
  pandas = "*"
56
- cognite-sdk = "^7.54.6"
56
+ cognite-sdk = "^7.71.2"
57
57
  rdflib = "*"
58
58
  pydantic = "^2"
59
59
  PyYAML = "*"
@@ -167,7 +167,7 @@ types-openpyxl = "^3"
167
167
  types-requests = "^2"
168
168
  types-setuptools = "^68"
169
169
  networkx-stubs = "^0.0.1"
170
- cognite-toolkit = "^0.3.23"
170
+ cognite-toolkit = "^0.3.24"
171
171
 
172
172
 
173
173
  [build-system]
@@ -1,2 +0,0 @@
1
- __version__ = "0.105.0"
2
- __engine__ = "^2.0.3"
File without changes
File without changes