Package org.eclipse.rdf4j.federated.evaluation

## Class SparqlTripleSource

- java.lang.Object
- - org.eclipse.rdf4j.federated.evaluation.TripleSourceBase
  - - org.eclipse.rdf4j.federated.evaluation.SparqlTripleSource

- All Implemented Interfaces:
    `TripleSource`

      public class SparqlTripleSource
      extends TripleSourceBase
      implements TripleSource

  A triple source to be used for (remote) SPARQL endpoints.

  This triple source supports the `SparqlEndpointConfiguration` for defining whether ASK queries are to be used for source selection. The query result of `TripleSourceBase.getStatements(String, BindingSet, FilterValueExpr, QueryInfo)` is wrapped in a `ConsumingIteration` to avoid blocking behavior..

  Author:
    Andreas Schwarte

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.rdf4j.federated.evaluation.TripleSourceBase

      `TripleSourceBase.ConnectionOperation<T>, TripleSourceBase.ResultHolder<T>`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.rdf4j.federated.evaluation.TripleSourceBase

      `endpoint, federationContext, monitoringService, strategy`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `CloseableIteration<Statement,​QueryEvaluationException>` | `getStatements​(Resource subj, IRI pred, Value obj, QueryInfo queryInfo, Resource... contexts)` | Return the statements matching the given pattern as a `Statement` iteration.
    `CloseableIteration<BindingSet,​QueryEvaluationException>` | `getStatements​(StatementPattern stmt, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo)` | Evaluate the query expression on the provided endpoint.
    `CloseableIteration<BindingSet,​QueryEvaluationException>` | `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 given `ExclusiveTupleExpr`, e.g.
    `boolean` | `hasStatements​(Resource subj, IRI pred, Value obj, QueryInfo queryInfo, Resource... contexts)` | Check if the repository can return results for the given triple pattern represented by subj, pred and obj
    `boolean` | `hasStatements​(StatementPattern stmt, BindingSet bindings, QueryInfo queryInfo, Dataset dataset)` | Check if the provided statement can return results.
    `String` | `toString()` |
    `boolean` | `usePreparedQuery​(StatementPattern stmt, QueryInfo queryInfo)` |

    - ### Methods inherited from class org.eclipse.rdf4j.federated.evaluation.TripleSourceBase

      `applyMaxExecutionTimeUpperBound, configureInference, getStatements, getStatements, monitorRemoteRequest, withConnection`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.federated.evaluation.TripleSource

      `getStatements, getStatements, getStatements, usePreparedQuery`

- - ### Method Detail

    - #### getStatements

          public CloseableIteration<BindingSet,​QueryEvaluationException> getStatements​(StatementPattern stmt,
                                                                                             BindingSet bindings,
                                                                                             FilterValueExpr filterExpr,
                                                                                             QueryInfo queryInfo)
                                                                                      throws RepositoryException,
                                                                                             MalformedQueryException,
                                                                                             QueryEvaluationException

      Description copied from interface: `TripleSource`
      Evaluate the query expression on the provided endpoint.
      Specified by:
        `getStatements` in interface `TripleSource`
      Parameters:
        `stmt` - the stmt expression to evaluate
        `bindings` - the bindings to use
        `filterExpr` - 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`

    - #### hasStatements

          public boolean hasStatements​(Resource subj,
                                       IRI pred,
                                       Value obj,
                                       QueryInfo queryInfo,
                                       Resource... contexts)
                                throws RepositoryException

      Description copied from interface: `TripleSource`
      Check if the repository can return results for the given triple pattern represented by subj, pred and obj
      Specified by:
        `hasStatements` in interface `TripleSource`
      Overrides:
        `hasStatements` in class `TripleSourceBase`
      Returns:
        whether the source can provide results
      Throws:
        `RepositoryException`

    - #### hasStatements

          public boolean hasStatements​(StatementPattern stmt,
                                       BindingSet bindings,
                                       QueryInfo queryInfo,
                                       Dataset dataset)
                                throws RepositoryException,
                                       MalformedQueryException,
                                       QueryEvaluationException

      Description copied from interface: `TripleSource`
      Check if the provided statement can return results.
      Specified by:
        `hasStatements` in interface `TripleSource`
        `bindings` - a binding set. in case no bindings are present, an `EmptyBindingSet` can be used (i.e. never null)
      Returns:
        whether the source can return results
      Throws:
        `RepositoryException`
        `MalformedQueryException`
        `QueryEvaluationException`

    - #### hasStatements

          public boolean hasStatements​(ExclusiveTupleExpr expr,
                                       BindingSet bindings)
                                throws RepositoryException,
                                       MalformedQueryException,
                                       QueryEvaluationException

      Description copied from interface: `TripleSource`
      Check if the repository can return results for the given `ExclusiveTupleExpr`, e.g. for an `ExclusiveGroup` with a list of Statements.
      Specified by:
        `hasStatements` in interface `TripleSource`
      Overrides:
        `hasStatements` in class `TripleSourceBase`
      Returns:
        whether the repository can return results
      Throws:
        `RepositoryException`
        `MalformedQueryException`
        `QueryEvaluationException`

    - #### usePreparedQuery

          public boolean usePreparedQuery​(StatementPattern stmt,
                                          QueryInfo queryInfo)

      Specified by:
        `usePreparedQuery` in interface `TripleSource`
      Returns:
        true if a prepared query is to be used preferably, false otherwise

    - #### getStatements

          public CloseableIteration<BindingSet,​QueryEvaluationException> getStatements​(TupleExpr preparedQuery,
                                                                                             BindingSet bindings,
                                                                                             FilterValueExpr filterExpr,
                                                                                             QueryInfo queryInfo)
                                                                                      throws RepositoryException,
                                                                                             MalformedQueryException,
                                                                                             QueryEvaluationException

      Description copied from interface: `TripleSource`
      Evaluate the prepared query in its internal representation on the provided endpoint.
      Specified by:
        `getStatements` in interface `TripleSource`
      Parameters:
        `preparedQuery` - a prepared query to evaluate
        `bindings` - the bindings to use
        `filterExpr` - 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

          public CloseableIteration<Statement,​QueryEvaluationException> getStatements​(Resource subj,
                                                                                            IRI pred,
                                                                                            Value obj,
                                                                                            QueryInfo queryInfo,
                                                                                            Resource... contexts)
                                                                                     throws RepositoryException,
                                                                                            MalformedQueryException,
                                                                                            QueryEvaluationException

      Description copied from interface: `TripleSource`
      Return the statements matching the given pattern as a `Statement` iteration.
      Specified by:
        `getStatements` in interface `TripleSource`
      Returns:
        the resulting iteration
      Throws:
        `RepositoryException`
        `MalformedQueryException`
        `QueryEvaluationException`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`