cognite-neat 0.76.3__tar.gz → 0.77.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/PKG-INFO +1 -1
  2. cognite_neat-0.77.0/cognite/neat/_version.py +1 -0
  3. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_rules2dms.py +3 -5
  4. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dms2rules.py +64 -31
  5. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_exporter.py +1 -3
  6. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_rules.py +2 -4
  7. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_schema.py +134 -39
  8. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_validation.py +1 -1
  9. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/pyproject.toml +1 -1
  10. cognite_neat-0.76.3/cognite/neat/_version.py +0 -1
  11. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/LICENSE +0 -0
  12. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/README.md +0 -0
  13. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/__init__.py +0 -0
  14. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/__init__.py +0 -0
  15. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/asgi/metrics.py +0 -0
  16. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/configuration.py +0 -0
  17. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/context_manager/__init__.py +0 -0
  18. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/context_manager/manager.py +0 -0
  19. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/data_classes/__init__.py +0 -0
  20. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/data_classes/rest.py +0 -0
  21. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/explorer.py +0 -0
  22. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/configuration.py +0 -0
  23. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/core.py +0 -0
  24. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/crud.py +0 -0
  25. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/data_exploration.py +0 -0
  26. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/metrics.py +0 -0
  27. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/rules.py +0 -0
  28. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/workflows.py +0 -0
  29. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/utils/__init__.py +0 -0
  30. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/utils/data_mapping.py +0 -0
  31. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/utils/logging.py +0 -0
  32. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/api/utils/query_templates.py +0 -0
  33. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/main.py +0 -0
  34. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/monitoring/__init__.py +0 -0
  35. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/monitoring/metrics.py +0 -0
  36. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/index.html +0 -0
  37. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
  38. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/README.md +0 -0
  39. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
  40. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
  41. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
  42. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
  43. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
  44. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
  45. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
  46. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
  47. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
  48. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css +0 -0
  49. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css.map +0 -0
  50. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js +0 -0
  51. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.LICENSE.txt +0 -0
  52. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.map +0 -0
  53. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
  54. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/config.py +0 -0
  55. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/constants.py +0 -0
  56. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/exceptions.py +0 -0
  57. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/__init__.py +0 -0
  58. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  59. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  60. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/examples/__init__.py +0 -0
  61. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  62. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/exceptions.py +0 -0
  63. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/extractors/__init__.py +0 -0
  64. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/extractors/_base.py +0 -0
  65. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/extractors/_mock_graph_generator.py +0 -0
  66. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/models.py +0 -0
  67. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/stores/__init__.py +0 -0
  68. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_base.py +0 -0
  69. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_graphdb_store.py +0 -0
  70. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_memory_store.py +0 -0
  71. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_oxigraph_store.py +0 -0
  72. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_oxrdflib.py +0 -0
  73. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_rdf_to_graph.py +0 -0
  74. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/__init__.py +0 -0
  75. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/__init__.py +0 -0
  76. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  77. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  78. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/examples/__init__.py +0 -0
  79. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  80. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/exceptions.py +0 -0
  81. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/extractors/__init__.py +0 -0
  82. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/extractors/_base.py +0 -0
  83. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/extractors/_dexpi.py +0 -0
  84. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/extractors/_graph_capturing_sheet.py +0 -0
  85. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +0 -0
  86. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/__init__.py +0 -0
  87. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/_asset_loader.py +0 -0
  88. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/_base.py +0 -0
  89. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/_exceptions.py +0 -0
  90. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/core/__init__.py +0 -0
  91. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/core/labels.py +0 -0
  92. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/core/models.py +0 -0
  93. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +0 -0
  94. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +0 -0
  95. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/rdf_to_dms.py +0 -0
  96. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/validator.py +0 -0
  97. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/models.py +0 -0
  98. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/__init__.py +0 -0
  99. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_base.py +0 -0
  100. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_graphdb_store.py +0 -0
  101. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_memory_store.py +0 -0
  102. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_oxigraph_store.py +0 -0
  103. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_oxrdflib.py +0 -0
  104. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_rdf_to_graph.py +0 -0
  105. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/transformations/__init__.py +0 -0
  106. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/transformations/entity_matcher.py +0 -0
  107. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/transformations/query_generator/__init__.py +0 -0
  108. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/transformations/query_generator/sparql.py +0 -0
  109. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/transformations/transformer.py +0 -0
  110. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/__init__.py +0 -0
  111. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/analysis.py +0 -0
  112. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-TNT.xlsx +0 -0
  113. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
  114. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/__init__.py +0 -0
  115. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/power-grid-containers.yaml +0 -0
  116. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/power-grid-example.xlsx +0 -0
  117. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/power-grid-model.yaml +0 -0
  118. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/rules-template.xlsx +0 -0
  119. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
  120. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/skos-rules.xlsx +0 -0
  121. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
  122. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/wind-energy.owl +0 -0
  123. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exceptions.py +0 -0
  124. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/__init__.py +0 -0
  125. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_base.py +0 -0
  126. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_core/__init__.py +0 -0
  127. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_core/rules2labels.py +0 -0
  128. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2dms.py +0 -0
  129. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2excel.py +0 -0
  130. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2graphql.py +0 -0
  131. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2ontology.py +0 -0
  132. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2pydantic_models.py +0 -0
  133. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2rules.py +0 -0
  134. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2triples.py +0 -0
  135. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_validation.py +0 -0
  136. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/__init__.py +0 -0
  137. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_base.py +0 -0
  138. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_dict2rules.py +0 -0
  139. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_dms2rules.py +0 -0
  140. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_graph2rules.py +0 -0
  141. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_json2rules.py +0 -0
  142. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_owl2rules/__init__.py +0 -0
  143. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2classes.py +0 -0
  144. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2metadata.py +0 -0
  145. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2properties.py +0 -0
  146. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2rules.py +0 -0
  147. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_spreadsheet2rules.py +0 -0
  148. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_xsd2rules.py +0 -0
  149. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_yaml2rules.py +0 -0
  150. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/__init__.py +0 -0
  151. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/_base.py +0 -0
  152. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/raw_rules.py +0 -0
  153. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/rdfpath.py +0 -0
  154. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/rules.py +0 -0
  155. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/tables.py +0 -0
  156. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/value_types.py +0 -0
  157. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +0 -0
  158. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
  159. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
  160. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
  161. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +0 -0
  162. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
  163. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +0 -0
  164. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  165. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
  166. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
  167. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/py.typed +0 -0
  168. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/__init__.py +0 -0
  169. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/_shared.py +0 -0
  170. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/analysis/__init__.py +0 -0
  171. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/analysis/_base.py +0 -0
  172. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/analysis/_information_rules.py +0 -0
  173. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/examples/__init__.py +0 -0
  174. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/examples/wind-energy.owl +0 -0
  175. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/exceptions.py +0 -0
  176. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/__init__.py +0 -0
  177. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_base.py +0 -0
  178. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_models.py +0 -0
  179. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_rules2excel.py +0 -0
  180. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_rules2ontology.py +0 -0
  181. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
  182. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_validation.py +0 -0
  183. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/__init__.py +0 -0
  184. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_base.py +0 -0
  185. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
  186. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
  187. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
  188. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
  189. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
  190. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_owl2rules/__init__.py +0 -0
  191. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_owl2rules/_owl2classes.py +0 -0
  192. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +0 -0
  193. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_owl2rules/_owl2properties.py +0 -0
  194. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_owl2rules/_owl2rules.py +0 -0
  195. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_spreadsheet2rules.py +0 -0
  196. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_yaml2rules.py +0 -0
  197. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/issues/__init__.py +0 -0
  198. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/issues/base.py +0 -0
  199. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/issues/dms.py +0 -0
  200. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/issues/fileread.py +0 -0
  201. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/issues/formatters.py +0 -0
  202. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/issues/importing.py +0 -0
  203. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/issues/spreadsheet.py +0 -0
  204. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/issues/spreadsheet_file.py +0 -0
  205. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/__init__.py +0 -0
  206. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/_base.py +0 -0
  207. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/_rdfpath.py +0 -0
  208. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/_types/__init__.py +0 -0
  209. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/_types/_base.py +0 -0
  210. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/_types/_field.py +0 -0
  211. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/data_types.py +0 -0
  212. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/__init__.py +0 -0
  213. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_converter.py +0 -0
  214. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_rules_input.py +0 -0
  215. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_serializer.py +0 -0
  216. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/domain.py +0 -0
  217. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/entities.py +0 -0
  218. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/information/__init__.py +0 -0
  219. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/information/_converter.py +0 -0
  220. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/information/_rules.py +0 -0
  221. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/rules/models/wrapped_entities.py +0 -0
  222. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/__init__.py +0 -0
  223. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/auxiliary.py +0 -0
  224. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/cdf.py +0 -0
  225. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/cdf_loaders/__init__.py +0 -0
  226. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/cdf_loaders/_base.py +0 -0
  227. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/cdf_loaders/_data_modeling.py +0 -0
  228. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/cdf_loaders/_ingestion.py +0 -0
  229. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/cdf_loaders/data_classes.py +0 -0
  230. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/exceptions.py +0 -0
  231. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/spreadsheet.py +0 -0
  232. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/text.py +0 -0
  233. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/utils.py +0 -0
  234. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/utils/xml.py +0 -0
  235. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/__init__.py +0 -0
  236. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/_exceptions.py +0 -0
  237. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/base.py +0 -0
  238. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/cdf_store.py +0 -0
  239. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
  240. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
  241. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
  242. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
  243. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
  244. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
  245. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
  246. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  247. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
  248. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
  249. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/manager.py +0 -0
  250. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/migration/__init__.py +0 -0
  251. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/migration/steps.py +0 -0
  252. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/migration/wf_manifests.py +0 -0
  253. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/model.py +0 -0
  254. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/__init__.py +0 -0
  255. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/data_contracts.py +0 -0
  256. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/__init__.py +0 -0
  257. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
  258. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
  259. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
  260. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
  261. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +0 -0
  262. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/rules_importer.py +0 -0
  263. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
  264. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
  265. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
  266. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/__init__.py +0 -0
  267. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/graph_contextualization.py +0 -0
  268. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/graph_extractor.py +0 -0
  269. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/graph_loader.py +0 -0
  270. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/graph_store.py +0 -0
  271. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/graph_transformer.py +0 -0
  272. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/rules_exporter.py +0 -0
  273. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/rules_importer.py +0 -0
  274. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/step_model.py +0 -0
  275. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/steps_registry.py +0 -0
  276. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/tasks.py +0 -0
  277. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/triggers.py +0 -0
  278. {cognite_neat-0.76.3 → cognite_neat-0.77.0}/cognite/neat/workflows/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cognite-neat
3
- Version: 0.76.3
3
+ Version: 0.77.0
4
4
  Summary: Knowledge graph transformation
5
5
  Home-page: https://cognite-neat.readthedocs-hosted.com/
6
6
  License: Apache-2.0
@@ -0,0 +1 @@
1
+ __version__ = "0.77.0"
@@ -5,7 +5,7 @@ from typing import Literal, TypeAlias, cast
5
5
 
6
6
  from cognite.client import CogniteClient
7
7
  from cognite.client.data_classes._base import CogniteResource, CogniteResourceList
8
- from cognite.client.data_classes.data_modeling import DataModelApply, DataModelId
8
+ from cognite.client.data_classes.data_modeling import DataModelApply, DataModelApplyList, DataModelId
9
9
  from cognite.client.exceptions import CogniteAPIError
10
10
 
11
11
  from cognite.neat.rules import issues
@@ -114,9 +114,7 @@ class DMSExporter(CDFExporter[DMSSchema]):
114
114
  dms_rules = rules.as_dms_architect_rules()
115
115
  else:
116
116
  raise ValueError(f"{type(rules).__name__} cannot be exported to DMS")
117
- return dms_rules.as_schema(
118
- include_ref=True, include_pipeline=self.export_pipeline, instance_space=self.instance_space
119
- )
117
+ return dms_rules.as_schema(include_pipeline=self.export_pipeline, instance_space=self.instance_space)
120
118
 
121
119
  def delete_from_cdf(self, rules: Rules, client: CogniteClient, dry_run: bool = False) -> Iterable[UploadResult]:
122
120
  schema, to_export = self._prepare_schema_and_exporters(rules, client)
@@ -272,7 +270,7 @@ class DMSExporter(CDFExporter[DMSSchema]):
272
270
  if self.export_components.intersection({"all", "views"}):
273
271
  to_export.append((schema.views, ViewLoader(client, self.existing_handling)))
274
272
  if self.export_components.intersection({"all", "data_models"}):
275
- to_export.append((schema.data_models, DataModelLoader(client)))
273
+ to_export.append((DataModelApplyList([schema.data_model]), DataModelLoader(client)))
276
274
  if isinstance(schema, PipelineSchema):
277
275
  to_export.append((schema.databases, RawDatabaseLoader(client)))
278
276
  to_export.append((schema.raw_tables, RawTableLoader(client)))
@@ -6,7 +6,7 @@ from typing import Any, Literal, cast, overload
6
6
 
7
7
  from cognite.client import CogniteClient
8
8
  from cognite.client import data_modeling as dm
9
- from cognite.client.data_classes.data_modeling import DataModelIdentifier
9
+ from cognite.client.data_classes.data_modeling import DataModelId, DataModelIdentifier
10
10
  from cognite.client.data_classes.data_modeling.containers import BTreeIndex, InvertedIndex
11
11
  from cognite.client.data_classes.data_modeling.views import (
12
12
  MultiEdgeConnectionApply,
@@ -39,7 +39,6 @@ from cognite.neat.rules.models.dms import (
39
39
  from cognite.neat.rules.models.entities import (
40
40
  ClassEntity,
41
41
  ContainerEntity,
42
- DataModelEntity,
43
42
  DMSUnknownEntity,
44
43
  ViewEntity,
45
44
  ViewPropertyEntity,
@@ -52,12 +51,14 @@ class DMSImporter(BaseImporter):
52
51
  schema: DMSSchema,
53
52
  read_issues: Sequence[ValidationIssue] | None = None,
54
53
  metadata: DMSMetadata | None = None,
54
+ ref_metadata: DMSMetadata | None = None,
55
55
  ):
56
56
  # Calling this root schema to distinguish it from
57
57
  # * User Schema
58
58
  # * Reference Schema
59
59
  self.root_schema = schema
60
60
  self.metadata = metadata
61
+ self.ref_metadata = ref_metadata
61
62
  self.issue_list = IssueList(read_issues)
62
63
  self._all_containers_by_id = {container.as_id(): container for container in schema.containers}
63
64
  if self.root_schema.reference:
@@ -66,42 +67,78 @@ class DMSImporter(BaseImporter):
66
67
  )
67
68
 
68
69
  @classmethod
69
- def from_data_model_id(cls, client: CogniteClient, data_model_id: DataModelIdentifier) -> "DMSImporter":
70
+ def from_data_model_id(
71
+ cls,
72
+ client: CogniteClient,
73
+ data_model_id: DataModelIdentifier,
74
+ reference_model_id: DataModelIdentifier | None = None,
75
+ ) -> "DMSImporter":
70
76
  """Create a DMSImporter ready to convert the given data model to rules.
71
77
 
72
78
  Args:
73
79
  client: Instantiated CogniteClient to retrieve data model.
80
+ reference_model_id: The reference data model to retrieve. This is the data model that
81
+ the given data model is built on top of, typically, an enterprise data model.
74
82
  data_model_id: Data Model to retrieve.
75
83
 
76
84
  Returns:
77
85
  DMSImporter: DMSImporter instance
78
86
  """
79
- data_models = client.data_modeling.data_models.retrieve(data_model_id, inline_views=True)
80
- if len(data_models) == 0:
87
+ data_model_ids = [data_model_id, reference_model_id] if reference_model_id else [data_model_id]
88
+ data_models = client.data_modeling.data_models.retrieve(data_model_ids, inline_views=True)
89
+
90
+ user_models = cls._find_model_in_list(data_models, data_model_id)
91
+ if len(user_models) == 0:
81
92
  return cls(DMSSchema(), [issues.importing.NoDataModelError(f"Data model {data_model_id} not found")])
82
- data_model = data_models.latest_version()
93
+ user_model = user_models.latest_version()
94
+
95
+ if reference_model_id:
96
+ ref_models = cls._find_model_in_list(data_models, reference_model_id)
97
+ if len(ref_models) == 0:
98
+ return cls(
99
+ DMSSchema(), [issues.importing.NoDataModelError(f"Data model {reference_model_id} not found")]
100
+ )
101
+ ref_model: dm.DataModel[dm.View] | None = ref_models.latest_version()
102
+ else:
103
+ ref_model = None
83
104
 
84
105
  try:
85
- schema = DMSSchema.from_data_model(client, data_model)
106
+ schema = DMSSchema.from_data_model(client, user_model, ref_model)
86
107
  except Exception as e:
87
108
  return cls(DMSSchema(), [issues.importing.APIError(str(e))])
88
109
 
89
- created = ms_to_datetime(data_model.created_time)
90
- updated = ms_to_datetime(data_model.last_updated_time)
110
+ metadata = cls._create_metadata_from_model(user_model)
111
+ ref_metadata = cls._create_metadata_from_model(ref_model) if ref_model else None
91
112
 
92
- metadata = cls._create_metadata_from_model(data_model, created, updated)
113
+ return cls(schema, [], metadata, ref_metadata)
93
114
 
94
- return cls(schema, [], metadata)
115
+ @classmethod
116
+ def _find_model_in_list(
117
+ cls, data_models: dm.DataModelList[dm.View], model_id: DataModelIdentifier
118
+ ) -> dm.DataModelList[dm.View]:
119
+ identifier = DataModelId.load(model_id)
120
+ return dm.DataModelList[dm.View](
121
+ [
122
+ model
123
+ for model in data_models
124
+ if (model.space, model.external_id) == (identifier.space, identifier.external_id)
125
+ ]
126
+ )
95
127
 
96
128
  @classmethod
97
129
  def _create_metadata_from_model(
98
130
  cls,
99
131
  model: dm.DataModel[dm.View] | dm.DataModelApply,
100
- created: datetime | None = None,
101
- updated: datetime | None = None,
102
132
  ) -> DMSMetadata:
103
133
  description, creator = DMSMetadata._get_description_and_creator(model.description)
104
- now = datetime.now().replace(microsecond=0)
134
+
135
+ if isinstance(model, dm.DataModel):
136
+ created = ms_to_datetime(model.created_time)
137
+ updated = ms_to_datetime(model.last_updated_time)
138
+ else:
139
+ now = datetime.now().replace(microsecond=0)
140
+ created = now
141
+ updated = now
105
142
  return DMSMetadata(
106
143
  schema_=SchemaCompleteness.complete,
107
144
  extension=ExtensionCategory.addition,
@@ -109,8 +146,8 @@ class DMSImporter(BaseImporter):
109
146
  external_id=model.external_id,
110
147
  name=model.name or model.external_id,
111
148
  version=model.version or "0.1.0",
112
- updated=updated or now,
113
- created=created or now,
149
+ updated=updated,
150
+ created=created,
114
151
  creator=creator,
115
152
  description=description,
116
153
  )
@@ -147,28 +184,33 @@ class DMSImporter(BaseImporter):
147
184
  # In case there were errors during the import, the to_rules method will return None
148
185
  return self._return_or_raise(self.issue_list, errors)
149
186
 
150
- if len(self.root_schema.data_models) == 0:
187
+ if not self.root_schema.data_model:
151
188
  self.issue_list.append(issues.importing.NoDataModelError("No data model found."))
152
189
  return self._return_or_raise(self.issue_list, errors)
153
-
190
+ model = self.root_schema.data_model
154
191
  with _handle_issues(
155
192
  self.issue_list,
156
193
  ) as future:
157
194
  schema_completeness = SchemaCompleteness.complete
158
195
  data_model_type = DataModelType.enterprise
159
196
  reference: DMSRules | None = None
160
- if ref_schema := self.root_schema.reference:
197
+ if (ref_schema := self.root_schema.reference) and (ref_model := ref_schema.data_model):
161
198
  # Reference should always be an enterprise model.
162
199
  reference = DMSRules(
163
200
  **self._create_rule_components(
164
- ref_schema, self._create_default_metadata(ref_schema.views), DataModelType.enterprise
201
+ ref_model,
202
+ ref_schema,
203
+ self.ref_metadata or self._create_default_metadata(ref_schema.views),
204
+ DataModelType.enterprise,
165
205
  )
166
206
  )
167
207
  schema_completeness = SchemaCompleteness.extended
168
208
  data_model_type = DataModelType.solution
169
209
 
170
210
  user_rules = DMSRules(
171
- **self._create_rule_components(self.root_schema, self.metadata, data_model_type, schema_completeness),
211
+ **self._create_rule_components(
212
+ model, self.root_schema, self.metadata, data_model_type, schema_completeness
213
+ ),
172
214
  reference=reference,
173
215
  )
174
216
 
@@ -179,21 +221,12 @@ class DMSImporter(BaseImporter):
179
221
 
180
222
  def _create_rule_components(
181
223
  self,
224
+ data_model: dm.DataModelApply,
182
225
  schema: DMSSchema,
183
226
  metadata: DMSMetadata | None = None,
184
227
  data_model_type: DataModelType | None = None,
185
228
  schema_completeness: SchemaCompleteness | None = None,
186
229
  ) -> dict[str, Any]:
187
- if len(schema.data_models) > 2:
188
- # Creating a DataModelEntity to convert the data model id to a string.
189
- self.issue_list.append(
190
- issues.importing.MultipleDataModelsWarning(
191
- [str(DataModelEntity.from_id(model.as_id())) for model in schema.data_models]
192
- )
193
- )
194
-
195
- data_model = schema.data_models[0]
196
-
197
230
  properties = SheetList[DMSProperty]()
198
231
  for view in schema.views:
199
232
  view_id = view.as_id()
@@ -42,11 +42,9 @@ class _DMSExporter:
42
42
  def __init__(
43
43
  self,
44
44
  rules: DMSRules,
45
- include_ref: bool = True,
46
45
  include_pipeline: bool = False,
47
46
  instance_space: str | None = None,
48
47
  ):
49
- self.include_ref = include_ref
50
48
  self.include_pipeline = include_pipeline
51
49
  self.instance_space = instance_space
52
50
  self.rules = rules
@@ -75,7 +73,7 @@ class _DMSExporter:
75
73
 
76
74
  output = DMSSchema(
77
75
  spaces=spaces,
78
- data_models=dm.DataModelApplyList([data_model]),
76
+ data_model=data_model,
79
77
  views=views,
80
78
  containers=containers,
81
79
  node_types=node_types,
@@ -345,12 +345,10 @@ class DMSRules(BaseRules):
345
345
  space, version = self.metadata.space, self.metadata.version
346
346
  return _DMSRulesSerializer(info, space, version).clean(dumped)
347
347
 
348
- def as_schema(
349
- self, include_ref: bool = False, include_pipeline: bool = False, instance_space: str | None = None
350
- ) -> DMSSchema:
348
+ def as_schema(self, include_pipeline: bool = False, instance_space: str | None = None) -> DMSSchema:
351
349
  from ._exporter import _DMSExporter
352
350
 
353
- return _DMSExporter(self, include_ref, include_pipeline, instance_space).to_schema()
351
+ return _DMSExporter(self, include_pipeline, instance_space).to_schema()
354
352
 
355
353
  def as_information_architect_rules(self) -> "InformationRules":
356
354
  from ._converter import _DMSRulesConverter
@@ -3,6 +3,7 @@ import sys
3
3
  import warnings
4
4
  import zipfile
5
5
  from collections import Counter, defaultdict
6
+ from collections.abc import Sequence
6
7
  from dataclasses import Field, dataclass, field, fields
7
8
  from pathlib import Path
8
9
  from typing import Any, ClassVar, cast
@@ -43,12 +44,12 @@ else:
43
44
 
44
45
  @dataclass
45
46
  class DMSSchema:
46
- data_models: dm.DataModelApplyList = field(default_factory=lambda: dm.DataModelApplyList([]))
47
+ data_model: dm.DataModelApply | None = None
47
48
  spaces: dm.SpaceApplyList = field(default_factory=lambda: dm.SpaceApplyList([]))
48
49
  views: dm.ViewApplyList = field(default_factory=lambda: dm.ViewApplyList([]))
49
50
  containers: dm.ContainerApplyList = field(default_factory=lambda: dm.ContainerApplyList([]))
50
51
  node_types: dm.NodeApplyList = field(default_factory=lambda: dm.NodeApplyList([]))
51
- # The last schema is the previous version of the data model. In the case, extension=additio, this
52
+ # The last schema is the previous version of the data model. In the case, extension=addition, this
52
53
  # should not be modified.
53
54
  last: "DMSSchema | None" = None
54
55
  # Reference is typically the Enterprise model, while this is the solution model.
@@ -57,7 +58,7 @@ class DMSSchema:
57
58
  _FIELD_NAME_BY_RESOURCE_TYPE: ClassVar[dict[str, str]] = {
58
59
  "container": "containers",
59
60
  "view": "views",
60
- "datamodel": "data_models",
61
+ "datamodel": "data_model",
61
62
  "space": "spaces",
62
63
  "node": "node_types",
63
64
  }
@@ -95,18 +96,49 @@ class DMSSchema:
95
96
  return cls.from_data_model(client, data_model)
96
97
 
97
98
  @classmethod
98
- def from_data_model(cls, client: CogniteClient, data_model: dm.DataModel) -> "DMSSchema":
99
+ def from_data_model(
100
+ cls,
101
+ client: CogniteClient,
102
+ data_model: dm.DataModel[dm.View],
103
+ reference_model: dm.DataModel[dm.View] | None = None,
104
+ ) -> "DMSSchema":
105
+ """Create a schema from a data model.
106
+
107
+ If a reference model is provided, the schema will include a reference schema. To determine which views,
108
+ and containers to put in the reference schema, the following rule is applied:
109
+
110
+ If a view or container space is different from the data model space,
111
+ it will be included in the reference schema.*
112
+
113
+ *One exception to this rule is if a view is directly referenced by the data model. In this case, the view will
114
+ be included in the data model schema, even if the space is different.
115
+
116
+ Args:
117
+ client: The Cognite client used for retrieving components referenced by the data model.
118
+ data_model: The data model to create the schema from.
119
+ reference_model: (Optional) The reference model to include in the schema.
120
+ This is typically the Enterprise model.
121
+
122
+ Returns:
123
+ DMSSchema: The schema created from the data model.
124
+ """
99
125
  views = dm.ViewList(data_model.views)
126
+
127
+ data_model_write = data_model.as_write()
128
+ data_model_write.views = list(views.as_ids())
129
+
130
+ if reference_model:
131
+ views.extend(reference_model.views)
132
+
100
133
  container_ids = views.referenced_containers()
101
134
  containers = client.data_modeling.containers.retrieve(list(container_ids))
102
135
  cls._append_referenced_containers(client, containers)
103
136
 
104
- space_read = client.data_modeling.spaces.retrieve(data_model.space)
105
- if space_read is None:
106
- raise ValueError(f"Space {data_model.space} not found")
107
- space = space_read.as_write()
108
- data_model_write = data_model.as_write()
109
- data_model_write.views = list(views.as_write())
137
+ space_ids = [data_model.space, reference_model.space] if reference_model else [data_model.space]
138
+ space_read = client.data_modeling.spaces.retrieve(space_ids)
139
+ if len(space_read) != len(space_ids):
140
+ raise ValueError(f"Space(s) {space_read} not found")
141
+ space_write = space_read.as_write()
110
142
 
111
143
  view_loader = ViewLoader(client)
112
144
  # We need to include parent views in the schema to make sure that the schema is valid.
@@ -121,11 +153,41 @@ class DMSSchema:
121
153
  # The ViewLoader as_write method looks up parents and remove properties from them.
122
154
  view_write = dm.ViewApplyList([view_loader.as_write(view) for view in views])
123
155
 
156
+ container_write = containers.as_write()
157
+ user_space = data_model.space
158
+ if reference_model:
159
+ user_model_view_ids = set(data_model_write.views)
160
+ ref_model_write = reference_model.as_write()
161
+ ref_model_write.views = [view.as_id() for view in reference_model.views]
162
+
163
+ ref_views = dm.ViewApplyList(
164
+ [view for view in view_write if (view.space != user_space) or (view.as_id() not in user_model_view_ids)]
165
+ )
166
+ view_write = dm.ViewApplyList(
167
+ [view for view in view_write if view.space == user_space or view.as_id() in user_model_view_ids]
168
+ )
169
+
170
+ ref_containers = dm.ContainerApplyList(
171
+ [container for container in container_write if container.space != user_space]
172
+ )
173
+ container_write = dm.ContainerApplyList(
174
+ [container for container in container_write if container.space == user_space]
175
+ )
176
+
177
+ ref_schema: DMSSchema | None = cls(
178
+ spaces=dm.SpaceApplyList([s for s in space_write if s.space != user_space]),
179
+ data_model=ref_model_write,
180
+ views=ref_views,
181
+ containers=ref_containers,
182
+ )
183
+ else:
184
+ ref_schema = None
124
185
  return cls(
125
- spaces=dm.SpaceApplyList([space]),
126
- data_models=dm.DataModelApplyList([data_model_write]),
186
+ spaces=dm.SpaceApplyList([s for s in space_write if s.space == user_space]),
187
+ data_model=data_model_write,
127
188
  views=view_write,
128
- containers=containers.as_write(),
189
+ containers=container_write,
190
+ reference=ref_schema,
129
191
  )
130
192
 
131
193
  @classmethod
@@ -187,11 +249,10 @@ class DMSSchema:
187
249
  (data_models / f"{space.space}.space.yaml").write_text(
188
250
  space.dump_yaml(), newline=new_line, encoding=encoding
189
251
  )
190
- if "data_models" not in exclude_set:
191
- for model in self.data_models:
192
- (data_models / f"{model.external_id}.datamodel.yaml").write_text(
193
- model.dump_yaml(), newline=new_line, encoding=encoding
194
- )
252
+ if "data_models" not in exclude_set and self.data_model:
253
+ (data_models / f"{self.data_model.external_id}.datamodel.yaml").write_text(
254
+ self.data_model.dump_yaml(), newline=new_line, encoding=encoding
255
+ )
195
256
  if "views" not in exclude_set and self.views:
196
257
  view_dir = data_models / "views"
197
258
  view_dir.mkdir(parents=True, exist_ok=True)
@@ -265,9 +326,10 @@ class DMSSchema:
265
326
  if "spaces" not in exclude_set:
266
327
  for space in self.spaces:
267
328
  zip_ref.writestr(f"data_models/{space.space}.space.yaml", space.dump_yaml())
268
- if "data_models" not in exclude_set:
269
- for model in self.data_models:
270
- zip_ref.writestr(f"data_models/{model.external_id}.datamodel.yaml", model.dump_yaml())
329
+ if "data_models" not in exclude_set and self.data_model:
330
+ zip_ref.writestr(
331
+ f"data_models/{self.data_model.external_id}.datamodel.yaml", self.data_model.dump_yaml()
332
+ )
271
333
  if "views" not in exclude_set:
272
334
  for view in self.views:
273
335
  zip_ref.writestr(f"data_models/views/{view.external_id}.view.yaml", view.dump_yaml())
@@ -308,10 +370,30 @@ class DMSSchema:
308
370
  loaded: dict[str, Any] = {}
309
371
  for attr in fields(cls):
310
372
  if items := data_dict.get(attr.name) or data_dict.get(to_camel(attr.name)):
311
- try:
312
- loaded[attr.name] = attr.type.load(items)
313
- except Exception as e:
314
- loaded[attr.name] = cls._load_individual_resources(items, attr, str(e), context.get(attr.name, []))
373
+ if attr.name == "data_model":
374
+ if isinstance(items, list) and len(items) > 1:
375
+ warnings.warn(
376
+ issues.importing.MultipleDataModelsWarning(
377
+ [item.get("externalId", "Unknown") for item in items]
378
+ ),
379
+ stacklevel=2,
380
+ )
381
+ item = items[0] if isinstance(items, list) else items
382
+ try:
383
+ loaded[attr.name] = dm.DataModelApply.load(item)
384
+ except Exception as e:
385
+ data_model_file = context.get(attr.name, [Path("UNKNOWN")])[0]
386
+ warnings.warn(
387
+ issues.fileread.FailedLoadWarning(data_model_file, dm.DataModelApply.__name__, str(e)),
388
+ stacklevel=2,
389
+ )
390
+ else:
391
+ try:
392
+ loaded[attr.name] = attr.type.load(items)
393
+ except Exception as e:
394
+ loaded[attr.name] = cls._load_individual_resources(
395
+ items, attr, str(e), context.get(attr.name, [])
396
+ )
315
397
  return cls(**loaded)
316
398
 
317
399
  @classmethod
@@ -353,9 +435,12 @@ class DMSSchema:
353
435
  cls_fields = sorted(fields(self), key=lambda f: f.name) if sort else fields(self)
354
436
  for attr in cls_fields:
355
437
  if items := getattr(self, attr.name):
356
- items = sorted(items, key=self._to_sortable_identifier) if sort else items
357
438
  key = to_camel(attr.name) if camel_case else attr.name
358
- output[key] = [item.dump(camel_case=camel_case) for item in items]
439
+ if isinstance(items, Sequence):
440
+ items = sorted(items, key=self._to_sortable_identifier) if sort else items
441
+ output[key] = [item.dump(camel_case=camel_case) for item in items]
442
+ else:
443
+ output[key] = items.dump(camel_case=camel_case)
359
444
  return output
360
445
 
361
446
  @classmethod
@@ -458,7 +543,8 @@ class DMSSchema:
458
543
  )
459
544
  )
460
545
 
461
- for model in self.data_models:
546
+ if self.data_model:
547
+ model = self.data_model
462
548
  if model.space not in defined_spaces:
463
549
  errors.add(MissingSpaceError(space=model.space, referred_by=model.as_id()))
464
550
 
@@ -506,16 +592,25 @@ class DMSSchema:
506
592
  )
507
593
  return None
508
594
 
509
- def referenced_spaces(self) -> set[str]:
510
- referenced_spaces = {container.space for container in self.containers}
511
- referenced_spaces |= {view.space for view in self.views}
512
- referenced_spaces |= {container.space for view in self.views for container in view.referenced_containers()}
513
- referenced_spaces |= {parent.space for view in self.views for parent in view.implements or []}
595
+ def referenced_spaces(self, include_indirect_references: bool = True) -> set[str]:
596
+ """Get the spaces referenced by the schema.
597
+
598
+ Args:
599
+ include_indirect_references (bool): If True, the spaces referenced by as view.implements, and
600
+ view.referenced_containers will be included in the output.
601
+ Returns:
602
+ set[str]: The spaces referenced by the schema.
603
+ """
604
+ referenced_spaces = {view.space for view in self.views}
605
+ referenced_spaces |= {container.space for container in self.containers}
606
+ if include_indirect_references:
607
+ referenced_spaces |= {container.space for view in self.views for container in view.referenced_containers()}
608
+ referenced_spaces |= {parent.space for view in self.views for parent in view.implements or []}
514
609
  referenced_spaces |= {node.space for node in self.node_types}
515
- referenced_spaces |= {model.space for model in self.data_models}
516
- referenced_spaces |= {view.space for model in self.data_models for view in model.views or []}
610
+ if self.data_model:
611
+ referenced_spaces |= {self.data_model.space}
612
+ referenced_spaces |= {view.space for view in self.data_model.views or []}
517
613
  referenced_spaces |= {s.space for s in self.spaces}
518
-
519
614
  return referenced_spaces
520
615
 
521
616
 
@@ -625,9 +720,9 @@ class PipelineSchema(DMSSchema):
625
720
 
626
721
  @classmethod
627
722
  def from_dms(cls, schema: DMSSchema, instance_space: str | None = None) -> "PipelineSchema":
628
- if not schema.data_models:
723
+ if not schema.data_model:
629
724
  raise ValueError("PipelineSchema must contain at least one data model")
630
- first_data_model = schema.data_models[0]
725
+ first_data_model = schema.data_model
631
726
  # The database name is limited to 32 characters
632
727
  database_name = first_data_model.external_id[:32]
633
728
  instance_space = instance_space or first_data_model.space
@@ -666,7 +761,7 @@ class PipelineSchema(DMSSchema):
666
761
 
667
762
  return cls(
668
763
  spaces=schema.spaces,
669
- data_models=schema.data_models,
764
+ data_model=schema.data_model,
670
765
  views=schema.views,
671
766
  containers=schema.containers,
672
767
  transformations=transformations,
@@ -164,7 +164,7 @@ class DMSPostValidation:
164
164
  # Everything is allowed
165
165
  return None
166
166
  # Is an extension of an existing model.
167
- user_schema = self.rules.as_schema(include_ref=False)
167
+ user_schema = self.rules.as_schema()
168
168
  ref_schema = self.rules.reference.as_schema()
169
169
  new_containers = {container.as_id(): container for container in user_schema.containers}
170
170
  existing_containers = {container.as_id(): container for container in ref_schema.containers}
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cognite-neat"
3
- version = "0.76.3"
3
+ version = "0.77.0"
4
4
  readme = "README.md"
5
5
  description = "Knowledge graph transformation"
6
6
  authors = [
@@ -1 +0,0 @@
1
- __version__ = "0.76.3"
File without changes
File without changes