pyrdf2vec.connectors module¶
- class pyrdf2vec.connectors.Connector(endpoint, *, cache=NOTHING)¶
Bases:
abc.ABC
Base class of the connectors.
- _asession¶
The aiohttp session to use for asynchrone requests. Defaults to None.
- _headers¶
The HTTP headers to use. Defaults to {“Accept”: “application/sparql-results+json”}.
- cache¶
The policy and size cache to use. Defaults to TTLCache(maxsize=1024, ttl=1200).
- endpoint¶
The endpoint to execute the queries.
- abstract fetch(query)¶
Fetchs the result of a query.
- Parameters
query (
str
) – The query to fetch the result- Returns
The JSON response.
- Raises
NotImplementedError – If this method is called, without having provided an implementation.
- class pyrdf2vec.connectors.SPARQLConnector(endpoint, *, cache=NOTHING)¶
Bases:
pyrdf2vec.connectors.Connector
Represents a SPARQL connector.
- _asession¶
The aiohttp session to use for asynchrone requests. Defaults to None.
- _headers¶
The HTTP headers to use. Defaults to {“Accept”: “application/sparql-results+json”}.
- cache¶
The policy and size cache to use. Defaults to connectors.TTLCache(maxsize=1024, ttl=1200).
- endpoint¶
The endpoint to execute the queries.
- async afetch(queries)¶
Fetchs the result of SPARQL queries asynchronously.
- fetch(query)¶
Fetchs the result of a SPARQL query.
- get_query(entity, preds=None)¶
Gets the SPARQL query for an entity.