Package org.eclipse.rdf4j.federated.evaluation

## Class SparqlFederationEvalStrategy

- java.lang.Object
- - org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy
  - - org.eclipse.rdf4j.federated.evaluation.FederationEvalStrategy
    - - org.eclipse.rdf4j.federated.evaluation.SparqlFederationEvalStrategy

- All Implemented Interfaces:
    `EvaluationStrategy`, `FederatedServiceResolver`, `FederatedServiceResolverClient`, `UUIDable`

      public class SparqlFederationEvalStrategy
      extends FederationEvalStrategy

  Implementation of a federation evaluation strategy which provides some special optimizations for SPARQL (remote) endpoints. The most important optimization is to used prepared SPARQL Queries that are already created using Strings.

  Joins are executed using `ControlledWorkerBoundJoin`.

  This implementation uses the SPARQL 1.1 VALUES operator for the bound-join evaluation

  s
  Author:
    Andreas Schwarte

- - ### Field Summary

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

      `cache, executor, federationContext`

    - ### Fields inherited from class org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy

      `dataset, serviceResolver, tripleSource`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SparqlFederationEvalStrategy​(FederationContext federationContext)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `CloseableIteration<BindingSet,​QueryEvaluationException>` | `evaluateBoundJoinStatementPattern​(StatementTupleExpr stmt, List<BindingSet> bindings)` | Evaluate a bound join at the relevant endpoint, i.e.
    `protected CloseableIteration<BindingSet,​QueryEvaluationException>` | `evaluateBoundJoinStatementPattern_UNION​(StatementTupleExpr stmt, List<BindingSet> bindings)` | Deprecated.
    `CloseableIteration<BindingSet,​QueryEvaluationException>` | `evaluateExclusiveGroup​(ExclusiveGroup group, BindingSet bindings)` |
    `CloseableIteration<BindingSet,​QueryEvaluationException>` | `evaluateGroupedCheck​(CheckStatementPattern stmt, List<BindingSet> bindings)` | Perform a grouped check at the relevant endpoints, i.e.
    `CloseableIteration<BindingSet,​QueryEvaluationException>` | `executeJoin​(ControlledWorkerScheduler<BindingSet> joinScheduler, CloseableIteration<BindingSet,​QueryEvaluationException> leftIter, TupleExpr rightArg, Set<String> joinVars, BindingSet bindings, QueryInfo queryInfo)` | Execute the join in a separate thread using some join executor.

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

      `evaluate, evaluate, evaluate, evaluate, evaluate, evaluateAtStatementSources, evaluateAtStatementSources, evaluateAtStatementSources, evaluateExclusiveTupleExpr, evaluateLeftJoin, evaluateNaryUnion, evaluateNJoin, evaluateService, evaluateService, evaluateSingleSourceQuery, getStatements, optimize, optimizeExclusiveExpressions, optimizeJoinOrder, performSourceSelection, precompile, precompile, prepare, prepare, prepareExclusiveTupleExpr, prepareLeftJoin, prepareNaryUnion, prepareNJoin, propagateServices`

    - ### Methods inherited from class org.eclipse.rdf4j.query.algebra.evaluation.impl.StrictEvaluationStrategy

      `evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, getLimit, getService, getUUID, getVarValue, isReducedOrDistinct, isTrue, isTrue, precompile, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, prepare, setFederatedServiceResolver, setOptimizerPipeline, setTrackResultSize, setTrackTime, supplyBinaryValueEvaluation, supplyUnaryValueEvaluation`

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

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

    - ### Methods inherited from interface org.eclipse.rdf4j.query.algebra.evaluation.EvaluationStrategy

      `makeQueue, makeSet`

- - ### Constructor Detail

    - #### SparqlFederationEvalStrategy

          public SparqlFederationEvalStrategy​(FederationContext federationContext)

  - ### Method Detail

    - #### evaluateBoundJoinStatementPattern

          public CloseableIteration<BindingSet,​QueryEvaluationException> evaluateBoundJoinStatementPattern​(StatementTupleExpr stmt,
                                                                                                                 List<BindingSet> bindings)
                                                                                                          throws QueryEvaluationException

      Description copied from class: `FederationEvalStrategy`
      Evaluate a bound join at the relevant endpoint, i.e. i.e. for a group of bindings retrieve results for the bound statement from the relevant endpoints
      Specified by:
        `evaluateBoundJoinStatementPattern` in class `FederationEvalStrategy`
      Returns:
        the result iteration
      Throws:
        `QueryEvaluationException`

    - #### evaluateBoundJoinStatementPattern_UNION

          protected CloseableIteration<BindingSet,​QueryEvaluationException> evaluateBoundJoinStatementPattern_UNION​(StatementTupleExpr stmt,
                                                                                                                          List<BindingSet> bindings)
                                                                                                                   throws QueryEvaluationException

      Deprecated.
      Alternative evaluation implementation using UNION. Nowadays we use a VALUES clause based implementation
      Throws:
        `QueryEvaluationException`

    - #### evaluateGroupedCheck

          public CloseableIteration<BindingSet,​QueryEvaluationException> evaluateGroupedCheck​(CheckStatementPattern stmt,
                                                                                                    List<BindingSet> bindings)
                                                                                             throws QueryEvaluationException

      Description copied from class: `FederationEvalStrategy`
      Perform a grouped check at the relevant endpoints, i.e. for a group of bindings keep only those for which at least one endpoint provides a result to the bound statement.
      Specified by:
        `evaluateGroupedCheck` in class `FederationEvalStrategy`
      Returns:
        the result iteration
      Throws:
        `QueryEvaluationException`

    - #### executeJoin

          public CloseableIteration<BindingSet,​QueryEvaluationException> executeJoin​(ControlledWorkerScheduler<BindingSet> joinScheduler,
                                                                                           CloseableIteration<BindingSet,​QueryEvaluationException> leftIter,
                                                                                           TupleExpr rightArg,
                                                                                           Set<String> joinVars,
                                                                                           BindingSet bindings,
                                                                                           QueryInfo queryInfo)
                                                                                    throws QueryEvaluationException

      Description copied from class: `FederationEvalStrategy`
      Execute the join in a separate thread using some join executor. Join executors are for instance: - `SynchronousJoin` - `SynchronousBoundJoin` - `ControlledWorkerJoin` - `ControlledWorkerBoundJoin` For endpoint federation use controlled worker bound join, for local federation use controlled worker join. The other operators are there for completeness. Use `FederationEvalStrategy.executor` to execute the join (it is a runnable).
      Specified by:
        `executeJoin` in class `FederationEvalStrategy`
      Returns:
        the result
      Throws:
        `QueryEvaluationException`

    - #### evaluateExclusiveGroup

          public CloseableIteration<BindingSet,​QueryEvaluationException> evaluateExclusiveGroup​(ExclusiveGroup group,
                                                                                                      BindingSet bindings)
                                                                                               throws RepositoryException,
                                                                                                      MalformedQueryException,
                                                                                                      QueryEvaluationException

      Specified by:
        `evaluateExclusiveGroup` in class `FederationEvalStrategy`
      Throws:
        `RepositoryException`
        `MalformedQueryException`
        `QueryEvaluationException`