cognite-neat 0.70.1__py3-none-any.whl → 0.127.19__py3-none-any.whl

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 (530) hide show
  1. cognite/neat/__init__.py +4 -1
  2. cognite/neat/_client/__init__.py +4 -0
  3. cognite/neat/_client/api.py +8 -0
  4. cognite/neat/_client/client.py +21 -0
  5. cognite/neat/_client/config.py +40 -0
  6. cognite/neat/_client/containers_api.py +125 -0
  7. cognite/neat/_client/data_classes.py +44 -0
  8. cognite/neat/_client/data_model_api.py +115 -0
  9. cognite/neat/_client/spaces_api.py +115 -0
  10. cognite/neat/_client/statistics_api.py +24 -0
  11. cognite/neat/_client/views_api.py +129 -0
  12. cognite/neat/_data_model/_analysis.py +186 -0
  13. cognite/neat/_data_model/_constants.py +67 -0
  14. cognite/neat/_data_model/_identifiers.py +61 -0
  15. cognite/neat/_data_model/_shared.py +41 -0
  16. cognite/neat/_data_model/deployer/_differ.py +140 -0
  17. cognite/neat/_data_model/deployer/_differ_container.py +360 -0
  18. cognite/neat/_data_model/deployer/_differ_data_model.py +54 -0
  19. cognite/neat/_data_model/deployer/_differ_space.py +9 -0
  20. cognite/neat/_data_model/deployer/_differ_view.py +299 -0
  21. cognite/neat/_data_model/deployer/data_classes.py +529 -0
  22. cognite/neat/_data_model/deployer/deployer.py +401 -0
  23. cognite/neat/_data_model/exporters/__init__.py +15 -0
  24. cognite/neat/_data_model/exporters/_api_exporter.py +37 -0
  25. cognite/neat/_data_model/exporters/_base.py +24 -0
  26. cognite/neat/_data_model/exporters/_table_exporter/exporter.py +128 -0
  27. cognite/neat/_data_model/exporters/_table_exporter/workbook.py +409 -0
  28. cognite/neat/_data_model/exporters/_table_exporter/writer.py +399 -0
  29. cognite/neat/_data_model/importers/__init__.py +5 -0
  30. cognite/neat/_data_model/importers/_api_importer.py +166 -0
  31. cognite/neat/_data_model/importers/_base.py +16 -0
  32. cognite/neat/_data_model/importers/_table_importer/data_classes.py +291 -0
  33. cognite/neat/_data_model/importers/_table_importer/importer.py +192 -0
  34. cognite/neat/_data_model/importers/_table_importer/reader.py +875 -0
  35. cognite/neat/_data_model/importers/_table_importer/source.py +94 -0
  36. cognite/neat/_data_model/models/conceptual/_base.py +18 -0
  37. cognite/neat/_data_model/models/conceptual/_concept.py +67 -0
  38. cognite/neat/_data_model/models/conceptual/_data_model.py +51 -0
  39. cognite/neat/_data_model/models/conceptual/_properties.py +104 -0
  40. cognite/neat/_data_model/models/conceptual/_property.py +105 -0
  41. cognite/neat/_data_model/models/dms/__init__.py +206 -0
  42. cognite/neat/_data_model/models/dms/_base.py +31 -0
  43. cognite/neat/_data_model/models/dms/_constants.py +47 -0
  44. cognite/neat/_data_model/models/dms/_constraints.py +42 -0
  45. cognite/neat/_data_model/models/dms/_container.py +159 -0
  46. cognite/neat/_data_model/models/dms/_data_model.py +94 -0
  47. cognite/neat/_data_model/models/dms/_data_types.py +195 -0
  48. cognite/neat/_data_model/models/dms/_http.py +28 -0
  49. cognite/neat/_data_model/models/dms/_indexes.py +30 -0
  50. cognite/neat/_data_model/models/dms/_limits.py +96 -0
  51. cognite/neat/_data_model/models/dms/_references.py +135 -0
  52. cognite/neat/_data_model/models/dms/_schema.py +18 -0
  53. cognite/neat/_data_model/models/dms/_space.py +48 -0
  54. cognite/neat/_data_model/models/dms/_types.py +17 -0
  55. cognite/neat/_data_model/models/dms/_view_filter.py +282 -0
  56. cognite/neat/_data_model/models/dms/_view_property.py +235 -0
  57. cognite/neat/_data_model/models/dms/_views.py +210 -0
  58. cognite/neat/_data_model/models/entities/__init__.py +50 -0
  59. cognite/neat/_data_model/models/entities/_base.py +101 -0
  60. cognite/neat/_data_model/models/entities/_constants.py +22 -0
  61. cognite/neat/_data_model/models/entities/_data_types.py +144 -0
  62. cognite/neat/_data_model/models/entities/_identifiers.py +61 -0
  63. cognite/neat/_data_model/models/entities/_parser.py +226 -0
  64. cognite/neat/_data_model/validation/dms/__init__.py +57 -0
  65. cognite/neat/_data_model/validation/dms/_ai_readiness.py +167 -0
  66. cognite/neat/_data_model/validation/dms/_base.py +304 -0
  67. cognite/neat/_data_model/validation/dms/_connections.py +627 -0
  68. cognite/neat/_data_model/validation/dms/_consistency.py +56 -0
  69. cognite/neat/_data_model/validation/dms/_containers.py +135 -0
  70. cognite/neat/_data_model/validation/dms/_limits.py +414 -0
  71. cognite/neat/_data_model/validation/dms/_orchestrator.py +202 -0
  72. cognite/neat/_data_model/validation/dms/_views.py +101 -0
  73. cognite/neat/_exceptions.py +56 -0
  74. cognite/neat/_issues.py +68 -0
  75. cognite/neat/_session/__init__.py +3 -0
  76. cognite/neat/_session/_html/_render.py +30 -0
  77. cognite/neat/_session/_html/static/__init__.py +8 -0
  78. cognite/neat/_session/_html/static/deployment.css +303 -0
  79. cognite/neat/_session/_html/static/deployment.js +149 -0
  80. cognite/neat/_session/_html/static/issues.css +211 -0
  81. cognite/neat/_session/_html/static/issues.js +167 -0
  82. cognite/neat/_session/_html/static/shared.css +186 -0
  83. cognite/neat/_session/_html/templates/__init__.py +4 -0
  84. cognite/neat/_session/_html/templates/deployment.html +74 -0
  85. cognite/neat/_session/_html/templates/issues.html +44 -0
  86. cognite/neat/_session/_issues.py +76 -0
  87. cognite/neat/_session/_opt.py +35 -0
  88. cognite/neat/_session/_physical.py +240 -0
  89. cognite/neat/_session/_result.py +231 -0
  90. cognite/neat/_session/_session.py +69 -0
  91. cognite/neat/_session/_usage_analytics/_collector.py +131 -0
  92. cognite/neat/_session/_usage_analytics/_constants.py +23 -0
  93. cognite/neat/_session/_usage_analytics/_storage.py +240 -0
  94. cognite/neat/_session/_wrappers.py +82 -0
  95. cognite/neat/_state_machine/__init__.py +10 -0
  96. cognite/neat/_state_machine/_base.py +37 -0
  97. cognite/neat/_state_machine/_states.py +52 -0
  98. cognite/neat/_store/__init__.py +3 -0
  99. cognite/neat/_store/_provenance.py +71 -0
  100. cognite/neat/_store/_store.py +144 -0
  101. cognite/neat/_utils/_reader.py +194 -0
  102. cognite/neat/_utils/auxiliary.py +39 -0
  103. cognite/neat/_utils/collection.py +11 -0
  104. cognite/neat/_utils/http_client/__init__.py +39 -0
  105. cognite/neat/_utils/http_client/_client.py +245 -0
  106. cognite/neat/_utils/http_client/_config.py +19 -0
  107. cognite/neat/_utils/http_client/_data_classes.py +294 -0
  108. cognite/neat/_utils/http_client/_tracker.py +31 -0
  109. cognite/neat/_utils/text.py +71 -0
  110. cognite/neat/_utils/useful_types.py +37 -0
  111. cognite/neat/_utils/validation.py +149 -0
  112. cognite/neat/_version.py +2 -1
  113. cognite/neat/v0/core/__init__.py +0 -0
  114. cognite/neat/v0/core/_client/__init__.py +4 -0
  115. cognite/neat/v0/core/_client/_api/__init__.py +0 -0
  116. cognite/neat/v0/core/_client/_api/data_modeling_loaders.py +1032 -0
  117. cognite/neat/v0/core/_client/_api/neat_instances.py +101 -0
  118. cognite/neat/v0/core/_client/_api/schema.py +158 -0
  119. cognite/neat/v0/core/_client/_api/statistics.py +91 -0
  120. cognite/neat/v0/core/_client/_api_client.py +21 -0
  121. cognite/neat/v0/core/_client/data_classes/__init__.py +0 -0
  122. cognite/neat/v0/core/_client/data_classes/data_modeling.py +198 -0
  123. cognite/neat/v0/core/_client/data_classes/neat_sequence.py +261 -0
  124. cognite/neat/v0/core/_client/data_classes/schema.py +540 -0
  125. cognite/neat/v0/core/_client/data_classes/statistics.py +125 -0
  126. cognite/neat/v0/core/_client/testing.py +39 -0
  127. cognite/neat/v0/core/_config.py +11 -0
  128. cognite/neat/v0/core/_constants.py +278 -0
  129. cognite/neat/v0/core/_data_model/__init__.py +0 -0
  130. cognite/neat/v0/core/_data_model/_constants.py +210 -0
  131. cognite/neat/v0/core/_data_model/_shared.py +59 -0
  132. cognite/neat/v0/core/_data_model/analysis/__init__.py +3 -0
  133. cognite/neat/v0/core/_data_model/analysis/_base.py +578 -0
  134. cognite/neat/v0/core/_data_model/catalog/__init__.py +8 -0
  135. cognite/neat/v0/core/_data_model/catalog/classic_model.xlsx +0 -0
  136. cognite/neat/v0/core/_data_model/catalog/conceptual-imf-data-model.xlsx +0 -0
  137. cognite/neat/v0/core/_data_model/catalog/hello_world_pump.xlsx +0 -0
  138. cognite/neat/v0/core/_data_model/exporters/__init__.py +38 -0
  139. cognite/neat/v0/core/_data_model/exporters/_base.py +67 -0
  140. cognite/neat/v0/core/_data_model/exporters/_data_model2dms.py +428 -0
  141. cognite/neat/v0/core/_data_model/exporters/_data_model2excel.py +612 -0
  142. cognite/neat/v0/core/_data_model/exporters/_data_model2instance_template.py +158 -0
  143. cognite/neat/v0/core/_data_model/exporters/_data_model2semantic_model.py +646 -0
  144. cognite/neat/v0/core/_data_model/exporters/_data_model2yaml.py +84 -0
  145. cognite/neat/v0/core/_data_model/importers/__init__.py +49 -0
  146. cognite/neat/v0/core/_data_model/importers/_base.py +64 -0
  147. cognite/neat/v0/core/_data_model/importers/_base_file_reader.py +56 -0
  148. cognite/neat/v0/core/_data_model/importers/_dict2data_model.py +131 -0
  149. cognite/neat/v0/core/_data_model/importers/_dms2data_model.py +705 -0
  150. cognite/neat/v0/core/_data_model/importers/_graph2data_model.py +299 -0
  151. cognite/neat/v0/core/_data_model/importers/_rdf/__init__.py +4 -0
  152. cognite/neat/v0/core/_data_model/importers/_rdf/_base.py +161 -0
  153. cognite/neat/v0/core/_data_model/importers/_rdf/_inference2rdata_model.py +618 -0
  154. cognite/neat/v0/core/_data_model/importers/_rdf/_owl2data_model.py +124 -0
  155. cognite/neat/v0/core/_data_model/importers/_rdf/_shared.py +255 -0
  156. cognite/neat/v0/core/_data_model/importers/_spreadsheet2data_model.py +424 -0
  157. cognite/neat/v0/core/_data_model/models/__init__.py +38 -0
  158. cognite/neat/v0/core/_data_model/models/_base_unverified.py +181 -0
  159. cognite/neat/v0/core/_data_model/models/_base_verified.py +449 -0
  160. cognite/neat/v0/core/_data_model/models/_import_contexts.py +82 -0
  161. cognite/neat/v0/core/_data_model/models/_types.py +171 -0
  162. cognite/neat/v0/core/_data_model/models/conceptual/__init__.py +25 -0
  163. cognite/neat/v0/core/_data_model/models/conceptual/_unverified.py +193 -0
  164. cognite/neat/v0/core/_data_model/models/conceptual/_validation.py +308 -0
  165. cognite/neat/v0/core/_data_model/models/conceptual/_verified.py +327 -0
  166. cognite/neat/v0/core/_data_model/models/data_types.py +422 -0
  167. cognite/neat/v0/core/_data_model/models/entities/__init__.py +70 -0
  168. cognite/neat/v0/core/_data_model/models/entities/_constants.py +18 -0
  169. cognite/neat/v0/core/_data_model/models/entities/_loaders.py +155 -0
  170. cognite/neat/v0/core/_data_model/models/entities/_multi_value.py +83 -0
  171. cognite/neat/v0/core/_data_model/models/entities/_restrictions.py +230 -0
  172. cognite/neat/v0/core/_data_model/models/entities/_single_value.py +676 -0
  173. cognite/neat/v0/core/_data_model/models/entities/_types.py +103 -0
  174. cognite/neat/v0/core/_data_model/models/entities/_wrapped.py +217 -0
  175. cognite/neat/v0/core/_data_model/models/mapping/__init__.py +3 -0
  176. cognite/neat/v0/core/_data_model/models/mapping/_classic2core.py +39 -0
  177. cognite/neat/v0/core/_data_model/models/mapping/_classic2core.yaml +608 -0
  178. cognite/neat/v0/core/_data_model/models/physical/__init__.py +40 -0
  179. cognite/neat/v0/core/_data_model/models/physical/_exporter.py +658 -0
  180. cognite/neat/v0/core/_data_model/models/physical/_unverified.py +557 -0
  181. cognite/neat/v0/core/_data_model/models/physical/_validation.py +887 -0
  182. cognite/neat/v0/core/_data_model/models/physical/_verified.py +667 -0
  183. cognite/neat/v0/core/_data_model/transformers/__init__.py +70 -0
  184. cognite/neat/v0/core/_data_model/transformers/_base.py +79 -0
  185. cognite/neat/v0/core/_data_model/transformers/_converters.py +2485 -0
  186. cognite/neat/v0/core/_data_model/transformers/_mapping.py +390 -0
  187. cognite/neat/v0/core/_data_model/transformers/_union_conceptual.py +208 -0
  188. cognite/neat/v0/core/_data_model/transformers/_verification.py +120 -0
  189. cognite/neat/v0/core/_instances/__init__.py +0 -0
  190. cognite/neat/v0/core/_instances/_shared.py +37 -0
  191. cognite/neat/v0/core/_instances/_tracking/__init__.py +4 -0
  192. cognite/neat/v0/core/_instances/_tracking/base.py +30 -0
  193. cognite/neat/v0/core/_instances/_tracking/log.py +27 -0
  194. cognite/neat/v0/core/_instances/extractors/__init__.py +76 -0
  195. cognite/neat/v0/core/_instances/extractors/_base.py +58 -0
  196. cognite/neat/v0/core/_instances/extractors/_classic_cdf/__init__.py +0 -0
  197. cognite/neat/v0/core/_instances/extractors/_classic_cdf/_assets.py +37 -0
  198. cognite/neat/v0/core/_instances/extractors/_classic_cdf/_base.py +443 -0
  199. cognite/neat/v0/core/_instances/extractors/_classic_cdf/_classic.py +479 -0
  200. cognite/neat/v0/core/_instances/extractors/_classic_cdf/_data_sets.py +35 -0
  201. cognite/neat/v0/core/_instances/extractors/_classic_cdf/_events.py +33 -0
  202. cognite/neat/v0/core/_instances/extractors/_classic_cdf/_files.py +45 -0
  203. cognite/neat/v0/core/_instances/extractors/_classic_cdf/_labels.py +54 -0
  204. cognite/neat/v0/core/_instances/extractors/_classic_cdf/_relationships.py +122 -0
  205. cognite/neat/v0/core/_instances/extractors/_classic_cdf/_sequences.py +280 -0
  206. cognite/neat/v0/core/_instances/extractors/_classic_cdf/_timeseries.py +48 -0
  207. cognite/neat/v0/core/_instances/extractors/_dict.py +105 -0
  208. cognite/neat/v0/core/_instances/extractors/_dms.py +315 -0
  209. cognite/neat/v0/core/_instances/extractors/_dms_graph.py +238 -0
  210. cognite/neat/v0/core/_instances/extractors/_mock_graph_generator.py +404 -0
  211. cognite/neat/v0/core/_instances/extractors/_raw.py +67 -0
  212. cognite/neat/v0/core/_instances/extractors/_rdf_file.py +80 -0
  213. cognite/neat/v0/core/_instances/loaders/__init__.py +24 -0
  214. cognite/neat/v0/core/_instances/loaders/_base.py +116 -0
  215. cognite/neat/v0/core/_instances/loaders/_rdf2dms.py +649 -0
  216. cognite/neat/v0/core/_instances/loaders/_rdf_to_instance_space.py +249 -0
  217. cognite/neat/v0/core/_instances/queries/__init__.py +3 -0
  218. cognite/neat/v0/core/_instances/queries/_base.py +16 -0
  219. cognite/neat/v0/core/_instances/queries/_queries.py +16 -0
  220. cognite/neat/v0/core/_instances/queries/_select.py +478 -0
  221. cognite/neat/v0/core/_instances/queries/_update.py +37 -0
  222. cognite/neat/v0/core/_instances/transformers/__init__.py +65 -0
  223. cognite/neat/v0/core/_instances/transformers/_base.py +133 -0
  224. cognite/neat/v0/core/_instances/transformers/_classic_cdf.py +589 -0
  225. cognite/neat/v0/core/_instances/transformers/_prune_graph.py +315 -0
  226. cognite/neat/v0/core/_instances/transformers/_rdfpath.py +84 -0
  227. cognite/neat/v0/core/_instances/transformers/_value_type.py +366 -0
  228. cognite/neat/v0/core/_issues/__init__.py +21 -0
  229. cognite/neat/v0/core/_issues/_base.py +348 -0
  230. cognite/neat/v0/core/_issues/_contextmanagers.py +50 -0
  231. cognite/neat/v0/core/_issues/_factory.py +69 -0
  232. cognite/neat/v0/core/_issues/errors/__init__.py +90 -0
  233. cognite/neat/v0/core/_issues/errors/_external.py +91 -0
  234. cognite/neat/v0/core/_issues/errors/_general.py +51 -0
  235. cognite/neat/v0/core/_issues/errors/_properties.py +80 -0
  236. cognite/neat/v0/core/_issues/errors/_resources.py +116 -0
  237. cognite/neat/v0/core/_issues/errors/_wrapper.py +93 -0
  238. cognite/neat/{rules/issues → v0/core/_issues}/formatters.py +12 -10
  239. cognite/neat/v0/core/_issues/warnings/__init__.py +99 -0
  240. cognite/neat/v0/core/_issues/warnings/_external.py +56 -0
  241. cognite/neat/v0/core/_issues/warnings/_general.py +46 -0
  242. cognite/neat/v0/core/_issues/warnings/_models.py +165 -0
  243. cognite/neat/v0/core/_issues/warnings/_properties.py +108 -0
  244. cognite/neat/v0/core/_issues/warnings/_resources.py +110 -0
  245. cognite/neat/v0/core/_issues/warnings/user_modeling.py +125 -0
  246. cognite/neat/v0/core/_shared.py +77 -0
  247. cognite/neat/v0/core/_store/__init__.py +4 -0
  248. cognite/neat/v0/core/_store/_data_model.py +487 -0
  249. cognite/neat/v0/core/_store/_instance.py +485 -0
  250. cognite/neat/v0/core/_store/_provenance.py +217 -0
  251. cognite/neat/v0/core/_store/exceptions.py +59 -0
  252. cognite/neat/v0/core/_utils/__init__.py +0 -0
  253. cognite/neat/v0/core/_utils/auth.py +364 -0
  254. cognite/neat/v0/core/_utils/auxiliary.py +169 -0
  255. cognite/neat/v0/core/_utils/collection_.py +66 -0
  256. cognite/neat/v0/core/_utils/graph_transformations_report.py +36 -0
  257. cognite/neat/v0/core/_utils/io_.py +11 -0
  258. cognite/neat/v0/core/_utils/rdf_.py +336 -0
  259. cognite/neat/v0/core/_utils/reader/__init__.py +3 -0
  260. cognite/neat/v0/core/_utils/reader/_base.py +194 -0
  261. cognite/neat/v0/core/_utils/spreadsheet.py +182 -0
  262. cognite/neat/v0/core/_utils/tarjan.py +44 -0
  263. cognite/neat/v0/core/_utils/text.py +277 -0
  264. cognite/neat/v0/core/_utils/time_.py +17 -0
  265. cognite/neat/v0/core/_utils/upload.py +134 -0
  266. cognite/neat/v0/core/_utils/xml_.py +52 -0
  267. cognite/neat/v0/plugins/__init__.py +4 -0
  268. cognite/neat/v0/plugins/_base.py +9 -0
  269. cognite/neat/v0/plugins/_data_model.py +48 -0
  270. cognite/neat/v0/plugins/_issues.py +35 -0
  271. cognite/neat/v0/plugins/_manager.py +94 -0
  272. cognite/neat/v0/session/__init__.py +3 -0
  273. cognite/neat/v0/session/_base.py +332 -0
  274. cognite/neat/v0/session/_collector.py +131 -0
  275. cognite/neat/v0/session/_diff.py +51 -0
  276. cognite/neat/v0/session/_drop.py +103 -0
  277. cognite/neat/v0/session/_experimental.py +26 -0
  278. cognite/neat/v0/session/_explore.py +39 -0
  279. cognite/neat/v0/session/_fix.py +28 -0
  280. cognite/neat/v0/session/_inspect.py +285 -0
  281. cognite/neat/v0/session/_mapping.py +71 -0
  282. cognite/neat/v0/session/_plugin.py +66 -0
  283. cognite/neat/v0/session/_prepare.py +286 -0
  284. cognite/neat/v0/session/_read.py +923 -0
  285. cognite/neat/v0/session/_set.py +101 -0
  286. cognite/neat/v0/session/_show.py +298 -0
  287. cognite/neat/v0/session/_state/README.md +23 -0
  288. cognite/neat/v0/session/_state.py +161 -0
  289. cognite/neat/v0/session/_subset.py +88 -0
  290. cognite/neat/v0/session/_template.py +208 -0
  291. cognite/neat/v0/session/_to.py +454 -0
  292. cognite/neat/v0/session/_wizard.py +44 -0
  293. cognite/neat/v0/session/engine/__init__.py +4 -0
  294. cognite/neat/v0/session/engine/_import.py +7 -0
  295. cognite/neat/v0/session/engine/_interface.py +25 -0
  296. cognite/neat/v0/session/engine/_load.py +131 -0
  297. cognite/neat/v0/session/exceptions.py +103 -0
  298. cognite/neat/v1.py +3 -0
  299. cognite_neat-0.127.19.dist-info/METADATA +145 -0
  300. cognite_neat-0.127.19.dist-info/RECORD +318 -0
  301. {cognite_neat-0.70.1.dist-info → cognite_neat-0.127.19.dist-info}/WHEEL +1 -1
  302. cognite/neat/app/api/asgi/metrics.py +0 -4
  303. cognite/neat/app/api/configuration.py +0 -110
  304. cognite/neat/app/api/context_manager/__init__.py +0 -3
  305. cognite/neat/app/api/context_manager/manager.py +0 -16
  306. cognite/neat/app/api/data_classes/configuration.py +0 -121
  307. cognite/neat/app/api/data_classes/rest.py +0 -78
  308. cognite/neat/app/api/explorer.py +0 -64
  309. cognite/neat/app/api/routers/configuration.py +0 -24
  310. cognite/neat/app/api/routers/core.py +0 -51
  311. cognite/neat/app/api/routers/crud.py +0 -112
  312. cognite/neat/app/api/routers/data_exploration.py +0 -334
  313. cognite/neat/app/api/routers/metrics.py +0 -10
  314. cognite/neat/app/api/routers/rules.py +0 -169
  315. cognite/neat/app/api/routers/workflows.py +0 -274
  316. cognite/neat/app/api/utils/data_mapping.py +0 -17
  317. cognite/neat/app/api/utils/logging.py +0 -26
  318. cognite/neat/app/api/utils/query_templates.py +0 -92
  319. cognite/neat/app/main.py +0 -17
  320. cognite/neat/app/monitoring/metrics.py +0 -69
  321. cognite/neat/app/ui/index.html +0 -1
  322. cognite/neat/app/ui/neat-app/.gitignore +0 -23
  323. cognite/neat/app/ui/neat-app/README.md +0 -70
  324. cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -14
  325. cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
  326. cognite/neat/app/ui/neat-app/build/index.html +0 -1
  327. cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
  328. cognite/neat/app/ui/neat-app/build/manifest.json +0 -25
  329. cognite/neat/app/ui/neat-app/build/robots.txt +0 -3
  330. cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css +0 -2
  331. cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css.map +0 -1
  332. cognite/neat/app/ui/neat-app/build/static/js/main.ed960141.js +0 -3
  333. cognite/neat/app/ui/neat-app/build/static/js/main.ed960141.js.LICENSE.txt +0 -97
  334. cognite/neat/app/ui/neat-app/build/static/js/main.ed960141.js.map +0 -1
  335. cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -1
  336. cognite/neat/config.py +0 -46
  337. cognite/neat/constants.py +0 -36
  338. cognite/neat/exceptions.py +0 -139
  339. cognite/neat/graph/__init__.py +0 -3
  340. cognite/neat/graph/exceptions.py +0 -91
  341. cognite/neat/graph/extractor/__init__.py +0 -6
  342. cognite/neat/graph/extractor/_base.py +0 -14
  343. cognite/neat/graph/extractor/_dexpi.py +0 -306
  344. cognite/neat/graph/extractor/_graph_capturing_sheet.py +0 -401
  345. cognite/neat/graph/extractor/_mock_graph_generator.py +0 -359
  346. cognite/neat/graph/extractors/_base.py +0 -14
  347. cognite/neat/graph/extractors/_mock_graph_generator.py +0 -359
  348. cognite/neat/graph/loader/__init__.py +0 -23
  349. cognite/neat/graph/loader/_asset_loader.py +0 -516
  350. cognite/neat/graph/loader/_base.py +0 -69
  351. cognite/neat/graph/loader/_exceptions.py +0 -87
  352. cognite/neat/graph/loader/core/labels.py +0 -58
  353. cognite/neat/graph/loader/core/models.py +0 -136
  354. cognite/neat/graph/loader/core/rdf_to_assets.py +0 -1047
  355. cognite/neat/graph/loader/core/rdf_to_relationships.py +0 -558
  356. cognite/neat/graph/loader/rdf_to_dms.py +0 -309
  357. cognite/neat/graph/loader/validator.py +0 -87
  358. cognite/neat/graph/models.py +0 -6
  359. cognite/neat/graph/stores/__init__.py +0 -13
  360. cognite/neat/graph/stores/_base.py +0 -384
  361. cognite/neat/graph/stores/_graphdb_store.py +0 -51
  362. cognite/neat/graph/stores/_memory_store.py +0 -43
  363. cognite/neat/graph/stores/_oxigraph_store.py +0 -145
  364. cognite/neat/graph/stores/_oxrdflib.py +0 -247
  365. cognite/neat/graph/stores/_rdf_to_graph.py +0 -40
  366. cognite/neat/graph/transformation/entity_matcher.py +0 -101
  367. cognite/neat/graph/transformation/query_generator/__init__.py +0 -3
  368. cognite/neat/graph/transformation/query_generator/sparql.py +0 -540
  369. cognite/neat/graph/transformation/transformer.py +0 -316
  370. cognite/neat/rules/_analysis/_base.py +0 -25
  371. cognite/neat/rules/_analysis/_information_rules.py +0 -414
  372. cognite/neat/rules/_shared.py +0 -5
  373. cognite/neat/rules/analysis.py +0 -231
  374. cognite/neat/rules/examples/Rules-Nordic44-to-TNT.xlsx +0 -0
  375. cognite/neat/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
  376. cognite/neat/rules/examples/__init__.py +0 -18
  377. cognite/neat/rules/examples/power-grid-containers.yaml +0 -113
  378. cognite/neat/rules/examples/power-grid-example.xlsx +0 -0
  379. cognite/neat/rules/examples/power-grid-model.yaml +0 -213
  380. cognite/neat/rules/examples/rules-template.xlsx +0 -0
  381. cognite/neat/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
  382. cognite/neat/rules/examples/skos-rules.xlsx +0 -0
  383. cognite/neat/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
  384. cognite/neat/rules/examples/wind-energy.owl +0 -1511
  385. cognite/neat/rules/exceptions.py +0 -2972
  386. cognite/neat/rules/exporter/__init__.py +0 -20
  387. cognite/neat/rules/exporter/_base.py +0 -45
  388. cognite/neat/rules/exporter/_core/__init__.py +0 -5
  389. cognite/neat/rules/exporter/_core/rules2labels.py +0 -24
  390. cognite/neat/rules/exporter/_rules2dms.py +0 -888
  391. cognite/neat/rules/exporter/_rules2excel.py +0 -212
  392. cognite/neat/rules/exporter/_rules2graphql.py +0 -183
  393. cognite/neat/rules/exporter/_rules2ontology.py +0 -523
  394. cognite/neat/rules/exporter/_rules2pydantic_models.py +0 -748
  395. cognite/neat/rules/exporter/_rules2rules.py +0 -104
  396. cognite/neat/rules/exporter/_rules2triples.py +0 -37
  397. cognite/neat/rules/exporter/_validation.py +0 -150
  398. cognite/neat/rules/exporters/__init__.py +0 -15
  399. cognite/neat/rules/exporters/_base.py +0 -42
  400. cognite/neat/rules/exporters/_models.py +0 -58
  401. cognite/neat/rules/exporters/_rules2dms.py +0 -259
  402. cognite/neat/rules/exporters/_rules2excel.py +0 -196
  403. cognite/neat/rules/exporters/_rules2ontology.py +0 -561
  404. cognite/neat/rules/exporters/_rules2yaml.py +0 -78
  405. cognite/neat/rules/exporters/_validation.py +0 -107
  406. cognite/neat/rules/importer/__init__.py +0 -22
  407. cognite/neat/rules/importer/_base.py +0 -70
  408. cognite/neat/rules/importer/_dict2rules.py +0 -158
  409. cognite/neat/rules/importer/_dms2rules.py +0 -196
  410. cognite/neat/rules/importer/_graph2rules.py +0 -304
  411. cognite/neat/rules/importer/_json2rules.py +0 -39
  412. cognite/neat/rules/importer/_owl2rules/__init__.py +0 -3
  413. cognite/neat/rules/importer/_owl2rules/_owl2classes.py +0 -239
  414. cognite/neat/rules/importer/_owl2rules/_owl2metadata.py +0 -255
  415. cognite/neat/rules/importer/_owl2rules/_owl2properties.py +0 -217
  416. cognite/neat/rules/importer/_owl2rules/_owl2rules.py +0 -290
  417. cognite/neat/rules/importer/_spreadsheet2rules.py +0 -45
  418. cognite/neat/rules/importer/_xsd2rules.py +0 -20
  419. cognite/neat/rules/importer/_yaml2rules.py +0 -39
  420. cognite/neat/rules/importers/__init__.py +0 -16
  421. cognite/neat/rules/importers/_base.py +0 -124
  422. cognite/neat/rules/importers/_dms2rules.py +0 -191
  423. cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -3
  424. cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -224
  425. cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -318
  426. cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -164
  427. cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -359
  428. cognite/neat/rules/importers/_owl2rules/__init__.py +0 -3
  429. cognite/neat/rules/importers/_owl2rules/_owl2classes.py +0 -219
  430. cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +0 -217
  431. cognite/neat/rules/importers/_owl2rules/_owl2properties.py +0 -203
  432. cognite/neat/rules/importers/_owl2rules/_owl2rules.py +0 -148
  433. cognite/neat/rules/importers/_spreadsheet2rules.py +0 -266
  434. cognite/neat/rules/importers/_yaml2rules.py +0 -110
  435. cognite/neat/rules/issues/__init__.py +0 -27
  436. cognite/neat/rules/issues/base.py +0 -190
  437. cognite/neat/rules/issues/dms.py +0 -331
  438. cognite/neat/rules/issues/fileread.py +0 -156
  439. cognite/neat/rules/issues/importing.py +0 -220
  440. cognite/neat/rules/issues/spreadsheet.py +0 -381
  441. cognite/neat/rules/issues/spreadsheet_file.py +0 -151
  442. cognite/neat/rules/models/__init__.py +0 -5
  443. cognite/neat/rules/models/_base.py +0 -151
  444. cognite/neat/rules/models/_rules/__init__.py +0 -14
  445. cognite/neat/rules/models/_rules/_types/__init__.py +0 -66
  446. cognite/neat/rules/models/_rules/_types/_base.py +0 -450
  447. cognite/neat/rules/models/_rules/_types/_field.py +0 -339
  448. cognite/neat/rules/models/_rules/_types/_value.py +0 -156
  449. cognite/neat/rules/models/_rules/base.py +0 -320
  450. cognite/neat/rules/models/_rules/dms_architect_rules.py +0 -1034
  451. cognite/neat/rules/models/_rules/dms_schema.py +0 -641
  452. cognite/neat/rules/models/_rules/domain_rules.py +0 -55
  453. cognite/neat/rules/models/_rules/information_rules.py +0 -525
  454. cognite/neat/rules/models/raw_rules.py +0 -304
  455. cognite/neat/rules/models/rdfpath.py +0 -238
  456. cognite/neat/rules/models/rules.py +0 -1269
  457. cognite/neat/rules/models/tables.py +0 -9
  458. cognite/neat/rules/models/value_types.py +0 -117
  459. cognite/neat/utils/__init__.py +0 -3
  460. cognite/neat/utils/auxiliary.py +0 -11
  461. cognite/neat/utils/cdf.py +0 -24
  462. cognite/neat/utils/cdf_loaders/__init__.py +0 -25
  463. cognite/neat/utils/cdf_loaders/_base.py +0 -62
  464. cognite/neat/utils/cdf_loaders/_data_modeling.py +0 -275
  465. cognite/neat/utils/cdf_loaders/_ingestion.py +0 -152
  466. cognite/neat/utils/cdf_loaders/data_classes.py +0 -121
  467. cognite/neat/utils/exceptions.py +0 -41
  468. cognite/neat/utils/spreadsheet.py +0 -84
  469. cognite/neat/utils/text.py +0 -104
  470. cognite/neat/utils/utils.py +0 -354
  471. cognite/neat/utils/xml.py +0 -37
  472. cognite/neat/workflows/__init__.py +0 -12
  473. cognite/neat/workflows/_exceptions.py +0 -41
  474. cognite/neat/workflows/base.py +0 -574
  475. cognite/neat/workflows/cdf_store.py +0 -393
  476. cognite/neat/workflows/examples/Export DMS/workflow.yaml +0 -89
  477. cognite/neat/workflows/examples/Export Rules to Ontology/workflow.yaml +0 -152
  478. cognite/neat/workflows/examples/Extract DEXPI Graph and Export Rules/workflow.yaml +0 -139
  479. cognite/neat/workflows/examples/Extract RDF Graph and Generate Assets/workflow.yaml +0 -270
  480. cognite/neat/workflows/examples/Import DMS/workflow.yaml +0 -65
  481. cognite/neat/workflows/examples/Ontology to Data Model/workflow.yaml +0 -116
  482. cognite/neat/workflows/examples/Validate Rules/workflow.yaml +0 -67
  483. cognite/neat/workflows/examples/Validate Solution Model/workflow.yaml +0 -64
  484. cognite/neat/workflows/examples/Visualize Data Model Using Mock Graph/workflow.yaml +0 -95
  485. cognite/neat/workflows/examples/Visualize Semantic Data Model/workflow.yaml +0 -111
  486. cognite/neat/workflows/manager.py +0 -309
  487. cognite/neat/workflows/migration/steps.py +0 -93
  488. cognite/neat/workflows/migration/wf_manifests.py +0 -33
  489. cognite/neat/workflows/model.py +0 -202
  490. cognite/neat/workflows/steps/data_contracts.py +0 -140
  491. cognite/neat/workflows/steps/lib/__init__.py +0 -7
  492. cognite/neat/workflows/steps/lib/graph_extractor.py +0 -123
  493. cognite/neat/workflows/steps/lib/graph_loader.py +0 -68
  494. cognite/neat/workflows/steps/lib/graph_store.py +0 -139
  495. cognite/neat/workflows/steps/lib/io_steps.py +0 -393
  496. cognite/neat/workflows/steps/lib/rules_exporter.py +0 -453
  497. cognite/neat/workflows/steps/lib/rules_importer.py +0 -171
  498. cognite/neat/workflows/steps/lib/rules_validator.py +0 -102
  499. cognite/neat/workflows/steps/lib/v1/__init__.py +0 -7
  500. cognite/neat/workflows/steps/lib/v1/graph_contextualization.py +0 -82
  501. cognite/neat/workflows/steps/lib/v1/graph_extractor.py +0 -644
  502. cognite/neat/workflows/steps/lib/v1/graph_loader.py +0 -606
  503. cognite/neat/workflows/steps/lib/v1/graph_store.py +0 -278
  504. cognite/neat/workflows/steps/lib/v1/graph_transformer.py +0 -58
  505. cognite/neat/workflows/steps/lib/v1/rules_exporter.py +0 -513
  506. cognite/neat/workflows/steps/lib/v1/rules_importer.py +0 -612
  507. cognite/neat/workflows/steps/step_model.py +0 -83
  508. cognite/neat/workflows/steps_registry.py +0 -212
  509. cognite/neat/workflows/tasks.py +0 -18
  510. cognite/neat/workflows/triggers.py +0 -169
  511. cognite/neat/workflows/utils.py +0 -19
  512. cognite_neat-0.70.1.dist-info/METADATA +0 -212
  513. cognite_neat-0.70.1.dist-info/RECORD +0 -234
  514. cognite_neat-0.70.1.dist-info/entry_points.txt +0 -3
  515. /cognite/neat/{app/api → _data_model}/__init__.py +0 -0
  516. /cognite/neat/{app/api/data_classes → _data_model/deployer}/__init__.py +0 -0
  517. /cognite/neat/{app/api/utils → _data_model/exporters/_table_exporter}/__init__.py +0 -0
  518. /cognite/neat/{app/monitoring → _data_model/importers/_table_importer}/__init__.py +0 -0
  519. /cognite/neat/{graph/extractors → _data_model/models}/__init__.py +0 -0
  520. /cognite/neat/{graph/loader/core → _data_model/models/conceptual}/__init__.py +0 -0
  521. /cognite/neat/{graph/transformation → _data_model/validation}/__init__.py +0 -0
  522. /cognite/neat/{rules → _session/_html}/__init__.py +0 -0
  523. /cognite/neat/{rules/_analysis → _session/_usage_analytics}/__init__.py +0 -0
  524. /cognite/neat/{workflows/migration → _utils}/__init__.py +0 -0
  525. /cognite/neat/{workflows/steps → v0}/__init__.py +0 -0
  526. /cognite/neat/{graph → v0/core/_instances}/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  527. /cognite/neat/{graph → v0/core/_instances}/examples/Knowledge-Graph-Nordic44.xml +0 -0
  528. /cognite/neat/{graph → v0/core/_instances}/examples/__init__.py +0 -0
  529. /cognite/neat/{graph → v0/core/_instances}/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  530. {cognite_neat-0.70.1.dist-info → cognite_neat-0.127.19.dist-info/licenses}/LICENSE +0 -0
cognite/neat/__init__.py CHANGED
@@ -1,3 +1,6 @@
1
+ from cognite.neat.v0.core._utils.auth import get_cognite_client
2
+ from cognite.neat.v0.session import NeatSession
3
+
1
4
  from ._version import __version__
2
5
 
3
- __all__ = ["__version__"]
6
+ __all__ = ["NeatSession", "__version__", "get_cognite_client"]
@@ -0,0 +1,4 @@
1
+ from .client import NeatClient
2
+ from .config import NeatClientConfig
3
+
4
+ __all__ = ["NeatClient", "NeatClientConfig"]
@@ -0,0 +1,8 @@
1
+ from cognite.neat._client.config import NeatClientConfig
2
+ from cognite.neat._utils.http_client import HTTPClient
3
+
4
+
5
+ class NeatAPI:
6
+ def __init__(self, neat_config: NeatClientConfig, http_client: HTTPClient) -> None:
7
+ self._config = neat_config
8
+ self._http_client = http_client
@@ -0,0 +1,21 @@
1
+ from cognite.client import ClientConfig, CogniteClient
2
+
3
+ from cognite.neat._utils.http_client import HTTPClient
4
+
5
+ from .config import NeatClientConfig
6
+ from .containers_api import ContainersAPI
7
+ from .data_model_api import DataModelsAPI
8
+ from .spaces_api import SpacesAPI
9
+ from .statistics_api import StatisticsAPI
10
+ from .views_api import ViewsAPI
11
+
12
+
13
+ class NeatClient:
14
+ def __init__(self, cognite_client_or_config: CogniteClient | ClientConfig) -> None:
15
+ self.config = NeatClientConfig(cognite_client_or_config)
16
+ self.http_client = HTTPClient(self.config)
17
+ self.data_models = DataModelsAPI(self.config, self.http_client)
18
+ self.views = ViewsAPI(self.config, self.http_client)
19
+ self.containers = ContainersAPI(self.config, self.http_client)
20
+ self.spaces = SpacesAPI(self.config, self.http_client)
21
+ self.statistics = StatisticsAPI(self.config, self.http_client)
@@ -0,0 +1,40 @@
1
+ from cognite.client import ClientConfig, CogniteClient
2
+
3
+
4
+ class NeatClientConfig(ClientConfig):
5
+ def __init__(self, cognite_client_or_config: CogniteClient | ClientConfig):
6
+ config = (
7
+ cognite_client_or_config.config
8
+ if isinstance(cognite_client_or_config, CogniteClient)
9
+ else cognite_client_or_config
10
+ )
11
+ super().__init__(
12
+ client_name=config.client_name,
13
+ project=config.project,
14
+ credentials=config.credentials,
15
+ api_subversion=config.api_subversion,
16
+ base_url=config.base_url,
17
+ max_workers=config.max_workers,
18
+ headers=config.headers,
19
+ timeout=config.timeout,
20
+ file_transfer_timeout=config.file_transfer_timeout,
21
+ debug=config.debug,
22
+ )
23
+
24
+ def create_api_url(self, endpoint: str) -> str:
25
+ """Create a full API URL for the given endpoint.
26
+
27
+ Args:
28
+ endpoint (str): The API endpoint to append to the base URL.
29
+
30
+ Returns:
31
+ str: The full API URL.
32
+
33
+ Examples:
34
+ >>> config = NeatClientConfig(cluster="bluefield", project="my_project", ...)
35
+ >>> config.create_api_url("/models/instances")
36
+ "https://bluefield.cognitedata.com/api/v1/my_project/models/instances"
37
+ """
38
+ if not endpoint.startswith("/"):
39
+ endpoint = f"/{endpoint}"
40
+ return f"{self.base_url}/api/v1/projects/{self.project}{endpoint}"
@@ -0,0 +1,125 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Sequence
4
+
5
+ from cognite.neat._data_model.models.dms import ContainerReference, ContainerRequest, ContainerResponse, DataModelBody
6
+ from cognite.neat._utils.http_client import ItemIDBody, ItemsRequest, ParametersRequest
7
+ from cognite.neat._utils.useful_types import PrimitiveType
8
+
9
+ from .api import NeatAPI
10
+ from .data_classes import PagedResponse
11
+
12
+
13
+ class ContainersAPI(NeatAPI):
14
+ ENDPOINT = "/models/containers"
15
+
16
+ def apply(self, items: Sequence[ContainerRequest]) -> list[ContainerResponse]:
17
+ """Apply (create or update) containers in CDF.
18
+
19
+ Args:
20
+ items: List of ContainerRequest objects to apply.
21
+ Returns:
22
+ List of ContainerResponse objects.
23
+ """
24
+ if not items:
25
+ return []
26
+ if len(items) > 100:
27
+ raise ValueError("Cannot apply more than 100 containers at once.")
28
+ result = self._http_client.request_with_retries(
29
+ ItemsRequest(
30
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
31
+ method="POST",
32
+ body=DataModelBody(items=items),
33
+ )
34
+ )
35
+ result.raise_for_status()
36
+ result = PagedResponse[ContainerResponse].model_validate_json(result.success_response.body)
37
+ return result.items
38
+
39
+ def retrieve(
40
+ self,
41
+ items: list[ContainerReference],
42
+ ) -> list[ContainerResponse]:
43
+ """Retrieve containers by their identifiers.
44
+
45
+ Args:
46
+ items: List of (space, external_id) tuples identifying the containers to retrieve.
47
+
48
+ Returns:
49
+ List of ContainerResponse objects.
50
+ """
51
+ if not items:
52
+ return []
53
+ if len(items) > 1000:
54
+ raise ValueError("Cannot retrieve more than 1000 containers at once.")
55
+
56
+ result = self._http_client.request_with_retries(
57
+ ItemsRequest(
58
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/byids"),
59
+ method="POST",
60
+ body=ItemIDBody(items=items),
61
+ )
62
+ )
63
+ result.raise_for_status()
64
+ result = PagedResponse[ContainerResponse].model_validate_json(result.success_response.body)
65
+ return result.items
66
+
67
+ def delete(self, items: list[ContainerReference]) -> list[ContainerReference]:
68
+ """Delete containers by their identifiers.
69
+
70
+ Args:
71
+ items: List of ContainerReference objects identifying the containers to delete.
72
+
73
+ Returns:
74
+ List of ContainerReference objects representing the deleted containers.
75
+ """
76
+ if not items:
77
+ return []
78
+ if len(items) > 100:
79
+ raise ValueError("Cannot delete more than 100 containers at once.")
80
+
81
+ result = self._http_client.request_with_retries(
82
+ ItemsRequest(
83
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/delete"),
84
+ method="POST",
85
+ body=ItemIDBody(items=items),
86
+ )
87
+ )
88
+ result.raise_for_status()
89
+ result = PagedResponse[ContainerReference].model_validate_json(result.success_response.body)
90
+ return result.items
91
+
92
+ def list(
93
+ self,
94
+ space: str | None = None,
95
+ include_global: bool = False,
96
+ limit: int = 10,
97
+ ) -> list[ContainerResponse]:
98
+ """List containers in CDF Project.
99
+
100
+ Args:
101
+ space: If specified, only containers in this space are returned.
102
+ include_global: If True, include global containers.
103
+ limit: Maximum number of containers to return. Max is 1000.
104
+
105
+ Returns:
106
+ List of ContainerResponse objects.
107
+ """
108
+ if limit > 1000:
109
+ raise ValueError("Pagination is not (yet) supported for listing containers. The maximum limit is 1000.")
110
+ parameters: dict[str, PrimitiveType] = {
111
+ "includeGlobal": include_global,
112
+ "limit": limit,
113
+ }
114
+ if space is not None:
115
+ parameters["space"] = space
116
+ result = self._http_client.request_with_retries(
117
+ ParametersRequest(
118
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
119
+ method="GET",
120
+ parameters=parameters,
121
+ )
122
+ )
123
+ result.raise_for_status()
124
+ result = PagedResponse[ContainerResponse].model_validate_json(result.success_response.body)
125
+ return result.items
@@ -0,0 +1,44 @@
1
+ from typing import Generic, TypeVar
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+ T = TypeVar("T", bound=BaseModel)
6
+
7
+
8
+ class PagedResponse(BaseModel, Generic[T]):
9
+ items: list[T]
10
+ next_cursor: str | None = Field(None, alias="nextCursor")
11
+
12
+
13
+ class ResourceLimit(BaseModel):
14
+ """Model for resources with count and limit."""
15
+
16
+ count: int
17
+ limit: int
18
+
19
+
20
+ class InstancesDetail(BaseModel, populate_by_name=True):
21
+ """Model for instances with detailed metrics."""
22
+
23
+ edges: int
24
+ soft_deleted_edges: int = Field(alias="softDeletedEdges")
25
+ nodes: int
26
+ soft_deleted_nodes: int = Field(alias="softDeletedNodes")
27
+ instances: int
28
+ instances_limit: int = Field(alias="instancesLimit")
29
+ soft_deleted_instances: int = Field(alias="softDeletedInstances")
30
+ soft_deleted_instances_limit: int = Field(alias="softDeletedInstancesLimit")
31
+
32
+
33
+ class StatisticsResponse(BaseModel, populate_by_name=True):
34
+ """Main API response model."""
35
+
36
+ spaces: ResourceLimit
37
+ containers: ResourceLimit
38
+ views: ResourceLimit
39
+ data_models: ResourceLimit = Field(alias="dataModels")
40
+ container_properties: ResourceLimit = Field(alias="containerProperties")
41
+ instances: InstancesDetail
42
+ concurrent_read_limit: int = Field(alias="concurrentReadLimit")
43
+ concurrent_write_limit: int = Field(alias="concurrentWriteLimit")
44
+ concurrent_delete_limit: int = Field(alias="concurrentDeleteLimit")
@@ -0,0 +1,115 @@
1
+ from collections.abc import Sequence
2
+
3
+ from cognite.neat._data_model.models.dms import DataModelBody, DataModelReference, DataModelRequest, DataModelResponse
4
+ from cognite.neat._utils.http_client import ItemIDBody, ItemsRequest, ParametersRequest
5
+ from cognite.neat._utils.useful_types import PrimitiveType
6
+
7
+ from .api import NeatAPI
8
+ from .data_classes import PagedResponse
9
+
10
+
11
+ class DataModelsAPI(NeatAPI):
12
+ ENDPOINT = "/models/datamodels"
13
+
14
+ def apply(self, data_models: Sequence[DataModelRequest]) -> list[DataModelResponse]:
15
+ """Apply (create or update) data models in CDF.
16
+
17
+ Args:
18
+ data_models: List of DataModelRequest objects to apply.
19
+ Returns:
20
+ List of DataModelResponse objects.
21
+ """
22
+ if not data_models:
23
+ return []
24
+ if len(data_models) > 100:
25
+ raise ValueError("Cannot apply more than 100 data models at once.")
26
+
27
+ result = self._http_client.request_with_retries(
28
+ ItemsRequest(
29
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
30
+ method="POST",
31
+ body=DataModelBody(items=data_models),
32
+ )
33
+ )
34
+ result.raise_for_status()
35
+ result = PagedResponse[DataModelResponse].model_validate_json(result.success_response.body)
36
+ return result.items
37
+
38
+ def retrieve(
39
+ self,
40
+ items: list[DataModelReference],
41
+ ) -> list[DataModelResponse]:
42
+ """Retrieve data models by their identifiers.
43
+
44
+ Args:
45
+ items: List of data models references identifying the data models to retrieve.
46
+ Returns:
47
+ List of DataModelResponse objects.
48
+ """
49
+ if not items:
50
+ return []
51
+ if len(items) > 100:
52
+ raise ValueError("Cannot retrieve more than 1000 containers at once.")
53
+
54
+ result = self._http_client.request_with_retries(
55
+ ItemsRequest(
56
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/byids"),
57
+ method="POST",
58
+ body=ItemIDBody(items=items),
59
+ )
60
+ )
61
+ result.raise_for_status()
62
+ result = PagedResponse[DataModelResponse].model_validate_json(result.success_response.body)
63
+ return result.items
64
+
65
+ def delete(self, items: list[DataModelReference]) -> list[DataModelReference]:
66
+ """Delete data models by their identifiers.
67
+
68
+ Args:
69
+ items: List of data model references identifying the data models to delete.
70
+ Returns:
71
+ List of DataModelReference objects representing the deleted data models.
72
+ """
73
+ if not items:
74
+ return []
75
+ if len(items) > 100:
76
+ raise ValueError("Cannot delete more than 100 data models at once.")
77
+
78
+ result = self._http_client.request_with_retries(
79
+ ItemsRequest(
80
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/delete"),
81
+ method="POST",
82
+ body=ItemIDBody(items=items),
83
+ )
84
+ )
85
+ result.raise_for_status()
86
+ result = PagedResponse[DataModelReference].model_validate_json(result.success_response.body)
87
+ return result.items
88
+
89
+ def list(
90
+ self,
91
+ space: str | None = None,
92
+ all_versions: bool = False,
93
+ include_global: bool = False,
94
+ limit: int = 10,
95
+ ) -> list[DataModelResponse]:
96
+ """List data models in CDF Project."""
97
+ if limit > 1000:
98
+ raise ValueError("Pagination is not (yet) supported for listing data models. The maximum limit is 1000.")
99
+ parameters: dict[str, PrimitiveType] = {
100
+ "allVersions": all_versions,
101
+ "includeGlobal": include_global,
102
+ "limit": limit,
103
+ }
104
+ if space is not None:
105
+ parameters["space"] = space
106
+ result = self._http_client.request_with_retries(
107
+ ParametersRequest(
108
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
109
+ method="GET",
110
+ parameters=parameters,
111
+ )
112
+ )
113
+ result.raise_for_status()
114
+ result = PagedResponse[DataModelResponse].model_validate_json(result.success_response.body)
115
+ return result.items
@@ -0,0 +1,115 @@
1
+ from __future__ import annotations
2
+
3
+ from cognite.neat._data_model.models.dms import DataModelBody, SpaceRequest, SpaceResponse
4
+ from cognite.neat._data_model.models.dms._references import SpaceReference
5
+ from cognite.neat._utils.http_client import ItemIDBody, ItemsRequest, ParametersRequest
6
+ from cognite.neat._utils.useful_types import PrimitiveType
7
+
8
+ from .api import NeatAPI
9
+ from .data_classes import PagedResponse
10
+
11
+
12
+ class SpacesAPI(NeatAPI):
13
+ ENDPOINT = "/models/spaces"
14
+
15
+ def apply(self, spaces: list[SpaceRequest]) -> list[SpaceResponse]:
16
+ """Apply (create or update) spaces in CDF.
17
+
18
+ Args:
19
+ spaces: List of SpaceRequest objects to apply.
20
+ Returns:
21
+ List of SpaceResponse objects.
22
+ """
23
+ if not spaces:
24
+ return []
25
+ if len(spaces) > 100:
26
+ raise ValueError("Cannot apply more than 100 spaces at once.")
27
+ result = self._http_client.request_with_retries(
28
+ ItemsRequest(
29
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
30
+ method="POST",
31
+ body=DataModelBody(items=spaces),
32
+ )
33
+ )
34
+ result.raise_for_status()
35
+ result = PagedResponse[SpaceResponse].model_validate_json(result.success_response.body)
36
+ return result.items
37
+
38
+ def retrieve(self, spaces: list[SpaceReference]) -> list[SpaceResponse]:
39
+ """Retrieve spaces by their identifiers.
40
+
41
+ Args:
42
+ spaces: List of space identifiers to retrieve.
43
+
44
+ Returns:
45
+ List of SpaceResponse objects.
46
+ """
47
+ if not spaces:
48
+ return []
49
+ if len(spaces) > 1000:
50
+ raise ValueError("Cannot retrieve more than 1000 spaces at once.")
51
+
52
+ result = self._http_client.request_with_retries(
53
+ ItemsRequest(
54
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/byids"),
55
+ method="POST",
56
+ body=ItemIDBody(items=spaces),
57
+ )
58
+ )
59
+ result.raise_for_status()
60
+ result = PagedResponse[SpaceResponse].model_validate_json(result.success_response.body)
61
+ return result.items
62
+
63
+ def delete(self, spaces: list[SpaceReference]) -> list[SpaceReference]:
64
+ """Delete spaces by their identifiers.
65
+
66
+ Args:
67
+ spaces: List of space identifiers to delete.
68
+ Returns:
69
+ List of SpaceReference objects representing the deleted spaces.
70
+ """
71
+ if not spaces:
72
+ return []
73
+ if len(spaces) > 100:
74
+ raise ValueError("Cannot delete more than 100 spaces at once.")
75
+ result = self._http_client.request_with_retries(
76
+ ItemsRequest(
77
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/delete"),
78
+ method="POST",
79
+ body=ItemIDBody(items=spaces),
80
+ )
81
+ )
82
+ result.raise_for_status()
83
+ result = PagedResponse[SpaceReference].model_validate_json(result.success_response.body)
84
+ return result.items
85
+
86
+ def list(
87
+ self,
88
+ include_global: bool = False,
89
+ limit: int = 10,
90
+ ) -> list[SpaceResponse]:
91
+ """List spaces in CDF Project.
92
+
93
+ Args:
94
+ include_global: If True, include global spaces.
95
+ limit: Maximum number of spaces to return. Max is 1000.
96
+
97
+ Returns:
98
+ List of SpaceResponse objects.
99
+ """
100
+ if limit > 1000:
101
+ raise ValueError("Pagination is not (yet) supported for listing spaces. The maximum limit is 1000.")
102
+ parameters: dict[str, PrimitiveType] = {
103
+ "includeGlobal": include_global,
104
+ "limit": limit,
105
+ }
106
+ result = self._http_client.request_with_retries(
107
+ ParametersRequest(
108
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
109
+ method="GET",
110
+ parameters=parameters,
111
+ )
112
+ )
113
+ result.raise_for_status()
114
+ result = PagedResponse[SpaceResponse].model_validate_json(result.success_response.body)
115
+ return result.items
@@ -0,0 +1,24 @@
1
+ from cognite.neat._client.api import NeatAPI
2
+ from cognite.neat._client.data_classes import StatisticsResponse
3
+ from cognite.neat._utils.http_client import ParametersRequest
4
+
5
+
6
+ class StatisticsAPI(NeatAPI):
7
+ def project(self) -> StatisticsResponse:
8
+ """Retrieve project-wide usage data and limits.
9
+
10
+ Returns:
11
+ StatisticsResponse object.
12
+ """
13
+
14
+ result = self._http_client.request_with_retries(
15
+ ParametersRequest(
16
+ endpoint_url=self._config.create_api_url("/models/statistics"),
17
+ method="GET",
18
+ parameters=None,
19
+ )
20
+ )
21
+
22
+ result.raise_for_status()
23
+ result = StatisticsResponse.model_validate_json(result.success_response.body)
24
+ return result
@@ -0,0 +1,129 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Sequence
4
+
5
+ from cognite.neat._data_model.models.dms import DataModelBody, ViewReference, ViewRequest, ViewResponse
6
+ from cognite.neat._utils.collection import chunker_sequence
7
+ from cognite.neat._utils.http_client import ItemIDBody, ItemsRequest, ParametersRequest
8
+ from cognite.neat._utils.useful_types import PrimitiveType
9
+
10
+ from .api import NeatAPI
11
+ from .data_classes import PagedResponse
12
+
13
+
14
+ class ViewsAPI(NeatAPI):
15
+ ENDPOINT = "/models/views"
16
+
17
+ def apply(self, items: Sequence[ViewRequest]) -> list[ViewResponse]:
18
+ """Create or update views in CDF Project.
19
+ Args:
20
+ items: List of ViewRequest objects to create or update.
21
+ Returns:
22
+ List of ViewResponse objects.
23
+ """
24
+ if not items:
25
+ return []
26
+ if len(items) > 100:
27
+ raise ValueError("Cannot apply more than 100 views at once.")
28
+ result = self._http_client.request_with_retries(
29
+ ItemsRequest(
30
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
31
+ method="POST",
32
+ body=DataModelBody(items=items),
33
+ )
34
+ )
35
+ result.raise_for_status()
36
+ result = PagedResponse[ViewResponse].model_validate_json(result.success_response.body)
37
+ return result.items
38
+
39
+ def retrieve(
40
+ self,
41
+ items: list[ViewReference],
42
+ include_inherited_properties: bool = True,
43
+ ) -> list[ViewResponse]:
44
+ """Retrieve views by their identifiers.
45
+
46
+ Args:
47
+ items: List of (space, external_id, version) tuples identifying the views to retrieve.
48
+ include_inherited_properties: If True, include properties inherited from parent views.
49
+
50
+ Returns:
51
+ List of ViewResponse objects.
52
+ """
53
+ results: list[ViewResponse] = []
54
+ for chunk in chunker_sequence(items, 100):
55
+ batch = self._http_client.request_with_retries(
56
+ ItemsRequest(
57
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/byids"),
58
+ method="POST",
59
+ body=ItemIDBody(items=chunk),
60
+ parameters={"includeInheritedProperties": include_inherited_properties},
61
+ )
62
+ )
63
+ batch.raise_for_status()
64
+ result = PagedResponse[ViewResponse].model_validate_json(batch.success_response.body)
65
+ results.extend(result.items)
66
+ return results
67
+
68
+ def delete(self, items: list[ViewReference]) -> list[ViewReference]:
69
+ """Delete views by their identifiers.
70
+
71
+ Args:
72
+ items: List of (space, external_id, version) tuples identifying the views to delete.
73
+ """
74
+ if not items:
75
+ return []
76
+ if len(items) > 100:
77
+ raise ValueError("Cannot delete more than 100 views at once.")
78
+
79
+ result = self._http_client.request_with_retries(
80
+ ItemsRequest(
81
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/delete"),
82
+ method="POST",
83
+ body=ItemIDBody(items=items),
84
+ )
85
+ )
86
+ result.raise_for_status()
87
+ result = PagedResponse[ViewReference].model_validate_json(result.success_response.body)
88
+ return result.items
89
+
90
+ def list(
91
+ self,
92
+ space: str | None = None,
93
+ all_versions: bool = False,
94
+ include_inherited_properties: bool = True,
95
+ include_global: bool = False,
96
+ limit: int = 10,
97
+ ) -> list[ViewResponse]:
98
+ """List views in CDF Project.
99
+
100
+ Args:
101
+ space: If specified, only views in this space are returned.
102
+ all_versions: If True, return all versions. If False, only return the latest version.
103
+ include_inherited_properties: If True, include properties inherited from parent views.
104
+ include_global: If True, include global views.
105
+ limit: Maximum number of views to return. Max is 1000.
106
+
107
+ Returns:
108
+ List of ViewResponse objects.
109
+ """
110
+ if limit > 1000:
111
+ raise ValueError("Pagination is not (yet) supported for listing views. The maximum limit is 1000.")
112
+ parameters: dict[str, PrimitiveType] = {
113
+ "allVersions": all_versions,
114
+ "includeInheritedProperties": include_inherited_properties,
115
+ "includeGlobal": include_global,
116
+ "limit": limit,
117
+ }
118
+ if space is not None:
119
+ parameters["space"] = space
120
+ result = self._http_client.request_with_retries(
121
+ ParametersRequest(
122
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
123
+ method="GET",
124
+ parameters=parameters,
125
+ )
126
+ )
127
+ result.raise_for_status()
128
+ result = PagedResponse[ViewResponse].model_validate_json(result.success_response.body)
129
+ return result.items