cognite-neat 0.104.0__py3-none-any.whl → 0.105.1__py3-none-any.whl

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

Potentially problematic release.


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

Files changed (143) hide show
  1. cognite/neat/_client/_api/data_modeling_loaders.py +83 -23
  2. cognite/neat/_client/_api/schema.py +2 -1
  3. cognite/neat/_client/data_classes/neat_sequence.py +261 -0
  4. cognite/neat/_client/data_classes/schema.py +5 -1
  5. cognite/neat/_client/testing.py +33 -0
  6. cognite/neat/_constants.py +57 -0
  7. cognite/neat/_graph/extractors/_classic_cdf/_base.py +6 -5
  8. cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +225 -11
  9. cognite/neat/_graph/extractors/_mock_graph_generator.py +1 -1
  10. cognite/neat/_graph/loaders/_rdf2dms.py +31 -5
  11. cognite/neat/_graph/transformers/__init__.py +3 -1
  12. cognite/neat/_graph/transformers/_classic_cdf.py +39 -51
  13. cognite/neat/_graph/transformers/_rdfpath.py +14 -15
  14. cognite/neat/_graph/transformers/_value_type.py +72 -0
  15. cognite/neat/_issues/__init__.py +0 -2
  16. cognite/neat/_issues/_base.py +19 -35
  17. cognite/neat/_issues/warnings/__init__.py +6 -1
  18. cognite/neat/_issues/warnings/_general.py +7 -0
  19. cognite/neat/_issues/warnings/_properties.py +11 -0
  20. cognite/neat/_issues/warnings/_resources.py +11 -0
  21. cognite/neat/_rules/exporters/_rules2dms.py +35 -1
  22. cognite/neat/_rules/exporters/_rules2excel.py +2 -2
  23. cognite/neat/_rules/importers/_dms2rules.py +66 -55
  24. cognite/neat/_rules/models/_base_rules.py +4 -1
  25. cognite/neat/_rules/models/entities/_wrapped.py +10 -5
  26. cognite/neat/_rules/models/mapping/_classic2core.yaml +239 -38
  27. cognite/neat/_rules/transformers/__init__.py +8 -2
  28. cognite/neat/_rules/transformers/_converters.py +271 -188
  29. cognite/neat/_rules/transformers/_mapping.py +75 -59
  30. cognite/neat/_rules/transformers/_verification.py +2 -3
  31. cognite/neat/_session/_inspect.py +3 -1
  32. cognite/neat/_session/_prepare.py +112 -24
  33. cognite/neat/_session/_read.py +33 -70
  34. cognite/neat/_session/_state.py +2 -2
  35. cognite/neat/_session/_to.py +2 -2
  36. cognite/neat/_store/_rules_store.py +4 -8
  37. cognite/neat/_utils/reader/_base.py +27 -0
  38. cognite/neat/_version.py +1 -1
  39. {cognite_neat-0.104.0.dist-info → cognite_neat-0.105.1.dist-info}/METADATA +4 -3
  40. cognite_neat-0.105.1.dist-info/RECORD +179 -0
  41. {cognite_neat-0.104.0.dist-info → cognite_neat-0.105.1.dist-info}/WHEEL +1 -1
  42. cognite/neat/_app/api/__init__.py +0 -0
  43. cognite/neat/_app/api/asgi/metrics.py +0 -4
  44. cognite/neat/_app/api/configuration.py +0 -98
  45. cognite/neat/_app/api/context_manager/__init__.py +0 -3
  46. cognite/neat/_app/api/context_manager/manager.py +0 -16
  47. cognite/neat/_app/api/data_classes/__init__.py +0 -0
  48. cognite/neat/_app/api/data_classes/rest.py +0 -59
  49. cognite/neat/_app/api/explorer.py +0 -66
  50. cognite/neat/_app/api/routers/configuration.py +0 -25
  51. cognite/neat/_app/api/routers/crud.py +0 -102
  52. cognite/neat/_app/api/routers/metrics.py +0 -10
  53. cognite/neat/_app/api/routers/workflows.py +0 -224
  54. cognite/neat/_app/api/utils/__init__.py +0 -0
  55. cognite/neat/_app/api/utils/data_mapping.py +0 -17
  56. cognite/neat/_app/api/utils/logging.py +0 -26
  57. cognite/neat/_app/api/utils/query_templates.py +0 -92
  58. cognite/neat/_app/main.py +0 -17
  59. cognite/neat/_app/monitoring/__init__.py +0 -0
  60. cognite/neat/_app/monitoring/metrics.py +0 -69
  61. cognite/neat/_app/ui/index.html +0 -1
  62. cognite/neat/_app/ui/neat-app/.gitignore +0 -23
  63. cognite/neat/_app/ui/neat-app/README.md +0 -70
  64. cognite/neat/_app/ui/neat-app/build/asset-manifest.json +0 -14
  65. cognite/neat/_app/ui/neat-app/build/favicon.ico +0 -0
  66. cognite/neat/_app/ui/neat-app/build/img/architect-icon.svg +0 -116
  67. cognite/neat/_app/ui/neat-app/build/img/developer-icon.svg +0 -112
  68. cognite/neat/_app/ui/neat-app/build/img/sme-icon.svg +0 -34
  69. cognite/neat/_app/ui/neat-app/build/index.html +0 -1
  70. cognite/neat/_app/ui/neat-app/build/logo192.png +0 -0
  71. cognite/neat/_app/ui/neat-app/build/manifest.json +0 -25
  72. cognite/neat/_app/ui/neat-app/build/robots.txt +0 -3
  73. cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -2
  74. cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -1
  75. cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -3
  76. cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -88
  77. cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -1
  78. cognite/neat/_app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -1
  79. cognite/neat/_app/ui/neat-app/package-lock.json +0 -18306
  80. cognite/neat/_app/ui/neat-app/package.json +0 -62
  81. cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
  82. cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +0 -116
  83. cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +0 -112
  84. cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +0 -34
  85. cognite/neat/_app/ui/neat-app/public/index.html +0 -43
  86. cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
  87. cognite/neat/_app/ui/neat-app/public/manifest.json +0 -25
  88. cognite/neat/_app/ui/neat-app/public/robots.txt +0 -3
  89. cognite/neat/_app/ui/neat-app/src/App.css +0 -38
  90. cognite/neat/_app/ui/neat-app/src/App.js +0 -17
  91. cognite/neat/_app/ui/neat-app/src/App.test.js +0 -8
  92. cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +0 -70
  93. cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +0 -43
  94. cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +0 -124
  95. cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +0 -63
  96. cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +0 -511
  97. cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +0 -36
  98. cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +0 -56
  99. cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +0 -60
  100. cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +0 -112
  101. cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +0 -67
  102. cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +0 -79
  103. cognite/neat/_app/ui/neat-app/src/index.css +0 -13
  104. cognite/neat/_app/ui/neat-app/src/index.js +0 -13
  105. cognite/neat/_app/ui/neat-app/src/logo.svg +0 -1
  106. cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +0 -13
  107. cognite/neat/_app/ui/neat-app/src/setupTests.js +0 -5
  108. cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +0 -388
  109. cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +0 -61
  110. cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +0 -184
  111. cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +0 -180
  112. cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +0 -570
  113. cognite/neat/_app/ui/neat-app/tsconfig.json +0 -27
  114. cognite/neat/_workflows/__init__.py +0 -17
  115. cognite/neat/_workflows/base.py +0 -590
  116. cognite/neat/_workflows/cdf_store.py +0 -393
  117. cognite/neat/_workflows/examples/Export_DMS/workflow.yaml +0 -89
  118. cognite/neat/_workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -66
  119. cognite/neat/_workflows/examples/Import_DMS/workflow.yaml +0 -65
  120. cognite/neat/_workflows/examples/Validate_Rules/workflow.yaml +0 -67
  121. cognite/neat/_workflows/examples/Validate_Solution_Model/workflow.yaml +0 -64
  122. cognite/neat/_workflows/manager.py +0 -292
  123. cognite/neat/_workflows/model.py +0 -203
  124. cognite/neat/_workflows/steps/__init__.py +0 -0
  125. cognite/neat/_workflows/steps/data_contracts.py +0 -109
  126. cognite/neat/_workflows/steps/lib/__init__.py +0 -0
  127. cognite/neat/_workflows/steps/lib/current/__init__.py +0 -6
  128. cognite/neat/_workflows/steps/lib/current/graph_extractor.py +0 -100
  129. cognite/neat/_workflows/steps/lib/current/graph_loader.py +0 -51
  130. cognite/neat/_workflows/steps/lib/current/graph_store.py +0 -48
  131. cognite/neat/_workflows/steps/lib/current/rules_exporter.py +0 -537
  132. cognite/neat/_workflows/steps/lib/current/rules_importer.py +0 -323
  133. cognite/neat/_workflows/steps/lib/current/rules_validator.py +0 -106
  134. cognite/neat/_workflows/steps/lib/io/__init__.py +0 -1
  135. cognite/neat/_workflows/steps/lib/io/io_steps.py +0 -393
  136. cognite/neat/_workflows/steps/step_model.py +0 -79
  137. cognite/neat/_workflows/steps_registry.py +0 -218
  138. cognite/neat/_workflows/tasks.py +0 -18
  139. cognite/neat/_workflows/triggers.py +0 -169
  140. cognite/neat/_workflows/utils.py +0 -19
  141. cognite_neat-0.104.0.dist-info/RECORD +0 -276
  142. {cognite_neat-0.104.0.dist-info → cognite_neat-0.105.1.dist-info}/LICENSE +0 -0
  143. {cognite_neat-0.104.0.dist-info → cognite_neat-0.105.1.dist-info}/entry_points.txt +0 -0
@@ -1,100 +0,0 @@
1
- import json
2
- from pathlib import Path
3
- from typing import ClassVar, cast
4
-
5
- from cognite.neat._graph.extractors import RdfFileExtractor
6
- from cognite.neat._graph.extractors._mock_graph_generator import MockGraphGenerator
7
- from cognite.neat._issues.errors import WorkflowStepNotInitializedError
8
- from cognite.neat._rules._shared import DMSRules, InformationRules
9
- from cognite.neat._workflows.model import FlowMessage, StepExecutionStatus
10
- from cognite.neat._workflows.steps.data_contracts import MultiRuleData, NeatGraph
11
- from cognite.neat._workflows.steps.step_model import Configurable, Step
12
-
13
- __all__ = ["GraphFromMockData", "GraphFromRdfFile"]
14
-
15
- CATEGORY = __name__.split(".")[-1].replace("_", " ").title()
16
-
17
-
18
- class GraphFromMockData(Step):
19
- """
20
- This step generate mock graph based on the defined classes and target number of instances
21
- """
22
-
23
- description = "This step generate mock graph based on the defined classes and target number of instances"
24
- version = "private-beta"
25
- category = CATEGORY
26
- configurables: ClassVar[list[Configurable]] = [
27
- Configurable(
28
- name="Class count",
29
- value="",
30
- label="Target number of instances for each class",
31
- ),
32
- Configurable(
33
- name="Graph",
34
- value="solution",
35
- label="The name of target graph.",
36
- options=["source", "solution"],
37
- ),
38
- ]
39
-
40
- def run( # type: ignore[override, syntax]
41
- self, rules: MultiRuleData, store: NeatGraph
42
- ) -> FlowMessage:
43
- if self.configs is None:
44
- raise WorkflowStepNotInitializedError(type(self).__name__)
45
-
46
- if not rules.information and not rules.dms:
47
- return FlowMessage(
48
- error_text="Rules must be made either by Information Architect or DMS Architect!",
49
- step_execution_status=StepExecutionStatus.ABORT_AND_FAIL,
50
- )
51
-
52
- try:
53
- class_count = json.loads(self.configs["Class count"]) if self.configs["Class count"] else {}
54
- except Exception:
55
- return FlowMessage(
56
- error_text="Defected JSON stored in class_count",
57
- step_execution_status=StepExecutionStatus.ABORT_AND_FAIL,
58
- )
59
-
60
- extractor = MockGraphGenerator(
61
- cast(InformationRules | DMSRules, rules.information or rules.dms),
62
- class_count,
63
- )
64
-
65
- store.graph.write(extractor)
66
-
67
- return FlowMessage(output_text=f"Instances loaded to the {store.__class__.__name__}")
68
-
69
-
70
- class GraphFromRdfFile(Step):
71
- """
72
- This step extract instances from a file into the source graph. The file must be in RDF format.
73
- """
74
-
75
- description = "This step extract instances from a file into the source graph. The file must be in RDF format."
76
- version = "private-beta"
77
- category = CATEGORY
78
- configurables: ClassVar[list[Configurable]] = [
79
- Configurable(
80
- name="File path",
81
- value="source-graphs/source-graph-dump.xml",
82
- label="File name of source graph data dump in RDF format",
83
- )
84
- ]
85
-
86
- def run(self, store: NeatGraph) -> FlowMessage: # type: ignore[override, syntax]
87
- if self.configs is None or self.data_store_path is None:
88
- raise WorkflowStepNotInitializedError(type(self).__name__)
89
-
90
- if source_file := self.configs["File path"]:
91
- store.graph.write(
92
- RdfFileExtractor( # type: ignore[abstract]
93
- filepath=self.data_store_path / Path(source_file),
94
- )
95
- )
96
-
97
- else:
98
- raise ValueError("You need a valid file path to be specified")
99
-
100
- return FlowMessage(output_text="Instances loaded to NeatGraph!")
@@ -1,51 +0,0 @@
1
- import time
2
- from pathlib import Path
3
- from typing import ClassVar
4
-
5
- from cognite.neat._issues.errors import WorkflowStepNotInitializedError
6
- from cognite.neat._workflows.model import FlowMessage
7
- from cognite.neat._workflows.steps.data_contracts import NeatGraph
8
- from cognite.neat._workflows.steps.step_model import Configurable, Step
9
-
10
- __all__ = [
11
- "GraphToRdfFile",
12
- ]
13
-
14
- CATEGORY = __name__.split(".")[-1].replace("_", " ").title()
15
-
16
-
17
- class GraphToRdfFile(Step):
18
- """
19
- The step generates loads graph to RDF file
20
- """
21
-
22
- description = "The step generates nodes and edges from the graph"
23
- category = CATEGORY
24
- version = "private-beta"
25
- configurables: ClassVar[list[Configurable]] = [
26
- Configurable(
27
- name="File path",
28
- value="staging/graph_export.ttl",
29
- label=("Relative path for the RDF file storage, " "must end with .ttl !"),
30
- ),
31
- ]
32
-
33
- def run( # type: ignore[override, syntax]
34
- self, store: NeatGraph
35
- ) -> FlowMessage: # type: ignore[syntax]
36
- if self.configs is None or self.data_store_path is None:
37
- raise WorkflowStepNotInitializedError(type(self).__name__)
38
-
39
- storage_path = self.data_store_path / Path(self.configs["File path"])
40
- relative_graph_file_path = str(storage_path).split("/data/")[1]
41
-
42
- store.graph.graph.serialize(str(storage_path), format="turtle")
43
-
44
- output_text = (
45
- "<p></p>"
46
- "Graph loaded to RDF file can be downloaded here : "
47
- f'<a href="/data/{relative_graph_file_path}?{time.time()}" '
48
- f'target="_blank">{storage_path.stem}.ttl</a>'
49
- )
50
-
51
- return FlowMessage(output_text=output_text)
@@ -1,48 +0,0 @@
1
- from typing import ClassVar
2
-
3
- from cognite.neat._store import NeatGraphStore
4
- from cognite.neat._workflows.model import FlowMessage
5
- from cognite.neat._workflows.steps.data_contracts import (
6
- MultiRuleData,
7
- NeatGraph,
8
- )
9
- from cognite.neat._workflows.steps.step_model import Configurable, Step
10
-
11
- __all__ = ["GraphStoreConfiguration"]
12
-
13
- CATEGORY = __name__.split(".")[-1].replace("_", " ").title()
14
-
15
-
16
- class GraphStoreConfiguration(Step):
17
- """
18
- This step initializes source OR solution graph store
19
- """
20
-
21
- description = "This step initializes the source and solution graph stores."
22
- version = "private-beta"
23
- category = CATEGORY
24
- configurables: ClassVar[list[Configurable]] = [
25
- Configurable(
26
- name="Graph store type",
27
- value="oxigraph",
28
- label="Graph store type, supported: oxigraph, rdflib",
29
- options=["oxigraph", "rdflib"],
30
- ),
31
- ]
32
-
33
- def run( # type: ignore[override]
34
- self, rules_data: MultiRuleData | None = None
35
- ) -> (FlowMessage, NeatGraph): # type: ignore[syntax]
36
- store_type = self.configs.get("Graph store type", "oxigraph")
37
-
38
- if store_type == "oxigraph":
39
- store = NeatGraph(graph=NeatGraphStore.from_oxi_store(rules=rules_data.information if rules_data else None))
40
- else:
41
- store = NeatGraph(
42
- graph=NeatGraphStore.from_memory_store(rules=rules_data.information if rules_data else None)
43
- )
44
-
45
- return (
46
- FlowMessage(output_text="Graph store configured successfully"),
47
- store,
48
- )