Store

class Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: Set

Abstract base class for stores.

registry: Final[dict[str, type[Store]]] = {'_sparql': <class 'kif_lib.store.sparql.sparql_core._SPARQL_Store'>, 'dbpedia-rdf': <class 'kif_lib.store.sparql.rdf.DBpediaRDF_Store'>, 'dbpedia-sparql': <class 'kif_lib.store.sparql.sparql.DBpediaSPARQL_Store'>, 'empty': <class 'kif_lib.store.empty.EmptyStore'>, 'mixer': <class 'kif_lib.store.mixer.MixerStore'>, 'pubchem-rdf': <class 'kif_lib.store.sparql.rdf.PubChemRDF_Store'>, 'pubchem-sparql': <class 'kif_lib.store.sparql.sparql.PubChemSPARQL_Store'>, 'rdf': <class 'kif_lib.store.sparql.rdf.RDF_Store'>, 'sparql': <class 'kif_lib.store.sparql.sparql.SPARQL_Store'>, 'sparql-httpx': <class 'kif_lib.store.sparql.httpx.HttpxSPARQL_Store'>, 'sparql-jena': <class 'kif_lib.store.sparql.jena.JenaSPARQL_Store'>, 'sparql-rdflib': <class 'kif_lib.store.sparql.rdflib.RDFLibSPARQL_Store'>, 'wdqs': <class 'kif_lib.store.sparql.sparql.WDQS_Store'>, 'wikidata-rdf': <class 'kif_lib.store.sparql.rdf.WikidataRDF_Store'>, 'wikidata-sparql': <class 'kif_lib.store.sparql.sparql.WikidataSPARQL_Store'>}

The store plugin registry.

store_name: ClassVar[str]

The name of this store plugin.

store_description: ClassVar[str]

The description of this store plugin.

exception Error[source]

Bases: Error

Base class for store errors.

__init__(*args: Any, base_filter: Filter | None = None, distinct: bool | None = None, extra_references: TReferenceRecordSet | None = None, flags: TFlags | None = None, limit: int | None = None, page_size: int | None = None, timeout: float | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

property context: Context

The current KIF context.

get_context(context: Context | None = None) Context[source]

Gets the current KIF context.

If context is not None, returns context.

Returns:

Context.

property default_base_filter: Filter

The default value for Store.base_filter.

get_default_base_filter() Filter[source]

Gets the default value for Store.base_filter.

Returns:

Filter.

property base_filter: Filter

The base filter of store.

get_base_filter(default: Filter | None = None) Filter[source]

Gets the base filter of store.

If the base filter is None, returns default.

If default is None, assumes Store.default_base_filter.

Parameters:

default – Default base filter.

Returns:

Filter.

set_base_filter(base_filter: Filter | None = None) None[source]

Sets the base filter of store.

If filter is None, resets base filter to Store.default_base_filter.

Parameters:

base_filter – Filter.

property subject: Fingerprint

The subject fingerprint of the base filter of store.

get_subject() Fingerprint[source]

Gets the subject fingerprint of the base filter of store.

Returns:

Fingerprint.

set_subject(subject: TFingerprint | None = None) None[source]

Sets the subject fingerprint of the base filter of store.

If subject is None, assumes the full fingerprint.

Parameters:

subject – Fingerprint.

property property: Fingerprint

The property fingerprint of the base filter of store.

get_property() Fingerprint[source]

Gets the property fingerprint of the base filter of store.

Returns:

Fingerprint.

set_property(property: TFingerprint) None[source]

Sets the property fingerprint of the base filter of store.

If property is None, assumes the full fingerprint.

Parameters:

property – Fingerprint.

property value: Fingerprint

The value fingerprint of the base filter of store.

get_value() Fingerprint[source]

Gets the value fingerprint of the base filter of store.

Returns:

Fingerprint.

set_value(value: TFingerprint) None[source]

Sets the value fingerprint of the base filter of store.

If value is None, assumes the full fingerprint.

Parameters:

value – Fingerprint.

property snak_mask: SnakMask

The snak mask of the base filter of store.

get_snak_mask() SnakMask[source]

Gets the snak mask of the base filter of store.

Returns:

Snak mask.

set_snak_mask(snak_mask: Filter.TSnakMask) None[source]

Sets the snak mask of the base filter of store.

Parameters:

snak_mask – Snak mask.

property subject_mask: DatatypeMask

The subject mask of the base filter of store.

get_subject_mask() DatatypeMask[source]

Gets the subject mask of the base filter of store.

Returns:

Datatype mask.

set_subject_mask(subject_mask: Filter.TDatatypeMask) None[source]

Sets the subject mask of the base filter of store.

Parameters:

subject_mask – Datatype mask.

property property_mask: DatatypeMask

The property mask of the base filter of store.

get_property_mask() DatatypeMask[source]

Gets the property mask of the base filter of store.

Returns:

Datatype mask.

set_property_mask(property_mask: Filter.TDatatypeMask) None[source]

Sets the property mask of the base filter of store.

Parameters:

property_mask – Datatype mask.

property value_mask: DatatypeMask

The value mask of the base filter of store.

get_value_mask() DatatypeMask[source]

Gets the value mask of the base filter of store.

Returns:

Datatype mask.

set_value_mask(value_mask: Filter.TDatatypeMask) None[source]

Sets the value mask of the base filter of store.

Parameters:

value_mask – Datatype mask.

property rank_mask: RankMask

The rank mask of the base filter of store.

get_rank_mask() RankMask[source]

Gets the rank mask of the base filter of store.

Returns:

Datatype mask.

set_rank_mask(rank_mask: Filter.TRankMask) None[source]

Sets the rank mask of the base filter of store.

Parameters:

rank_mask – Datatype mask.

property language: str | None

The language of the base filter of store.

get_language() str | None[source]

Gets the language of the base filter of store.

Returns:

Language.

set_language(language: String | str | None) None[source]

Sets the language of the base filter of store.

Parameters:

language – Language.

property annotated: bool

The annotated flag of the base filter of store.

get_annotated() bool[source]

Gets the annotated flag of the base filter of store.

Returns:

Annotated flag.

set_annotated(annotated: bool) None[source]

Sets the annotated flag of the base filter of store.

Parameters:

annotated – Annotated flag.

property default_distinct: bool

The default value for Store.distinct.

get_default_distinct() bool[source]

Gets the default value for Store.distinct.

Returns:

Default distinct flag.

property distinct: bool

The distinct flag of store (whether to suppress duplicates).

get_distinct(default: bool | None = None) bool[source]

Gets the distinct flag of store.

If the distinct flag is None, returns default.

If default is None, assumes Store.default_distinct.

Parameters:

default – Default distinct flag.

Returns:

Distinct flag.

set_distinct(distinct: bool | None = None) None[source]

Sets distinct flag of store.

If distinct is None, assumes Store.default_distinct.

Parameters:

distinct – Distinct flag.

property default_extra_references: ReferenceRecordSet

The default value for Store.extra_references.

get_default_extra_references() ReferenceRecordSet[source]

Gets the default value for Store.extra_references.

Returns:

Reference record set.

property extra_references: ReferenceRecordSet

The extra references of store.

get_extra_references(default: ReferenceRecordSet | None = None) ReferenceRecordSet[source]

Gets the extra references of store.

If the extra references is None, returns default.

If default is None, assumes Store.default_extra_references.

Parameters:

default – Default reference record set.

Returns:

Reference record set.

set_extra_references(extra_references: TReferenceRecordSet | None = None) None[source]

Sets the extra references of store.

If extra_references is None, resets extra references to Store.default_extra_references.

Parameters:

references – Reference record set.

class Flags(*values)[source]

Bases: Flags

Store flags.

DEBUG = 1

Whether to enable debugging.

BEST_RANK = 2

Whether to fetch only the best ranked statements.

VALUE_SNAK = 4

Whether to fetch value snaks.

SOME_VALUE_SNAK = 8

Whether to fetch some-value snaks.

NO_VALUE_SNAK = 16

Whether to fetch no-value snaks.

ALL = 31

All flags.

DEBUG: Final[Flags] = 1

Whether to enable debugging.

BEST_RANK: Final[Flags] = 2

Whether to fetch only the best ranked statements.

VALUE_SNAK: Final[Flags] = 4

Whether to fetch value snaks.

SOME_VALUE_SNAK: Final[Flags] = 8

Whether to fetch some-value snaks.

NO_VALUE_SNAK: Final[Flags] = 16

Whether to fetch no-value snaks.

TFlags: TypeAlias = kif_lib.store.abc.Store.Flags | int

Type alias for store flags.

property default_flags: Flags

The default value for Store.flags.

get_default_flags() Flags[source]

Gets the default value for Store.flags.

Returns:

Default store flags.

property flags: Flags

The store flags.

get_flags(default: Flags | None = None) Flags[source]

Gets the store flags.

If default is None, assumes Store.default_flags.

Parameters:

default – Default flags.

Returns:

Store flags.

has_flags(flags: TFlags) bool[source]

Tests whether flags are set in store.

Parameters:

flags – Store flags.

Returns:

True if successful; False otherwise.

set_flags(flags: TFlags | None = None) None[source]

Sets flags in store.

Parameters:

flags – Store flags.

unset_flags(flags: TFlags) None[source]

Unsets flags in store.

Parameters:

flags – Store flags.

property max_limit: int

The maximum value for Store.limit.

get_max_limit() int[source]

Gets the maximum value for Store.limit.

Returns:

Maximum limit.

property default_limit: int | None

The default value for Store.limit.

get_default_limit() int | None[source]

Gets the default value for Store.limit.

Returns:

Default limit or None.

property limit: int | None

The limit of store (maximum number of responses).

get_limit(default: int | None = None) int | None[source]

Gets the limit of store.

If the limit is None, returns default.

If default is None, assumes Store.default_limit.

Parameters:

default – Default limit.

Returns:

Limit or None.

set_limit(limit: int | None = None) None[source]

Sets the limit of store.

If limit is negative, assumes zero.

If limit is None, assumes Store.default_limit.

Parameters:

limit – Limit.

property max_page_size: int

The maximum value for Store.page_size.

get_max_page_size() int[source]

Gets the maximum value for Store.page_size.

Returns:

Maximum page size.

property default_page_size: int

The default value for Store.page_size.

get_default_page_size() int[source]

Gets the default value for Store.page_size.

Returns:

Default page size.

property page_size: int

The page size of store (size of response pages).

get_page_size(default: int | None = None) int[source]

Gets the page size of store.

If the page size is None, returns default.

If default is None, assumes Store.default_page_size.

Parameters:

default – Default page size.

Returns:

Page size.

set_page_size(page_size: int | None = None) None[source]

Sets page size of store.

If page_size is negative, assumes zero.

If page_size is None, assumes Store.default_page_size.

Parameters:

page_size – Page size.

property max_timeout: float

The maximum value for Store.timeout.

get_max_timeout() float[source]

Gets the maximum value for Store.timeout.

Returns:

Maximum timeout (in seconds).

property default_timeout: float | None

The default value for Store.timeout.

get_default_timeout() float | None[source]

Gets the default value for Store.timeout.

Returns:

Timeout or None.

property timeout: float | None

The timeout of store (in seconds).

get_timeout(default: float | None = None) float | None[source]

Gets the timeout of store.

If the timeout is None, returns default.

If default is None, assumes Store.default_timeout.

Parameters:

default – Default timeout.

Returns:

Timeout or None.

set_timeout(timeout: float | None = None) None[source]

Sets the timeout of store.

If timeout is negative, assumes zero.

If timeout is None, assumes Store.default_timeout.

Parameters:

timeout – Timeout.

ask(subject: TFingerprint | None = None, property: TFingerprint | None = None, value: TFingerprint | None = None, snak_mask: Filter.TSnakMask | None = None, subject_mask: Filter.TDatatypeMask | None = None, property_mask: Filter.TDatatypeMask | None = None, value_mask: Filter.TDatatypeMask | None = None, rank_mask: Filter.TRankMask | None = None, language: str | None = None, annotated: bool | None = None, snak: Snak | None = None, filter: Filter | None = None) bool[source]

Tests whether some statement matches filter.

Parameters:
  • subject – Entity.

  • property – Property.

  • value – Value.

  • snak_mask – Snak mask.

  • subject_mask – Datatype mask.

  • property_mask – Datatype mask.

  • value_mask – Datatype mask.

  • rank_mask – Rank mask.

  • language – Language.

  • annotated – Annotated flag.

  • snak – Snak.

  • filter – Filter.

Returns:

True if successful; False otherwise.

contains(stmt: Statement) bool[source]

Tests whether statement occurs in store.

Parameters:

stmt – Statement.

Returns:

True if successful; False otherwise.

count(subject: TFingerprint | None = None, property: TFingerprint | None = None, value: TFingerprint | None = None, snak_mask: Filter.TSnakMask | None = None, subject_mask: Filter.TDatatypeMask | None = None, property_mask: Filter.TDatatypeMask | None = None, value_mask: Filter.TDatatypeMask | None = None, rank_mask: Filter.TRankMask | None = None, language: str | None = None, annotated: bool | None = None, snak: Snak | None = None, filter: Filter | None = None) int[source]

Counts statements matching filter.

Parameters:
  • subject – Entity.

  • property – Property.

  • value – Value.

  • snak_mask – Snak mask.

  • subject_mask – Datatype mask.

  • property_mask – Datatype mask.

  • value_mask – Datatype mask.

  • rank_mask – Rank mask.

  • language – Language.

  • annotated – Annotated flag.

  • snak – Snak.

  • filter – Filter.

Returns:

The number of statements matching filter.

filter(subject: TFingerprint | None = None, property: TFingerprint | None = None, value: TFingerprint | None = None, snak_mask: Filter.TSnakMask | None = None, subject_mask: Filter.TDatatypeMask | None = None, property_mask: Filter.TDatatypeMask | None = None, value_mask: Filter.TDatatypeMask | None = None, rank_mask: Filter.TRankMask | None = None, language: str | None = None, annotated: bool | None = None, snak: Snak | None = None, filter: Filter | None = None, limit: int | None = None, distinct: bool | None = None) Iterator[Statement][source]

Searches for statements matching filter.

Parameters:
  • subject – Entity.

  • property – Property.

  • value – Value.

  • snak_mask – Snak mask.

  • subject_mask – Datatype mask.

  • property_mask – Datatype mask.

  • value_mask – Datatype mask.

  • rank_mask – Rank mask.

  • language – Language.

  • annotated – Annotated flag.

  • snak – Snak.

  • filter – Filter filter.

  • limit – Limit (maximum number) of statements to return.

  • distinct – Whether to skip duplicated matches.

Returns:

An iterator of statements matching filter.

filter_annotated(subject: TFingerprint | None = None, property: TFingerprint | None = None, value: TFingerprint | None = None, snak_mask: Filter.TSnakMask | None = None, subject_mask: Filter.TDatatypeMask | None = None, property_mask: Filter.TDatatypeMask | None = None, value_mask: Filter.TDatatypeMask | None = None, rank_mask: Filter.TRankMask | None = None, language: str | None = None, annotated: bool | None = None, snak: Snak | None = None, filter: Filter | None = None, limit: int | None = None, distinct: bool | None = None) Iterator[AnnotatedStatement][source]

Store.filter() with annotations.

Parameters:
  • subject – Entity.

  • property – Property.

  • value – Value.

  • snak_mask – Snak mask.

  • subject_mask – Datatype mask.

  • property_mask – Datatype mask.

  • value_mask – Datatype mask.

  • rank_mask – Rank mask.

  • language – Language.

  • annotated – Annotated flag (ignored).

  • snak – Snak.

  • filter – Filter.

  • limit – Limit (maximum number) of statements to return.

  • distinct – Whether to skip duplicated matches.

Returns:

An iterator of annotated statements matching filter.

class EmptyStore(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: Store

Empty store.

Parameters:

store_name – Name of the store plugin to instantiate.

__init__(store_name: str, *args: Any, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

store_description: ClassVar[str] = 'Empty store'

The description of this store plugin.

store_name: ClassVar[str] = 'empty'

The name of this store plugin.

class MixerStore(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: Store

Mixer store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • sources – Sources to mix.

  • sync_flags – Whether to sync store flags.

  • sync_limit – Whether to sync store limit.

  • sync_page_size – Whether to sync page size.

  • sync_timeout – Whether to sync timeout.

__init__(store_name: str, sources: Iterable[Store] = (), sync_flags: bool = True, sync_limit: bool = True, sync_page_size: bool = True, sync_timeout: bool = True, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

property sources: Collection[Store]

The mixed sources.

get_sources() Collection[Store][source]

Gets the mixed underlying sources.

Returns:

Mixed sources.

property sync_flags: bool

Whether to sync store flags.

get_sync_flags() bool[source]

Tests whether to sync store flags.

Returns:

True if successful; False otherwise.

property sync_limit: bool

Whether to sync store limit.

get_sync_limit() bool[source]

Tests whether to sync store limit.

Returns:

True if successful; False otherwise.

property sync_page_size: bool

Whether to sync store page size.

get_sync_page_size() bool[source]

Tests whether to sync store page size.

Returns:

True if successful; False otherwise.

property sync_timeout: bool

Whether to sync store timeout.

get_sync_timeout() bool[source]

Tests whether to sync store timeout.

Returns:

True if successful; False otherwise.

store_description: ClassVar[str] = 'Mixer store'

The description of this store plugin.

store_name: ClassVar[str] = 'mixer'

The name of this store plugin.

class HttpxSPARQL_Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: _SPARQL_Store

SPARQL store with httpx backend.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • iri – IRI of the target SPARQL endpoint.

  • headers – HTTP headers.

  • mapping – SPARQL mapping.

  • kwargs – Other keyword arguments.

class HttpxBackend(store: _SPARQL_Store, iri: T_IRI, *, headers: HTTP_Headers | None = None, **kwargs: Any)[source]

Bases: Backend

Httpx backend.

Parameters:
  • store – Parent SPARQL store.

  • iri – IRI of the target SPARQL endpoint.

  • headers – HTTP headers.

  • kwargs – Other keyword arguments.

HTTP_Headers

alias of Mapping[str, str]

__init__(store: _SPARQL_Store, iri: T_IRI, *, headers: HTTP_Headers | None = None, **kwargs: Any) None[source]
store_description: ClassVar[str] = 'SPARQL store with httpx backend'

The description of this store plugin.

store_name: ClassVar[str] = 'sparql-httpx'

The name of this store plugin.

__init__(store_name: str, iri: T_IRI, headers: HttpxSPARQL_Store.HttpxBackend.HTTP_Headers | None = None, mapping: SPARQL_Mapping | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

class RDFLibSPARQL_Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: _SPARQL_Store

SPARQL store with RDFLib backend.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Input sources.

  • format – Input source format (file extension or media type).

  • location – Relative or absolute URL of the input source.

  • file – File-like object to be used as input source.

  • data – Data to be used as input source.

  • graph – KIF graph to used as input source.

  • rdflib_graph – RDFLib graph to be used as input source.

  • skolemize – Whether to skolemize the resulting graph.

  • mapping – SPARQL mapping.

  • kwargs – Other keyword arguments.

class RDFLibBackend(store: _SPARQL_Store, *args: Args, format: str | None = None, location: str | None = None, file: BinaryIO | TextIO | None = None, data: bytes | str | None = None, graph: TGraph | None = None, rdflib_graph: rdflib.Graph | None = None, skolemize: bool | None = None, **kwargs: Any)[source]

Bases: LocalBackend

RDFLib backend.

Parameters:
  • store – Parent SPARQL store.

  • args – Input sources, files, paths, strings, or statements.

  • format – Input source format (file extension or media type).

  • location – Relative or absolute URL of the input source.

  • file – File-like object to be used as input source.

  • data – Data to be used as input source.

  • graph – KIF graph to used as input source.

  • rdflib_graph – RDFLib graph to be used as input source.

  • skolemize – Whether to skolemize the resulting graph.

  • kwargs – Other keyword arguments.

Args

Type alias for RDFLib SPARQL store arguments.

alias of BinaryIO | TextIO | InputSource | str | bytes | PurePath | Statement

__init__(store_name: str, *args: Args, format: str | None = None, location: str | None = None, file: BinaryIO | TextIO | None = None, data: bytes | str | None = None, graph: TGraph | None = None, rdflib_graph: rdflib.Graph | None = None, skolemize: bool | None = None, mapping: SPARQL_Mapping | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

store_description: ClassVar[str] = 'SPARQL store with RDFLib backend'

The description of this store plugin.

store_name: ClassVar[str] = 'sparql-rdflib'

The name of this store plugin.

class RDF_Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: MixerStore

RDF store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Input sources.

  • format – Input source format (file extension or media type).

  • location – Relative or absolute IRI of the input source.

  • file – File-like object to be used as input source.

  • data – Data to be used as input source.

  • graph – KIF graph to used as input source.

  • rdflib_graph – RDFLib graph to be used as input source.

  • skolemize – Whether to skolemize the resulting graph.

  • mapping – SPARQL mapping.

  • kwargs – Other keyword arguments.

Args

Type alias for RDFLib SPARQL store arguments.

alias of BinaryIO | TextIO | InputSource | str | bytes | PurePath | Statement

__init__(store_name: str, *args: Args, format: str | None = None, location: str | None = None, file: BinaryIO | TextIO | None = None, data: bytes | str | None = None, graph: TGraph | None = None, rdflib_graph: rdflib.Graph | None = None, skolemize: bool | None = None, mapping: SPARQL_Mapping | None = None, backend: str | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

store_description: ClassVar[str] = 'RDF store'

The description of this store plugin.

store_name: ClassVar[str] = 'rdf'

The name of this store plugin.

class DBpediaRDF_Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: RDF_Store

Alias for RDF_Store with DBpedia mappings.

__init__(store_name: str, *args: RDF_Store.Args, format: str | None = None, location: str | None = None, file: BinaryIO | TextIO | None = None, data: bytes | str | None = None, graph: TGraph | None = None, rdflib_graph: rdflib.Graph | None = None, skolemize: bool | None = None, mapping: SPARQL_Mapping | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

store_description: ClassVar[str] = 'DBpedia RDF store'

The description of this store plugin.

store_name: ClassVar[str] = 'dbpedia-rdf'

The name of this store plugin.

class PubChemRDF_Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: RDF_Store

Alias for RDF_Store with PubChem mappings.

__init__(store_name: str, *args: RDF_Store.Args, format: str | None = None, location: str | None = None, file: BinaryIO | TextIO | None = None, data: bytes | str | None = None, graph: TGraph | None = None, rdflib_graph: rdflib.Graph | None = None, skolemize: bool | None = None, mapping: SPARQL_Mapping | None = None, normalize_casrn: bool | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

store_description: ClassVar[str] = 'PubChem RDF store'

The description of this store plugin.

store_name: ClassVar[str] = 'pubchem-rdf'

The name of this store plugin.

class WikidataRDF_Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: RDF_Store

Alias for RDF_Store with Wikidata mappings.

__init__(store_name: str, *args: RDF_Store.Args, format: str | None = None, location: str | None = None, file: BinaryIO | TextIO | None = None, data: bytes | str | None = None, graph: TGraph | None = None, rdflib_graph: rdflib.Graph | None = None, skolemize: bool | None = None, mapping: SPARQL_Mapping | None = None, strict: bool | None = None, truthy: Filter.TDatatypeMask | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

store_description: ClassVar[str] = 'Wikidata RDF store'

The description of this store plugin.

store_name: ClassVar[str] = 'wikidata-rdf'

The name of this store plugin.

class SPARQL_Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: MixerStore

SPARQL store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Input sources.

  • format – Input source format (file extension or media type).

  • location – Relative or absolute IRI of the input source.

  • file – File-like object to be used as input source.

  • data – Data to be used as input source.

  • graph – KIF graph to used as input source.

  • rdflib_graph – RDFLib graph to be used as input source.

  • skolemize – Whether to skolemize the resulting graph.

  • mapping – SPARQL mapping.

  • kwargs – Other keyword arguments.

Args

Type alias for SPARQL Store arguments.

alias of IRI | String | str | BinaryIO | TextIO | InputSource | bytes | PurePath | Statement

__init__(store_name: str, *args: SPARQL_Store.Args, format: str | None = None, location: str | None = None, file: BinaryIO | TextIO | None = None, data: bytes | str | None = None, graph: TGraph | None = None, rdflib_graph: rdflib.Graph | None = None, skolemize: bool | None = None, mapping: SPARQL_Mapping | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

store_description: ClassVar[str] = 'SPARQL store'

The description of this store plugin.

store_name: ClassVar[str] = 'sparql'

The name of this store plugin.

class DBpediaSPARQL_Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: SPARQL_Store

Alias for SPARQL_Store with DBpedia mappings.

__init__(store_name: str, *args: SPARQL_Store.Args, format: str | None = None, location: str | None = None, file: BinaryIO | TextIO | None = None, data: bytes | str | None = None, graph: TGraph | None = None, rdflib_graph: rdflib.Graph | None = None, skolemize: bool | None = None, mapping: SPARQL_Mapping | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

store_description: ClassVar[str] = 'DBpedia SPARQL store'

The description of this store plugin.

store_name: ClassVar[str] = 'dbpedia-sparql'

The name of this store plugin.

class PubChemSPARQL_Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: SPARQL_Store

Alias for SPARQL_Store with PubChem mappings.

__init__(store_name: str, *args: SPARQL_Store.Args, format: str | None = None, location: str | None = None, file: BinaryIO | TextIO | None = None, data: bytes | str | None = None, graph: TGraph | None = None, rdflib_graph: rdflib.Graph | None = None, skolemize: bool | None = None, mapping: SPARQL_Mapping | None = None, normalize_casrn: bool | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

store_description: ClassVar[str] = 'PubChem SPARQL store'

The description of this store plugin.

store_name: ClassVar[str] = 'pubchem-sparql'

The name of this store plugin.

class WikidataSPARQL_Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: SPARQL_Store

Alias for SPARQL_Store with Wikidata mappings.

__init__(store_name: str, *args: SPARQL_Store.Args, format: str | None = None, location: str | None = None, file: BinaryIO | TextIO | None = None, data: bytes | str | None = None, graph: TGraph | None = None, rdflib_graph: rdflib.Graph | None = None, skolemize: bool | None = None, mapping: SPARQL_Mapping | None = None, blazegraph: bool | None = None, strict: bool | None = None, truthy: Filter.TDatatypeMask | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

store_description: ClassVar[str] = 'Wikidata SPARQL store'

The description of this store plugin.

store_name: ClassVar[str] = 'wikidata-sparql'

The name of this store plugin.

class WDQS_Store(store_name: str, *args: Any, **kwargs: Any)[source]

Bases: WikidataSPARQL_Store

Alias for WikidataSPARQL_Store with stricter mappings.

__init__(store_name: str, *args: SPARQL_Store.Args, format: str | None = None, location: str | None = None, file: BinaryIO | TextIO | None = None, data: bytes | str | None = None, graph: TGraph | None = None, rdflib_graph: rdflib.Graph | None = None, skolemize: bool | None = None, mapping: SPARQL_Mapping | None = None, truthy: Filter.TDatatypeMask | None = None, **kwargs: Any) None[source]

Initializes Store.

Parameters:
  • store_name – Name of the store plugin to instantiate.

  • args – Arguments.

  • base_filter – Base filter.

  • extra_references – Extra references to attach to statements.

  • flags – Store flags.

  • limit – Limit (maximum number) of responses.

  • page_size – Page size of paginated responses.

  • timeout – Timeout of responses (in seconds).

  • kwargs – Other keyword arguments.

store_description: ClassVar[str] = 'Wikidata query service store'

The description of this store plugin.

store_name: ClassVar[str] = 'wdqs'

The name of this store plugin.