aas-standard-parser 0.2.0__py3-none-any.whl → 0.2.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.
@@ -15,6 +15,7 @@ logger = logging.getLogger(__name__)
15
15
  class ReferenceProperties:
16
16
  """Class representing properties of a reference in the mapping configuration."""
17
17
 
18
+ reference: model.ExternalReference = field(metadata={"description": "Reference to the property in the submodel."})
18
19
  submodel_id: str = field(metadata={"description": "Identifier of the submodel used by the reference."})
19
20
  property_name: str = field(metadata={"description": "Name of the mapped property."})
20
21
  parent_path: list[str] = field(metadata={"description": "List of idShorts representing the parent path of the reference."})
@@ -23,21 +24,15 @@ class ReferenceProperties:
23
24
  class SourceSinkRelation:
24
25
  """Class representing a source-sink relation in the mapping configuration."""
25
26
 
26
- source_submodel_id: str = field(metadata={"description": "Identifier of the source (AID) submodel used by the source reference."})
27
- sink_submodel_id: str = field(metadata={"description": "Identifier of the target submodel used by the sink reference."})
28
- source: model.ExternalReference = field(metadata={"description": "Reference to the source property in the AID submodel."})
29
- sink: model.ExternalReference = field(metadata={"description": "Reference to the sink property in the target submodel."})
30
- source_property_name: str = field(metadata={"description": "Name of the mapped property in source."})
31
- sink_property_name: str = field(metadata={"description": "Name of the mapped property in sink."})
32
- source_parent_path: list[str] = field(metadata={"description": "List of idShorts representing the parent path of the source reference."})
33
- sink_parent_path: list[str] = field(metadata={"description": "List of idShorts representing the parent path of the reference."})
27
+ source_properties: ReferenceProperties = field(metadata={"description": "Properties of the source reference."})
28
+ sink_properties: ReferenceProperties = field(metadata={"description": "Properties of the sink reference."})
34
29
 
35
30
  def source_as_dict(self) -> dict:
36
31
  """Convert the source reference to a dictionary.
37
32
 
38
33
  :return: The source reference as a dictionary.
39
34
  """
40
- dict_string = json.dumps(self.source, cls=basyx.aas.adapter.json.AASToJsonEncoder)
35
+ dict_string = json.dumps(self.source_properties.reference, cls=basyx.aas.adapter.json.AASToJsonEncoder)
41
36
  dict_string = dict_string.replace("GlobalReference", "Submodel").replace("FragmentReference", "SubmodelElementCollection")
42
37
  return json.loads(dict_string)
43
38
 
@@ -46,7 +41,7 @@ class SourceSinkRelation:
46
41
 
47
42
  :return: The sink reference as a dictionary.
48
43
  """
49
- return json.loads(json.dumps(self.sink, cls=basyx.aas.adapter.json.AASToJsonEncoder))
44
+ return json.dumps(self.sink_properties.reference, cls=basyx.aas.adapter.json.AASToJsonEncoder)
50
45
 
51
46
 
52
47
  class MappingConfiguration:
@@ -168,7 +163,7 @@ def parse_mapping_configuration_element(
168
163
  return None
169
164
 
170
165
  # check if all relations have the same AID submodel
171
- aid_submodel_ids = list({source_sink_relation.source_submodel_id for source_sink_relation in source_sink_relations})
166
+ aid_submodel_ids = list({source_sink_relation.source_properties.submodel_id for source_sink_relation in source_sink_relations})
172
167
 
173
168
  if len(aid_submodel_ids) != 1:
174
169
  logger.error(
@@ -237,20 +232,9 @@ def _generate_source_sink_relations(mapping_configuration_element: model.Submode
237
232
  logger.warning(f"'second' reference is missing in RelationshipElement '{source_sink_relation.id_short}'")
238
233
  continue
239
234
 
240
- source_ref_properties = _get_reference_properties(source_sink_relation.first)
241
- sink_ref_properties = _get_reference_properties(source_sink_relation.second)
242
-
243
235
  relation = SourceSinkRelation()
244
-
245
- relation.source = source_sink_relation.first
246
- relation.source_submodel_id = source_ref_properties.submodel_id
247
- relation.source_property_name = source_ref_properties.property_name
248
- relation.source_parent_path = source_ref_properties.parent_path
249
-
250
- relation.sink = source_sink_relation.second
251
- relation.sink_submodel_id = sink_ref_properties.submodel_id
252
- relation.sink_property_name = sink_ref_properties.property_name
253
- relation.sink_parent_path = sink_ref_properties.parent_path
236
+ relation.source_properties = _get_reference_properties(source_sink_relation.first)
237
+ relation.sink_properties = _get_reference_properties(source_sink_relation.second)
254
238
 
255
239
  source_sink_relations.append(relation)
256
240
 
@@ -276,6 +260,7 @@ def _get_reference_properties(reference: model.ExternalReference) -> ReferencePr
276
260
  ref_properties.submodel_id = global_ref.value
277
261
  ref_properties.property_name = last_fragment_ref.value
278
262
  ref_properties.parent_path = parent_path
263
+ ref_properties.reference = reference
279
264
 
280
265
  return ref_properties
281
266
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aas-standard-parser
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Some auxiliary functions for parsing standard submodels
5
5
  Author-email: Daniel Klein <daniel.klein@em.ag>
6
6
  License: MIT License
@@ -1,14 +1,14 @@
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=3hAKH3F1_r9ZDPLz82PYIehJnUsZodqX6ysVx2wM3fg,13440
3
+ aas_standard_parser/aimc_parser.py,sha256=EdZmXL8wDTscSPCKI1ILKUIeNkZPMLHV2leTCXsqckQ,12347
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
8
  aas_standard_parser/demo/demo_process.py,sha256=Xn9uD0xLoNx0ZvB3Lk0oYkGBRHaEfUbfqv5_SpPWYck,530
9
9
  aas_standard_parser/demo/logging_handler.py,sha256=x-eX4XDU3sZTJE22rzJSiaWQ8wRMbtaFpFBAeAcbIzI,5752
10
- aas_standard_parser-0.2.0.dist-info/licenses/LICENSE,sha256=simqYMD2P9Ikm0Kh9n7VGNpaVcm2TMVVQmECYZ_xVZ8,1065
11
- aas_standard_parser-0.2.0.dist-info/METADATA,sha256=FjntnuF2IPILHFc5n6A2EITPZQGPJKAdN9nXTR1uSL8,1718
12
- aas_standard_parser-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
- aas_standard_parser-0.2.0.dist-info/top_level.txt,sha256=OQaK6cwYttR1-eKTz5u4M0jbwSfp4HqJ56chaf0nHnw,20
14
- aas_standard_parser-0.2.0.dist-info/RECORD,,
10
+ aas_standard_parser-0.2.1.dist-info/licenses/LICENSE,sha256=simqYMD2P9Ikm0Kh9n7VGNpaVcm2TMVVQmECYZ_xVZ8,1065
11
+ aas_standard_parser-0.2.1.dist-info/METADATA,sha256=ymMIlWi-tUVCsZya-shT7XkYyrSgCGM_KA4EoN8sITI,1718
12
+ aas_standard_parser-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ aas_standard_parser-0.2.1.dist-info/top_level.txt,sha256=OQaK6cwYttR1-eKTz5u4M0jbwSfp4HqJ56chaf0nHnw,20
14
+ aas_standard_parser-0.2.1.dist-info/RECORD,,