aas-standard-parser 0.2.1__py3-none-any.whl → 0.2.3__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.
- aas_standard_parser/aimc_parser.py +1 -50
- aas_standard_parser/classes/aimc_parser_classes.py +52 -0
- {aas_standard_parser-0.2.1.dist-info → aas_standard_parser-0.2.3.dist-info}/METADATA +1 -1
- {aas_standard_parser-0.2.1.dist-info → aas_standard_parser-0.2.3.dist-info}/RECORD +7 -6
- {aas_standard_parser-0.2.1.dist-info → aas_standard_parser-0.2.3.dist-info}/WHEEL +0 -0
- {aas_standard_parser-0.2.1.dist-info → aas_standard_parser-0.2.3.dist-info}/licenses/LICENSE +0 -0
- {aas_standard_parser-0.2.1.dist-info → aas_standard_parser-0.2.3.dist-info}/top_level.txt +0 -0
|
@@ -1,64 +1,15 @@
|
|
|
1
1
|
"""Parser for Mapping Configurations in AIMC Submodel."""
|
|
2
2
|
|
|
3
|
-
import json
|
|
4
3
|
import logging
|
|
5
|
-
from dataclasses import field
|
|
6
4
|
|
|
7
|
-
import basyx.aas.adapter.json
|
|
8
5
|
from basyx.aas import model
|
|
9
6
|
|
|
10
7
|
import aas_standard_parser.collection_helpers as ch
|
|
8
|
+
from aas_standard_parser.classes.aimc_parser_classes import MappingConfiguration, MappingConfigurations, ReferenceProperties, SourceSinkRelation
|
|
11
9
|
|
|
12
10
|
logger = logging.getLogger(__name__)
|
|
13
11
|
|
|
14
12
|
|
|
15
|
-
class ReferenceProperties:
|
|
16
|
-
"""Class representing properties of a reference in the mapping configuration."""
|
|
17
|
-
|
|
18
|
-
reference: model.ExternalReference = field(metadata={"description": "Reference to the property in the submodel."})
|
|
19
|
-
submodel_id: str = field(metadata={"description": "Identifier of the submodel used by the reference."})
|
|
20
|
-
property_name: str = field(metadata={"description": "Name of the mapped property."})
|
|
21
|
-
parent_path: list[str] = field(metadata={"description": "List of idShorts representing the parent path of the reference."})
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class SourceSinkRelation:
|
|
25
|
-
"""Class representing a source-sink relation in the mapping configuration."""
|
|
26
|
-
|
|
27
|
-
source_properties: ReferenceProperties = field(metadata={"description": "Properties of the source reference."})
|
|
28
|
-
sink_properties: ReferenceProperties = field(metadata={"description": "Properties of the sink reference."})
|
|
29
|
-
|
|
30
|
-
def source_as_dict(self) -> dict:
|
|
31
|
-
"""Convert the source reference to a dictionary.
|
|
32
|
-
|
|
33
|
-
:return: The source reference as a dictionary.
|
|
34
|
-
"""
|
|
35
|
-
dict_string = json.dumps(self.source_properties.reference, cls=basyx.aas.adapter.json.AASToJsonEncoder)
|
|
36
|
-
dict_string = dict_string.replace("GlobalReference", "Submodel").replace("FragmentReference", "SubmodelElementCollection")
|
|
37
|
-
return json.loads(dict_string)
|
|
38
|
-
|
|
39
|
-
def sink_as_dict(self) -> dict:
|
|
40
|
-
"""Convert the sink reference to a dictionary.
|
|
41
|
-
|
|
42
|
-
:return: The sink reference as a dictionary.
|
|
43
|
-
"""
|
|
44
|
-
return json.dumps(self.sink_properties.reference, cls=basyx.aas.adapter.json.AASToJsonEncoder)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class MappingConfiguration:
|
|
48
|
-
"""Class representing a mapping configuration."""
|
|
49
|
-
|
|
50
|
-
interface_reference: model.ReferenceElement = field(metadata={"description": "Reference to the interface in the AID submodel."})
|
|
51
|
-
aid_submodel_id: str = field(metadata={"description": "Identifier of the AID submodel used by the interface reference."})
|
|
52
|
-
source_sink_relations: list[SourceSinkRelation] = field(metadata={"description": "List of source-sink relations in the mapping configuration."})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
class MappingConfigurations:
|
|
56
|
-
"""Class representing mapping configurations from AIMC submodel."""
|
|
57
|
-
|
|
58
|
-
configurations: list[MappingConfiguration] = field(metadata={"description": "List of mapping configurations."})
|
|
59
|
-
aid_submodel_ids: list[str] = field(metadata={"description": "List of AID submodel IDs used in the mapping configurations."})
|
|
60
|
-
|
|
61
|
-
|
|
62
13
|
def get_mapping_configuration_root_element(aimc_submodel: model.Submodel) -> model.SubmodelElementCollection | None:
|
|
63
14
|
"""Get the mapping configuration root submodel element collection from the AIMC submodel.
|
|
64
15
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from dataclasses import field
|
|
3
|
+
|
|
4
|
+
import basyx.aas.adapter.json
|
|
5
|
+
from basyx.aas import model
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ReferenceProperties:
|
|
9
|
+
"""Class representing properties of a reference in the mapping configuration."""
|
|
10
|
+
|
|
11
|
+
reference: model.ExternalReference = field(metadata={"description": "Reference to the property in the submodel."})
|
|
12
|
+
submodel_id: str = field(metadata={"description": "Identifier of the submodel used by the reference."})
|
|
13
|
+
property_name: str = field(metadata={"description": "Name of the mapped property."})
|
|
14
|
+
parent_path: list[str] = field(metadata={"description": "List of idShorts representing the parent path of the reference."})
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SourceSinkRelation:
|
|
18
|
+
"""Class representing a source-sink relation in the mapping configuration."""
|
|
19
|
+
|
|
20
|
+
source_properties: ReferenceProperties = field(metadata={"description": "Properties of the source reference."})
|
|
21
|
+
sink_properties: ReferenceProperties = field(metadata={"description": "Properties of the sink reference."})
|
|
22
|
+
|
|
23
|
+
def source_reference_as_dict(self) -> dict:
|
|
24
|
+
"""Convert the source reference to a dictionary.
|
|
25
|
+
|
|
26
|
+
:return: The source reference as a dictionary.
|
|
27
|
+
"""
|
|
28
|
+
dict_string = json.dumps(self.source_properties.reference, cls=basyx.aas.adapter.json.AASToJsonEncoder)
|
|
29
|
+
dict_string = dict_string.replace("GlobalReference", "Submodel").replace("FragmentReference", "SubmodelElementCollection")
|
|
30
|
+
return json.dumps(dict_string)
|
|
31
|
+
|
|
32
|
+
def sink_reference_as_dict(self) -> dict:
|
|
33
|
+
"""Convert the sink reference to a dictionary.
|
|
34
|
+
|
|
35
|
+
:return: The sink reference as a dictionary.
|
|
36
|
+
"""
|
|
37
|
+
return json.dumps(self.sink_properties.reference, cls=basyx.aas.adapter.json.AASToJsonEncoder)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class MappingConfiguration:
|
|
41
|
+
"""Class representing a mapping configuration."""
|
|
42
|
+
|
|
43
|
+
interface_reference: model.ReferenceElement = field(metadata={"description": "Reference to the interface in the AID submodel."})
|
|
44
|
+
aid_submodel_id: str = field(metadata={"description": "Identifier of the AID submodel used by the interface reference."})
|
|
45
|
+
source_sink_relations: list[SourceSinkRelation] = field(metadata={"description": "List of source-sink relations in the mapping configuration."})
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class MappingConfigurations:
|
|
49
|
+
"""Class representing mapping configurations from AIMC submodel."""
|
|
50
|
+
|
|
51
|
+
configurations: list[MappingConfiguration] = field(metadata={"description": "List of mapping configurations."})
|
|
52
|
+
aid_submodel_ids: list[str] = field(metadata={"description": "List of AID submodel IDs used in the mapping configurations."})
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
aas_standard_parser/__init__.py,sha256=3iBTUUlJ97ImkAHdss_GP970BANEU1uNeg0HlRzzois,599
|
|
2
2
|
aas_standard_parser/aid_parser.py,sha256=9vp8_kJRfExTmw8tjmO32n1eHFAE5ItmfPlZ2ORLZMs,14314
|
|
3
|
-
aas_standard_parser/aimc_parser.py,sha256=
|
|
3
|
+
aas_standard_parser/aimc_parser.py,sha256=3GSM-jBj-9OqNDnL7CssqogNOZEd7_fjRtxwzRZi-iA,9972
|
|
4
4
|
aas_standard_parser/collection_helpers.py,sha256=fTQGQiC-bGD41Qx0FDDBtWhvkeZtEe6Sh-aT93ePwro,4153
|
|
5
5
|
aas_standard_parser/reference_helpers.py,sha256=UbqXaub5PTvt_W3VPntSSFcTS59PUwlTpoujny8rIRI,377
|
|
6
6
|
aas_standard_parser/submodel_parser.py,sha256=XH-XTBB3a0MB1NR5nAzG9C6f9hT_qG42f-ABruN3MzE,3169
|
|
7
7
|
aas_standard_parser/utils.py,sha256=5iIPpM_ob2V9MwFL_vTbXd23doYKot30xenRmTPAquo,723
|
|
8
|
+
aas_standard_parser/classes/aimc_parser_classes.py,sha256=eEWofShWRUMFG3H9MKOK_L24ZZcXfmus34hUwjutjgE,2569
|
|
8
9
|
aas_standard_parser/demo/demo_process.py,sha256=Xn9uD0xLoNx0ZvB3Lk0oYkGBRHaEfUbfqv5_SpPWYck,530
|
|
9
10
|
aas_standard_parser/demo/logging_handler.py,sha256=x-eX4XDU3sZTJE22rzJSiaWQ8wRMbtaFpFBAeAcbIzI,5752
|
|
10
|
-
aas_standard_parser-0.2.
|
|
11
|
-
aas_standard_parser-0.2.
|
|
12
|
-
aas_standard_parser-0.2.
|
|
13
|
-
aas_standard_parser-0.2.
|
|
14
|
-
aas_standard_parser-0.2.
|
|
11
|
+
aas_standard_parser-0.2.3.dist-info/licenses/LICENSE,sha256=simqYMD2P9Ikm0Kh9n7VGNpaVcm2TMVVQmECYZ_xVZ8,1065
|
|
12
|
+
aas_standard_parser-0.2.3.dist-info/METADATA,sha256=o2rq6QjCoIiWOk3sMMCZIpTiAAlqWIryUYNUOxw0ah4,1718
|
|
13
|
+
aas_standard_parser-0.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
aas_standard_parser-0.2.3.dist-info/top_level.txt,sha256=OQaK6cwYttR1-eKTz5u4M0jbwSfp4HqJ56chaf0nHnw,20
|
|
15
|
+
aas_standard_parser-0.2.3.dist-info/RECORD,,
|
|
File without changes
|
{aas_standard_parser-0.2.1.dist-info → aas_standard_parser-0.2.3.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|