aas_core3.verification
Verify that the instances of the meta-model satisfy the invariants.
Here is an example how to verify an instance of aas_core3.types.Extension:
import aas_core3.types as aas_types
import aas_core3.verification as aas_verification
an_instance = aas_types.Extension(
# ... some constructor arguments ...
)
for error in aas_verification.verify(an_instance):
print(f"{error.cause} at: {error.path}")
- class aas_core3.verification.PropertySegment(instance: Class, name: str)[source]
Represent a property access on a path to an erroneous value.
- name: Final[str]
Name of the property
- class aas_core3.verification.IndexSegment(sequence: Sequence[Class], index: int)[source]
Represent an index access on a path to an erroneous value.
- index: Final[int]
Index of the item
- class aas_core3.verification.Path[source]
Represent the relative path to the erroneous value.
- property segments: Sequence[Union[PropertySegment, IndexSegment]]
Get the segments of the path.
- class aas_core3.verification.Error(cause: str)[source]
Represent a verification error in the data.
- cause: Final[str]
Human-readable description of the error
- aas_core3.verification.matches_id_short(text: str) bool[source]
Check that
textis a valid short ID.
- aas_core3.verification.matches_version_type(text: str) bool[source]
Check that
textis a valid version string.
- aas_core3.verification.matches_revision_type(text: str) bool[source]
Check that
textis a valid revision string.
- aas_core3.verification.matches_xs_date_time_utc(text: str) bool[source]
Check that
textconforms to the pattern of anxs:dateTime.The time zone must be fixed to UTC. We verify only that the
textmatches a pre-defined pattern. We do not verify that the day of month is correct nor do we check for leap seconds.See: https://www.w3.org/TR/xmlschema-2/#dateTime
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.is_xs_date_time_utc(value: str) bool[source]
Check that
valueis axs:dateTimewith the time zone set to UTC.
- aas_core3.verification.matches_mime_type(text: str) bool[source]
Check that
textconforms to the pattern of MIME type.The definition has been taken from: https://www.rfc-editor.org/rfc/rfc7231#section-3.1.1.1, https://www.rfc-editor.org/rfc/rfc7230#section-3.2.3 and https://www.rfc-editor.org/rfc/rfc7230#section-3.2.6.
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_rfc_2396(text: str) bool[source]
Check that
textmatches to the URI pattern defined in RFC 2396The definition has been taken from: https://datatracker.ietf.org/doc/html/rfc2396
Note that RFX 2396 alone is not enough for specifying
xs:anyURIfor XSD version 1.0, as that specifies URI together with the amendment of RFC 2732.- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_bcp_47(text: str) bool[source]
Check that
textis a valid BCP 47 language tag.
- aas_core3.verification.lang_strings_have_unique_languages(lang_strings: Iterable[AbstractLangString]) bool[source]
Check that
lang_stringsare specified each for a unique language.
- aas_core3.verification.qualifier_types_are_unique(qualifiers: Iterable[Qualifier]) bool[source]
Check that there are no duplicate
types.Qualifier.type’s in thequalifiers.
- aas_core3.verification.matches_xml_serializable_string(text: str) bool[source]
Check that
textconforms to the pattern of the Constraint AASd-130.Ensures that encoding is possible and interoperability between different serializations is possible.
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_any_uri(text: str) bool[source]
Check that
textconforms to the pattern of anxs:anyURI.See: https://www.w3.org/TR/xmlschema-2/#anyURI and https://datatracker.ietf.org/doc/html/rfc3987
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_base_64_binary(text: str) bool[source]
Check that
textconforms to the pattern of anxs:base64Binary.See: https://www.w3.org/TR/xmlschema-2/#base64Binary
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_boolean(text: str) bool[source]
Check that
textconforms to the pattern of anxs:boolean.See: https://www.w3.org/TR/xmlschema-2/#boolean
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_date(text: str) bool[source]
Check that
textconforms to the pattern of anxs:date.See: https://www.w3.org/TR/xmlschema-2/#date
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_date_time(text: str) bool[source]
Check that
textconforms to the pattern of anxs:dateTime.See: https://www.w3.org/TR/xmlschema-2/#dateTime
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.is_xs_date_time(value: str) bool[source]
Check that
valueis axs:dateTimewith the time zone set to UTC.
- aas_core3.verification.matches_xs_decimal(text: str) bool[source]
Check that
textconforms to the pattern of anxs:decimal.See: https://www.w3.org/TR/xmlschema-2/#decimal
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_double(text: str) bool[source]
Check that
textconforms to the pattern of anxs:double.See: https://www.w3.org/TR/xmlschema-2/#double
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_duration(text: str) bool[source]
Check that
textconforms to the pattern of anxs:duration.See: https://www.w3.org/TR/xmlschema-2/#duration
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_float(text: str) bool[source]
Check that
textconforms to the pattern of anxs:float.See: https://www.w3.org/TR/xmlschema-2/#float
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_g_day(text: str) bool[source]
Check that
textconforms to the pattern of anxs:gDay.See: https://www.w3.org/TR/xmlschema-2/#gDay
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_g_month(text: str) bool[source]
Check that
textconforms to the pattern of anxs:gMonth.See: https://www.w3.org/TR/xmlschema-2/#gMonth
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_g_month_day(text: str) bool[source]
Check that
textconforms to the pattern of anxs:gMonthDay.See: https://www.w3.org/TR/xmlschema-2/#gMonthDay
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_g_year(text: str) bool[source]
Check that
textconforms to the pattern of anxs:gYear.See: https://www.w3.org/TR/xmlschema-2/#gYear
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_g_year_month(text: str) bool[source]
Check that
textconforms to the pattern of anxs:gYearMonth.See: https://www.w3.org/TR/xmlschema-2/#gYearMonth
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_hex_binary(text: str) bool[source]
Check that
textconforms to the pattern of anxs:hexBinary.See: https://www.w3.org/TR/xmlschema-2/#hexBinary
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_time(text: str) bool[source]
Check that
textconforms to the pattern of anxs:time.See: https://www.w3.org/TR/xmlschema-2/#time
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_integer(text: str) bool[source]
Check that
textconforms to the pattern of anxs:integer.See: https://www.w3.org/TR/xmlschema-2/#integer
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_long(text: str) bool[source]
Check that
textconforms to the pattern of anxs:long.See: https://www.w3.org/TR/xmlschema-2/#long
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_int(text: str) bool[source]
Check that
textconforms to the pattern of anxs:int.See: https://www.w3.org/TR/xmlschema-2/#int
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_short(text: str) bool[source]
Check that
textconforms to the pattern of anxs:short.See: https://www.w3.org/TR/xmlschema-2/#short
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_byte(text: str) bool[source]
Check that
textconforms to the pattern of anxs:byte.See: https://www.w3.org/TR/xmlschema-2/#byte
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_non_negative_integer(text: str) bool[source]
Check that
textconforms to the pattern of anxs:nonNegativeInteger.See: https://www.w3.org/TR/xmlschema-2/#nonNegativeInteger
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_positive_integer(text: str) bool[source]
Check that
textconforms to the pattern of anxs:positiveInteger.See: https://www.w3.org/TR/xmlschema-2/#positiveInteger
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_unsigned_long(text: str) bool[source]
Check that
textconforms to the pattern of anxs:unsignedLong.See: https://www.w3.org/TR/xmlschema-2/#unsignedLong
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_unsigned_int(text: str) bool[source]
Check that
textconforms to the pattern of anxs:unsignedInt.See: https://www.w3.org/TR/xmlschema-2/#unsignedInt
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_unsigned_short(text: str) bool[source]
Check that
textconforms to the pattern of anxs:unsignedShort.See: https://www.w3.org/TR/xmlschema-2/#unsignedShort
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_unsigned_byte(text: str) bool[source]
Check that
textconforms to the pattern of anxs:unsignedByte.See: https://www.w3.org/TR/xmlschema-2/#unsignedByte
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_non_positive_integer(text: str) bool[source]
Check that
textconforms to the pattern of anxs:nonPositiveInteger.See: https://www.w3.org/TR/xmlschema-2/#nonPositiveInteger
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_negative_integer(text: str) bool[source]
Check that
textconforms to the pattern of anxs:negativeInteger.See: https://www.w3.org/TR/xmlschema-2/#negativeInteger
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.matches_xs_string(text: str) bool[source]
Check that
textconforms to the pattern of anxs:string.See: https://www.w3.org/TR/xmlschema-2/#string
- Parameters
text¶ – Text to be checked
- Returns
True if the
textconforms to the pattern
- aas_core3.verification.is_xs_double(value: str) bool[source]
Check that
valueis a validxs:double.
- aas_core3.verification.is_xs_g_month_day(value: str) bool[source]
Check that
valueis a validxs:gMonthDay.
- aas_core3.verification.is_xs_unsigned_long(value: str) bool[source]
Check that
valueis a validxs:unsignedLong.
- aas_core3.verification.is_xs_unsigned_int(value: str) bool[source]
Check that
valueis a validxs:unsignedInt.
- aas_core3.verification.is_xs_unsigned_short(value: str) bool[source]
Check that
valueis a validxs:unsignedShort.
- aas_core3.verification.is_xs_unsigned_byte(value: str) bool[source]
Check that
valueis a validxs:unsignedByte.
- aas_core3.verification.value_consistent_with_xsd_type(value: str, value_type: DataTypeDefXSD) bool[source]
Check that
valueis consistent with the givenvalue_type.
- aas_core3.verification.is_model_reference_to(reference: Reference, expected_type: KeyTypes) bool[source]
Check that the target of the model reference matches the
expected_type.
- aas_core3.verification.is_model_reference_to_referable(reference: Reference) bool[source]
Check that the target of the reference matches a
constants.AAS_REFERABLES.
- aas_core3.verification.id_shorts_are_unique(referables: Iterable[Referable]) bool[source]
Check that all
types.Referable.id_shortare unique amongreferables.
- aas_core3.verification.id_shorts_of_variables_are_unique(input_variables: Optional[List[OperationVariable]], output_variables: Optional[List[OperationVariable]], inoutput_variables: Optional[List[OperationVariable]]) bool[source]
Check that the
types.Referable.id_short’s among all theinput_variables,output_variablesandinoutput_variablesare unique.
- aas_core3.verification.extension_names_are_unique(extensions: Iterable[Extension]) bool[source]
Check that all
types.Extension.nameare unique amongextensions.
- aas_core3.verification.submodel_elements_have_identical_semantic_ids(elements: Iterable[SubmodelElement]) bool[source]
Check that all
elementshave the identicaltypes.HasSemantics.semantic_id.
- aas_core3.verification.submodel_element_is_of_type(element: SubmodelElement, expected_type: AASSubmodelElements) bool[source]
Check that
elementis an instance of class corresponding toexpected_type.
- aas_core3.verification.properties_or_ranges_have_value_type(elements: Iterable[SubmodelElement], value_type: DataTypeDefXSD) bool[source]
Check that
elementswhich aretypes.Propertyortypes.Rangehave the givenvalue_type.
- aas_core3.verification.reference_key_values_equal(that: Reference, other: Reference) bool[source]
Check that the two references,
thatandother, are equal by comparing theirtypes.Reference.keysbytypes.Key.value’s.
- aas_core3.verification.data_specification_iec_61360s_for_property_or_value_have_appropriate_data_type(embedded_data_specifications: Iterable[EmbeddedDataSpecification]) bool[source]
Check that
types.DataSpecificationIEC61360.data_typeis defined appropriately for all data specifications whose content is given as IEC 61360.
- aas_core3.verification.data_specification_iec_61360s_for_reference_have_appropriate_data_type(embedded_data_specifications: Iterable[EmbeddedDataSpecification]) bool[source]
Check that
types.DataSpecificationIEC61360.data_typeis defined appropriately for all data specifications whose content is given as IEC 61360.
- aas_core3.verification.data_specification_iec_61360s_for_document_have_appropriate_data_type(embedded_data_specifications: Iterable[EmbeddedDataSpecification]) bool[source]
Check that
types.DataSpecificationIEC61360.data_typeis defined appropriately for all data specifications whose content is given as IEC 61360.
- aas_core3.verification.data_specification_iec_61360s_have_data_type(embedded_data_specifications: Iterable[EmbeddedDataSpecification]) bool[source]
Check that
types.DataSpecificationIEC61360.data_typeis defined for all data specifications whose content is given as IEC 61360.
- aas_core3.verification.data_specification_iec_61360s_have_value(embedded_data_specifications: Iterable[EmbeddedDataSpecification]) bool[source]
Check that
types.DataSpecificationIEC61360.valueis defined for all data specifications whose content is given as IEC 61360.
- aas_core3.verification.data_specification_iec_61360s_have_definition_at_least_in_english(embedded_data_specifications: Iterable[EmbeddedDataSpecification]) bool[source]
Check that
types.DataSpecificationIEC61360.definitionis defined for all data specifications whose content is given as IEC 61360 at least in English.
- aas_core3.verification.is_bcp_47_for_english(text: str) bool[source]
Check that the
textcorresponds to a BCP47 code for english.
- aas_core3.verification.verify(that: Class) Iterator[Error][source]
Verify the constraints of
thatrecursively.- Parameters
that¶ – instance whose constraints we want to verify
- Yield
constraint violations
- aas_core3.verification.verify_xml_serializable_string(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_non_empty_xml_serializable_string(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_date_time_utc(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_duration(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_blob_type(that: bytes) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_identifier(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_value_type_iec_61360(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_name_type(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_version_type(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_revision_type(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_label_type(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_message_topic_type(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_bcp_47_language_tag(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_content_type(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_path_type(that: str) Iterator[Error][source]
Verify the constraints of
that.
- aas_core3.verification.verify_qualifier_type(that: str) Iterator[Error][source]
Verify the constraints of
that.