Skip to content

basic

BasicImplementation

Bases: object

__init__(archive, **kwargs)

Provides common features for an interface implementation: namely, an archive and a privacy setting. Also provides access to certain common methods of the archive. This should be the base class for interface-specific implementations.

Requires an archive with the following attributes: - ref - report semantic reference - source - report physical data source - static - a boolean indicating whether the full contents of the archive are loaded into memory - get_uuid() - deprecated - only present for compatibility reasons - getitem - retrieve already-loaded entity - retrieve_or_fetch_entity() - _fetch abstract method must be implemented

All of these requirements are met by the standard ArchiveImplementation, with the exception of the _fetch abstract method.

Since a recent change that removed the 'basic' interface as a default for all resources, this must be explicitly assigned to at least one resource in order for a query to be valid. The basic interface should be assigned to the resource that meets the following requirements: - most comprehensive source of information about entity properties (e.g. documentary pseudo-interface) - easiest to load (e.g. a non-static)

Parameters:

Name Type Description Default
archive

an LcArchive

required
privacy

No longer used. Privacy is enforced at the server and not the resource (where it was phony from the beginning)

required

bg_lcia(process, query_qty, ref_flow=None, *kwargs)

This needs to be handled by a query with lci() access, or by a subclass

Parameters:

Name Type Description Default
process
required
query_qty
required
ref_flow
None
kwargs
()

Returns:

Type Description

get(external_ref, **kwargs)

Parameters:

Name Type Description Default
external_ref

may also be link, as long as requested origin is equal or lesser in specificity

required
kwargs
{}

Returns:

Type Description

entity or None

get_context(term, **kwargs)

I think this needs to be moved into the quantity interface

Parameters:

Name Type Description Default
term
required
kwargs
{}

Returns:

Type Description

get_item(external_ref, item)

In this, we accept either an external_ref or an entity reference itself. If the latter, we dereference via the archive to an actual entity, which we then ask for the item. If the dereference and the reference are the same, throws an error.

Parameters:

Name Type Description Default
external_ref
required
item
required

Returns:

Type Description

is_lcia_engine(**kwargs)

suggests expansion to a graph-based TM

Parameters:

Name Type Description Default
kwargs
{}

Returns:

Type Description

validate()

way to check that a query implementation is valid without querying anything

Returns:

Type Description