httk.store.query.portable

Derive portable query fields and operations from OPTIMADE definitions.

Classes

PortableQueryCapabilities

Describe the query operations guaranteed by one property definition.

Functions

portable_query_capabilities(definition)

Derive the portable operation subset for definition.

portable_query_fields(entry_type, *[, include, exclude])

Return the ordered portable query fields described by entry_type.

Module Contents

class httk.store.query.portable.PortableQueryCapabilities[source]

Describe the query operations guaranteed by one property definition.

query-support expresses a cross-provider guarantee, not a particular server’s implementation detail. all optional is deliberately fail-closed here: it gives a portable client no operation it can rely on. A server may offer more, but that is not represented by the definition.

Parameters:
  • query_support – The normalized declared query-support level.

  • operations – The portable operation families guaranteed by the definition.

query_support: str | None[source]
operations: frozenset[str][source]
supports(operation)[source]

Report whether operation is guaranteed by this definition.

Parameters:

operation (str) – The operation family to test.

Returns:

True when the operation is portable.

Return type:

bool

httk.store.query.portable.portable_query_capabilities(definition)[source]

Derive the portable operation subset for definition.

The operation names are "equality", "ordering", "stringmatching", and "set". They intentionally describe the query-language operation families rather than storage implementation. IS [NOT] KNOWN is part of the equality family because it is the NULL spelling of equality/inequality in the OPTIMADE filter language.

Parameters:

definition (httk.core.PropertyDefinition) – The OPTIMADE property definition to inspect.

Returns:

The guaranteed portable query capabilities.

Return type:

PortableQueryCapabilities

httk.store.query.portable.portable_query_fields(entry_type, *, include=(), exclude=())[source]

Return the ordered portable query fields described by entry_type.

By default, this selects scalar fields and flat lists with at least one operation guaranteed by their definition. include is an explicit binding override for named existing properties; it is appended as a second ordered group after the derived fields, in entry-definition order among the included names, but does not manufacture query capabilities absent from that definition. exclude always wins. Both arguments reject unknown or duplicate names so binding mistakes cannot silently broaden a profile.

Parameters:
Returns:

Derived property names followed by explicitly included names.

Raises:

ValueError – If include or exclude contains an unknown or duplicate property name.

Return type:

tuple[str, Ellipsis]