cognite-neat 0.76.2__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.2 → 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.2 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_rules2dms.py +3 -5
  4. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_rules2excel.py +62 -37
  5. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dms2rules.py +64 -31
  6. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_spreadsheet2rules.py +77 -58
  7. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/issues/dms.py +65 -0
  8. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_exporter.py +1 -3
  9. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_rules.py +2 -4
  10. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_rules_input.py +9 -0
  11. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_schema.py +160 -39
  12. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_serializer.py +5 -5
  13. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_validation.py +34 -1
  14. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/domain.py +1 -0
  15. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/information/_converter.py +2 -0
  16. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +2 -1
  17. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/pyproject.toml +1 -1
  18. cognite_neat-0.76.2/cognite/neat/_version.py +0 -1
  19. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/LICENSE +0 -0
  20. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/README.md +0 -0
  21. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/__init__.py +0 -0
  22. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/__init__.py +0 -0
  23. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/asgi/metrics.py +0 -0
  24. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/configuration.py +0 -0
  25. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/context_manager/__init__.py +0 -0
  26. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/context_manager/manager.py +0 -0
  27. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/data_classes/__init__.py +0 -0
  28. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/data_classes/rest.py +0 -0
  29. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/explorer.py +0 -0
  30. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/configuration.py +0 -0
  31. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/core.py +0 -0
  32. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/crud.py +0 -0
  33. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/data_exploration.py +0 -0
  34. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/metrics.py +0 -0
  35. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/rules.py +0 -0
  36. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/routers/workflows.py +0 -0
  37. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/utils/__init__.py +0 -0
  38. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/utils/data_mapping.py +0 -0
  39. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/utils/logging.py +0 -0
  40. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/api/utils/query_templates.py +0 -0
  41. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/main.py +0 -0
  42. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/monitoring/__init__.py +0 -0
  43. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/monitoring/metrics.py +0 -0
  44. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/index.html +0 -0
  45. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
  46. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/README.md +0 -0
  47. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
  48. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
  49. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
  50. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
  51. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
  52. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
  53. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
  54. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
  55. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
  56. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css +0 -0
  57. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css.map +0 -0
  58. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js +0 -0
  59. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.LICENSE.txt +0 -0
  60. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.map +0 -0
  61. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
  62. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/config.py +0 -0
  63. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/constants.py +0 -0
  64. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/exceptions.py +0 -0
  65. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/__init__.py +0 -0
  66. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  67. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  68. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/examples/__init__.py +0 -0
  69. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  70. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/exceptions.py +0 -0
  71. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/extractors/__init__.py +0 -0
  72. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/extractors/_base.py +0 -0
  73. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/extractors/_mock_graph_generator.py +0 -0
  74. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/models.py +0 -0
  75. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/stores/__init__.py +0 -0
  76. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_base.py +0 -0
  77. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_graphdb_store.py +0 -0
  78. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_memory_store.py +0 -0
  79. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_oxigraph_store.py +0 -0
  80. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_oxrdflib.py +0 -0
  81. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/graph/stores/_rdf_to_graph.py +0 -0
  82. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/__init__.py +0 -0
  83. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/__init__.py +0 -0
  84. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  85. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  86. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/examples/__init__.py +0 -0
  87. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  88. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/exceptions.py +0 -0
  89. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/extractors/__init__.py +0 -0
  90. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/extractors/_base.py +0 -0
  91. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/extractors/_dexpi.py +0 -0
  92. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/extractors/_graph_capturing_sheet.py +0 -0
  93. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +0 -0
  94. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/__init__.py +0 -0
  95. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/_asset_loader.py +0 -0
  96. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/_base.py +0 -0
  97. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/_exceptions.py +0 -0
  98. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/core/__init__.py +0 -0
  99. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/core/labels.py +0 -0
  100. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/core/models.py +0 -0
  101. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +0 -0
  102. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +0 -0
  103. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/rdf_to_dms.py +0 -0
  104. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/loaders/validator.py +0 -0
  105. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/models.py +0 -0
  106. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/__init__.py +0 -0
  107. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_base.py +0 -0
  108. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_graphdb_store.py +0 -0
  109. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_memory_store.py +0 -0
  110. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_oxigraph_store.py +0 -0
  111. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_oxrdflib.py +0 -0
  112. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/stores/_rdf_to_graph.py +0 -0
  113. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/transformations/__init__.py +0 -0
  114. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/transformations/entity_matcher.py +0 -0
  115. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/transformations/query_generator/__init__.py +0 -0
  116. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/transformations/query_generator/sparql.py +0 -0
  117. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/graph/transformations/transformer.py +0 -0
  118. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/__init__.py +0 -0
  119. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/analysis.py +0 -0
  120. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-TNT.xlsx +0 -0
  121. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
  122. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/__init__.py +0 -0
  123. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/power-grid-containers.yaml +0 -0
  124. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/power-grid-example.xlsx +0 -0
  125. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/power-grid-model.yaml +0 -0
  126. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/rules-template.xlsx +0 -0
  127. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
  128. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/skos-rules.xlsx +0 -0
  129. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
  130. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/examples/wind-energy.owl +0 -0
  131. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exceptions.py +0 -0
  132. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/__init__.py +0 -0
  133. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_base.py +0 -0
  134. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_core/__init__.py +0 -0
  135. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_core/rules2labels.py +0 -0
  136. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2dms.py +0 -0
  137. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2excel.py +0 -0
  138. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2graphql.py +0 -0
  139. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2ontology.py +0 -0
  140. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2pydantic_models.py +0 -0
  141. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2rules.py +0 -0
  142. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_rules2triples.py +0 -0
  143. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/exporters/_validation.py +0 -0
  144. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/__init__.py +0 -0
  145. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_base.py +0 -0
  146. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_dict2rules.py +0 -0
  147. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_dms2rules.py +0 -0
  148. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_graph2rules.py +0 -0
  149. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_json2rules.py +0 -0
  150. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_owl2rules/__init__.py +0 -0
  151. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2classes.py +0 -0
  152. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2metadata.py +0 -0
  153. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2properties.py +0 -0
  154. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2rules.py +0 -0
  155. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_spreadsheet2rules.py +0 -0
  156. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_xsd2rules.py +0 -0
  157. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/importers/_yaml2rules.py +0 -0
  158. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/__init__.py +0 -0
  159. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/_base.py +0 -0
  160. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/raw_rules.py +0 -0
  161. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/rdfpath.py +0 -0
  162. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/rules.py +0 -0
  163. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/tables.py +0 -0
  164. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/rules/models/value_types.py +0 -0
  165. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +0 -0
  166. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
  167. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
  168. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
  169. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +0 -0
  170. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
  171. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +0 -0
  172. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  173. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
  174. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
  175. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/py.typed +0 -0
  176. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/__init__.py +0 -0
  177. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/_shared.py +0 -0
  178. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/analysis/__init__.py +0 -0
  179. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/analysis/_base.py +0 -0
  180. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/analysis/_information_rules.py +0 -0
  181. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/examples/__init__.py +0 -0
  182. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/examples/wind-energy.owl +0 -0
  183. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/exceptions.py +0 -0
  184. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/__init__.py +0 -0
  185. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_base.py +0 -0
  186. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_models.py +0 -0
  187. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_rules2ontology.py +0 -0
  188. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
  189. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/exporters/_validation.py +0 -0
  190. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/__init__.py +0 -0
  191. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_base.py +0 -0
  192. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
  193. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
  194. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
  195. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
  196. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
  197. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_owl2rules/__init__.py +0 -0
  198. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_owl2rules/_owl2classes.py +0 -0
  199. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +0 -0
  200. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_owl2rules/_owl2properties.py +0 -0
  201. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_owl2rules/_owl2rules.py +0 -0
  202. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/importers/_yaml2rules.py +0 -0
  203. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/issues/__init__.py +0 -0
  204. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/issues/base.py +0 -0
  205. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/issues/fileread.py +0 -0
  206. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/issues/formatters.py +0 -0
  207. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/issues/importing.py +0 -0
  208. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/issues/spreadsheet.py +0 -0
  209. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/issues/spreadsheet_file.py +0 -0
  210. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/__init__.py +0 -0
  211. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/_base.py +0 -0
  212. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/_rdfpath.py +0 -0
  213. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/_types/__init__.py +0 -0
  214. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/_types/_base.py +0 -0
  215. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/_types/_field.py +0 -0
  216. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/data_types.py +0 -0
  217. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/__init__.py +0 -0
  218. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/dms/_converter.py +0 -0
  219. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/entities.py +0 -0
  220. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/information/__init__.py +0 -0
  221. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/information/_rules.py +0 -0
  222. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/rules/models/wrapped_entities.py +0 -0
  223. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/__init__.py +0 -0
  224. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/auxiliary.py +0 -0
  225. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/cdf.py +0 -0
  226. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/cdf_loaders/__init__.py +0 -0
  227. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/cdf_loaders/_base.py +0 -0
  228. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/cdf_loaders/_data_modeling.py +0 -0
  229. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/cdf_loaders/_ingestion.py +0 -0
  230. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/cdf_loaders/data_classes.py +0 -0
  231. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/exceptions.py +0 -0
  232. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/spreadsheet.py +0 -0
  233. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/text.py +0 -0
  234. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/utils.py +0 -0
  235. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/utils/xml.py +0 -0
  236. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/__init__.py +0 -0
  237. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/_exceptions.py +0 -0
  238. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/base.py +0 -0
  239. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/cdf_store.py +0 -0
  240. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
  241. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
  242. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
  243. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
  244. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
  245. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
  246. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
  247. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  248. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
  249. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
  250. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/manager.py +0 -0
  251. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/migration/__init__.py +0 -0
  252. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/migration/steps.py +0 -0
  253. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/migration/wf_manifests.py +0 -0
  254. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/model.py +0 -0
  255. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/__init__.py +0 -0
  256. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/data_contracts.py +0 -0
  257. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/__init__.py +0 -0
  258. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
  259. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
  260. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
  261. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
  262. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/rules_importer.py +0 -0
  263. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
  264. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
  265. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
  266. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/__init__.py +0 -0
  267. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/graph_contextualization.py +0 -0
  268. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/graph_extractor.py +0 -0
  269. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/graph_loader.py +0 -0
  270. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/graph_store.py +0 -0
  271. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/graph_transformer.py +0 -0
  272. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/rules_exporter.py +0 -0
  273. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/lib/legacy/rules_importer.py +0 -0
  274. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps/step_model.py +0 -0
  275. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/steps_registry.py +0 -0
  276. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/tasks.py +0 -0
  277. {cognite_neat-0.76.2 → cognite_neat-0.77.0}/cognite/neat/workflows/triggers.py +0 -0
  278. {cognite_neat-0.76.2 → 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.2
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)))
@@ -13,8 +13,10 @@ from openpyxl.worksheet.worksheet import Worksheet
13
13
 
14
14
  from cognite.neat.rules._shared import Rules
15
15
  from cognite.neat.rules.models import (
16
+ DataModelType,
16
17
  DMSRules,
17
18
  DomainRules,
19
+ ExtensionCategory,
18
20
  InformationRules,
19
21
  RoleTypes,
20
22
  SchemaCompleteness,
@@ -35,11 +37,18 @@ class ExcelExporter(BaseExporter[Workbook]):
35
37
  new_model_id: The new model ID to use for the exported spreadsheet. This is only applicable if the input
36
38
  rules have 'is_reference' set. If provided, the model ID will be used to automatically create the
37
39
  new metadata sheet in the Excel file.
38
- is_reference: If True, the rules are considered to be a reference model. The exported Excel file will
39
- then contain empty sheets for the main rules and this data model will be dumped to the reference sheets.
40
- This is useful when you are building a solution model based on an Enterprise model, then the
41
- Enterprise model will serve as the reference model. It is also useful when you are extending an existing
42
- model, then the existing model will serve as the reference model. Defaults to False.
40
+ dump_as: This determines how the rules are written to the Excel file. An Excel file has up to three sets of
41
+ sheets: user, last, and reference. The user sheets are used for inputting rules from a user. The last sheets
42
+ are used for the last version of the same model as the user, while the reference sheets are used for
43
+ the model the user is building on. The options are:
44
+ * "user": The rules are written to the user sheets. This is used when you want to modify the rules
45
+ directly and potentially change the model. This is useful when you have imported the data model
46
+ from outside CDF and you want to modify it before you write it to CDF.
47
+ * "last": The rules are written to the last sheets. This is used when you want to extend the rules,
48
+ but have validation that you are not breaking the existing model. This is used when you want to
49
+ change a model that has already been published to CDF and that model is in production.
50
+ * "reference": The rules are written to the reference sheets. This is typically used when you want to build
51
+ a new solution on top of an enterprise model.
43
52
 
44
53
  The following styles are available:
45
54
 
@@ -51,7 +60,7 @@ class ExcelExporter(BaseExporter[Workbook]):
51
60
  """
52
61
 
53
62
  Style = Literal["none", "minimal", "default", "maximal"]
54
-
63
+ DumpOptions = Literal["user", "last", "reference"]
55
64
  _main_header_by_sheet_name: ClassVar[dict[str, str]] = {
56
65
  "Properties": "Definition of Properties per Class",
57
66
  "Classes": "Definition of Classes",
@@ -59,21 +68,24 @@ class ExcelExporter(BaseExporter[Workbook]):
59
68
  "Containers": "Definition of Containers",
60
69
  }
61
70
  style_options = get_args(Style)
71
+ dump_options = get_args(DumpOptions)
62
72
 
63
73
  def __init__(
64
74
  self,
65
75
  styling: Style = "default",
66
76
  output_role: RoleTypes | None = None,
67
77
  new_model_id: tuple[str, str, str] | None = None,
68
- is_reference: bool = False,
78
+ dump_as: DumpOptions = "user",
69
79
  ):
70
80
  if styling not in self.style_options:
71
81
  raise ValueError(f"Invalid styling: {styling}. Valid options are {self.style_options}")
82
+ if dump_as not in self.dump_options:
83
+ raise ValueError(f"Invalid dump_as: {dump_as}. Valid options are {self.dump_options}")
72
84
  self.styling = styling
73
85
  self._styling_level = self.style_options.index(styling)
74
86
  self.output_role = output_role
75
87
  self.new_model_id = new_model_id
76
- self.is_reference = is_reference
88
+ self.dump_as = dump_as
77
89
 
78
90
  def export_to_file(self, rules: Rules, filepath: Path) -> None:
79
91
  """Exports transformation rules to excel file."""
@@ -90,41 +102,48 @@ class ExcelExporter(BaseExporter[Workbook]):
90
102
  # Remove default sheet named "Sheet"
91
103
  workbook.remove(workbook["Sheet"])
92
104
 
93
- dumped_rules: dict[str, Any]
105
+ dumped_user_rules: dict[str, Any]
106
+ dumped_last_rules: dict[str, Any] | None = None
94
107
  dumped_reference_rules: dict[str, Any] | None = None
95
- if self.is_reference:
108
+ if self.dump_as != "user":
96
109
  # Writes empty reference sheets
97
- dumped_rules = {
110
+ dumped_user_rules = {
98
111
  "Metadata": self._create_metadata_sheet_user_rules(rules),
99
112
  }
100
- dumped_rules["Metadata"]["role"] = (
101
- self.output_role and self.output_role.value
102
- ) or rules.metadata.role.value
103
- dumped_reference_rules = rules.reference_self().model_dump(by_alias=True)
113
+
114
+ if self.dump_as == "last":
115
+ dumped_last_rules = rules.model_dump(by_alias=True)
116
+ if rules.reference:
117
+ dumped_reference_rules = rules.reference.model_dump(by_alias=True)
118
+ elif self.dump_as == "reference":
119
+ dumped_reference_rules = rules.reference_self().model_dump(by_alias=True)
104
120
  else:
105
- dumped_rules = rules.model_dump(by_alias=True)
121
+ dumped_user_rules = rules.model_dump(by_alias=True)
122
+ if rules.last:
123
+ dumped_last_rules = rules.last.model_dump(by_alias=True)
106
124
  if rules.reference:
107
125
  dumped_reference_rules = rules.reference.model_dump(by_alias=True)
108
126
 
109
- self._write_metadata_sheet(workbook, dumped_rules["Metadata"])
110
- self._write_sheets(workbook, dumped_rules, rules)
127
+ self._write_metadata_sheet(workbook, dumped_user_rules["Metadata"])
128
+ self._write_sheets(workbook, dumped_user_rules, rules)
129
+ if dumped_last_rules:
130
+ self._write_sheets(workbook, dumped_last_rules, rules, sheet_prefix="Last")
131
+
111
132
  if dumped_reference_rules:
112
- self._write_sheets(workbook, dumped_reference_rules, rules, is_reference=True)
113
- self._write_metadata_sheet(workbook, dumped_reference_rules["Metadata"], is_reference=True)
133
+ prefix = "Ref"
134
+ self._write_sheets(workbook, dumped_reference_rules, rules, sheet_prefix=prefix)
135
+ self._write_metadata_sheet(workbook, dumped_reference_rules["Metadata"], sheet_prefix=prefix)
114
136
 
115
137
  if self._styling_level > 0:
116
138
  self._adjust_column_widths(workbook)
117
139
 
118
140
  return workbook
119
141
 
120
- def _write_sheets(self, workbook: Workbook, dumped_rules: dict[str, Any], rules: Rules, is_reference: bool = False):
142
+ def _write_sheets(self, workbook: Workbook, dumped_rules: dict[str, Any], rules: Rules, sheet_prefix: str = ""):
121
143
  for sheet_name, headers in rules.headers_by_sheet(by_alias=True).items():
122
144
  if sheet_name in ("Metadata", "prefixes", "Reference", "Last"):
123
145
  continue
124
- if is_reference:
125
- sheet = workbook.create_sheet(f"Ref{sheet_name}")
126
- else:
127
- sheet = workbook.create_sheet(sheet_name)
146
+ sheet = workbook.create_sheet(f"{sheet_prefix}{sheet_name}")
128
147
 
129
148
  main_header = self._main_header_by_sheet_name[sheet_name]
130
149
  sheet.append([main_header] + [""] * (len(headers) - 1))
@@ -170,17 +189,14 @@ class ExcelExporter(BaseExporter[Workbook]):
170
189
  for cell in sheet["2"]:
171
190
  cell.font = Font(bold=True, size=14)
172
191
 
173
- def _write_metadata_sheet(self, workbook: Workbook, metadata: dict[str, Any], is_reference: bool = False) -> None:
192
+ def _write_metadata_sheet(self, workbook: Workbook, metadata: dict[str, Any], sheet_prefix: str = "") -> None:
174
193
  # Excel does not support timezone in datetime strings
175
194
  if isinstance(metadata.get("created"), datetime):
176
195
  metadata["created"] = metadata["created"].replace(tzinfo=None)
177
196
  if isinstance(metadata.get("updated"), datetime):
178
197
  metadata["updated"] = metadata["updated"].replace(tzinfo=None)
179
198
 
180
- if is_reference:
181
- metadata_sheet = workbook.create_sheet("RefMetadata")
182
- else:
183
- metadata_sheet = workbook.create_sheet("Metadata")
199
+ metadata_sheet = workbook.create_sheet(f"{sheet_prefix}Metadata")
184
200
  for key, value in metadata.items():
185
201
  metadata_sheet.append([key, value])
186
202
 
@@ -241,25 +257,29 @@ class ExcelExporter(BaseExporter[Workbook]):
241
257
  # Excel does not support timezone in datetime strings
242
258
  now_iso = datetime.now().replace(tzinfo=None).isoformat()
243
259
  is_info = isinstance(rules, InformationRules)
244
- is_dms = not is_info
245
- is_extension = self.new_model_id is not None
246
- is_solution = is_extension and self.new_model_id != existing_model_id
260
+ is_dms = isinstance(rules, DMSRules)
261
+ is_extension = self.new_model_id is not None or rules.reference is not None
262
+ is_solution = rules.metadata.data_model_type == DataModelType.solution
247
263
 
248
- if is_solution:
264
+ if is_solution and self.new_model_id:
249
265
  metadata["prefix" if is_info else "space"] = self.new_model_id[0] # type: ignore[index]
250
266
  metadata["title" if is_info else "externalId"] = self.new_model_id[1] # type: ignore[index]
251
267
  metadata["version"] = self.new_model_id[2] # type: ignore[index]
268
+ elif is_solution and self.dump_as == "reference" and rules.reference:
269
+ metadata["prefix" if is_info else "space"] = "YOUR_PREFIX"
270
+ metadata["title" if is_info else "externalId"] = "YOUR_TITLE"
271
+ metadata["version"] = "1"
252
272
  else:
253
273
  metadata["prefix" if is_info else "space"] = existing_model_id[0]
254
274
  metadata["title" if is_info else "externalId"] = existing_model_id[1]
255
275
  metadata["version"] = existing_model_id[2]
256
276
 
257
- if is_solution and is_info:
277
+ if is_solution and is_info and self.new_model_id:
258
278
  metadata["namespace"] = f"http://purl.org/{self.new_model_id[0]}/" # type: ignore[index]
259
279
  elif is_info:
260
280
  metadata["namespace"] = existing_metadata["namespace"]
261
281
 
262
- if is_solution and is_dms:
282
+ if is_solution and is_dms and self.new_model_id:
263
283
  metadata["name"] = self.new_model_id[1] # type: ignore[index]
264
284
 
265
285
  if is_solution:
@@ -285,6 +305,11 @@ class ExcelExporter(BaseExporter[Workbook]):
285
305
  else:
286
306
  metadata["schema"] = SchemaCompleteness.complete.value
287
307
 
288
- metadata["extension"] = "addition"
308
+ if is_solution:
309
+ metadata["dataModelType"] = DataModelType.solution.value
310
+ else:
311
+ metadata["dataModelType"] = DataModelType.enterprise.value
289
312
 
313
+ metadata["extension"] = ExtensionCategory.addition.value
314
+ metadata["role"] = (self.output_role and self.output_role.value) or rules.metadata.role.value
290
315
  return metadata
@@ -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()
@@ -87,71 +87,95 @@ class MetadataRaw(UserDict):
87
87
  class ReadResult:
88
88
  sheets: dict[str, dict | list]
89
89
  read_info_by_sheet: dict[str, SpreadsheetRead]
90
- role: RoleTypes
91
- schema: SchemaCompleteness | None
90
+ metadata: MetadataRaw
91
+
92
+ @property
93
+ def role(self) -> RoleTypes:
94
+ return self.metadata.role
95
+
96
+ @property
97
+ def schema(self) -> SchemaCompleteness | None:
98
+ return self.metadata.schema
92
99
 
93
100
 
94
101
  class SpreadsheetReader:
95
- def __init__(self, issue_list: IssueList, is_reference: bool = False):
102
+ def __init__(
103
+ self,
104
+ issue_list: IssueList,
105
+ required: bool = True,
106
+ metadata: MetadataRaw | None = None,
107
+ sheet_prefix: Literal["", "Last", "Ref"] = "",
108
+ ):
96
109
  self.issue_list = issue_list
97
- self._is_reference = is_reference
110
+ self.required = required
111
+ self.metadata = metadata
112
+ self._sheet_prefix = sheet_prefix
98
113
 
99
114
  @property
100
115
  def metadata_sheet_name(self) -> str:
101
- metadata_name = "Metadata"
102
- return self.to_reference_sheet(metadata_name) if self._is_reference else metadata_name
116
+ return f"{self._sheet_prefix}Metadata"
103
117
 
104
118
  def sheet_names(self, role: RoleTypes) -> set[str]:
105
119
  names = MANDATORY_SHEETS_BY_ROLE[role]
106
- return {self.to_reference_sheet(sheet_name) for sheet_name in names} if self._is_reference else names
107
-
108
- @classmethod
109
- def to_reference_sheet(cls, sheet_name: str) -> str:
110
- return f"Ref{sheet_name}"
120
+ return {f"{self._sheet_prefix}{sheet_name}" for sheet_name in names if sheet_name != "Metadata"}
111
121
 
112
122
  def read(self, filepath: Path) -> None | ReadResult:
113
123
  with pd.ExcelFile(filepath) as excel_file:
114
- if self.metadata_sheet_name not in excel_file.sheet_names:
124
+ metadata: MetadataRaw | None
125
+ if self.metadata is not None:
126
+ metadata = self.metadata
127
+ else:
128
+ metadata = self._read_metadata(excel_file, filepath)
129
+ if metadata is None:
130
+ # The reading of metadata failed, so we can't continue
131
+ return None
132
+
133
+ sheets, read_info_by_sheet = self._read_sheets(excel_file, metadata.role)
134
+ if sheets is None or self.issue_list.has_errors:
135
+ return None
136
+ sheets["Metadata"] = dict(metadata)
137
+
138
+ return ReadResult(sheets, read_info_by_sheet, metadata)
139
+
140
+ def _read_metadata(self, excel_file: ExcelFile, filepath: Path) -> MetadataRaw | None:
141
+ if self.metadata_sheet_name not in excel_file.sheet_names:
142
+ if self.required:
115
143
  self.issue_list.append(
116
144
  issues.spreadsheet_file.MetadataSheetMissingOrFailedError(
117
145
  filepath, sheet_name=self.metadata_sheet_name
118
146
  )
119
147
  )
120
- return None
121
-
122
- metadata = MetadataRaw.from_excel(excel_file, self.metadata_sheet_name)
148
+ return None
123
149
 
124
- if not metadata.is_valid(self.issue_list, filepath):
125
- return None
150
+ metadata = MetadataRaw.from_excel(excel_file, self.metadata_sheet_name)
126
151
 
127
- sheets, read_info_by_sheet = self._read_sheets(metadata, excel_file)
128
- if sheets is None or self.issue_list.has_errors:
129
- return None
130
-
131
- return ReadResult(sheets, read_info_by_sheet, metadata.role, metadata.schema)
152
+ if not metadata.is_valid(self.issue_list, filepath):
153
+ return None
154
+ return metadata
132
155
 
133
156
  def _read_sheets(
134
- self, metadata: MetadataRaw, excel_file: ExcelFile
157
+ self, excel_file: ExcelFile, read_role: RoleTypes
135
158
  ) -> tuple[dict[str, dict | list] | None, dict[str, SpreadsheetRead]]:
136
159
  read_info_by_sheet: dict[str, SpreadsheetRead] = defaultdict(SpreadsheetRead)
137
160
 
138
- sheets: dict[str, dict | list] = {"Metadata": dict(metadata)}
161
+ sheets: dict[str, dict | list] = {}
139
162
 
140
- expected_sheet_names = self.sheet_names(metadata.role)
163
+ expected_sheet_names = self.sheet_names(read_role)
141
164
 
142
165
  if missing_sheets := expected_sheet_names.difference(set(excel_file.sheet_names)):
143
- self.issue_list.append(
144
- issues.spreadsheet_file.SheetMissingError(cast(Path, excel_file.io), list(missing_sheets))
145
- )
166
+ if self.required:
167
+ self.issue_list.append(
168
+ issues.spreadsheet_file.SheetMissingError(cast(Path, excel_file.io), list(missing_sheets))
169
+ )
146
170
  return None, read_info_by_sheet
147
171
 
148
172
  for source_sheet_name, target_sheet_name, headers_input in SOURCE_SHEET__TARGET_FIELD__HEADERS:
149
- source_sheet_name = self.to_reference_sheet(source_sheet_name) if self._is_reference else source_sheet_name
173
+ source_sheet_name = f"{self._sheet_prefix}{source_sheet_name}"
150
174
 
151
175
  if source_sheet_name not in excel_file.sheet_names:
152
176
  continue
153
177
  if isinstance(headers_input, dict):
154
- headers = headers_input[metadata.role]
178
+ headers = headers_input[read_role]
155
179
  else:
156
180
  headers = headers_input
157
181
 
@@ -188,42 +212,37 @@ class ExcelImporter(BaseImporter):
188
212
  issue_list.append(issues.spreadsheet_file.SpreadsheetNotFoundError(self.filepath))
189
213
  return self._return_or_raise(issue_list, errors)
190
214
 
191
- user_result = SpreadsheetReader(issue_list, is_reference=False).read(self.filepath)
192
- if user_result is None or issue_list.has_errors:
215
+ user_read = SpreadsheetReader(issue_list).read(self.filepath)
216
+ if user_read is None or issue_list.has_errors:
193
217
  return self._return_or_raise(issue_list, errors)
194
218
 
195
- reference_result: ReadResult | None = None
196
- if (
197
- user_result
198
- and user_result.role != RoleTypes.domain_expert
199
- and user_result.schema == SchemaCompleteness.extended
200
- ):
201
- reference_result = SpreadsheetReader(issue_list, is_reference=True).read(self.filepath)
219
+ last_read: ReadResult | None = None
220
+ reference_read: ReadResult | None = None
221
+ if user_read.schema == SchemaCompleteness.extended:
222
+ # Last does not have its own metadata sheet. It is the same as the user's metadata sheet.
223
+ last_read = SpreadsheetReader(
224
+ issue_list, required=False, metadata=user_read.metadata, sheet_prefix="Last"
225
+ ).read(self.filepath)
226
+ reference_read = SpreadsheetReader(issue_list, sheet_prefix="Ref").read(self.filepath)
202
227
  if issue_list.has_errors:
203
228
  return self._return_or_raise(issue_list, errors)
204
229
 
205
- if user_result and reference_result and user_result.role != reference_result.role:
230
+ if reference_read and user_read.role != reference_read.role:
206
231
  issue_list.append(issues.spreadsheet_file.RoleMismatchError(self.filepath))
207
232
  return self._return_or_raise(issue_list, errors)
208
233
 
209
- if user_result and reference_result:
210
- user_result.sheets["reference"] = reference_result.sheets
211
- sheets = user_result.sheets
212
- original_role = user_result.role
213
- read_info_by_sheet = user_result.read_info_by_sheet
214
- read_info_by_sheet.update(reference_result.read_info_by_sheet)
215
- elif user_result:
216
- sheets = user_result.sheets
217
- original_role = user_result.role
218
- read_info_by_sheet = user_result.read_info_by_sheet
219
- elif reference_result:
220
- sheets = reference_result.sheets
221
- original_role = reference_result.role
222
- read_info_by_sheet = reference_result.read_info_by_sheet
223
- else:
224
- raise ValueError(
225
- "No rules were generated. This should have been caught earlier. " f"Bug in {type(self).__name__}."
226
- )
234
+ sheets = user_read.sheets
235
+ original_role = user_read.role
236
+ read_info_by_sheet = user_read.read_info_by_sheet
237
+ if last_read:
238
+ sheets["last"] = last_read.sheets
239
+ read_info_by_sheet.update(last_read.read_info_by_sheet)
240
+ if reference_read:
241
+ # The last rules will also be validated against the reference rules
242
+ sheets["last"]["reference"] = reference_read.sheets # type: ignore[call-overload]
243
+ if reference_read:
244
+ sheets["reference"] = reference_read.sheets
245
+ read_info_by_sheet.update(reference_read.read_info_by_sheet)
227
246
 
228
247
  rules_cls = RULES_PER_ROLE[original_role]
229
248
  with _handle_issues(