2.5. aas.model.provider - Providers for storing and retrieving AAS-objects
This module implements Registries for the AAS, in order to enable resolving global
Identifiers; and mapping Identifiers to
Identifiable objects.
- class basyx.aas.model.provider.AbstractObjectProvider
Abstract baseclass for all objects, that allow to retrieve
Identifiableobjects (resp. proxy objects for remoteIdentifiableobjects) by theirIdentifier.This includes local object stores, database clients and AAS API clients.
- get(identifier: str, default: Optional[basyx.aas.model.base.Identifiable] = None) Optional[basyx.aas.model.base.Identifiable]
Find an object in this set by its
id, with fallback parameter- Parameters
identifier –
Identifierof the object to returndefault – An object to be returned, if no object with the given
idis found
- Returns
The
Identifiableobject with the givenidin the provider. Otherwise the default object or None, if none is given.
- abstract get_identifiable(identifier: str) basyx.aas.model.base.Identifiable
Find an
Identifiableby itsIdentifierThis may include looking up the object’s endpoint in a registry and fetching it from an HTTP server or a database.
- Parameters
identifier –
Identifierof the object to return- Returns
The
Identifiableobject (or a proxy object for a remoteIdentifiableobject)- Raises
KeyError – If no such
Identifiablecan be found
- class basyx.aas.model.provider.AbstractObjectStore
Abstract baseclass of for container-like objects for storage of
Identifiableobjects.ObjectStores are special ObjectProvides that – in addition to retrieving objects by
Identifier– allow to add and delete objects (i.e. behave like a Python set). This includes local object stores (likeDictObjectStore) and databaseBackends.The AbstractObjectStore inherits from the MutableSet abstract collections class and therefore implements all the functions of this class.
- class basyx.aas.model.provider.DictObjectStore(objects: Iterable[basyx.aas.model.provider._IT] = ())
A local in-memory object store for
Identifiableobjects, backed by a dict, mappingIdentifier→Identifiable- add(x: basyx.aas.model.provider._IT) None
Add an element.
- discard(x: basyx.aas.model.provider._IT) None
Remove an element. Do not raise an exception if absent.
- get_identifiable(identifier: str) basyx.aas.model.provider._IT
Find an
Identifiableby itsIdentifierThis may include looking up the object’s endpoint in a registry and fetching it from an HTTP server or a database.
- Parameters
identifier –
Identifierof the object to return- Returns
The
Identifiableobject (or a proxy object for a remoteIdentifiableobject)- Raises
KeyError – If no such
Identifiablecan be found
- class basyx.aas.model.provider.ObjectProviderMultiplexer(registries: Optional[List[basyx.aas.model.provider.AbstractObjectProvider]] = None)
A multiplexer for Providers of
Identifiableobjects.This class combines multiple registries of
Identifiableobjects into a single one to allow retrievingIdentifiableobjects from different sources. It implements theAbstractObjectProviderinterface to be used as registry itself.- Variables
registries – A list of
AbstractObjectProvidersto query when looking up an object
- get_identifiable(identifier: str) basyx.aas.model.base.Identifiable
Find an
Identifiableby itsIdentifierThis may include looking up the object’s endpoint in a registry and fetching it from an HTTP server or a database.
- Parameters
identifier –
Identifierof the object to return- Returns
The
Identifiableobject (or a proxy object for a remoteIdentifiableobject)- Raises
KeyError – If no such
Identifiablecan be found