2.2. aas.model.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.
- exception basyx.aas.model.base.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 basyx.aas.model.base.AdministrativeInformation(version: Optional[str] = None, revision: Optional[str] = None, creator: Optional[basyx.aas.model.base.Reference] = None, template_id: Optional[str] = None, embedded_data_specifications: Iterable[basyx.aas.model.base.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
- 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.
- Variables
embedded_data_specifications – List of Embedded data specification. used by the element.
- class basyx.aas.model.base.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
- class basyx.aas.model.base.ConstrainedLangStringSet(dict_: Dict[str, str], constraint_check_fn: Callable[[str, str], None])
A
LangStringSetwith constrained values.
- class basyx.aas.model.base.ConstrainedList(items: Iterable[basyx.aas.model.base._T], item_add_hook: Optional[Callable[[basyx.aas.model.base._T, List[basyx.aas.model.base._T]], None]] = None, item_set_hook: Optional[Callable[[List[basyx.aas.model.base._T], List[basyx.aas.model.base._T], List[basyx.aas.model.base._T]], None]] = None, item_del_hook: Optional[Callable[[basyx.aas.model.base._T, List[basyx.aas.model.base._T]], 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_hook and an item_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_hook is called every time one or multiple items are overwritten with one or multiple new items, à la list[i] = new_item or list[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_hook must be used in addition to item_del_hook.
Finally, item_del_hook is called whenever an item is removed from the list, (e.g. via .remove(), .pop() or del list[i]. It is passed the item about to be deleted and the current list elements.
- clear() None -- remove all items from S
- extend(values: Iterable[basyx.aas.model.base._T]) None
S.extend(iterable) – extend sequence by appending elements from the iterable
- insert(index: int, value: basyx.aas.model.base._T) None
S.insert(index, value) – insert value before index
- class basyx.aas.model.base.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_61360 is used
for an element, the value of Has_data_specification.embedded_data_specifications shall contain the external reference to the IRI of the corresponding data specification template https://admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360/3/0
- class basyx.aas.model.base.DataSpecificationIEC61360(preferred_name: basyx.aas.model.base.PreferredNameTypeIEC61360, data_type: Optional[basyx.aas.model.base.DataTypeIEC61360] = None, definition: Optional[basyx.aas.model.base.DefinitionTypeIEC61360] = None, short_name: Optional[basyx.aas.model.base.ShortNameTypeIEC61360] = None, unit: Optional[str] = None, unit_id: Optional[basyx.aas.model.base.Reference] = None, source_of_definition: Optional[str] = None, symbol: Optional[str] = None, value_format: Optional[str] = None, value_list: Optional[Set[basyx.aas.model.base.ValueReferencePair]] = None, value: Optional[str] = None, level_types: Iterable[basyx.aas.model.base.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
- class basyx.aas.model.base.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 –
- class basyx.aas.model.base.DefinitionTypeIEC61360(dict_: Dict[str, str])
A
ConstrainedLangStringSetwhere each value must have at least 1 and at most 1023 characters.
- class basyx.aas.model.base.Direction(value)
Direction of an event. Used in
aas.model.submodel.BasicEventElement.
- class basyx.aas.model.base.EmbeddedDataSpecification(data_specification: basyx.aas.model.base.Reference, data_specification_content: basyx.aas.model.base.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 basyx.aas.model.base.EntityType(value)
Enumeration for denoting whether an entity is a self-managed or a co-managed entity
- Variables
CO_MANAGED_ENTITY – For co-managed entities there is no separate
AAS. Co-managed entities need to be part of a self-managed entitySELF_MANAGED_ENTITY – Self-managed entities have their own
AAS, but can be part of the bill of material of a composite self-managed entity.
- class basyx.aas.model.base.Extension(name: str, value_type: Optional[Type[Union[dateutil.relativedelta.relativedelta, datetime.datetime, basyx.aas.model.datatypes.Date, datetime.time, basyx.aas.model.datatypes.GYearMonth, basyx.aas.model.datatypes.GYear, basyx.aas.model.datatypes.GMonthDay, basyx.aas.model.datatypes.GMonth, basyx.aas.model.datatypes.GDay, bool, basyx.aas.model.datatypes.Base64Binary, basyx.aas.model.datatypes.HexBinary, basyx.aas.model.datatypes.Float, float, decimal.Decimal, int, basyx.aas.model.datatypes.Long, basyx.aas.model.datatypes.Int, basyx.aas.model.datatypes.Short, basyx.aas.model.datatypes.Byte, basyx.aas.model.datatypes.NonPositiveInteger, basyx.aas.model.datatypes.NegativeInteger, basyx.aas.model.datatypes.NonNegativeInteger, basyx.aas.model.datatypes.PositiveInteger, basyx.aas.model.datatypes.UnsignedLong, basyx.aas.model.datatypes.UnsignedInt, basyx.aas.model.datatypes.UnsignedShort, basyx.aas.model.datatypes.UnsignedByte, basyx.aas.model.datatypes.AnyURI, str, basyx.aas.model.datatypes.NormalizedString]]] = None, value: Optional[Union[dateutil.relativedelta.relativedelta, datetime.datetime, basyx.aas.model.datatypes.Date, datetime.time, basyx.aas.model.datatypes.GYearMonth, basyx.aas.model.datatypes.GYear, basyx.aas.model.datatypes.GMonthDay, basyx.aas.model.datatypes.GMonth, basyx.aas.model.datatypes.GDay, bool, basyx.aas.model.datatypes.Base64Binary, basyx.aas.model.datatypes.HexBinary, basyx.aas.model.datatypes.Float, float, decimal.Decimal, int, basyx.aas.model.datatypes.Long, basyx.aas.model.datatypes.Int, basyx.aas.model.datatypes.Short, basyx.aas.model.datatypes.Byte, basyx.aas.model.datatypes.NonPositiveInteger, basyx.aas.model.datatypes.NegativeInteger, basyx.aas.model.datatypes.NonNegativeInteger, basyx.aas.model.datatypes.PositiveInteger, basyx.aas.model.datatypes.UnsignedLong, basyx.aas.model.datatypes.UnsignedInt, basyx.aas.model.datatypes.UnsignedShort, basyx.aas.model.datatypes.UnsignedByte, basyx.aas.model.datatypes.AnyURI, str, basyx.aas.model.datatypes.NormalizedString]] = None, refers_to: Iterable[basyx.aas.model.base.ModelReference] = (), semantic_id: Optional[basyx.aas.model.base.Reference] = None, supplemental_semantic_id: Iterable[basyx.aas.model.base.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)
- class basyx.aas.model.base.ExternalReference(key: Tuple[basyx.aas.model.base.Key, ...], referred_semantic_id: Optional[basyx.aas.model.base.Reference] = 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 basyx.aas.model.base.HasDataSpecification(embedded_data_specifications: Iterable[basyx.aas.model.base.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.
Note: Please consider, that we have not implemented DataSpecification template class
- Variables
embedded_data_specifications – List of
EmbeddedDataSpecification.
- class basyx.aas.model.base.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.
TODO: This constraint is not yet implemented, a new Class for CustomSets should be implemented
- Variables
namespace_element_sets – List of
NamespaceSetsextension – A
NamespaceSetofExtensionsof the element._MEMBER_OBJ_TYPE –
_NSO_ATTRIBUTE_NAME – Specific attribute name <aas.model.base.Namespace>`.
- add_extension(extension: basyx.aas.model.base.Extension) None
Add a
Extensionto this Namespace
- get_extension_by_name(name: str) basyx.aas.model.base.Extension
Find an
Extensionin this namespace by its name- Raises
KeyError – If no such
Extensioncan be found
- class basyx.aas.model.base.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.
- class basyx.aas.model.base.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.
- class basyx.aas.model.base.IEC61360LevelType(value)
Level types for the level_type in
DataSpecificationIEC61360The level types are:- Variables
MIN –
MAX –
NOM –
TYP –
- class basyx.aas.model.base.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 basyx.aas.model.base.Key(type_: basyx.aas.model.base.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: basyx.aas.model.base.Referable) basyx.aas.model.base.Key
Construct a key for a given
Referable(orIdentifiable) object- Parameters
referable –
ReferableorIdentifiableobject- Returns
- get_identifier() Optional[str]
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 basyx.aas.model.base.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.
- class basyx.aas.model.base.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.
- clear() None. Remove all items from D.
- class basyx.aas.model.base.ModelReference(key: Tuple[basyx.aas.model.base.Key, ...], type_: Type[basyx.aas.model.base._RT], referred_semantic_id: Optional[basyx.aas.model.base.Reference] = 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: basyx.aas.model.base.Referable) basyx.aas.model.base.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
Identifier- Raises
ValueError – If this
ModelReferencedoes not include a Key of AasIdentifiable type
- resolve(provider_: provider.AbstractObjectProvider) basyx.aas.model.base._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
NamespaceUnexpectedTypeError – If the retrieved object is not of the expected type (or one of its subclasses). The object is stored in the value attribute of the exception
KeyError – If the reference could not be resolved
- class basyx.aas.model.base.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).
- class basyx.aas.model.base.MultiLanguageNameType(dict_: Dict[str, str])
A
ConstrainedLangStringSetwhere each value is aShortNameType. See also:check_short_name_type()
- class basyx.aas.model.base.MultiLanguageTextType(dict_: Dict[str, str])
A
ConstrainedLangStringSetwhere each value must have at least 1 and at most 1023 characters.
- class basyx.aas.model.base.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 basyx.aas.model.base.NamespaceSet(parent: Union[basyx.aas.model.base.UniqueIdShortNamespace, basyx.aas.model.base.UniqueSemanticIdNamespace, basyx.aas.model.base.Qualifiable, basyx.aas.model.base.HasExtension], attribute_names: List[Tuple[str, bool]], items: Iterable[basyx.aas.model.base._NSO] = (), item_add_hook: Optional[Callable[[basyx.aas.model.base._NSO, Iterable[basyx.aas.model.base._NSO]], None]] = None, item_id_set_hook: Optional[Callable[[basyx.aas.model.base._NSO], None]] = None, item_id_del_hook: Optional[Callable[[basyx.aas.model.base._NSO], 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 parent attribute of the stored AAS objects and ensures the uniqueness of their attribute within the Namespace.
Use add(), remove(), pop(), discard(), clear(), len(), x in checks and iteration just like on a normal set of AAS objects. To get an AAS object by its attribute, use get_object() or get() (the latter one allows a default argument and returns None instead of raising a KeyError). As a bonus, the x in check 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 items contains multiple objects with same unique attribute
- add(element: basyx.aas.model.base._NSO)
Add an element.
- clear() None
This is slow (creates N new iterators!) but effective.
- discard(x: basyx.aas.model.base._NSO) None
Remove an element. Do not raise an exception if absent.
- get(attribute_name: str, attribute_value: str, default: Optional[basyx.aas.model.base._NSO] = None) Optional[basyx.aas.model.base._NSO]
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 default object or None, if none is given.
- get_object_by_attribute(attribute_name: str, attribute_value: Union[str, basyx.aas.model.base.Reference]) basyx.aas.model.base._NSO
Find an object in this set by its unique attribute
- Raises
KeyError – If no such object can be found
- pop() basyx.aas.model.base._NSO
Return the popped value. Raise KeyError if empty.
- remove(item: basyx.aas.model.base._NSO) None
Remove an element. If not a member, raise a KeyError.
- update_nss_from(other: basyx.aas.model.base.NamespaceSet)
Update a NamespaceSet from a given NamespaceSet.
WARNING: By updating, the “other” NamespaceSet gets destroyed.
- Parameters
other – The NamespaceSet to update from
- class basyx.aas.model.base.OrderedNamespaceSet(parent: Union[basyx.aas.model.base.UniqueIdShortNamespace, basyx.aas.model.base.UniqueSemanticIdNamespace, basyx.aas.model.base.Qualifiable, basyx.aas.model.base.HasExtension], attribute_names: List[Tuple[str, bool]], items: Iterable[basyx.aas.model.base._NSO] = (), item_add_hook: Optional[Callable[[basyx.aas.model.base._NSO, Iterable[basyx.aas.model.base._NSO]], None]] = None, item_id_set_hook: Optional[Callable[[basyx.aas.model.base._NSO], None]] = None, item_id_del_hook: Optional[Callable[[basyx.aas.model.base._NSO], 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.- add(element: basyx.aas.model.base._NSO)
Add an element.
- clear() None
This is slow (creates N new iterators!) but effective.
- insert(index: int, object_: basyx.aas.model.base._NSO) None
S.insert(index, value) – insert value before index
- pop(i: Optional[int] = None) basyx.aas.model.base._NSO
Return the popped value. Raise KeyError if empty.
- remove(item: Union[Tuple[str, Union[str, basyx.aas.model.base.Reference]], basyx.aas.model.base._NSO])
Remove an element. If not a member, raise a KeyError.
- class basyx.aas.model.base.PreferredNameTypeIEC61360(dict_: Dict[str, str])
A
ConstrainedLangStringSetwhere each value must have at least 1 and at most 255 characters.
- class basyx.aas.model.base.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: basyx.aas.model.base.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
- get_qualifier_by_type(qualifier_type: str) basyx.aas.model.base.Qualifier
Find a
Qualifierin this Namespace by its type- Raises
KeyError – If no such
Qualifiercan be found
- class basyx.aas.model.base.Qualifier(type_: str, value_type: Type[Union[dateutil.relativedelta.relativedelta, datetime.datetime, basyx.aas.model.datatypes.Date, datetime.time, basyx.aas.model.datatypes.GYearMonth, basyx.aas.model.datatypes.GYear, basyx.aas.model.datatypes.GMonthDay, basyx.aas.model.datatypes.GMonth, basyx.aas.model.datatypes.GDay, bool, basyx.aas.model.datatypes.Base64Binary, basyx.aas.model.datatypes.HexBinary, basyx.aas.model.datatypes.Float, float, decimal.Decimal, int, basyx.aas.model.datatypes.Long, basyx.aas.model.datatypes.Int, basyx.aas.model.datatypes.Short, basyx.aas.model.datatypes.Byte, basyx.aas.model.datatypes.NonPositiveInteger, basyx.aas.model.datatypes.NegativeInteger, basyx.aas.model.datatypes.NonNegativeInteger, basyx.aas.model.datatypes.PositiveInteger, basyx.aas.model.datatypes.UnsignedLong, basyx.aas.model.datatypes.UnsignedInt, basyx.aas.model.datatypes.UnsignedShort, basyx.aas.model.datatypes.UnsignedByte, basyx.aas.model.datatypes.AnyURI, str, basyx.aas.model.datatypes.NormalizedString]], value: Optional[Union[dateutil.relativedelta.relativedelta, datetime.datetime, basyx.aas.model.datatypes.Date, datetime.time, basyx.aas.model.datatypes.GYearMonth, basyx.aas.model.datatypes.GYear, basyx.aas.model.datatypes.GMonthDay, basyx.aas.model.datatypes.GMonth, basyx.aas.model.datatypes.GDay, bool, basyx.aas.model.datatypes.Base64Binary, basyx.aas.model.datatypes.HexBinary, basyx.aas.model.datatypes.Float, float, decimal.Decimal, int, basyx.aas.model.datatypes.Long, basyx.aas.model.datatypes.Int, basyx.aas.model.datatypes.Short, basyx.aas.model.datatypes.Byte, basyx.aas.model.datatypes.NonPositiveInteger, basyx.aas.model.datatypes.NegativeInteger, basyx.aas.model.datatypes.NonNegativeInteger, basyx.aas.model.datatypes.PositiveInteger, basyx.aas.model.datatypes.UnsignedLong, basyx.aas.model.datatypes.UnsignedInt, basyx.aas.model.datatypes.UnsignedShort, basyx.aas.model.datatypes.UnsignedByte, basyx.aas.model.datatypes.AnyURI, str, basyx.aas.model.datatypes.NormalizedString]] = None, value_id: Optional[basyx.aas.model.base.Reference] = None, kind: basyx.aas.model.base.QualifierKind = QualifierKind.CONCEPT_QUALIFIER, semantic_id: Optional[basyx.aas.model.base.Reference] = None, supplemental_semantic_id: Iterable[basyx.aas.model.base.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)
- class basyx.aas.model.base.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”
- class basyx.aas.model.base.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[Optional[basyx.aas.model.base.Referable], Optional[List[str]]]
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_age seconds 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: basyx.aas.model.base.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
- class basyx.aas.model.base.Reference(key: Tuple[basyx.aas.model.base.Key, ...], referred_semantic_id: Optional[basyx.aas.model.base.Reference] = 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 basyx.aas.model.base.Resource(path: str, content_type: Optional[str] = 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 basyx.aas.model.base.ShortNameTypeIEC61360(dict_: Dict[str, str])
A
ConstrainedLangStringSetwhere each value must have at least 1 and at most 18 characters.
- class basyx.aas.model.base.SpecificAssetId(name: str, value: str, external_subject_id: Optional[basyx.aas.model.base.ExternalReference] = None, semantic_id: Optional[basyx.aas.model.base.Reference] = None, supplemental_semantic_id: Iterable[basyx.aas.model.base.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 basyx.aas.model.base.StateOfEvent(value)
State of an event. Used in
aas.model.submodel.BasicEventElement.
- exception basyx.aas.model.base.UnexpectedTypeError(value: basyx.aas.model.base.Referable, *args)
Exception to be raised by
aas.model.base.ModelReference.resolve()if the retrieved object has not the expected type.- Variables
value – The object of unexpected type
- class basyx.aas.model.base.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: basyx.aas.model.base.Referable) None
Add a
Referableto this Namespace
- get_referable(id_short: str) basyx.aas.model.base.Referable
Find a
Referablein this Namespace by its id_short
- class basyx.aas.model.base.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: basyx.aas.model.base.Reference) basyx.aas.model.base.HasSemantics
Find an HasSemantics in this Namespaces by its semantic_id
- Raises
KeyError – If no such HasSemantics can be found
- remove_object_by_semantic_id(semantic_id: basyx.aas.model.base.Reference) None
Remove an HasSemantics from this Namespace by its semantic_id
- Raises
KeyError – If no such HasSemantics can be found
- class basyx.aas.model.base.ValueReferencePair(value: str, value_id: basyx.aas.model.base.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.
- class basyx.aas.model.base.LangStringSet
A dict of language-Identifier (according to ISO 639-1 and ISO 3166-1) and string in this language. The meaning of the string in each language is the same.
<<Data Type>>
Example: [“en-US”, “germany”]
- class basyx.aas.model.base.ValueList
A Set of
ValueReferencePairs