aas_core_rc02.verification

Verify that the instances of the meta-model satisfy the invariants.

Here is an example how to verify an instance of aas_core3_rc02.types.Extension:

import aas_core3_rc02.types as aas_types
import aas_core3_rc02.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_rc02.verification.PropertySegment(instance: Class, name: str)[source]

Represent a property access on a path to an erroneous value.

__init__(instance: Class, name: str) None[source]

Initialize with the given values.

instance: Final[Class]

Instance containing the property

name: Final[str]

Name of the property

__str__() str[source]

Return str(self).

class aas_core3_rc02.verification.IndexSegment(sequence: Sequence[Class], index: int)[source]

Represent an index access on a path to an erroneous value.

__init__(sequence: Sequence[Class], index: int) None[source]

Initialize with the given values.

sequence: Final[Sequence[Class]]

Sequence containing the item at index

index: Final[int]

Index of the item

__str__() str[source]

Return str(self).

class aas_core3_rc02.verification.Path[source]

Represent the relative path to the erroneous value.

__init__() None[source]

Initialize as an empty path.

property segments: Sequence[Union[PropertySegment, IndexSegment]]

Get the segments of the path.

__str__() str[source]

Return str(self).

class aas_core3_rc02.verification.Error(cause: str)[source]

Represent a verification error in the data.

__init__(cause: str) None[source]

Initialize as an error with an empty path.

cause: Final[str]

Human-readable description of the error

path: Final[Path]

Path to the erroneous value

aas_core3_rc02.verification.matches_id_short(text: str) bool[source]

Check that text is a valid short ID.

aas_core3_rc02.verification.matches_xs_date_time_stamp_utc(text: str) bool[source]

Check that text conforms to the pattern of an xs:dateTimeStamp.

The time zone must be fixed to UTC. We verify only that the text matches 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/xmlschema11-2/#dateTimeStamp

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.is_xs_date_time_stamp_utc(value: str) bool[source]

Check that value is a xs:dateTimeStamp with the time zone set to UTC.

aas_core3_rc02.verification.matches_mime_type(text: str) bool[source]

Check that text conforms 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 text conforms to the pattern

aas_core3_rc02.verification.matches_rfc_8089_path(text: str) bool[source]

Check that text is a path conforming to the pattern of RFC 8089.

The definition has been taken from: https://datatracker.ietf.org/doc/html/rfc8089

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_bcp_47(text: str) bool[source]

Check that text is a valid BCP 47 language tag.

See: https://en.wikipedia.org/wiki/IETF_language_tag

aas_core3_rc02.verification.lang_strings_have_unique_languages(lang_strings: Iterable[LangString]) bool[source]

Check that lang_strings are specified each for a unique language.

aas_core3_rc02.verification.qualifier_types_are_unique(qualifiers: Iterable[Qualifier]) bool[source]

Check that there are no duplicate types.Qualifier.type’s in the qualifiers.

aas_core3_rc02.verification.matches_xs_any_uri(text: str) bool[source]

Check that text conforms to the pattern of an xs:anyURI.

See: https://www.w3.org/TR/xmlschema11-2/#anyURI and https://datatracker.ietf.org/doc/html/rfc3987

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_base_64_binary(text: str) bool[source]

Check that text conforms to the pattern of an xs:base64Binary.

See: https://www.w3.org/TR/xmlschema11-2/#base64Binary

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_boolean(text: str) bool[source]

Check that text conforms to the pattern of an xs:boolean.

See: https://www.w3.org/TR/xmlschema11-2/#boolean

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_date(text: str) bool[source]

Check that text conforms to the pattern of an xs:date.

See: https://www.w3.org/TR/xmlschema11-2/#date

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_date_time(text: str) bool[source]

Check that text conforms to the pattern of an xs:dateTime.

See: https://www.w3.org/TR/xmlschema11-2/#dateTime

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_date_time_stamp(text: str) bool[source]

Check that text conforms to the pattern of an xs:dateTimeStamp.

See: https://www.w3.org/TR/xmlschema11-2/#dateTimeStamp

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_decimal(text: str) bool[source]

Check that text conforms to the pattern of an xs:decimal.

See: https://www.w3.org/TR/xmlschema11-2/#decimal

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_double(text: str) bool[source]

Check that text conforms to the pattern of an xs:double.

See: https://www.w3.org/TR/xmlschema11-2/#double

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_duration(text: str) bool[source]

Check that text conforms to the pattern of an xs:duration.

See: https://www.w3.org/TR/xmlschema11-2/#duration

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_float(text: str) bool[source]

Check that text conforms to the pattern of an xs:float.

See: https://www.w3.org/TR/xmlschema11-2/#float

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_g_day(text: str) bool[source]

Check that text conforms to the pattern of an xs:gDay.

See: https://www.w3.org/TR/xmlschema11-2/#gDay

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_g_month(text: str) bool[source]

Check that text conforms to the pattern of an xs:gMonth.

See: https://www.w3.org/TR/xmlschema11-2/#gMonth

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_g_month_day(text: str) bool[source]

Check that text conforms to the pattern of an xs:gMonthDay.

See: https://www.w3.org/TR/xmlschema11-2/#gMonthDay

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_g_year(text: str) bool[source]

Check that text conforms to the pattern of an xs:gYear.

See: https://www.w3.org/TR/xmlschema11-2/#gYear

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_g_year_month(text: str) bool[source]

Check that text conforms to the pattern of an xs:gYearMonth.

See: https://www.w3.org/TR/xmlschema11-2/#gYearMonth

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_hex_binary(text: str) bool[source]

Check that text conforms to the pattern of an xs:hexBinary.

See: https://www.w3.org/TR/xmlschema11-2/#hexBinary

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_time(text: str) bool[source]

Check that text conforms to the pattern of an xs:time.

See: https://www.w3.org/TR/xmlschema11-2/#time

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_day_time_duration(text: str) bool[source]

Check that text conforms to the pattern of an xs:dayTimeDuration.

See: https://www.w3.org/TR/xmlschema11-2/#dayTimeDuration

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_year_month_duration(text: str) bool[source]

Check that text conforms to the pattern of an xs:yearMonthDuration.

See: https://www.w3.org/TR/xmlschema11-2/#yearMonthDuration

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_integer(text: str) bool[source]

Check that text conforms to the pattern of an xs:integer.

See: https://www.w3.org/TR/xmlschema11-2/#integer

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_long(text: str) bool[source]

Check that text conforms to the pattern of an xs:long.

See: https://www.w3.org/TR/xmlschema11-2/#long

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_int(text: str) bool[source]

Check that text conforms to the pattern of an xs:int.

See: https://www.w3.org/TR/xmlschema11-2/#int

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_short(text: str) bool[source]

Check that text conforms to the pattern of an xs:short.

See: https://www.w3.org/TR/xmlschema11-2/#short

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_byte(text: str) bool[source]

Check that text conforms to the pattern of an xs:byte.

See: https://www.w3.org/TR/xmlschema11-2/#byte

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_non_negative_integer(text: str) bool[source]

Check that text conforms to the pattern of an xs:nonNegativeInteger.

See: https://www.w3.org/TR/xmlschema11-2/#nonNegativeInteger

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_positive_integer(text: str) bool[source]

Check that text conforms to the pattern of an xs:positiveInteger.

See: https://www.w3.org/TR/xmlschema11-2/#positiveInteger

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_unsigned_long(text: str) bool[source]

Check that text conforms to the pattern of an xs:unsignedLong.

See: https://www.w3.org/TR/xmlschema11-2/#unsignedLong

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_unsigned_int(text: str) bool[source]

Check that text conforms to the pattern of an xs:unsignedInt.

See: https://www.w3.org/TR/xmlschema11-2/#unsignedInt

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_unsigned_short(text: str) bool[source]

Check that text conforms to the pattern of an xs:unsignedShort.

See: https://www.w3.org/TR/xmlschema11-2/#unsignedShort

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_unsigned_byte(text: str) bool[source]

Check that text conforms to the pattern of an xs:unsignedByte.

See: https://www.w3.org/TR/xmlschema11-2/#unsignedByte

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_non_positive_integer(text: str) bool[source]

Check that text conforms to the pattern of an xs:nonPositiveInteger.

See: https://www.w3.org/TR/xmlschema11-2/#nonPositiveInteger

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_negative_integer(text: str) bool[source]

Check that text conforms to the pattern of an xs:negativeInteger.

See: https://www.w3.org/TR/xmlschema11-2/#negativeInteger

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.matches_xs_string(text: str) bool[source]

Check that text conforms to the pattern of an xs:string.

See: https://www.w3.org/TR/xmlschema11-2/#string

Parameters

text – Text to be checked

Returns

True if the text conforms to the pattern

aas_core3_rc02.verification.is_xs_date(value: str) bool[source]

Check that value is a valid xs:date.

aas_core3_rc02.verification.is_xs_date_time(value: str) bool[source]

Check that value is a valid xs:dateTime.

aas_core3_rc02.verification.is_xs_date_time_stamp(value: str) bool[source]

Check that value is a valid xs:dateTimeStamp.

aas_core3_rc02.verification.is_xs_double(value: str) bool[source]

Check that value is a valid xs:double.

aas_core3_rc02.verification.is_xs_float(value: str) bool[source]

Check that value is a valid xs:float.

aas_core3_rc02.verification.is_xs_g_month_day(value: str) bool[source]

Check that value is a valid xs:gMonthDay.

aas_core3_rc02.verification.is_xs_long(value: str) bool[source]

Check that value is a valid xs:long.

aas_core3_rc02.verification.is_xs_int(value: str) bool[source]

Check that value is a valid xs:int.

aas_core3_rc02.verification.is_xs_short(value: str) bool[source]

Check that value is a valid xs:short.

aas_core3_rc02.verification.is_xs_byte(value: str) bool[source]

Check that value is a valid xs:byte.

aas_core3_rc02.verification.is_xs_unsigned_long(value: str) bool[source]

Check that value is a valid xs:unsignedLong.

aas_core3_rc02.verification.is_xs_unsigned_int(value: str) bool[source]

Check that value is a valid xs:unsignedInt.

aas_core3_rc02.verification.is_xs_unsigned_short(value: str) bool[source]

Check that value is a valid xs:unsignedShort.

aas_core3_rc02.verification.is_xs_unsigned_byte(value: str) bool[source]

Check that value is a valid xs:unsignedByte.

aas_core3_rc02.verification.value_consistent_with_xsd_type(value: str, value_type: DataTypeDefXsd) bool[source]

Check that value is consistent with the given value_type.

aas_core3_rc02.verification.matches_global_asset_id_literally(text: str) bool[source]

Check that the text matches globalAssetId case-insensitive.

The case-insensitivity depends on the culture. For example in Turkish, uppercase “i” is “İ”, not “I”. We assume the culture to be English, and explicitly check for English case-folding.

Parameters

text – which needs to match globalAssetId literally

Returns

True if the text matches case-insensitive

aas_core3_rc02.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_rc02.verification.is_model_reference_to_referable(reference: Reference) bool[source]

Check that the target of the reference matches a constants.AAS_REFERABLES.

aas_core3_rc02.verification.id_shorts_are_unique(referables: Iterable[Referable]) bool[source]

Check that all types.Referable.id_short are unique among referables.

aas_core3_rc02.verification.extension_names_are_unique(extensions: Iterable[Extension]) bool[source]

Check that all types.Extension.name are unique among extensions.

aas_core3_rc02.verification.submodel_elements_have_identical_semantic_ids(elements: Iterable[SubmodelElement]) bool[source]

Check that all elements have the identical types.HasSemantics.semantic_id.

aas_core3_rc02.verification.submodel_element_is_of_type(element: SubmodelElement, expected_type: AasSubmodelElements) bool[source]

Check that element is an instance of class corresponding to expected_type.

aas_core3_rc02.verification.properties_or_ranges_have_value_type(elements: Iterable[SubmodelElement], value_type: DataTypeDefXsd) bool[source]

Check that elements which are types.Property or types.Range have the given value_type.

aas_core3_rc02.verification.reference_key_values_equal(that: Reference, other: Reference) bool[source]

Check that the two references, that and other, are equal by comparing their types.Reference.keys by types.Key.value’s.

aas_core3_rc02.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_type is defined appropriately for all data specifications whose content is given as IEC 61360.

aas_core3_rc02.verification.data_specification_iec_61360s_for_reference_have_appropriate_data_type(embedded_data_specifications: Iterable[EmbeddedDataSpecification]) bool[source]

Check that types.DataSpecificationIEC61360.data_type is defined appropriately for all data specifications whose content is given as IEC 61360.

aas_core3_rc02.verification.data_specification_iec_61360s_for_document_have_appropriate_data_type(embedded_data_specifications: Iterable[EmbeddedDataSpecification]) bool[source]

Check that types.DataSpecificationIEC61360.data_type is defined appropriately for all data specifications whose content is given as IEC 61360.

aas_core3_rc02.verification.data_specification_iec_61360s_have_data_type(embedded_data_specifications: Iterable[EmbeddedDataSpecification]) bool[source]

Check that types.DataSpecificationIEC61360.data_type is defined for all data specifications whose content is given as IEC 61360.

aas_core3_rc02.verification.data_specification_iec_61360s_have_value(embedded_data_specifications: Iterable[EmbeddedDataSpecification]) bool[source]

Check that types.DataSpecificationIEC61360.value is defined for all data specifications whose content is given as IEC 61360.

aas_core3_rc02.verification.data_specification_iec_61360s_have_definition_at_least_in_english(embedded_data_specifications: Iterable[EmbeddedDataSpecification]) bool[source]

Check that types.DataSpecificationIEC61360.definition is defined for all data specifications whose content is given as IEC 61360 at least in English.

aas_core3_rc02.verification.is_bcp_47_for_english(text: str) bool[source]

Check that the text corresponds to a BCP47 code for english.

aas_core3_rc02.verification.verify(that: Class) Iterator[Error][source]

Verify the constraints of that recursively.

Parameters

that – instance whose constraints we want to verify

Yield

constraint violations

aas_core3_rc02.verification.verify_non_empty_string(that: str) Iterator[Error][source]

Verify the constraints of that.

aas_core3_rc02.verification.verify_date_time_stamp_utc(that: str) Iterator[Error][source]

Verify the constraints of that.

aas_core3_rc02.verification.verify_blob_type(that: bytes) Iterator[Error][source]

Verify the constraints of that.

aas_core3_rc02.verification.verify_identifier(that: str) Iterator[Error][source]

Verify the constraints of that.

aas_core3_rc02.verification.verify_bcp_47_language_tag(that: str) Iterator[Error][source]

Verify the constraints of that.

aas_core3_rc02.verification.verify_content_type(that: str) Iterator[Error][source]

Verify the constraints of that.

aas_core3_rc02.verification.verify_path_type(that: str) Iterator[Error][source]

Verify the constraints of that.

aas_core3_rc02.verification.verify_qualifier_type(that: str) Iterator[Error][source]

Verify the constraints of that.

aas_core3_rc02.verification.verify_value_data_type(that: str) Iterator[Error][source]

Verify the constraints of that.

aas_core3_rc02.verification.verify_id_short(that: str) Iterator[Error][source]

Verify the constraints of that.