aas-standard-parser 0.2.3__py3-none-any.whl → 0.2.5__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/__init__.py +2 -2
- aas_standard_parser/aas_parser.py +24 -0
- aas_standard_parser/classes/aimc_parser_classes.py +2 -2
- aas_standard_parser/reference_helpers.py +20 -1
- {aas_standard_parser-0.2.3.dist-info → aas_standard_parser-0.2.5.dist-info}/METADATA +1 -1
- {aas_standard_parser-0.2.3.dist-info → aas_standard_parser-0.2.5.dist-info}/RECORD +9 -8
- {aas_standard_parser-0.2.3.dist-info → aas_standard_parser-0.2.5.dist-info}/WHEEL +0 -0
- {aas_standard_parser-0.2.3.dist-info → aas_standard_parser-0.2.5.dist-info}/licenses/LICENSE +0 -0
- {aas_standard_parser-0.2.3.dist-info → aas_standard_parser-0.2.5.dist-info}/top_level.txt +0 -0
aas_standard_parser/__init__.py
CHANGED
|
@@ -13,7 +13,7 @@ except importlib.metadata.PackageNotFoundError:
|
|
|
13
13
|
__project__ = "aas-standard-parser"
|
|
14
14
|
__package__ = "aas-standard-parser"
|
|
15
15
|
|
|
16
|
-
from aas_standard_parser import aimc_parser
|
|
16
|
+
from aas_standard_parser import aas_parser, aid_parser, aimc_parser, submodel_parser
|
|
17
17
|
from aas_standard_parser.aid_parser import AIDParser
|
|
18
18
|
|
|
19
|
-
__all__ = ["AIDParser", "aimc_parser"]
|
|
19
|
+
__all__ = ["AIDParser", "aimc_parser", "aas_parser", "aid_parser", "submodel_parser"]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Module for parsing AAS."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
from basyx.aas import model
|
|
6
|
+
|
|
7
|
+
logger = logging.getLogger(__name__)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_submodel_ids(shell: model.AssetAdministrationShell) -> list[str]:
|
|
11
|
+
"""Get all submodel IDs from the given AAS.
|
|
12
|
+
|
|
13
|
+
:param shell: parent AAS to search within
|
|
14
|
+
:return: list of submodel IDs
|
|
15
|
+
"""
|
|
16
|
+
submodel_ids = []
|
|
17
|
+
for submodel in shell.submodel:
|
|
18
|
+
if len(submodel.key) < 1 or submodel.key[0].type != model.KeyTypes.SUBMODEL:
|
|
19
|
+
logger.warning(f"Submodel reference {submodel} does not start with SUBMODEL key type.")
|
|
20
|
+
continue
|
|
21
|
+
|
|
22
|
+
submodel_ids.append(submodel.key[0].value)
|
|
23
|
+
|
|
24
|
+
return submodel_ids
|
|
@@ -27,14 +27,14 @@ class SourceSinkRelation:
|
|
|
27
27
|
"""
|
|
28
28
|
dict_string = json.dumps(self.source_properties.reference, cls=basyx.aas.adapter.json.AASToJsonEncoder)
|
|
29
29
|
dict_string = dict_string.replace("GlobalReference", "Submodel").replace("FragmentReference", "SubmodelElementCollection")
|
|
30
|
-
return json.
|
|
30
|
+
return json.loads(dict_string)
|
|
31
31
|
|
|
32
32
|
def sink_reference_as_dict(self) -> dict:
|
|
33
33
|
"""Convert the sink reference to a dictionary.
|
|
34
34
|
|
|
35
35
|
:return: The sink reference as a dictionary.
|
|
36
36
|
"""
|
|
37
|
-
return json.dumps(self.sink_properties.reference, cls=basyx.aas.adapter.json.AASToJsonEncoder)
|
|
37
|
+
return json.loads(json.dumps(self.sink_properties.reference, cls=basyx.aas.adapter.json.AASToJsonEncoder))
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
class MappingConfiguration:
|
|
@@ -6,7 +6,26 @@ def construct_idshort_path_from_reference(reference: ModelReference) -> str:
|
|
|
6
6
|
|
|
7
7
|
# start from the second Key and omit the Identifiable at the beginning of the list
|
|
8
8
|
for key in reference.key[1:]:
|
|
9
|
-
idshort_path +=
|
|
9
|
+
idshort_path += key.value + "."
|
|
10
10
|
|
|
11
11
|
# get rid of the trailing dot
|
|
12
12
|
return idshort_path[:-1]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def get_values_from_keys(reference: ModelReference) -> list[str]:
|
|
16
|
+
"""Returns the values from all keys in reference as list.
|
|
17
|
+
|
|
18
|
+
:param reference: reference to extract values from
|
|
19
|
+
:return: list of values from all keys in the reference
|
|
20
|
+
"""
|
|
21
|
+
return [key.value for key in reference.key]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def get_value_from_key_at_index(reference: ModelReference, index: int) -> str:
|
|
25
|
+
"""Returns the value from the key at the given index in reference.
|
|
26
|
+
|
|
27
|
+
:param reference: reference to extract value from
|
|
28
|
+
:param index: index of the key to get the value from
|
|
29
|
+
:return: value from the key at the given index
|
|
30
|
+
"""
|
|
31
|
+
return reference.key[index].value
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
aas_standard_parser/__init__.py,sha256=
|
|
1
|
+
aas_standard_parser/__init__.py,sha256=lp7rs4UL5yebN0F69JKuNaqI8kI2_lU2LV3B0vUSXAw,687
|
|
2
|
+
aas_standard_parser/aas_parser.py,sha256=9SDxG2YGEWlcK2Wyy70r9rOO6ExAOaN79-SbjurOci4,667
|
|
2
3
|
aas_standard_parser/aid_parser.py,sha256=9vp8_kJRfExTmw8tjmO32n1eHFAE5ItmfPlZ2ORLZMs,14314
|
|
3
4
|
aas_standard_parser/aimc_parser.py,sha256=3GSM-jBj-9OqNDnL7CssqogNOZEd7_fjRtxwzRZi-iA,9972
|
|
4
5
|
aas_standard_parser/collection_helpers.py,sha256=fTQGQiC-bGD41Qx0FDDBtWhvkeZtEe6Sh-aT93ePwro,4153
|
|
5
|
-
aas_standard_parser/reference_helpers.py,sha256=
|
|
6
|
+
aas_standard_parser/reference_helpers.py,sha256=mUWlxD81aV8J-VLowjZ1prS52cFW1EVwXkaUOFL_P2Y,1037
|
|
6
7
|
aas_standard_parser/submodel_parser.py,sha256=XH-XTBB3a0MB1NR5nAzG9C6f9hT_qG42f-ABruN3MzE,3169
|
|
7
8
|
aas_standard_parser/utils.py,sha256=5iIPpM_ob2V9MwFL_vTbXd23doYKot30xenRmTPAquo,723
|
|
8
|
-
aas_standard_parser/classes/aimc_parser_classes.py,sha256=
|
|
9
|
+
aas_standard_parser/classes/aimc_parser_classes.py,sha256=PwKpuyB36urFc8YqQ6KtrG8H5WLd-3R2c3yST8Yyc_w,2581
|
|
9
10
|
aas_standard_parser/demo/demo_process.py,sha256=Xn9uD0xLoNx0ZvB3Lk0oYkGBRHaEfUbfqv5_SpPWYck,530
|
|
10
11
|
aas_standard_parser/demo/logging_handler.py,sha256=x-eX4XDU3sZTJE22rzJSiaWQ8wRMbtaFpFBAeAcbIzI,5752
|
|
11
|
-
aas_standard_parser-0.2.
|
|
12
|
-
aas_standard_parser-0.2.
|
|
13
|
-
aas_standard_parser-0.2.
|
|
14
|
-
aas_standard_parser-0.2.
|
|
15
|
-
aas_standard_parser-0.2.
|
|
12
|
+
aas_standard_parser-0.2.5.dist-info/licenses/LICENSE,sha256=simqYMD2P9Ikm0Kh9n7VGNpaVcm2TMVVQmECYZ_xVZ8,1065
|
|
13
|
+
aas_standard_parser-0.2.5.dist-info/METADATA,sha256=WcBxrASC27ogAtVxryD9Qqy_sgRuche2RflhBdxUTZw,1718
|
|
14
|
+
aas_standard_parser-0.2.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
+
aas_standard_parser-0.2.5.dist-info/top_level.txt,sha256=OQaK6cwYttR1-eKTz5u4M0jbwSfp4HqJ56chaf0nHnw,20
|
|
16
|
+
aas_standard_parser-0.2.5.dist-info/RECORD,,
|
|
File without changes
|
{aas_standard_parser-0.2.3.dist-info → aas_standard_parser-0.2.5.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|