2.2. base - Abstract Classes and Basic Structures
This module implements the basic structures of the AAS meta-model, including the abstract classes and enums needed for the higher level classes to inherit from.
- class ConstrainedList(items: Iterable[_T], item_add_hook: Callable[[_T, List[_T]], None] | None = None, item_set_hook: Callable[[List[_T], List[_T], List[_T]], None] | None = None, item_del_hook: Callable[[_T, List[_T]], None] | None = None)
A type of list that can be constrained by hooks, useful when implementing AASd constraints. This list can be initialized with an
item_add_hook,item_set_hookand anitem_del_hook.The item_add_hook is called every time an item is added to the list. It is passed the item that is added and all items currently contained in the list.
The
item_set_hookis called every time one or multiple items are overwritten with one or multiple new items, à lalist[i] = new_itemorlist[i:j] = new_items. It is passed the item(s) about to replaced, the new item(s) and all items currently contained in the list. Note that this can also be used to clear the list, e.g.list[:] = []. Thus, to ensure that a list is never empty,item_set_hookmust be used in addition toitem_del_hook.Finally,
item_del_hookis called whenever an item is removed from the list, (e.g. via.remove(),.pop()ordel list[i]. It is passed the item about to be deleted and the current list elements.
- class LangStringSet(dict_: Dict[str, str])
A mapping of language code to string. Must be non-empty.
langString is an RDF data type. A langString is a value tagged with a language code. RDF requires IETF BCP 4723 language tags, i.e. simple two-letter language tags for Locales like “de” conformant to ISO 639-1 are allowed as well as language tags plus extension like “de-DE” for country code, dialect etc. like in “en-US” or “en-GB” for English (United Kingdom) and English (United States). IETF language tags are referencing ISO 639, ISO 3166 and ISO 15924.
- exception AASConstraintViolation(constraint_id: int, message: str)
An Exception to be raised if an AASd-Constraint defined in the metamodel (Details of the Asset Administration Shell) is violated
- Variables:
constraint_id – The ID of the constraint that is violated
message – The error message of the Exception
- class AdministrativeInformation(version: str | None = None, revision: str | None = None, creator: Reference | None = None, template_id: str | None = None, embedded_data_specifications: Iterable[EmbeddedDataSpecification] = ())
Administrative meta-information for an element like version information.
Constraint AASd-005: If AdministrativeInformation/version is not specified then also AdministrativeInformation/revision shall be unspecified. This means, a revision requires a version. if there is no version there is no revision neither. Revision is optional.
- Variables:
version – Version of the element.
revision – Revision of the element.
creator – The subject ID of the subject responsible for making the element
template_id – Identifier of the template that guided the creation of the element
embedded_data_specifications – List of Embedded data specification. used by the element.
Note
In case of a submodel, the template ID is the identifier of the submodel template that guided the creation of the submodel.
Note
The submodel template ID is not relevant for validation. Here, the Submodel/semanticId shall be used
Note
Usage of the template ID is not restricted to submodel instances. The creation of submodel templates can also be guided by another submodel template.
- property revision
- class AssetKind(value)
Enumeration for denoting whether an asset is a type asset or an instance asset or whether this kind of classification is not applicable.
Note
INSTANCEbecomes an individual entity of a type, for example a device, by defining specific property values.Note
In an object oriented view, an instance denotes an object of a class (of a type)
- Variables:
TYPE – Type asset
INSTANCE – Instance asset
NOT_APPLICABLE – Neither a type asset nor an instance asset
- INSTANCE = 1
- NOT_APPLICABLE = 2
- TYPE = 0
- class ConstrainedLangStringSet(dict_: Dict[str, str], constraint_check_fn: Callable[[str, str], None])
A
LangStringSetwith constrained values.
- class DataSpecificationContent
Data specification content is part of a data specification template and defines which additional attributes shall be added to the element instance that references the data specification template and meta information about the template itself.
Constraint AASc-3a-050: If the
Data_specification_IEC_61360is used for an element, the value ofHasDataSpecification.embedded_data_specificationsshall contain the external reference to the IRI of the corresponding data specification templatehttps://admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360/3/0
- class DataSpecificationIEC61360(preferred_name: PreferredNameTypeIEC61360, data_type: DataTypeIEC61360 | None = None, definition: DefinitionTypeIEC61360 | None = None, short_name: ShortNameTypeIEC61360 | None = None, unit: str | None = None, unit_id: Reference | None = None, source_of_definition: str | None = None, symbol: str | None = None, value_format: str | None = None, value_list: Set[ValueReferencePair] | None = None, value: str | None = None, level_types: Iterable[IEC61360LevelType] = ())
A specialized
DataSpecificationContentto define specs according to IEC61360- Variables:
preferred_name – Preferred name of the data object
short_name – Short name of the data object
data_type – Data type of the data object
definition – Definition of the data object
parent – Reference to the next referable parent element of the element. (inherited from
Referable)unit – Optional unit of the data object
unit_id – Optional reference to a unit id
source_of_definition – Optional source of the definition
symbol – Optional unit symbol
value_format – Optional format of the values
value_list – Optional list of values
value – Optional value data type object
level_types – Optional set of level types of the DataSpecificationContent
- property source_of_definition
- property symbol
- property unit
- class DataTypeIEC61360(value)
Data types for data_type in
DataSpecificationIEC61360The data types are:- Variables:
DATE
STRING
STRING_TRANSLATABLE
INTEGER_MEASURE
INTEGER_COUNT
INTEGER_CURRENCY
REAL_MEASURE
REAL_COUNT
REAL_CURRENCY
BOOLEAN
IRI
IRDI
RATIONAL
RATIONAL_MEASURE
TIME
TIMESTAMP
HTML
BLOB
FILE
- BLOB = 17
- BOOLEAN = 9
- DATE = 0
- FILE = 18
- HTML = 16
- INTEGER_COUNT = 4
- INTEGER_CURRENCY = 5
- INTEGER_MEASURE = 3
- IRDI = 11
- IRI = 10
- RATIONAL = 12
- RATIONAL_MEASURE = 13
- REAL_COUNT = 7
- REAL_CURRENCY = 8
- REAL_MEASURE = 6
- STRING = 1
- STRING_TRANSLATABLE = 2
- TIME = 14
- TIMESTAMP = 15
- class DefinitionTypeIEC61360(dict_: Dict[str, str])
A
ConstrainedLangStringSetwhere each value must have at least 1 and at most 1023 characters.
- class Direction(value)
Direction of an event. Used in
basyx.aas.model.submodel.BasicEventElement.- INPUT = 0
- OUTPUT = 1
- class EmbeddedDataSpecification(data_specification: Reference, data_specification_content: DataSpecificationContent)
Embed the content of a data specification.
- Variables:
data_specification – Reference to the data specification
data_specification_content – Actual content of the data specification
- class EntityType(value)
Enumeration for denoting whether an entity is a self-managed or a co-managed entity
- Variables:
- CO_MANAGED_ENTITY = 0
- SELF_MANAGED_ENTITY = 1
- class Extension(name: str, value_type: Type[relativedelta | datetime | Date | time | GYearMonth | GYear | GMonthDay | GMonth | GDay | bool | Base64Binary | HexBinary | Float | float | Decimal | int | Long | Int | Short | Byte | NonPositiveInteger | NegativeInteger | NonNegativeInteger | PositiveInteger | UnsignedLong | UnsignedInt | UnsignedShort | UnsignedByte | AnyURI | str | NormalizedString] | None = None, value: relativedelta | datetime | Date | time | GYearMonth | GYear | GMonthDay | GMonth | GDay | bool | Base64Binary | HexBinary | Float | float | Decimal | int | Long | Int | Short | Byte | NonPositiveInteger | NegativeInteger | NonNegativeInteger | PositiveInteger | UnsignedLong | UnsignedInt | UnsignedShort | UnsignedByte | AnyURI | str | NormalizedString | None = None, refers_to: Iterable[ModelReference] = (), semantic_id: Reference | None = None, supplemental_semantic_id: Iterable[Reference] = ())
Single extension of an element
- Variables:
name – An extension of the element.
value_type – Type (
DataTypeDefXsd) of the value of the extension. Default: xsd:stringvalue – Value (
ValueDataType) of the extensionrefers_to – An iterable of
ModelReferenceto elements the extension refers tosemantic_id – The semantic_id defined in the
HasSemanticsclass.supplemental_semantic_id – Identifier of a supplemental semantic definition of the element. It is called supplemental semantic ID of the element. (inherited from
HasSemantics)
- property name
- property value
- class ExternalReference(key: Tuple[Key, ...], referred_semantic_id: Reference | None = None)
Reference to either a model element of the same or another AAs or to an external entity.
A reference is an ordered list of keys, each key referencing an element. The complete list of keys may for example be concatenated to a path that then gives unique access to an element or entity.
Constraint AASd-122: For external references, i.e. References with Reference/type = ExternalReference, the value of Key/type of the first key of Reference/keys shall be one of GenericGloballyIdentifiables.
Constraint AASd-124: For external references, i.e. References with Reference/type = ExternalReference, the last key of Reference/keys shall be either one of GenericGloballyIdentifiables or one of GenericFragmentKeys.
- Variables:
key – Ordered list of unique reference in its name space, each key referencing an element. The complete list of keys may for example be concatenated to a path that then gives unique access to an element or entity.
referred_semantic_id – SemanticId of the referenced model element. For external references there typically is no semantic id.
- class HasDataSpecification(embedded_data_specifications: Iterable[EmbeddedDataSpecification] = ())
Element that can be extended by using data specification templates.
A data specification template defines a named set of additional attributes an element may or shall have. The data specifications used are explicitly specified with their global ID.
Warning
Please consider, that we do not implement the DataSpecification template class.
- Variables:
embedded_data_specifications – List of
EmbeddedDataSpecification.
- class HasExtension
Abstract baseclass for all objects which form a Namespace to hold Extension objects and resolve them by their name.
<<abstract>>
Constraint AASd-077: The name of an Extension within HasExtensions needs to be unique.
- Variables:
namespace_element_sets – List of
NamespaceSetsextension – A
NamespaceSetofExtensionsof the element.
- add_extension(extension: Extension) None
Add a
Extensionto this Namespace- Parameters:
extension – The
Extensionto add- Raises:
KeyError – If a
Extensionwith the same name is already present in this namespaceValueError – If the given
Extensionalready has a parent namespace
- class HasKind
An element with a kind is an element that can either represent a type or an instance. Default for an element is that it is representing an instance.
<<abstract>>
- Variables:
_kind – Kind of the element: either type or instance. Default =
INSTANCE.
- property kind
- class HasSemantics
Element that can have a semantic definition.
<<abstract>>
Constraint AASd-118: If a supplemental semantic ID (HasSemantics/supplementalSemanticId) is defined, there shall also be a main semantic ID (HasSemantics/semanticId).
- Variables:
semantic_id – Identifier of the semantic definition of the element. It is called semantic id of the element. The semantic id may either reference an external global id or it may reference a referable model element of kind=Type that defines the semantics of the element.
supplemental_semantic_id – Identifier of a supplemental semantic definition of the element. It is called supplemental semantic ID of the element.
- property supplemental_semantic_id: ConstrainedList[Reference]
- class IEC61360LevelType(value)
Level types for the level_type in
DataSpecificationIEC61360The level types are:- Variables:
MIN
MAX
NOM
TYP
- MAX = 1
- MIN = 0
- NOM = 2
- TYP = 3
- class Identifiable
An element that has a globally unique
Identifier.<<abstract>>
- Variables:
administration –
AdministrativeInformationof an identifiable element.id – The globally unique id of the element.
- class Key(type_: KeyTypes, value: str)
A key is a reference to an element by its id.
- Variables:
type – Denote which kind of entity is referenced. In case type =
GLOBAL_REFERENCEthen the element is a global unique id. In all other cases the key references a model element of the same or of another AAS. The name of the model element is explicitly listed.value – The key value, for example an IRDI or IRI
- static from_referable(referable: Referable) Key
Construct a key for a given
Referable(orIdentifiable) object- Parameters:
referable –
ReferableorIdentifiableobject- Returns:
- get_identifier() str | None
Get an
Identifierobject corresponding to this key, if it is an identifiable key.- Returns:
None if this is no identifiable key, otherwise a corresponding
Identifierstring.
- class KeyTypes(value)
Enumeration for denoting which kind of entity is referenced. They can be categorized in ReferableElements, IdentifiableElements and other KeyTypes
IdentifiableElements starting from 0
- Variables:
ASSET_ADMINISTRATION_SHELL –
AssetAdministrationShellCONCEPT_DESCRIPTION –
ConceptDescriptionSUBMODEL –
Submodel
ReferableElements starting from 1000
Note
DataElement is abstract, i. e. if a key uses
DATA_ELEMENTthe reference may beProperty,Fileetc.Note
SubmodelElement is abstract, i.e. if a key uses
SUBMODEL_ELEMENTthe reference may be aProperty, aSubmodelElementCollection, anOperationetc.- Variables:
ANNOTATED_RELATIONSHIP_ELEMENT –
AnnotatedRelationshipElementBASIC_EVENT_ELEMENT –
BasicEventElementBLOB –
BlobCAPABILITY –
CapabilityDATA_ELEMENT –
DataElementENTITY –
EntityEVENT_ELEMENT –
EventElement, Note: EventElement is abstractFILE –
FileMULTI_LANGUAGE_PROPERTY –
MultiLanguagePropertyproperty with a value that can be provided in multiple languagesOPERATION –
OperationPROPERTY –
PropertyRANGE –
Rangewith min and maxREFERENCE_ELEMENT –
ReferenceElementRELATIONSHIP_ELEMENT –
RelationshipElementSUBMODEL_ELEMENT –
SubmodelElementSUBMODEL_ELEMENT_COLLECTION –
SubmodelElementCollectionSUBMODEL_ELEMENT_LIST –
SubmodelElementList
KeyTypes starting from 2000
- Variables:
GLOBAL_REFERENCE – reference to an element not belonging to an asset administration shell
FRAGMENT_REFERENCE – unique reference to an element within a file. The file itself is assumed to be part of an asset administration shell.
- ANNOTATED_RELATIONSHIP_ELEMENT = 1001
- ASSET_ADMINISTRATION_SHELL = 1
- BASIC_EVENT_ELEMENT = 1002
- BLOB = 1003
- CAPABILITY = 1004
- CONCEPT_DESCRIPTION = 2
- DATA_ELEMENT = 1006
- ENTITY = 1007
- EVENT_ELEMENT = 1008
- FILE = 1009
- FRAGMENT_REFERENCE = 2001
- GLOBAL_REFERENCE = 2000
- MULTI_LANGUAGE_PROPERTY = 1010
- OPERATION = 1011
- PROPERTY = 1012
- RANGE = 1013
- REFERENCE_ELEMENT = 1014
- RELATIONSHIP_ELEMENT = 1015
- SUBMODEL = 3
- SUBMODEL_ELEMENT = 1016
- SUBMODEL_ELEMENT_COLLECTION = 1017
- SUBMODEL_ELEMENT_LIST = 1019
- class ModelReference(key: Tuple[Key, ...], type_: Type[_RT], referred_semantic_id: Reference | None = None)
Typed Reference to any referable AAS object.
This is a special construct of the implementation to allow typed references and de-referencing.
Constraint AASd-123: For model references, i.e. References with Reference/type = ModelReference, the value of Key/type of the first key of Reference/keys shall be one of AasIdentifiables.
Constraint AASd-125: For model references, i.e. References with Reference/type = ModelReference with more than one key in Reference/keys, the value of Key/type of each of the keys following the first key of Reference/keys shall be one of FragmentKeys.
Constraint AASd-126: For model references, i.e. References with Reference/type = ModelReference with more than one key in Reference/keys, the value of Key/type of the last Key in the reference key chain may be one of GenericFragmentKeys, or no key at all shall have a value out of GenericFragmentKeys.
Constraint AASd-127: For model references, i.e. References with Reference/type = ModelReference with more than one key in Reference/keys, a key with Key/type FragmentReference shall be preceded by a key with Key/type File or Blob. All other AAS fragments, i.e. Key/type values out of AasSubmodelElements, do not support fragments.
Constraint AASd-128: For model references the Key/value of a Key preceded by a Key with Key/type=SubmodelElementList is an integer number denoting the position in the array of the submodel element list.
- Variables:
key – Ordered list of unique
Keysin its name space, each key referencing an element. The complete list of keys may for example be concatenated to a path that then gives unique access to an element or entity.type – The type of the referenced object (additional parameter, not from the AAS Metamodel) Initialization parameter:
type_referred_semantic_id – SemanticId of the referenced model element. For external references there typically is no semantic id.
- static from_referable(referable: Referable) ModelReference
Construct an
ModelReferenceto a givenReferableAAS objectThis requires that the
Referableobject isIdentifiableitself or is a child-, grand-child-, etc. object of anIdentifiableobject. Additionally, the object must be an instance of a knownReferabletype.- Parameters:
referable –
Referableobject to construct theModelReferencefrom- Returns:
Constructed
ModelReference- Raises:
ValueError – If no
Identifiableobject is found while traversing the object’s ancestors
- get_identifier() str
Retrieve the
Identifierof theIdentifiableobject, which is referenced or in which the referencedReferableis contained.- Returns:
- Raises:
ValueError – If this
ModelReferencedoes not include a Key of AasIdentifiable type
- resolve(provider_: provider.AbstractObjectProvider) _RT
Follow the
Referenceand retrieve theReferableobject it points to- Parameters:
provider –
AbstractObjectProvider- Returns:
The referenced object (or a proxy object for it)
- Raises:
IndexError – If the list of keys is empty
TypeError – If one of the intermediate objects on the path is not a
UniqueIdShortNamespaceValueError – If a non-numeric index is given to resolve in a
SubmodelElementListUnexpectedTypeError – If the retrieved object is not of the expected type (or one of its subclasses). The object is stored in the
valueattribute of the exceptionKeyError – If the reference could not be resolved
- class ModellingKind(value)
Enumeration for denoting whether an element is a type or an instance.
Note
An
INSTANCEbecomes an individual entity of a template, for example a device model, by defining specific property values.Note
In an object-oriented view, an instance denotes an object of a template (class).
- Variables:
TEMPLATE – Software element which specifies the common attributes shared by all instances of the template
INSTANCE – concrete, clearly identifiable component of a certain template.
Note
It becomes an individual entity of a template, for example a device model, by defining specific property values.
Note
In an object-oriented view, an instance denotes an object of a template (class).
- INSTANCE = 1
- TEMPLATE = 0
- class MultiLanguageNameType(dict_: Dict[str, str])
A
ConstrainedLangStringSetwhere each value is aShortNameType. See also:basyx.aas.model._string_constraints.check_short_name_type()
- class MultiLanguageTextType(dict_: Dict[str, str])
A
ConstrainedLangStringSetwhere each value must have at least 1 and at most 1023 characters.
- class Namespace
Abstract baseclass for all objects which form a Namespace to hold objects and resolve them by their specific attribute.
<<abstract>>
- Variables:
namespace_element_sets – List of
NamespaceSets
- class NamespaceSet(parent: UniqueIdShortNamespace | UniqueSemanticIdNamespace | Qualifiable | HasExtension, attribute_names: List[Tuple[str, bool]], items: Iterable[_NSO] = (), item_add_hook: Callable[[_NSO, Iterable[_NSO]], None] | None = None, item_id_set_hook: Callable[[_NSO], None] | None = None, item_id_del_hook: Callable[[_NSO], None] | None = None)
Helper class for storing AAS objects of a given type in a Namespace and find them by their unique attribute.
This class behaves much like a set of AAS objects of a defined type, but uses dicts internally to rapidly find those objects by their unique attribute. Additionally, it manages the
parentattribute of the stored AAS objects and ensures the uniqueness of their attribute within the Namespace.Use
add(),remove(),pop(),discard(),clear(),len(),x inchecks and iteration just like on a normal set of AAS objects. To get an AAS object by its attribute, useget_object()orget()(the latter one allows a default argument and returns None instead of raising a KeyError). As a bonus, thex incheck supports checking for existence of attribute or a concrete AAS object.- Variables:
parent – The Namespace this set belongs to
To initialize, use the following parameters:
- Parameters:
parent – The Namespace this set belongs to
attribute_names – List of attribute names, for which objects should be unique in the set. The bool flag indicates if the attribute should be matched case-sensitive (true) or case-insensitive (false)
items – A given list of AAS items to be added to the set
- Raises:
KeyError – When
itemscontains multiple objects with same unique attribute
- get(attribute_name: str, attribute_value: str, default: _NSO | None = None) _NSO | None
Find an object in this set by its attribute, with fallback parameter
- Parameters:
attribute_name – name of the attribute to search for
attribute_value – value of the attribute to search for
default – An object to be returned, if no object with the given attribute is found
- Returns:
The AAS object with the given attribute in the set. Otherwise the
defaultobject or None, if none is given.
- get_object_by_attribute(attribute_name: str, attribute_value: str | Reference) _NSO
Find an object in this set by its unique attribute
- Raises:
KeyError – If no such object can be found
- update_nss_from(other: NamespaceSet)
Update a NamespaceSet from a given NamespaceSet.
WARNING: By updating, the “other” NamespaceSet gets destroyed.
- Parameters:
other – The NamespaceSet to update from
- class OrderedNamespaceSet(parent: UniqueIdShortNamespace | UniqueSemanticIdNamespace | Qualifiable | HasExtension, attribute_names: List[Tuple[str, bool]], items: Iterable[_NSO] = (), item_add_hook: Callable[[_NSO, Iterable[_NSO]], None] | None = None, item_id_set_hook: Callable[[_NSO], None] | None = None, item_id_del_hook: Callable[[_NSO], None] | None = None)
A specialized version of
NamespaceSet, that keeps track of the order of the storedReferableobjects.Additionally to the MutableSet interface of
NamespaceSet, this class provides a set-like interface (actually it is derived from MutableSequence). However, we don’t permit duplicate entries in the ordered list of objects.
- class PreferredNameTypeIEC61360(dict_: Dict[str, str])
A
ConstrainedLangStringSetwhere each value must have at least 1 and at most 255 characters.
- class Qualifiable
Abstract baseclass for all objects which form a Namespace to hold
Qualifierobjects and resolve them by their type.<<abstract>>
- Variables:
namespace_element_sets – A list of all
NamespaceSetsof this Namespacequalifier – Unordered list of
Qualifiersthat gives additional qualification of a qualifiable element.
- add_qualifier(qualifier: Qualifier) None
Add a
Qualifierto this Namespace- Parameters:
qualifier – The
Qualifierto add- Raises:
KeyError – If a qualifier with the same type is already present in this namespace
ValueError – If the passed object already has a parent namespace
- class Qualifier(type_: str, value_type: Type[relativedelta | datetime | Date | time | GYearMonth | GYear | GMonthDay | GMonth | GDay | bool | Base64Binary | HexBinary | Float | float | Decimal | int | Long | Int | Short | Byte | NonPositiveInteger | NegativeInteger | NonNegativeInteger | PositiveInteger | UnsignedLong | UnsignedInt | UnsignedShort | UnsignedByte | AnyURI | str | NormalizedString], value: relativedelta | datetime | Date | time | GYearMonth | GYear | GMonthDay | GMonth | GDay | bool | Base64Binary | HexBinary | Float | float | Decimal | int | Long | Int | Short | Byte | NonPositiveInteger | NegativeInteger | NonNegativeInteger | PositiveInteger | UnsignedLong | UnsignedInt | UnsignedShort | UnsignedByte | AnyURI | str | NormalizedString | None = None, value_id: Reference | None = None, kind: QualifierKind = QualifierKind.CONCEPT_QUALIFIER, semantic_id: Reference | None = None, supplemental_semantic_id: Iterable[Reference] = ())
A qualifier is a type-value pair that makes additional statements w.r.t. the value of the element.
Constraint AASd-006: If both, the value and the valueId of a Qualifier are present, the value needs to be identical to the value of the referenced coded value in Qualifier/valueId.
Constraint AASd-020: The value of Qualifier/value shall be consistent with the data type as defined in Qualifier/valueType.
- Variables:
type – The type (
QualifierType) of the qualifier that is applied to the element.value_type – Data type (
DataTypeDefXsd) of the qualifier valuevalue – The value (
ValueDataType) of the qualifier.value_id –
Referenceto the global unique id of a coded value.semantic_id – The semantic_id defined in
HasSemantics.supplemental_semantic_id – Identifier of a supplemental semantic definition of the element. It is called supplemental semantic ID of the element. (inherited from
HasSemantics)
- property type
- property value
- class QualifierKind(value)
Enumeration for denoting whether a Qualifier is a concept, template or value qualifier.
- Variables:
CONCEPT_QUALIFIER – qualifies the semantic definition the element is referring to (HasSemantics/semanticId)
TEMPLATE_QUALIFIER – qualifies the elements within a specific submodel on concept level. Template qualifiers are only applicable to elements with kind=``Template``
VALUE_QUALIFIER – qualifies the value of the element and can change during run-time. Value qualifiers are only applicable to elements with kind=``Instance``
- CONCEPT_QUALIFIER = 0
- TEMPLATE_QUALIFIER = 1
- VALUE_QUALIFIER = 2
- class Referable
An element that is referable by its id_short. This id is not globally unique. This id is unique within the name space of the element.
<<abstract>>
Constraint AASd-001: In case of a referable element not being an identifiable element the idShort is mandatory and used for referring to the element in its name space.
Constraint AASd-002: idShort shall only feature letters, digits, underscore (
_); starting mandatory with a letter.Constraint AASd-004: Add parent in case of non identifiable elements.
Constraint AASd-022: idShort of non-identifiable referables shall be unique in its namespace (case-sensitive)
- Variables:
_id_short – Identifying string of the element within its name space
category – The category is a value that gives further meta information w.r.t. to the class of the element. It affects the expected existence of attributes and the applicability of constraints.
description – Description or comments on the element.
parent – Reference (in form of a
UniqueIdShortNamespace) to the next referable parent element of the element.source – Source of the object, an URI, that defines where this object’s data originates from. This is used to specify where the Referable should be updated from and committed to. Default is an empty string, making it use the source of its ancestor, if possible.
- commit() None
Transfer local changes on this object to all underlying external data sources.
This function commits the current state of this object to its own and each external data source of its ancestors. If there is no source, this function will do nothing.
- find_source() Tuple[Referable | None, List[str] | None]
Finds the closest source in this objects ancestors. If there is no source, returns None
- Returns:
Tuple with the closest ancestor with a defined source and the relative path of id_shorts to that ancestor
- update(max_age: float = 0, recursive: bool = True, _indirect_source: bool = True) None
Update the local Referable object from any underlying external data source, using an appropriate backend
If there is no source given, it will find its next ancestor with a source and update from this source. If there is no source in any ancestor, this function will do nothing
- Parameters:
max_age – Maximum age of the local data in seconds. This method may return early, if the previous update of the object has been performed less than
max_ageseconds ago.recursive – Also call update on all children of this object. Default is True
_indirect_source – Internal parameter to avoid duplicate updating.
- Raises:
backends.BackendError – If no appropriate backend or the data source is not available
- update_from(other: Referable, update_source: bool = False)
Internal function to updates the object’s attributes from another object of a similar type.
This function should not be used directly. It is typically used by backend implementations (database adapters, protocol clients, etc.) to update the object’s data, after
update()has been called.- Parameters:
other – The object to update from
update_source – Update the source attribute with the other’s source attribute. This is not propagated recursively
- classmethod validate_id_short(id_short: str) None
Validates an id_short against Constraint AASd-002 and
NameTyperestrictions.Constraint AASd-002: idShort of Referables shall only feature letters, digits, underscore (
_); starting mandatory with a letter. I.e.[a-zA-Z][a-zA-Z0-9_]+- Parameters:
id_short – The id_short to validate
- Raises:
ValueError – If the id_short doesn’t comply to the constraints imposed by
NameType(seecheck_name_type()).AASConstraintViolation – If the id_short doesn’t comply to Constraint AASd-002.
- class Reference(key: Tuple[Key, ...], referred_semantic_id: Reference | None = None)
Reference to either a model element of the same or another AAs or to an external entity.
A reference is an ordered list of keys, each key referencing an element. The complete list of keys may for example be concatenated to a path that then gives unique access to an element or entity.
This is the abstract superclass of ExternalReference and ModelReference, which implements common attributes and methods used in both reference types. The two reference types are implemented as separate classes in this SDK to allow typing and resolving of References with Reference/type=ModelReference.
<<abstract>>
Constraint AASd-121: For References the value of Key/type of the first key of Reference/keys shall be one of GloballyIdentifiables.
- Variables:
key – Ordered list of unique reference in its name space, each key referencing an element. The complete list of keys may for example be concatenated to a path that then gives unique access to an element or entity.
referred_semantic_id – SemanticId of the referenced model element. For external references there typically is no semantic id.
- class Resource(path: str, content_type: str | None = None)
Resource represents an address to a file (a locator). The value is an URI that can represent an absolute or relative path.
- Variables:
path – Path and name of the resource (with file extension). The path can be absolute or relative.
content_type – Content type of the content of the file. The content type states which file extensions the file can have.
- class ShortNameTypeIEC61360(dict_: Dict[str, str])
A
ConstrainedLangStringSetwhere each value must have at least 1 and at most 18 characters.
- class SpecificAssetId(name: str, value: str, external_subject_id: ExternalReference | None = None, semantic_id: Reference | None = None, supplemental_semantic_id: Iterable[Reference] = ())
A specific asset ID describes a generic supplementary identifying attribute of the asset. The specific asset ID is not necessarily globally unique.
Constraint AASd-133: SpecificAssetId/externalSubjectId shall be a global reference, i.e. Reference/type = ExternalReference
- Variables:
name – Key of the identifier
value – The value of the identifier with the corresponding key.
external_subject_id – The (external) subject the key belongs to or has meaning to.
semantic_id – Identifier of the semantic definition of the element. It is called semantic id of the element. The semantic id may either reference an external global id or it may reference a referable model element of kind=Type that defines the semantics of the element. (inherited from
HasSemantics)supplemental_semantic_id – Identifier of a supplemental semantic definition of the element. It is called supplemental semantic ID of the element. (inherited from
HasSemantics)
- class StateOfEvent(value)
State of an event. Used in
basyx.aas.model.submodel.BasicEventElement.- OFF = 1
- ON = 0
- exception UnexpectedTypeError(value: Referable, *args)
Exception to be raised by
ModelReference.resolve()if the retrieved object has not the expected type.- Variables:
value – The object of unexpected type
- class UniqueIdShortNamespace
Abstract baseclass for all objects which form a Namespace to hold
Referableobjects and resolve them by their id_short.A Namespace can contain multiple
NamespaceSets, which containReferableobjects of different types. However, the id_short of each object must be unique across all NamespaceSets of one Namespace.- Variables:
namespace_element_sets – A list of all
NamespaceSetsof this Namespace
- add_referable(referable: Referable) None
Add a
Referableto this Namespace- Parameters:
referable – The
Referableto add- Raises:
KeyError – If a
Referablewith the same name is already present in this namespaceValueError – If the given
Referablealready has a parent namespace
- get_referable(id_short: str | Iterable[str]) Referable
Find a
Referablein this Namespace by its id_short or by its id_short path. The id_short path may containSubmodelElementListindices.- Parameters:
id_short – id_short or id_short path as any
Iterable- Returns:
- Raises:
TypeError – If one of the intermediate objects on the path is not a
UniqueIdShortNamespaceValueError – If a non-numeric index is given to resolve in a
SubmodelElementList
- class UniqueSemanticIdNamespace
Abstract baseclass for all objects which form a Namespace to hold HasSemantics objects and resolve them by their their semantic_id.
A Namespace can contain multiple NamespaceSets, which contain HasSemantics objects of different types. However, the the semantic_id of each object must be unique across all NamespaceSets of one Namespace.
- Variables:
namespace_element_sets – A list of all NamespaceSets of this Namespace
- get_object_by_semantic_id(semantic_id: Reference) HasSemantics
Find an HasSemantics in this Namespaces by its semantic_id
- Raises:
KeyError – If no such HasSemantics can be found
- class ValueReferencePair(value: str, value_id: Reference)
A value reference pair within a value list. Each value has a global unique id defining its semantic.
<<DataType>>
- Variables:
value – The value of the referenced concept definition of the value in value_id
value_id – Global unique id of the value.
2.2.1. Constrained String Datatypes
These types are aliases of str and constrained by a setter where used.
2.2.2. Type Aliases
- DataTypeDefXsd
alias of
Type[relativedelta|datetime|Date|time|GYearMonth|GYear|GMonthDay|GMonth|GDay|bool|Base64Binary|HexBinary|Float|float|Decimal|int|Long|Int|Short|Byte|NonPositiveInteger|NegativeInteger|NonNegativeInteger|PositiveInteger|UnsignedLong|UnsignedInt|UnsignedShort|UnsignedByte|AnyURI|str|NormalizedString]
- ValueDataType
alias of
relativedelta|datetime|Date|time|GYearMonth|GYear|GMonthDay|GMonth|GDay|bool|Base64Binary|HexBinary|Float|float|Decimal|int|Long|Int|Short|Byte|NonPositiveInteger|NegativeInteger|NonNegativeInteger|PositiveInteger|UnsignedLong|UnsignedInt|UnsignedShort|UnsignedByte|AnyURI|str|NormalizedString
- ValueList
alias of
Set[ValueReferencePair]
2.2.3. Type Variables
- class _NSO
alias of TypeVar(‘_NSO’, bound=
Referable|Qualifier|HasSemantics|Extension)
- class _T
alias of TypeVar(‘_T’)