Package org.eclipse.rdf4j.federated.evaluation

## 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:
    `SparqlTripleSource`, `SailTripleSource`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `default CloseableIteration<BindingSet,​QueryEvaluationException>` | `getStatements​(String preparedQuery, QueryType queryType, QueryInfo queryInfo)` | Deprecated.
    `CloseableIteration<BindingSet,​QueryEvaluationException>` | `getStatements​(String preparedQuery, BindingSet bindings, FilterValueExpr filterExpr, QueryInfo queryInfo)` | Evaluate the prepared query (SPARQL query as String) on the provided endpoint.
    `CloseableIteration<BindingSet,​QueryEvaluationException>` | `getStatements​(String preparedQuery, BindingSet queryBindings, QueryType queryType, QueryInfo queryInfo)` | Evaluate a given SPARQL query of the provided query type at the given source.
    `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.
    `default boolean` | `usePreparedQuery()` | Deprecated. replaced with `usePreparedQuery(StatementPattern, QueryInfo)`, to be removed in 4.0
    `boolean` | `usePreparedQuery​(StatementPattern stmt, QueryInfo queryInfo)` |

- - ### Method Detail

    - #### getStatements

          CloseableIteration<BindingSet,​QueryEvaluationException> 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 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

          CloseableIteration<BindingSet,​QueryEvaluationException> 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 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

          @Deprecated
          default CloseableIteration<BindingSet,​QueryEvaluationException> getStatements​(String preparedQuery,
                                                                                              QueryType queryType,
                                                                                              QueryInfo queryInfo)
                                                                                       throws RepositoryException,
                                                                                              MalformedQueryException,
                                                                                              QueryEvaluationException

      Deprecated.
      Evaluate a given SPARQL query of the provided query type at the given source.
      Parameters:
        `preparedQuery` -
        `queryType` -
        `queryInfo` -
      Returns:
        the statements
      Throws:
        `RepositoryException`
        `MalformedQueryException`
        `QueryEvaluationException`

    - #### getStatements

          CloseableIteration<BindingSet,​QueryEvaluationException> 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, use `EmptyBindingSet` if there are none
        `queryType` -
        `queryInfo` -
      Returns:
        the statements
      Throws:
        `RepositoryException`
        `MalformedQueryException`
        `QueryEvaluationException`

    - #### getStatements

          CloseableIteration<BindingSet,​QueryEvaluationException> 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 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

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

      Return the statements matching the given pattern as a `Statement` 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, an `EmptyBindingSet` 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 given `ExclusiveTupleExpr`, e.g. for an `ExclusiveGroup` with a list of Statements.
      Parameters:
        `group` -
        `bindings` -
      Returns:
        whether the repository can return results
      Throws:
        `RepositoryException`
        `MalformedQueryException`
        `QueryEvaluationException`

    - #### usePreparedQuery

          @Deprecated
          default boolean usePreparedQuery()

      Deprecated.
      replaced with `usePreparedQuery(StatementPattern, QueryInfo)`, to be removed in 4.0
      Returns:
        true if a prepared query is to be used preferably, false otherwise

    - #### usePreparedQuery

          boolean usePreparedQuery​(StatementPattern stmt,
                                   QueryInfo queryInfo)

      Parameters:
        `stmt` -
        `queryInfo` -
      Returns:
        true if a prepared query is to be used preferably, false otherwise