Package org.eclipse.rdf4j.federated.optimizer

## Class StatementGroupAndJoinOptimizer

- java.lang.Object
- - org.eclipse.rdf4j.query.algebra.helpers.AbstractQueryModelVisitor<OptimizationException>
  - - org.eclipse.rdf4j.federated.optimizer.StatementGroupAndJoinOptimizer

- All Implemented Interfaces:
    `FedXOptimizer`, `QueryModelVisitor<OptimizationException>`

      public class StatementGroupAndJoinOptimizer
      extends AbstractQueryModelVisitor<OptimizationException>
      implements FedXOptimizer

  Optimizer with the following tasks: 1. Group `ExclusiveStatement` into `ExclusiveGroup` 2. Adjust the join order using `DefaultFedXCostModel`
  Author:
    as

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected QueryInfo` | `queryInfo` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StatementGroupAndJoinOptimizer​(QueryInfo queryInfo, FedXCostModel costModel)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected double` | `estimateCost​(TupleExpr tupleExpr, Set<String> joinVars)` |
    `protected List<TupleExpr>` | `formGroups​(List<TupleExpr> originalArgs)` | Group `ExclusiveStatement`s having the same source into an `ExclusiveGroup`.
    `void` | `meet​(Service tupleExpr)` |
    `protected void` | `meetNJoin​(NJoin node)` |
    `void` | `meetOther​(QueryModelNode node)` |
    `void` | `optimize​(TupleExpr tupleExpr)` | Optimize the provided tuple expression
    `protected List<TupleExpr>` | `optimizeJoinOrder​(List<TupleExpr> joinArgs)` | Join Order Optimizer Group -> Statements according to number of free Variables Additional Heuristics: - ExclusiveGroups are cheaper than any other subquery - owned statements are cheaper if they have a single free variable

    - ### Methods inherited from class org.eclipse.rdf4j.query.algebra.helpers.AbstractQueryModelVisitor

      `meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meet, meetBinaryTupleOperator, meetBinaryValueOperator, meetCompareSubQueryValueOperator, meetNAryValueOperator, meetNode, meetSubQueryValueOperator, meetUnaryTupleOperator, meetUnaryValueOperator, meetUpdateExpr`

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

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

- - ### Field Detail

    - #### queryInfo

          protected final QueryInfo queryInfo

  - ### Constructor Detail

    - #### StatementGroupAndJoinOptimizer

          public StatementGroupAndJoinOptimizer​(QueryInfo queryInfo,
                                                FedXCostModel costModel)

  - ### Method Detail

    - #### optimize

          public void optimize​(TupleExpr tupleExpr)

      Description copied from interface: `FedXOptimizer`
      Optimize the provided tuple expression
      Specified by:
        `optimize` in interface `FedXOptimizer`

    - #### meet

          public void meet​(Service tupleExpr)

      Specified by:
        `meet` in interface `QueryModelVisitor<OptimizationException>`
      Overrides:
        `meet` in class `AbstractQueryModelVisitor<OptimizationException>`

    - #### meetOther

          public void meetOther​(QueryModelNode node)

      Specified by:
        `meetOther` in interface `QueryModelVisitor<OptimizationException>`
      Overrides:
        `meetOther` in class `AbstractQueryModelVisitor<OptimizationException>`

    - #### meetNJoin

          protected void meetNJoin​(NJoin node)

    - #### formGroups

          protected List<TupleExpr> formGroups​(List<TupleExpr> originalArgs)

      Group `ExclusiveStatement`s having the same source into an `ExclusiveGroup`.
      Parameters:
        `originalArgs` -
      Returns:
        the new (potentially grouped) join arguments. If empty, the join will not produce any results.

    - #### optimizeJoinOrder

          protected List<TupleExpr> optimizeJoinOrder​(List<TupleExpr> joinArgs)

      Join Order Optimizer Group -> Statements according to number of free Variables Additional Heuristics: - ExclusiveGroups are cheaper than any other subquery - owned statements are cheaper if they have a single free variable
      Parameters:
        `joinArgs` -
      Returns:

    - #### estimateCost

          protected double estimateCost​(TupleExpr tupleExpr,
                                        Set<String> joinVars)