2.5. 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 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: Identifiable | None = None) Identifiable | None
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 thedefaultobject or None, if none is given.
- abstract get_identifiable(identifier: str) 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 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
MutableSetabstract collections class and therefore implements all the functions of this class.
- class DictObjectStore(objects: Iterable[_IT] = ())
A local in-memory object store for
Identifiableobjects, backed by a dict, mappingIdentifier→Identifiable- get_identifiable(identifier: str) _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 ObjectProviderMultiplexer(registries: List[AbstractObjectProvider] | None = 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) 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 _IT
alias of TypeVar(‘_IT’, bound=
Identifiable)