cognite-neat 0.77.10__tar.gz → 0.78.1__tar.gz

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

Potentially problematic release.


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

Files changed (283) hide show
  1. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/PKG-INFO +1 -1
  2. cognite_neat-0.78.1/cognite/neat/_version.py +1 -0
  3. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_inference2rules.py +49 -7
  4. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/entities.py +12 -0
  5. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/utils.py +5 -0
  6. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/current/rules_importer.py +95 -0
  7. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/pyproject.toml +1 -1
  8. cognite_neat-0.77.10/cognite/neat/_version.py +0 -1
  9. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/LICENSE +0 -0
  10. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/README.md +0 -0
  11. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/__init__.py +0 -0
  12. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/__init__.py +0 -0
  13. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/asgi/metrics.py +0 -0
  14. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/configuration.py +0 -0
  15. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/context_manager/__init__.py +0 -0
  16. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/context_manager/manager.py +0 -0
  17. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/data_classes/__init__.py +0 -0
  18. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/data_classes/rest.py +0 -0
  19. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/explorer.py +0 -0
  20. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/routers/configuration.py +0 -0
  21. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/routers/core.py +0 -0
  22. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/routers/crud.py +0 -0
  23. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/routers/data_exploration.py +0 -0
  24. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/routers/metrics.py +0 -0
  25. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/routers/rules.py +0 -0
  26. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/routers/workflows.py +0 -0
  27. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/utils/__init__.py +0 -0
  28. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/utils/data_mapping.py +0 -0
  29. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/utils/logging.py +0 -0
  30. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/api/utils/query_templates.py +0 -0
  31. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/main.py +0 -0
  32. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/monitoring/__init__.py +0 -0
  33. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/monitoring/metrics.py +0 -0
  34. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/index.html +0 -0
  35. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
  36. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/README.md +0 -0
  37. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
  38. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
  39. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
  40. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
  41. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
  42. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
  43. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
  44. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
  45. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
  46. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css +0 -0
  47. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/static/css/main.38a62222.css.map +0 -0
  48. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js +0 -0
  49. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.LICENSE.txt +0 -0
  50. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/static/js/main.ec7f72e2.js.map +0 -0
  51. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
  52. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/config.py +0 -0
  53. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/constants.py +0 -0
  54. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/exceptions.py +0 -0
  55. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/__init__.py +0 -0
  56. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  57. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  58. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/examples/__init__.py +0 -0
  59. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  60. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/exceptions.py +0 -0
  61. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/extractors/__init__.py +0 -0
  62. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/extractors/_base.py +0 -0
  63. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/extractors/_mock_graph_generator.py +0 -0
  64. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/models.py +0 -0
  65. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/stores/__init__.py +0 -0
  66. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/stores/_base.py +0 -0
  67. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/stores/_graphdb_store.py +0 -0
  68. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/stores/_memory_store.py +0 -0
  69. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/stores/_oxigraph_store.py +0 -0
  70. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/stores/_oxrdflib.py +0 -0
  71. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/graph/stores/_rdf_to_graph.py +0 -0
  72. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/__init__.py +0 -0
  73. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/__init__.py +0 -0
  74. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  75. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
  76. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/examples/__init__.py +0 -0
  77. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  78. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/exceptions.py +0 -0
  79. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/extractors/__init__.py +0 -0
  80. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/extractors/_base.py +0 -0
  81. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/extractors/_dexpi.py +0 -0
  82. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/extractors/_graph_capturing_sheet.py +0 -0
  83. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/extractors/_mock_graph_generator.py +0 -0
  84. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/loaders/__init__.py +0 -0
  85. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/loaders/_asset_loader.py +0 -0
  86. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/loaders/_base.py +0 -0
  87. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/loaders/_exceptions.py +0 -0
  88. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/loaders/core/__init__.py +0 -0
  89. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/loaders/core/labels.py +0 -0
  90. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/loaders/core/models.py +0 -0
  91. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py +0 -0
  92. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py +0 -0
  93. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/loaders/rdf_to_dms.py +0 -0
  94. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/loaders/validator.py +0 -0
  95. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/models.py +0 -0
  96. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/stores/__init__.py +0 -0
  97. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/stores/_base.py +0 -0
  98. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/stores/_graphdb_store.py +0 -0
  99. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/stores/_memory_store.py +0 -0
  100. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/stores/_oxigraph_store.py +0 -0
  101. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/stores/_oxrdflib.py +0 -0
  102. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/stores/_rdf_to_graph.py +0 -0
  103. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/transformations/__init__.py +0 -0
  104. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/transformations/entity_matcher.py +0 -0
  105. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/transformations/query_generator/__init__.py +0 -0
  106. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/transformations/query_generator/sparql.py +0 -0
  107. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/graph/transformations/transformer.py +0 -0
  108. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/__init__.py +0 -0
  109. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/analysis.py +0 -0
  110. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-TNT.xlsx +0 -0
  111. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/examples/Rules-Nordic44-to-graphql.xlsx +0 -0
  112. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/examples/__init__.py +0 -0
  113. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/examples/power-grid-containers.yaml +0 -0
  114. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/examples/power-grid-example.xlsx +0 -0
  115. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/examples/power-grid-model.yaml +0 -0
  116. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/examples/rules-template.xlsx +0 -0
  117. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/examples/sheet2cdf-transformation-rules.xlsx +0 -0
  118. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/examples/skos-rules.xlsx +0 -0
  119. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/examples/source-to-solution-mapping-rules.xlsx +0 -0
  120. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/examples/wind-energy.owl +0 -0
  121. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exceptions.py +0 -0
  122. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/__init__.py +0 -0
  123. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/_base.py +0 -0
  124. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/_core/__init__.py +0 -0
  125. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/_core/rules2labels.py +0 -0
  126. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/_rules2dms.py +0 -0
  127. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/_rules2excel.py +0 -0
  128. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/_rules2graphql.py +0 -0
  129. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/_rules2ontology.py +0 -0
  130. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/_rules2pydantic_models.py +0 -0
  131. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/_rules2rules.py +0 -0
  132. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/_rules2triples.py +0 -0
  133. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/exporters/_validation.py +0 -0
  134. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/__init__.py +0 -0
  135. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_base.py +0 -0
  136. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_dict2rules.py +0 -0
  137. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_dms2rules.py +0 -0
  138. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_graph2rules.py +0 -0
  139. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_json2rules.py +0 -0
  140. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_owl2rules/__init__.py +0 -0
  141. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2classes.py +0 -0
  142. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2metadata.py +0 -0
  143. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2properties.py +0 -0
  144. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_owl2rules/_owl2rules.py +0 -0
  145. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_spreadsheet2rules.py +0 -0
  146. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_xsd2rules.py +0 -0
  147. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/importers/_yaml2rules.py +0 -0
  148. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/models/__init__.py +0 -0
  149. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/models/_base.py +0 -0
  150. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/models/raw_rules.py +0 -0
  151. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/models/rdfpath.py +0 -0
  152. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/models/rules.py +0 -0
  153. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/models/tables.py +0 -0
  154. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/rules/models/value_types.py +0 -0
  155. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/workflows/examples/Export_DMS/workflow.yaml +0 -0
  156. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
  157. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
  158. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
  159. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/workflows/examples/Import_DMS/workflow.yaml +0 -0
  160. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
  161. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/workflows/examples/Validate_Rules/workflow.yaml +0 -0
  162. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  163. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
  164. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/legacy/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
  165. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/py.typed +0 -0
  166. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/__init__.py +0 -0
  167. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/_shared.py +0 -0
  168. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/analysis/__init__.py +0 -0
  169. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/analysis/_base.py +0 -0
  170. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/analysis/_information_rules.py +0 -0
  171. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/examples/__init__.py +0 -0
  172. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/examples/wind-energy.owl +0 -0
  173. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/exceptions.py +0 -0
  174. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/exporters/__init__.py +0 -0
  175. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/exporters/_base.py +0 -0
  176. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/exporters/_models.py +0 -0
  177. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/exporters/_rules2dms.py +0 -0
  178. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/exporters/_rules2excel.py +0 -0
  179. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/exporters/_rules2ontology.py +0 -0
  180. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
  181. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/exporters/_validation.py +0 -0
  182. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/__init__.py +0 -0
  183. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_base.py +0 -0
  184. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_dms2rules.py +0 -0
  185. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
  186. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
  187. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +0 -0
  188. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +0 -0
  189. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
  190. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_owl2rules/__init__.py +0 -0
  191. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_owl2rules/_owl2classes.py +0 -0
  192. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +0 -0
  193. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_owl2rules/_owl2properties.py +0 -0
  194. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_owl2rules/_owl2rules.py +0 -0
  195. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_spreadsheet2rules.py +0 -0
  196. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/importers/_yaml2rules.py +0 -0
  197. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/issues/__init__.py +0 -0
  198. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/issues/base.py +0 -0
  199. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/issues/dms.py +0 -0
  200. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/issues/fileread.py +0 -0
  201. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/issues/formatters.py +0 -0
  202. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/issues/importing.py +0 -0
  203. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/issues/spreadsheet.py +0 -0
  204. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/issues/spreadsheet_file.py +0 -0
  205. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/__init__.py +0 -0
  206. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/_base.py +0 -0
  207. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/_rdfpath.py +0 -0
  208. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/_types/__init__.py +0 -0
  209. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/_types/_base.py +0 -0
  210. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/_types/_field.py +0 -0
  211. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/data_types.py +0 -0
  212. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/dms/__init__.py +0 -0
  213. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/dms/_converter.py +0 -0
  214. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/dms/_exporter.py +0 -0
  215. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/dms/_rules.py +0 -0
  216. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/dms/_rules_input.py +0 -0
  217. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/dms/_schema.py +0 -0
  218. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/dms/_serializer.py +0 -0
  219. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/dms/_validation.py +0 -0
  220. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/domain.py +0 -0
  221. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/information/__init__.py +0 -0
  222. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/information/_converter.py +0 -0
  223. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/information/_rules.py +0 -0
  224. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/information/_rules_input.py +0 -0
  225. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/information/_serializer.py +0 -0
  226. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/information/_validation.py +0 -0
  227. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/rules/models/wrapped_entities.py +0 -0
  228. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/__init__.py +0 -0
  229. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/auxiliary.py +0 -0
  230. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/cdf.py +0 -0
  231. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/cdf_classes.py +0 -0
  232. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/cdf_loaders/__init__.py +0 -0
  233. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/cdf_loaders/_base.py +0 -0
  234. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/cdf_loaders/_data_modeling.py +0 -0
  235. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/cdf_loaders/_ingestion.py +0 -0
  236. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/cdf_loaders/data_classes.py +0 -0
  237. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/exceptions.py +0 -0
  238. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/spreadsheet.py +0 -0
  239. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/text.py +0 -0
  240. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/utils/xml.py +0 -0
  241. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/__init__.py +0 -0
  242. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/_exceptions.py +0 -0
  243. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/base.py +0 -0
  244. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/cdf_store.py +0 -0
  245. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
  246. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/examples/Export_Rules_to_Ontology/workflow.yaml +0 -0
  247. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/examples/Extract_DEXPI_Graph_and_Export_Rules/workflow.yaml +0 -0
  248. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/examples/Extract_RDF_Graph_and_Generate_Assets/workflow.yaml +0 -0
  249. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
  250. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/examples/Ontology_to_Data_Model/workflow.yaml +0 -0
  251. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
  252. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
  253. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
  254. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
  255. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/manager.py +0 -0
  256. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/migration/__init__.py +0 -0
  257. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/migration/steps.py +0 -0
  258. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/migration/wf_manifests.py +0 -0
  259. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/model.py +0 -0
  260. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/__init__.py +0 -0
  261. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/data_contracts.py +0 -0
  262. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/__init__.py +0 -0
  263. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
  264. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
  265. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
  266. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
  267. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +0 -0
  268. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/current/rules_validator.py +0 -0
  269. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
  270. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
  271. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/legacy/__init__.py +0 -0
  272. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/legacy/graph_contextualization.py +0 -0
  273. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/legacy/graph_extractor.py +0 -0
  274. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/legacy/graph_loader.py +0 -0
  275. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/legacy/graph_store.py +0 -0
  276. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/legacy/graph_transformer.py +0 -0
  277. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/legacy/rules_exporter.py +0 -0
  278. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/lib/legacy/rules_importer.py +0 -0
  279. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps/step_model.py +0 -0
  280. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/steps_registry.py +0 -0
  281. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/tasks.py +0 -0
  282. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/cognite/neat/workflows/triggers.py +0 -0
  283. {cognite_neat-0.77.10 → cognite_neat-0.78.1}/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.77.10
3
+ Version: 0.78.1
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.78.1"
@@ -7,15 +7,17 @@ from rdflib import Literal as RdfLiteral
7
7
 
8
8
  import cognite.neat.rules.issues as issues
9
9
  from cognite.neat.constants import PREFIXES
10
+ from cognite.neat.graph.stores import NeatGraphStoreBase
10
11
  from cognite.neat.rules.importers._base import BaseImporter, Rules, _handle_issues
11
12
  from cognite.neat.rules.issues import IssueList
12
13
  from cognite.neat.rules.models import InformationRules, RoleTypes
13
14
  from cognite.neat.rules.models._base import MatchType
15
+ from cognite.neat.rules.models.entities import ClassEntity
14
16
  from cognite.neat.rules.models.information import (
15
17
  InformationMetadata,
16
18
  InformationRulesInput,
17
19
  )
18
- from cognite.neat.utils.utils import get_namespace, remove_namespace
20
+ from cognite.neat.utils.utils import get_namespace, remove_namespace, replace_non_alphanumeric_with_underscore
19
21
 
20
22
  ORDERED_CLASSES_QUERY = """SELECT ?class (count(?s) as ?instances )
21
23
  WHERE { ?s a ?class . }
@@ -41,13 +43,23 @@ class InferenceImporter(BaseImporter):
41
43
  """
42
44
 
43
45
  def __init__(
44
- self, issue_list: IssueList, graph: Graph, max_number_of_instance: int = -1, make_compliant: bool = False
46
+ self, issue_list: IssueList, graph: Graph, make_compliant: bool = False, max_number_of_instance: int = -1
45
47
  ):
46
48
  self.issue_list = issue_list
47
49
  self.graph = graph
48
50
  self.max_number_of_instance = max_number_of_instance
49
51
  self.make_compliant = make_compliant
50
52
 
53
+ @classmethod
54
+ def from_graph_store(
55
+ cls, store: NeatGraphStoreBase, make_compliant: bool = False, max_number_of_instance: int = -1
56
+ ):
57
+ issue_list = IssueList(title="Inferred from graph store")
58
+
59
+ return cls(
60
+ issue_list, store.graph, make_compliant=make_compliant, max_number_of_instance=max_number_of_instance
61
+ )
62
+
51
63
  @classmethod
52
64
  def from_rdf_file(cls, filepath: Path, make_compliant: bool = False, max_number_of_instance: int = -1):
53
65
  issue_list = IssueList(title=f"'{filepath.name}'")
@@ -106,7 +118,7 @@ class InferenceImporter(BaseImporter):
106
118
  return self._return_or_raise(self.issue_list, errors)
107
119
 
108
120
  if self.make_compliant and rules:
109
- rules = self._make_dms_compliant_rules(rules)
121
+ self._make_dms_compliant_rules(rules)
110
122
 
111
123
  return self._to_output(
112
124
  rules,
@@ -172,7 +184,7 @@ class InferenceImporter(BaseImporter):
172
184
  definition = {
173
185
  "class_": class_id,
174
186
  "property_": property_id,
175
- "max_occurrence": cast(RdfLiteral, occurrence).value,
187
+ "max_count": cast(RdfLiteral, occurrence).value,
176
188
  "value_type": value_type_id,
177
189
  "reference": property_uri,
178
190
  }
@@ -180,7 +192,6 @@ class InferenceImporter(BaseImporter):
180
192
  # USE CASE 1: If property is not present in properties
181
193
  if id_ not in properties:
182
194
  properties[id_] = definition
183
-
184
195
  # USE CASE 2: If property is present in properties but with different max count
185
196
  elif id_ in properties and not (properties[id_]["max_count"] == definition["max_count"]):
186
197
  properties[id_]["max_count"] = max(properties[id_]["max_count"], definition["max_count"])
@@ -217,5 +228,36 @@ class InferenceImporter(BaseImporter):
217
228
  )
218
229
 
219
230
  @classmethod
220
- def _make_dms_compliant_rules(cls, rules: InformationRules) -> InformationRules:
221
- raise NotImplementedError("Compliance with DMS is not supported yet.")
231
+ def _make_dms_compliant_rules(cls, rules: InformationRules) -> None:
232
+ cls._fix_property_redefinition(rules)
233
+ cls._fix_naming_of_entities(rules)
234
+
235
+ @classmethod
236
+ def _fix_property_redefinition(cls, rules: InformationRules) -> None:
237
+ seen = set()
238
+ for i, property_ in enumerate(rules.properties.data):
239
+ prop_id = f"{property_.class_}.{property_.property_}"
240
+ if prop_id in seen:
241
+ property_.property_ = f"{property_.property_}_{i+1}"
242
+ seen.add(f"{property_.class_}.{property_.property_}")
243
+ else:
244
+ seen.add(prop_id)
245
+
246
+ @classmethod
247
+ def _fix_naming_of_entities(cls, rules: InformationRules) -> None:
248
+ # Fixing class ids
249
+ for class_ in rules.classes:
250
+ class_.class_ = class_.class_.as_dms_compliant_entity()
251
+ class_.parent = [parent.as_dms_compliant_entity() for parent in class_.parent] if class_.parent else None
252
+
253
+ # Fixing property definitions
254
+ for property_ in rules.properties:
255
+ # fix class id
256
+ property_.class_ = property_.class_.as_dms_compliant_entity()
257
+
258
+ # fix property id
259
+ property_.property_ = replace_non_alphanumeric_with_underscore(property_.property_)
260
+
261
+ # fix value type
262
+ if isinstance(property_.value_type, ClassEntity):
263
+ property_.value_type = property_.value_type.as_dms_compliant_entity()
@@ -7,6 +7,8 @@ from typing import Annotated, Any, ClassVar, Generic, TypeVar, cast
7
7
  from cognite.client.data_classes.data_modeling.ids import ContainerId, DataModelId, NodeId, PropertyId, ViewId
8
8
  from pydantic import AnyHttpUrl, BaseModel, BeforeValidator, Field, PlainSerializer, model_serializer, model_validator
9
9
 
10
+ from cognite.neat.utils.utils import replace_non_alphanumeric_with_underscore
11
+
10
12
  if sys.version_info >= (3, 11):
11
13
  from enum import StrEnum
12
14
  from typing import Self
@@ -211,6 +213,11 @@ class Entity(BaseModel, extra="ignore"):
211
213
  return f"{self.suffix!s}"
212
214
  return f"{self.prefix}:{self.suffix!s}"
213
215
 
216
+ def as_dms_compliant_entity(self) -> "Self":
217
+ new_entity = self.model_copy(deep=True)
218
+ new_entity.suffix = replace_non_alphanumeric_with_underscore(new_entity.suffix)
219
+ return new_entity
220
+
214
221
 
215
222
  T_Entity = TypeVar("T_Entity", bound=Entity)
216
223
 
@@ -231,6 +238,11 @@ class ClassEntity(Entity):
231
238
  space = default_space if isinstance(self.prefix, _UndefinedType) else self.prefix
232
239
  return ContainerEntity(space=space, externalId=str(self.suffix))
233
240
 
241
+ def as_dms_compliant_entity(self) -> "Self":
242
+ new_entity = self.model_copy(deep=True)
243
+ new_entity.suffix = replace_non_alphanumeric_with_underscore(new_entity.suffix)
244
+ return new_entity
245
+
234
246
 
235
247
  class ParentClassEntity(ClassEntity):
236
248
  type_: ClassVar[EntityTypes] = EntityTypes.parent_class
@@ -1,5 +1,6 @@
1
1
  import hashlib
2
2
  import logging
3
+ import re
3
4
  import sys
4
5
  import time
5
6
  from collections import OrderedDict
@@ -350,3 +351,7 @@ def get_inheritance_path(child: Any, child_parent: dict[Any, list[Any]]) -> list
350
351
  for parent in child_parent[child]:
351
352
  path.extend(get_inheritance_path(parent, child_parent))
352
353
  return path
354
+
355
+
356
+ def replace_non_alphanumeric_with_underscore(text):
357
+ return re.sub(r"\W+", "_", text)
@@ -20,6 +20,7 @@ __all__ = [
20
20
  "ExcelToRules",
21
21
  "OntologyToRules",
22
22
  "DMSToRules",
23
+ "RulesInferenceFromRdfFile",
23
24
  ]
24
25
 
25
26
 
@@ -259,3 +260,97 @@ class DMSToRules(Step):
259
260
  output_text = "Rules import and validation passed successfully!"
260
261
 
261
262
  return FlowMessage(output_text=output_text), MultiRuleData.from_rules(rules)
263
+
264
+
265
+ class RulesInferenceFromRdfFile(Step):
266
+ """This step infers rules from the RDF file which contains knowledge graph."""
267
+
268
+ description = "This step infers rules from the RDF file which contains knowledge graph"
269
+ version = "private-beta"
270
+ category = CATEGORY
271
+ configurables: ClassVar[list[Configurable]] = [
272
+ Configurable(
273
+ name="File path",
274
+ value="staging/knowledge_graph.ttl",
275
+ label=("Relative path to the RDF file to be used for inference"),
276
+ ),
277
+ Configurable(
278
+ name="Report formatter",
279
+ value=next(iter(FORMATTER_BY_NAME.keys())),
280
+ label="The format of the report for the validation of the rules",
281
+ options=list(FORMATTER_BY_NAME),
282
+ ),
283
+ Configurable(
284
+ name="Role",
285
+ value="infer",
286
+ label="For what role Rules are intended?",
287
+ options=["infer", *RoleTypes.__members__.keys()],
288
+ ),
289
+ Configurable(
290
+ name="Make compliant",
291
+ value="True",
292
+ label=(
293
+ "Attempt to make the imported Rules compliant, by fixing "
294
+ "redefinition of properties and by making ids of entities compliant with"
295
+ " CDF-allowed set of characters ."
296
+ ),
297
+ options=["True", "False"],
298
+ ),
299
+ Configurable(
300
+ name="Maximum number of instances to process",
301
+ value="-1",
302
+ label=(
303
+ "Maximum number of instances to process"
304
+ " to infer rules from the RDF file. Default -1 means all instances."
305
+ ),
306
+ ),
307
+ ]
308
+
309
+ def run(self, flow_message: FlowMessage) -> (FlowMessage, MultiRuleData): # type: ignore[syntax, override]
310
+ if self.configs is None or self.data_store_path is None:
311
+ raise StepNotInitialized(type(self).__name__)
312
+
313
+ file_path = self.configs.get("File path", None)
314
+ full_path = flow_message.payload.get("full_path", None) if flow_message.payload else None
315
+ make_compliant = self.configs.get("Make compliant", "True") == "True"
316
+
317
+ try:
318
+ max_number_of_instance = int(self.configs.get("Maximum number of instances to process", -1))
319
+ except ValueError:
320
+ error_text = "Maximum number of instances to process should be an integer value"
321
+ return FlowMessage(error_text=error_text, step_execution_status=StepExecutionStatus.ABORT_AND_FAIL)
322
+
323
+ if file_path:
324
+ rdf_file_path = self.data_store_path / Path(file_path)
325
+ elif full_path:
326
+ rdf_file_path = full_path
327
+ else:
328
+ error_text = "Expected either 'File name' in the step config or 'File uploader' step uploading Excel Rules."
329
+ return FlowMessage(error_text=error_text, step_execution_status=StepExecutionStatus.ABORT_AND_FAIL)
330
+
331
+ # if role is None, it will be inferred from the rules file
332
+ role = self.configs.get("Role")
333
+ role_enum = None
334
+ if role != "infer" and role is not None:
335
+ role_enum = RoleTypes[role]
336
+
337
+ inference_importer = importers.InferenceImporter.from_rdf_file(
338
+ rdf_file_path, make_compliant=make_compliant, max_number_of_instance=max_number_of_instance
339
+ )
340
+ rules, issues = inference_importer.to_rules(errors="continue", role=role_enum)
341
+
342
+ if rules is None:
343
+ output_dir = self.config.staging_path
344
+ report_writer = FORMATTER_BY_NAME[self.configs["Report formatter"]]()
345
+ report_writer.write_to_file(issues, file_or_dir_path=output_dir)
346
+ report_file = report_writer.default_file_name
347
+ error_text = (
348
+ "<p></p>"
349
+ f'<a href="/data/staging/{report_file}?{time.time()}" '
350
+ f'target="_blank">Failed to validate rules, click here for report</a>'
351
+ )
352
+ return FlowMessage(error_text=error_text, step_execution_status=StepExecutionStatus.ABORT_AND_FAIL)
353
+
354
+ output_text = "Rules validation passed successfully!"
355
+
356
+ return FlowMessage(output_text=output_text), MultiRuleData.from_rules(rules)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cognite-neat"
3
- version = "0.77.10"
3
+ version = "0.78.1"
4
4
  readme = "README.md"
5
5
  description = "Knowledge graph transformation"
6
6
  authors = [
@@ -1 +0,0 @@
1
- __version__ = "0.77.10"
File without changes
File without changes