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 Identifiable objects (resp. proxy objects for remote Identifiable objects) by their Identifier.

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:
  • identifierIdentifier of the object to return

  • default – An object to be returned, if no object with the given id is found

Returns:

The Identifiable object with the given id in the provider. Otherwise the default object or None, if none is given.

abstract get_identifiable(identifier: str) Identifiable

Find an Identifiable by its Identifier

This may include looking up the object’s endpoint in a registry and fetching it from an HTTP server or a database.

Parameters:

identifierIdentifier of the object to return

Returns:

The Identifiable object (or a proxy object for a remote Identifiable object)

Raises:

KeyError – If no such Identifiable can be found

class AbstractObjectStore

Abstract baseclass of for container-like objects for storage of Identifiable objects.

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 (like DictObjectStore) and database Backends.

The AbstractObjectStore inherits from the MutableSet abstract collections class and therefore implements all the functions of this class.

update(other: Iterable[_IT]) None
class DictObjectStore(objects: Iterable[_IT] = ())

A local in-memory object store for Identifiable objects, backed by a dict, mapping IdentifierIdentifiable

add(x: _IT) None

Add an element.

discard(x: _IT) None

Remove an element. Do not raise an exception if absent.

get_identifiable(identifier: str) _IT

Find an Identifiable by its Identifier

This may include looking up the object’s endpoint in a registry and fetching it from an HTTP server or a database.

Parameters:

identifierIdentifier of the object to return

Returns:

The Identifiable object (or a proxy object for a remote Identifiable object)

Raises:

KeyError – If no such Identifiable can be found

class ObjectProviderMultiplexer(registries: List[AbstractObjectProvider] | None = None)

A multiplexer for Providers of Identifiable objects.

This class combines multiple registries of Identifiable objects into a single one to allow retrieving Identifiable objects from different sources. It implements the AbstractObjectProvider interface to be used as registry itself.

Variables:

registries – A list of AbstractObjectProviders to query when looking up an object

get_identifiable(identifier: str) Identifiable

Find an Identifiable by its Identifier

This may include looking up the object’s endpoint in a registry and fetching it from an HTTP server or a database.

Parameters:

identifierIdentifier of the object to return

Returns:

The Identifiable object (or a proxy object for a remote Identifiable object)

Raises:

KeyError – If no such Identifiable can be found

class _IT

alias of TypeVar(‘_IT’, bound=Identifiable)