cognite-neat 0.90.1__py3-none-any.whl → 0.91.0__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 (32) hide show
  1. cognite/neat/_version.py +1 -1
  2. cognite/neat/graph/extractors/__init__.py +3 -0
  3. cognite/neat/graph/extractors/_dexpi.py +4 -4
  4. cognite/neat/graph/extractors/_iodd.py +160 -0
  5. cognite/neat/issues/_base.py +6 -2
  6. cognite/neat/rules/exporters/_rules2excel.py +3 -3
  7. cognite/neat/rules/exporters/_rules2yaml.py +5 -1
  8. cognite/neat/rules/models/__init__.py +2 -2
  9. cognite/neat/rules/models/_base_input.py +2 -2
  10. cognite/neat/rules/models/_base_rules.py +142 -142
  11. cognite/neat/rules/models/asset/_rules.py +1 -34
  12. cognite/neat/rules/models/dms/_rules.py +127 -46
  13. cognite/neat/rules/models/dms/_validation.py +2 -2
  14. cognite/neat/rules/models/domain.py +16 -19
  15. cognite/neat/rules/models/entities/_single_value.py +25 -11
  16. cognite/neat/rules/models/entities/_types.py +0 -10
  17. cognite/neat/rules/models/information/_rules.py +68 -43
  18. cognite/neat/rules/models/information/_validation.py +5 -5
  19. cognite/neat/rules/transformers/_converters.py +6 -8
  20. cognite/neat/rules/transformers/_pipelines.py +8 -4
  21. cognite/neat/store/_base.py +1 -1
  22. cognite/neat/utils/xml_.py +27 -12
  23. cognite/neat/workflows/examples/{Visualize_Semantic_Data_Model → Export_Semantic_Data_Model}/workflow.yaml +1 -46
  24. {cognite_neat-0.90.1.dist-info → cognite_neat-0.91.0.dist-info}/METADATA +1 -1
  25. {cognite_neat-0.90.1.dist-info → cognite_neat-0.91.0.dist-info}/RECORD +28 -31
  26. cognite/neat/rules/models/asset/_serializer.py +0 -73
  27. cognite/neat/rules/models/dms/_serializer.py +0 -157
  28. cognite/neat/rules/models/information/_serializer.py +0 -73
  29. cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -95
  30. {cognite_neat-0.90.1.dist-info → cognite_neat-0.91.0.dist-info}/LICENSE +0 -0
  31. {cognite_neat-0.90.1.dist-info → cognite_neat-0.91.0.dist-info}/WHEEL +0 -0
  32. {cognite_neat-0.90.1.dist-info → cognite_neat-0.91.0.dist-info}/entry_points.txt +0 -0
@@ -1,73 +0,0 @@
1
- from typing import Any, ClassVar
2
-
3
- from cognite.neat.rules.models import InformationRules
4
- from cognite.neat.rules.models.entities import ClassEntity, ReferenceEntity
5
- from cognite.neat.rules.models.information import InformationClass, InformationProperty
6
-
7
-
8
- class _InformationRulesSerializer:
9
- # These are the fields that need to be cleaned from the default space and version
10
- PROPERTIES_FIELDS: ClassVar[list[str]] = ["class_", "value_type"]
11
- CLASSES_FIELDS: ClassVar[list[str]] = ["class_"]
12
-
13
- def __init__(self, by_alias: bool, default_prefix: str) -> None:
14
- self.default_prefix = f"{default_prefix}:"
15
-
16
- self.properties_fields = self.PROPERTIES_FIELDS
17
- self.classes_fields = self.CLASSES_FIELDS
18
-
19
- self.prop_name = "properties"
20
- self.class_name = "classes"
21
- self.metadata_name = "metadata"
22
- self.class_parent = "parent"
23
-
24
- self.prop_property = "property_"
25
- self.prop_class = "class_"
26
-
27
- self.reference = "Reference" if by_alias else "reference"
28
- if by_alias:
29
- self.properties_fields = [
30
- InformationProperty.model_fields[field].alias or field for field in self.properties_fields
31
- ]
32
- self.classes_fields = [InformationClass.model_fields[field].alias or field for field in self.classes_fields]
33
- self.prop_name = InformationRules.model_fields[self.prop_name].alias or self.prop_name
34
- self.class_name = InformationRules.model_fields[self.class_name].alias or self.class_name
35
- self.class_parent = InformationClass.model_fields[self.class_parent].alias or self.class_parent
36
- self.metadata_name = InformationRules.model_fields[self.metadata_name].alias or self.metadata_name
37
-
38
- self.prop_property = InformationProperty.model_fields[self.prop_property].alias or self.prop_property
39
- self.prop_class = InformationProperty.model_fields[self.prop_class].alias or self.prop_class
40
-
41
- def clean(self, dumped: dict[str, Any], as_reference: bool) -> dict[str, Any]:
42
- # Sorting to get a deterministic order
43
- dumped[self.prop_name] = sorted(
44
- dumped[self.prop_name]["data"], key=lambda p: (p[self.prop_class], p[self.prop_property])
45
- )
46
- dumped[self.class_name] = sorted(dumped[self.class_name]["data"], key=lambda v: v[self.prop_class])
47
-
48
- for prop in dumped[self.prop_name]:
49
- if as_reference:
50
- class_entity = ClassEntity.load(prop[self.prop_class])
51
- prop[self.reference] = str(
52
- ReferenceEntity(
53
- prefix=str(class_entity.prefix), suffix=class_entity.suffix, property=prop[self.prop_property]
54
- )
55
- )
56
-
57
- for field_name in self.properties_fields:
58
- if value := prop.get(field_name):
59
- prop[field_name] = value.removeprefix(self.default_prefix)
60
-
61
- for class_ in dumped[self.class_name]:
62
- if as_reference:
63
- class_[self.reference] = class_[self.prop_class]
64
- for field_name in self.classes_fields:
65
- if value := class_.get(field_name):
66
- class_[field_name] = value.removeprefix(self.default_prefix)
67
-
68
- if value := class_.get(self.class_parent):
69
- class_[self.class_parent] = ",".join(
70
- parent.strip().removeprefix(self.default_prefix) for parent in value.split(",")
71
- )
72
-
73
- return dumped
@@ -1,95 +0,0 @@
1
- configs: []
2
- description: null
3
- implementation_module: null
4
- name: Visualize Data Model Using Mock Graph
5
- steps:
6
- - complex_configs: {}
7
- configs:
8
- File name: information-architect-david.xlsx
9
- Report formatter: BasicHTML
10
- Role: infer
11
- description: null
12
- enabled: true
13
- id: step_verify_rules
14
- label: Verify Rules
15
- max_retries: 0
16
- method: ExcelToRules
17
- params: {}
18
- retry_delay: 3
19
- stype: stdstep
20
- system_component_id: null
21
- transition_to:
22
- - step_configure_graph_store
23
- trigger: false
24
- ui_config:
25
- pos_x: 507
26
- pos_y: 250
27
- - complex_configs: {}
28
- configs:
29
- Disk storage directory: mock-graph-store
30
- Graph: source
31
- Graph store type: oxigraph
32
- GraphDB API root URL: ""
33
- Init procedure: reset
34
- Query URL: ""
35
- Update URL: ""
36
- description: null
37
- enabled: true
38
- id: step_configure_graph_store
39
- label: Configure Graph Store
40
- max_retries: 0
41
- method: GraphStoreConfiguration
42
- params: {}
43
- retry_delay: 3
44
- stype: stdstep
45
- system_component_id: null
46
- transition_to:
47
- - step_166101
48
- - step_mock_graph_generation
49
- trigger: false
50
- ui_config:
51
- pos_x: 506
52
- pos_y: 314
53
- - complex_configs: {}
54
- configs:
55
- Class count:
56
- '{"WindTurbine" : 1, "WindFarm" : 1, "OffshoreSubstation" : 1,
57
- "DistributionSubstation" : 1, "OnshoreSubstation" : 1, "ArrayCable" :
58
- 1, "ExportCable" : 1, "Transmission" : 1, "DistributionLine" : 1, "Meter"
59
- : 1, "ElectricCarCharger" : 1}'
60
- Graph: source
61
- description: null
62
- enabled: true
63
- id: step_mock_graph_generation
64
- label: Generate Mock Graph
65
- max_retries: 0
66
- method: GraphFromMockData
67
- params: {}
68
- retry_delay: 3
69
- stype: stdstep
70
- system_component_id: null
71
- transition_to: []
72
- trigger: false
73
- ui_config:
74
- pos_x: 506
75
- pos_y: 390
76
- - complex_configs: {}
77
- configs: {}
78
- description: null
79
- enabled: true
80
- id: step_upload_rules
81
- label: Upload Rules
82
- max_retries: 0
83
- method: null
84
- params:
85
- file_type: rules
86
- retry_delay: 3
87
- stype: file_uploader
88
- system_component_id: null
89
- transition_to:
90
- - step_verify_rules
91
- trigger: true
92
- ui_config:
93
- pos_x: 507
94
- pos_y: 177
95
- system_components: []