Skip to content

Commit 7fd37bb

Browse files
authored
Refactor for test data from aas-core-testdatagen (#5)
We rewrite the development scripts to use the latest aas-core-codegen 0.0.19 so that we can leverage the test data generated by aas-core-testdatagen. This significantly simplifies the development pipeline, and makes it easy to migrate the SDK to future versions of the AAS meta-model.
1 parent 8455f0c commit 7fd37bb

File tree

28,288 files changed

+131074
-434083
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

28,288 files changed

+131074
-434083
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
.idea/
2+
3+
# Dev. scripts
4+
.venv*/
5+
*.egg-info
6+
27
/src/.vs
38
*~
49

dev_scripts/codegen/codegen.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

dev_scripts/codegen/meta_model.py

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Downloaded from: https://raw.githubusercontent.com/aas-core-works/aas-core-meta/5a498be3a3b56f34af9a90b368cae10ca04e7ae4/aas_core_meta/v3_1.py
1+
# Downloaded from: https://raw.githubusercontent.com/aas-core-works/aas-core-meta/02040d200af0cb3bad1fa9c9555d7fb640bb8667/aas_core_meta/v3_1.py
22
"""
33
--- WORK IN PROGRESS ---
44
Provide an implementation of the Asset Administration Shell (AAS) V3.1.
@@ -326,7 +326,7 @@ def lang_strings_have_unique_languages(
326326
Check that the :paramref:`lang_strings` do not have overlapping
327327
:attr:`Abstract_lang_string.language`'s
328328
"""
329-
# NOTE (mristin, 2022-04-7):
329+
# NOTE (mristin):
330330
# This implementation will not be transpiled, but is given here as reference.
331331
language_set = set()
332332
for lang_string in lang_strings:
@@ -346,7 +346,7 @@ def qualifier_types_are_unique(qualifiers: List["Qualifier"]) -> bool:
346346
:param qualifiers: to be checked
347347
:return: True if all :attr:`Qualifier.type`'s are unique
348348
"""
349-
# NOTE (mristin, 2022-04-1):
349+
# NOTE (mristin):
350350
# This implementation is given here only as reference. It needs to be adapted
351351
# for each implementation separately.
352352
observed_types = set()
@@ -597,7 +597,7 @@ def matches_xs_double(text: str) -> bool:
597597
:param text: Text to be checked
598598
:returns: True if the :paramref:`text` conforms to the pattern
599599
"""
600-
# NOTE (mristin, 2022-04-6):
600+
# NOTE (mristin):
601601
# See: https://www.w3.org/TR/xmlschema-2/#nt-doubleRep
602602
double_rep = r"((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|-?INF|NaN)"
603603

@@ -615,7 +615,7 @@ def matches_xs_duration(text: str) -> bool:
615615
:param text: Text to be checked
616616
:returns: True if the :paramref:`text` conforms to the pattern
617617
"""
618-
# NOTE (mristin, 2022-04-6):
618+
# NOTE (mristin):
619619
# See https://www.w3.org/TR/xmlschema-2/#nt-durationRep
620620

621621
# fmt: off
@@ -671,7 +671,7 @@ def matches_xs_g_day(text: str) -> bool:
671671
:param text: Text to be checked
672672
:returns: True if the :paramref:`text` conforms to the pattern
673673
"""
674-
# NOTE (mristin, 2022-04-6):
674+
# NOTE (mristin):
675675
# See https://www.w3.org/TR/xmlschema-2/#nt-gDayRep
676676
g_day_lexical_rep = (
677677
r"---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"
@@ -691,7 +691,7 @@ def matches_xs_g_month(text: str) -> bool:
691691
:param text: Text to be checked
692692
:returns: True if the :paramref:`text` conforms to the pattern
693693
"""
694-
# NOTE (mristin, 2022-04-6):
694+
# NOTE (mristin):
695695
# See https://www.w3.org/TR/xmlschema-2/#nt-gMonthRep
696696
g_month_lexical_rep = (
697697
r"--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"
@@ -711,7 +711,7 @@ def matches_xs_g_month_day(text: str) -> bool:
711711
:param text: Text to be checked
712712
:returns: True if the :paramref:`text` conforms to the pattern
713713
"""
714-
# NOTE (mristin, 2022-04-6):
714+
# NOTE (mristin):
715715
# See https://www.w3.org/TR/xmlschema-2/#nt-gMonthDayRep
716716
g_month_day_rep = (
717717
r"--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])"
@@ -732,7 +732,7 @@ def matches_xs_g_year(text: str) -> bool:
732732
:param text: Text to be checked
733733
:returns: True if the :paramref:`text` conforms to the pattern
734734
"""
735-
# NOTE (mristin, 2022-04-6):
735+
# NOTE (mristin):
736736
# See https://www.w3.org/TR/xmlschema-2/#nt-gYearRep
737737
g_year_rep = (
738738
r"-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"
@@ -752,7 +752,7 @@ def matches_xs_g_year_month(text: str) -> bool:
752752
:param text: Text to be checked
753753
:returns: True if the :paramref:`text` conforms to the pattern
754754
"""
755-
# NOTE (mristin, 2022-04-6):
755+
# NOTE (mristin):
756756
# See https://www.w3.org/TR/xmlschema-2/#nt-gYearMonthRep
757757

758758
g_year_month_rep = (
@@ -774,7 +774,7 @@ def matches_xs_hex_binary(text: str) -> bool:
774774
:param text: Text to be checked
775775
:returns: True if the :paramref:`text` conforms to the pattern
776776
"""
777-
# NOTE (mristin, 2022-04-6):
777+
# NOTE (mristin):
778778
# See https://www.w3.org/TR/xmlschema-2/#nt-hexBinary
779779
hex_binary = r"([0-9a-fA-F]{2})*"
780780

@@ -792,7 +792,7 @@ def matches_xs_time(text: str) -> bool:
792792
:param text: Text to be checked
793793
:returns: True if the :paramref:`text` conforms to the pattern
794794
"""
795-
# NOTE (mristin, 2022-04-6):
795+
# NOTE (mristin):
796796
# See https://www.w3.org/TR/xmlschema-2/#nt-timeRep
797797
time_rep = (
798798
r"(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))"
@@ -1039,7 +1039,7 @@ def value_consistent_with_XSD_type(value: str, value_type: "Data_type_def_XSD")
10391039
:param value_type: pre-defined value type
10401040
:return: True if the :paramref:`value` conforms
10411041
"""
1042-
# NOTE (mristin, 2022-04-1):
1042+
# NOTE (mristin):
10431043
# We specify the pattern-matching functions above, and they should be handy to check
10441044
# for most obvious pattern mismatches.
10451045
#
@@ -1048,6 +1048,8 @@ def value_consistent_with_XSD_type(value: str, value_type: "Data_type_def_XSD")
10481048
# follows the pattern, but also that the day-of-month and leap seconds are taken
10491049
# into account.
10501050

1051+
raise NotImplementedError()
1052+
10511053

10521054
@verification
10531055
def is_model_reference_to(reference: "Reference", expected_type: "Key_types") -> bool:
@@ -1082,7 +1084,7 @@ def ID_shorts_are_unique(referables: List["Referable"]) -> bool:
10821084
Check that the :attr:`Referable.ID_short`'s among the :paramref:`referables` are
10831085
unique in their namespace.
10841086
"""
1085-
# NOTE (mristin, 2022-04-7):
1087+
# NOTE (mristin):
10861088
# This implementation will not be transpiled, but is given here as reference.
10871089
id_short_set = set()
10881090
for referable in referables:
@@ -1107,7 +1109,7 @@ def ID_shorts_of_variables_are_unique(
11071109
:paramref:`input_variables`, :paramref:`output_variables`
11081110
and :paramref:`inoutput_variables` are unique.
11091111
"""
1110-
# NOTE (s-heppner, 2023-01-25):
1112+
# NOTE (s-heppner):
11111113
# This implementation will not be transpiled, but is given here as reference.
11121114
id_short_set = set()
11131115
if input_variables is not None:
@@ -1138,7 +1140,7 @@ def ID_shorts_of_variables_are_unique(
11381140
@implementation_specific
11391141
def extension_names_are_unique(extensions: List["Extension"]) -> bool:
11401142
"""Check that the extension names are unique."""
1141-
# NOTE (mristin, 2022-04-7):
1143+
# NOTE (mristin):
11421144
# This implementation will not be transpiled, but is given here as reference.
11431145
name_set = set()
11441146
for extension in extensions:
@@ -1155,7 +1157,7 @@ def submodel_elements_have_identical_semantic_IDs(
11551157
elements: List["Submodel_element"],
11561158
) -> bool:
11571159
"""Check that all semantic IDs are identical, if specified."""
1158-
# NOTE (mristin, 2022-04-7):
1160+
# NOTE (mristin):
11591161
# This implementation will not be transpiled, but is given here as a reference.
11601162
semantic_ID = None
11611163
for element in elements:
@@ -1187,7 +1189,7 @@ def properties_or_ranges_have_value_type(
11871189
elements: List["Submodel_element"], value_type: "Data_type_def_XSD"
11881190
) -> bool:
11891191
"""Check that all the :paramref:`elements` have the :paramref:`value_type`."""
1190-
# NOTE (mristin, 2022-04-7):
1192+
# NOTE (mristin):
11911193
# This implementation will not be transpiled, but is given here as reference.
11921194
for element in elements:
11931195
if isinstance(element, (Property, Range)):
@@ -1201,7 +1203,7 @@ def properties_or_ranges_have_value_type(
12011203
@implementation_specific
12021204
def reference_key_values_equal(that: "Reference", other: "Reference") -> bool:
12031205
"""Check that the two references are equal by comparing their key values."""
1204-
# NOTE (mristin, 2022-04-7):
1206+
# NOTE (mristin):
12051207
# This implementation will not be transpiled, but is given here as reference.
12061208
if len(that.keys) != len(other.keys):
12071209
return False
@@ -1535,7 +1537,7 @@ class Extension(Has_semantics):
15351537
@implementation_specific
15361538
@non_mutating
15371539
def value_type_or_default(self) -> "Data_type_def_XSD":
1538-
# NOTE (mristin, 2022-04-7):
1540+
# NOTE (mristin):
15391541
# This implementation will not be transpiled, but is given here as reference.
15401542
return (
15411543
self.value_type if self.value_type is not None else Data_type_def_XSD.String
@@ -1785,7 +1787,7 @@ class Has_kind(DBC):
17851787
@implementation_specific
17861788
@non_mutating
17871789
def kind_or_default(self) -> "Modelling_kind":
1788-
# NOTE (mristin, 2022-04-7):
1790+
# NOTE (mristin):
17891791
# This implementation will not be transpiled, but is given here as reference.
17901792
return self.kind if self.kind is not None else Modelling_kind.Instance
17911793

@@ -2012,7 +2014,7 @@ class Qualifier(Has_semantics):
20122014
@implementation_specific
20132015
@non_mutating
20142016
def kind_or_default(self) -> "Qualifier_kind":
2015-
# NOTE (mristin, 2022-05-24):
2017+
# NOTE (mristin):
20162018
# This implementation will not be transpiled, but is given here as reference.
20172019
return self.kind if self.kind is not None else Qualifier_kind.Concept_qualifier
20182020

@@ -2766,7 +2768,7 @@ class Submodel_element_list(Submodel_element):
27662768
@implementation_specific
27672769
@non_mutating
27682770
def order_relevant_or_default(self) -> bool:
2769-
# NOTE (mristin, 2022-04-7):
2771+
# NOTE (mristin):
27702772
# This implementation will not be transpiled, but is given here as reference.
27712773
return self.order_relevant if self.order_relevant is not None else True
27722774

@@ -4009,7 +4011,7 @@ def __init__(
40094011
)
40104012

40114013

4012-
# NOTE (mristin, 2022-08-19):
4014+
# NOTE (mristin):
40134015
# We make the following verification functions implementation-specific since the casts
40144016
# are very clumsy to formalize and transpile in a readable way across languages.
40154017
# For example, since Python does not have a null-coalescing operator, formalizing
@@ -4030,7 +4032,7 @@ def data_specification_IEC_61360s_for_property_or_value_have_appropriate_data_ty
40304032
Check that the :attr:`Data_specification_IEC_61360.data_type` is defined
40314033
appropriately for all data specifications whose content is given as IEC 61360.
40324034
"""
4033-
# NOTE (mristin, 2022-04-7):
4035+
# NOTE (mristin):
40344036
# This implementation will not be transpiled, but is given here as reference.
40354037
return all(
40364038
not (
@@ -4059,7 +4061,7 @@ def data_specification_IEC_61360s_for_reference_have_appropriate_data_type(
40594061
Check that the :attr:`Data_specification_IEC_61360.data_type` is defined
40604062
appropriately for all data specifications whose content is given as IEC 61360.
40614063
"""
4062-
# NOTE (mristin, 2022-04-7):
4064+
# NOTE (mristin):
40634065
# This implementation will not be transpiled, but is given here as reference.
40644066
return all(
40654067
not (
@@ -4088,7 +4090,7 @@ def data_specification_IEC_61360s_for_document_have_appropriate_data_type(
40884090
Check that the :attr:`Data_specification_IEC_61360.data_type` is defined
40894091
appropriately for all data specifications whose content is given as IEC 61360.
40904092
"""
4091-
# NOTE (mristin, 2022-04-7):
4093+
# NOTE (mristin):
40924094
# This implementation will not be transpiled, but is given here as reference.
40934095
return all(
40944096
not (
@@ -4117,7 +4119,7 @@ def data_specification_IEC_61360s_have_data_type(
41174119
Check that the :attr:`Data_specification_IEC_61360.data_type` is defined for all
41184120
data specifications whose content is given as IEC 61360.
41194121
"""
4120-
# NOTE (mristin, 2022-04-7):
4122+
# NOTE (mristin):
41214123
# This implementation will not be transpiled, but is given here as reference.
41224124
return all(
41234125
not (
@@ -4140,7 +4142,7 @@ def data_specification_IEC_61360s_have_value(
41404142
Check that the :attr:`Data_specification_IEC_61360.value` is defined
41414143
for all data specifications whose content is given as IEC 61360.
41424144
"""
4143-
# NOTE (mristin, 2022-04-7):
4145+
# NOTE (mristin):
41444146
# This implementation will not be transpiled, but is given here as reference.
41454147
return all(
41464148
not (
@@ -4163,7 +4165,7 @@ def data_specification_IEC_61360s_have_definition_at_least_in_english(
41634165
Check that the :attr:`Data_specification_IEC_61360.definition` is defined
41644166
for all data specifications whose content is given as IEC 61360 at least in English.
41654167
"""
4166-
# NOTE (mristin, 2022-04-7):
4168+
# NOTE (mristin):
41674169
# This implementation will not be transpiled, but is given here as reference.
41684170

41694171
for data_specification in embedded_data_specifications:
@@ -4420,7 +4422,7 @@ class Reference_types(Enum):
44204422
"with type Submodel element list is an integer number denoting the position in "
44214423
"the array of the submodel element list."
44224424
)
4423-
# NOTE (mristin, 2022-07-10):
4425+
# NOTE (mristin):
44244426
# We can write AASd-127 in this simpler form assuming that AASd-126 ensures that
44254427
# only the last key can be a fragment reference.
44264428
@invariant(
@@ -5676,4 +5678,4 @@ def __init__(
56765678
self.value = value
56775679
self.level_type = level_type
56785680

5679-
# Downloaded from: https://raw.githubusercontent.com/aas-core-works/aas-core-meta/5a498be3a3b56f34af9a90b368cae10ca04e7ae4/aas_core_meta/v3_1.py
5681+
# Downloaded from: https://raw.githubusercontent.com/aas-core-works/aas-core-meta/02040d200af0cb3bad1fa9c9555d7fb640bb8667/aas_core_meta/v3_1.py

0 commit comments

Comments
 (0)