Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.idea/

# Dev. scripts
.venv*/
*.egg-info

/src/.vs
*~

Expand Down
48 changes: 0 additions & 48 deletions dev_scripts/codegen/codegen.py

This file was deleted.

66 changes: 34 additions & 32 deletions dev_scripts/codegen/meta_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Downloaded from: https://raw.githubusercontent.com/aas-core-works/aas-core-meta/5a498be3a3b56f34af9a90b368cae10ca04e7ae4/aas_core_meta/v3_1.py
# Downloaded from: https://raw.githubusercontent.com/aas-core-works/aas-core-meta/02040d200af0cb3bad1fa9c9555d7fb640bb8667/aas_core_meta/v3_1.py
"""
--- WORK IN PROGRESS ---
Provide an implementation of the Asset Administration Shell (AAS) V3.1.
Expand Down Expand Up @@ -326,7 +326,7 @@ def lang_strings_have_unique_languages(
Check that the :paramref:`lang_strings` do not have overlapping
:attr:`Abstract_lang_string.language`'s
"""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
language_set = set()
for lang_string in lang_strings:
Expand All @@ -346,7 +346,7 @@ def qualifier_types_are_unique(qualifiers: List["Qualifier"]) -> bool:
:param qualifiers: to be checked
:return: True if all :attr:`Qualifier.type`'s are unique
"""
# NOTE (mristin, 2022-04-1):
# NOTE (mristin):
# This implementation is given here only as reference. It needs to be adapted
# for each implementation separately.
observed_types = set()
Expand Down Expand Up @@ -597,7 +597,7 @@ def matches_xs_double(text: str) -> bool:
:param text: Text to be checked
:returns: True if the :paramref:`text` conforms to the pattern
"""
# NOTE (mristin, 2022-04-6):
# NOTE (mristin):
# See: https://www.w3.org/TR/xmlschema-2/#nt-doubleRep
double_rep = r"((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|-?INF|NaN)"

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

# fmt: off
Expand Down Expand Up @@ -671,7 +671,7 @@ def matches_xs_g_day(text: str) -> bool:
:param text: Text to be checked
:returns: True if the :paramref:`text` conforms to the pattern
"""
# NOTE (mristin, 2022-04-6):
# NOTE (mristin):
# See https://www.w3.org/TR/xmlschema-2/#nt-gDayRep
g_day_lexical_rep = (
r"---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"
Expand All @@ -691,7 +691,7 @@ def matches_xs_g_month(text: str) -> bool:
:param text: Text to be checked
:returns: True if the :paramref:`text` conforms to the pattern
"""
# NOTE (mristin, 2022-04-6):
# NOTE (mristin):
# See https://www.w3.org/TR/xmlschema-2/#nt-gMonthRep
g_month_lexical_rep = (
r"--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"
Expand All @@ -711,7 +711,7 @@ def matches_xs_g_month_day(text: str) -> bool:
:param text: Text to be checked
:returns: True if the :paramref:`text` conforms to the pattern
"""
# NOTE (mristin, 2022-04-6):
# NOTE (mristin):
# See https://www.w3.org/TR/xmlschema-2/#nt-gMonthDayRep
g_month_day_rep = (
r"--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])"
Expand All @@ -732,7 +732,7 @@ def matches_xs_g_year(text: str) -> bool:
:param text: Text to be checked
:returns: True if the :paramref:`text` conforms to the pattern
"""
# NOTE (mristin, 2022-04-6):
# NOTE (mristin):
# See https://www.w3.org/TR/xmlschema-2/#nt-gYearRep
g_year_rep = (
r"-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"
Expand All @@ -752,7 +752,7 @@ def matches_xs_g_year_month(text: str) -> bool:
:param text: Text to be checked
:returns: True if the :paramref:`text` conforms to the pattern
"""
# NOTE (mristin, 2022-04-6):
# NOTE (mristin):
# See https://www.w3.org/TR/xmlschema-2/#nt-gYearMonthRep

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

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

raise NotImplementedError()


@verification
def is_model_reference_to(reference: "Reference", expected_type: "Key_types") -> bool:
Expand Down Expand Up @@ -1082,7 +1084,7 @@ def ID_shorts_are_unique(referables: List["Referable"]) -> bool:
Check that the :attr:`Referable.ID_short`'s among the :paramref:`referables` are
unique in their namespace.
"""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
id_short_set = set()
for referable in referables:
Expand All @@ -1107,7 +1109,7 @@ def ID_shorts_of_variables_are_unique(
:paramref:`input_variables`, :paramref:`output_variables`
and :paramref:`inoutput_variables` are unique.
"""
# NOTE (s-heppner, 2023-01-25):
# NOTE (s-heppner):
# This implementation will not be transpiled, but is given here as reference.
id_short_set = set()
if input_variables is not None:
Expand Down Expand Up @@ -1138,7 +1140,7 @@ def ID_shorts_of_variables_are_unique(
@implementation_specific
def extension_names_are_unique(extensions: List["Extension"]) -> bool:
"""Check that the extension names are unique."""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
name_set = set()
for extension in extensions:
Expand All @@ -1155,7 +1157,7 @@ def submodel_elements_have_identical_semantic_IDs(
elements: List["Submodel_element"],
) -> bool:
"""Check that all semantic IDs are identical, if specified."""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as a reference.
semantic_ID = None
for element in elements:
Expand Down Expand Up @@ -1187,7 +1189,7 @@ def properties_or_ranges_have_value_type(
elements: List["Submodel_element"], value_type: "Data_type_def_XSD"
) -> bool:
"""Check that all the :paramref:`elements` have the :paramref:`value_type`."""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
for element in elements:
if isinstance(element, (Property, Range)):
Expand All @@ -1201,7 +1203,7 @@ def properties_or_ranges_have_value_type(
@implementation_specific
def reference_key_values_equal(that: "Reference", other: "Reference") -> bool:
"""Check that the two references are equal by comparing their key values."""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
if len(that.keys) != len(other.keys):
return False
Expand Down Expand Up @@ -1535,7 +1537,7 @@ class Extension(Has_semantics):
@implementation_specific
@non_mutating
def value_type_or_default(self) -> "Data_type_def_XSD":
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
return (
self.value_type if self.value_type is not None else Data_type_def_XSD.String
Expand Down Expand Up @@ -1785,7 +1787,7 @@ class Has_kind(DBC):
@implementation_specific
@non_mutating
def kind_or_default(self) -> "Modelling_kind":
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
return self.kind if self.kind is not None else Modelling_kind.Instance

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

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

Expand Down Expand Up @@ -4009,7 +4011,7 @@ def __init__(
)


# NOTE (mristin, 2022-08-19):
# NOTE (mristin):
# We make the following verification functions implementation-specific since the casts
# are very clumsy to formalize and transpile in a readable way across languages.
# For example, since Python does not have a null-coalescing operator, formalizing
Expand All @@ -4030,7 +4032,7 @@ def data_specification_IEC_61360s_for_property_or_value_have_appropriate_data_ty
Check that the :attr:`Data_specification_IEC_61360.data_type` is defined
appropriately for all data specifications whose content is given as IEC 61360.
"""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
return all(
not (
Expand Down Expand Up @@ -4059,7 +4061,7 @@ def data_specification_IEC_61360s_for_reference_have_appropriate_data_type(
Check that the :attr:`Data_specification_IEC_61360.data_type` is defined
appropriately for all data specifications whose content is given as IEC 61360.
"""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
return all(
not (
Expand Down Expand Up @@ -4088,7 +4090,7 @@ def data_specification_IEC_61360s_for_document_have_appropriate_data_type(
Check that the :attr:`Data_specification_IEC_61360.data_type` is defined
appropriately for all data specifications whose content is given as IEC 61360.
"""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
return all(
not (
Expand Down Expand Up @@ -4117,7 +4119,7 @@ def data_specification_IEC_61360s_have_data_type(
Check that the :attr:`Data_specification_IEC_61360.data_type` is defined for all
data specifications whose content is given as IEC 61360.
"""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
return all(
not (
Expand All @@ -4140,7 +4142,7 @@ def data_specification_IEC_61360s_have_value(
Check that the :attr:`Data_specification_IEC_61360.value` is defined
for all data specifications whose content is given as IEC 61360.
"""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.
return all(
not (
Expand All @@ -4163,7 +4165,7 @@ def data_specification_IEC_61360s_have_definition_at_least_in_english(
Check that the :attr:`Data_specification_IEC_61360.definition` is defined
for all data specifications whose content is given as IEC 61360 at least in English.
"""
# NOTE (mristin, 2022-04-7):
# NOTE (mristin):
# This implementation will not be transpiled, but is given here as reference.

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

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