Interface TripleSource
- All Known Implementing Classes:
SailTripleSource
,SparqlTripleSource
,TripleSourceBase
public interface TripleSource
Interface for implementations of triple sources. Particular implementations define how to evaluate the expression on
the endpoint. Different implementations might be necessary depending on the underlying repository.
- Author:
- Andreas Schwarte
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetStatements
(String preparedQuery, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo) Evaluate the prepared query (SPARQL query as String) on the provided endpoint.getStatements
(String preparedQuery, BindingSet queryBindings, QueryType queryType, QueryInfo queryInfo) Evaluate a given SPARQL query of the provided query type at the given source.Return the statements matching the given pattern as aStatement
iteration.getStatements
(StatementPattern stmt, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo) Evaluate the query expression on the provided endpoint.getStatements
(TupleExpr preparedQuery, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo) Evaluate the prepared query in its internal representation on the provided endpoint.boolean
hasStatements
(ExclusiveTupleExpr expr, BindingSet bindings) Check if the repository can return results for the givenExclusiveTupleExpr
, e.g.boolean
Check if the repository can return results for the given triple pattern represented by subj, pred and objboolean
hasStatements
(StatementPattern stmt, BindingSet bindings, QueryInfo queryInfo, Dataset dataset) Check if the provided statement can return results.boolean
usePreparedQuery
(StatementPattern stmt, QueryInfo queryInfo)
-
Method Details
-
getStatements
CloseableIteration<BindingSet> getStatements(TupleExpr preparedQuery, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo) throws RepositoryException, MalformedQueryException, QueryEvaluationException Evaluate the prepared query in its internal representation on the provided endpoint.- Parameters:
preparedQuery
- a prepared query to evaluatebindings
- the bindings to usefilterExpr
- the filter expression to apply or null if there is no filter or if it is evaluated already- Returns:
- the resulting iteration
- Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException
-
getStatements
CloseableIteration<BindingSet> getStatements(String preparedQuery, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo) throws RepositoryException, MalformedQueryException, QueryEvaluationException Evaluate the prepared query (SPARQL query as String) on the provided endpoint.- Parameters:
preparedQuery
- a prepared query to evaluate (SPARQL query as String)bindings
- the bindings to usefilterExpr
- the filter expression to apply or null if there is no filter or if it is evaluated already- Returns:
- the resulting iteration
- Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException
-
getStatements
CloseableIteration<BindingSet> getStatements(String preparedQuery, BindingSet queryBindings, QueryType queryType, QueryInfo queryInfo) throws RepositoryException, MalformedQueryException, QueryEvaluationException Evaluate a given SPARQL query of the provided query type at the given source.- Parameters:
preparedQuery
-queryBindings
- optional query bindings, useEmptyBindingSet
if there are nonequeryType
-queryInfo
-- Returns:
- the statements
- Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException
-
getStatements
CloseableIteration<BindingSet> getStatements(StatementPattern stmt, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo) throws RepositoryException, MalformedQueryException, QueryEvaluationException Evaluate the query expression on the provided endpoint.- Parameters:
stmt
- the stmt expression to evaluatebindings
- the bindings to usefilterExpr
- the filter expression to apply or null if there is no filter or if it is evaluated already- Returns:
- the resulting iteration
- Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException
-
getStatements
CloseableIteration<Statement> getStatements(Resource subj, IRI pred, Value obj, QueryInfo queryInfo, Resource... contexts) throws RepositoryException, MalformedQueryException, QueryEvaluationException Return the statements matching the given pattern as aStatement
iteration.- Parameters:
subj
-pred
-obj
-contexts
-- Returns:
- the resulting iteration
- Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException
-
hasStatements
boolean hasStatements(StatementPattern stmt, BindingSet bindings, QueryInfo queryInfo, Dataset dataset) throws RepositoryException, MalformedQueryException, QueryEvaluationException Check if the provided statement can return results.- Parameters:
stmt
-bindings
- a binding set. in case no bindings are present, anEmptyBindingSet
can be used (i.e. never null)queryInfo
-dataset
-- Returns:
- whether the source can return results
- Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException
-
hasStatements
boolean hasStatements(Resource subj, IRI pred, Value obj, QueryInfo queryInfo, Resource... contexts) throws RepositoryException Check if the repository can return results for the given triple pattern represented by subj, pred and obj- Parameters:
subj
-pred
-obj
-queryInfo
-contexts
-- Returns:
- whether the source can provide results
- Throws:
RepositoryException
-
hasStatements
boolean hasStatements(ExclusiveTupleExpr expr, BindingSet bindings) throws RepositoryException, MalformedQueryException, QueryEvaluationException Check if the repository can return results for the givenExclusiveTupleExpr
, e.g. for anExclusiveGroup
with a list of Statements.- Parameters:
bindings
-group
-- Returns:
- whether the repository can return results
- Throws:
RepositoryException
MalformedQueryException
QueryEvaluationException
-
usePreparedQuery
- Parameters:
stmt
-queryInfo
-- Returns:
- true if a prepared query is to be used preferably, false otherwise
-