Antelope Interface Reference

Antelope Interface Reference

Antelope organizes LCA functionality into seven distinct interfaces, each providing access to different types of operations and data. This modular design allows data sources to implement only the interfaces they support, while clients can discover available functionality dynamically.

Origins and Queries

Data sources are organized semantically into hierarchically-specified “origins” that indicate the data resource and applicable version. An origin is like a “domain name” for LCA data. For instance:

  • ecoinvent.3.10.cutoff
  • lcacommons.uslci.fy24.q4
  • openlca.lcia

Origins are hierarchically specified, and the first “dot” entry indicates the “issuer”, the party that is ostensibly responsible for maintaining the data (in the above examples: ecoinvent, lcacommons, openlca). In current practice, Antelope maintainers are responsible for all data content.

Work in antelope is performed using a “catalog”, which connects origins to data sources and allows a user to retrieve data by creating a “query”. The objects returned by the query are (almost) always “references” to data entities. These references contain a captive query and are instrumented with all the different query methods appropriate to each entity type.

1
2
3
4
5
6
from antelope_core import LcCatalog
catalog = LcCatalog()
catalog.new_resource('my.origin', '/path/to/data/source', 'DataSourceType', interfaces=('basic', 'exchange'))

catalog.index_ref('my.origin')
fs = catalog.query('my.origin').flows(name="polyethylene")

The Seven Interfaces

LCA information is organized into several “interfaces” that (a) represent different forms of knowledge about the data and (b) can be implemented using different back-end systems.

Under Antelope, reference data sources are all considered to be read-only, meaning that their contents may not be altered by a user. All user modifications are intended to occur within the foreground.

InterfacePurposeKey OperationsAccess Type
BasicEntity retrieval and propertiesget(), properties(), validate()Read-only
IndexSearch and enumerationprocesses(), flows(), count()Read-only
ExchangeProcess inventories and exchange relationshipsinventory(), exchanges(), ev()Read-only
BackgroundMatrix operations and system LCIlci(), sys_lci(), consumers()Read-only
QuantityUnit conversion and LCIAcf(), do_lcia(), factors()Read-Write
ConfigureResource configuration; allocationset_reference(), characterize_flow()Read-Write
ForegroundForeground modeling and observationnew_fragment(), observe(), traverse()Read-Write

Interface Dependencies

The interfaces build upon each other in layers:

  • Basic: Foundation for all other interfaces
  • Exchange + Index: Required together for inventory modeling
  • Background: Requires Exchange + Index for matrix construction
  • Quantity: Works with any of the above for LCIA operations
  • Configure: Mainly oriented towards linking and allocation to prepare background LCI data
  • Foreground: Uses all interfaces for comprehensive modeling

Qualitative and quantitative information

Each interface may include both qualitative (structured non-numeric) and quantitative (numeric) information. In access-controlled settings, access grants include a boolean flag for values which indicates whether the grantee is authorized to receive numerical information.

Quantitative information varies by interface according to the following table:

InterfaceQualitative informationQuantitative Information
BasicEntity documentationAggregated LCIA results
IndexSearchabilityLinking data
ExchangeExchangesExchanges with exchange values
BackgroundOrdering (foreground, background, emission, cutoffLCI Results
QuantityCharacterizationsCharacterization values

Query Pattern

All interfaces follow the same query delegation pattern:

1
2
3
4
5
6
7
8
9
10
# Get a query for a specific data source
query = catalog.query('my.data.source')

# Check what interfaces are available
print(query.origin, query.interfaces)

# Use interface methods directly
process = query.get('process-id')           # Basic interface
inventory = query.inventory(process)        # Exchange interface
results = query.do_lcia(quantity, inventory) # Quantity interface

Once an entity reference is retrieved via a query, it can be used to access applicable methods directly.

1
2
3
4
5
6
7
8
inv_query = catalog.query('inventory.resource')
process = query.get('process-id')
process.inventory()

lcia_query = catalog.query('lcia.resource')
lcia = lcia_query.get('lcia-method-id')

result = process.bg_lcia(lcia)

Interface Discovery

Data sources advertise which interfaces they support:

1
2
3
4
5
6
7
# Check available interfaces
catalog.show_interfaces()
# output: my.data.source [basic, exchange, quantity]

# Attempt operations only on supported interfaces
if 'index' in query.interfaces:
    processes = list(query.processes())

Next Steps