frex.stores package

Submodules

frex.stores.local_graph module

class frex.stores.local_graph.LocalGraph(*, file_paths: Tuple[pathlib.Path, ...])[source]

Bases: frex.stores.sparql_queryable.SparqlQueryable

LocalGraph should be used to store and access rdf graphs locally.

get_graph() rdflib.graph.Graph[source]

Get the local Graph object.

Returns

The local Graph object

load_graph_file(*, file_path: pathlib.Path)[source]

Load a piece of an RDF graph from a file.

Parameters

file_path – the path to the file containing the RDF graph to load.

Returns

None

query(*, sparql: str) rdflib.query.Result[source]

Query the local graph object.

Parameters

sparql – A string containing valid SPARQL to query the graph.

Returns

A Result containing the result from calling the SPARQL query.

frex.stores.remote_graph module

class frex.stores.remote_graph.RemoteGraph(*, endpoint: str)[source]

Bases: frex.stores.sparql_queryable.SparqlQueryable

RemoteGraph is used for accessing remote SPARQL endpoints.

query(*, sparql: str) rdflib.query.Result[source]

Query the remote graph using the API endpoint.

Parameters

sparql – A string containing valid SPARQL to query the graph.

Returns

A Result containing the result from calling the SPARQL query.

frex.stores.request_result_cache module

class frex.stores.request_result_cache.RequestResultCache(*, result: rdflib.query.Result)[source]

Bases: frex.stores.result_cache.ResultCache

RequestResultCache stores a local graph whose contents are the result of a query to some sparql queryable. After a single call to the graph containing relevant data, the contents of RequestResultCache should be used by the system for the remaining data formatting and retrieval functions.

get_graph() rdflib.graph.Graph[source]

Get the local Graph object.

Returns

The local Graph object

query(*, sparql: str) rdflib.query.Result[source]

Query the local graph object.

Parameters

sparql – A string containing valid SPARQL to query the graph.

Returns

A Result containing the result from calling the SPARQL query.

frex.stores.result_cache module

class frex.stores.result_cache.ResultCache[source]

Bases: frex.stores.sparql_queryable.SparqlQueryable, abc.ABC

abstract get_graph() rdflib.graph.Graph[source]

Get the local Graph object.

Returns

The local Graph object

frex.stores.sparql_queryable module

class frex.stores.sparql_queryable.SparqlQueryable[source]

Bases: abc.ABC

SparqlQueryable is the base class for stores that can be queried in some way using SPARQL queries.

abstract query(*, sparql: str) rdflib.query.Result[source]

Query the sparql queryable and retrieve a result.

Parameters

sparql – A string containing valid SPARQL to query.

Returns

A Result containing the result from calling the SPARQL query.

Module contents