Class QueryJoinOptimizer.JoinVisitor
java.lang.Object
org.eclipse.rdf4j.query.algebra.helpers.AbstractSimpleQueryModelVisitor<RuntimeException>
org.eclipse.rdf4j.query.algebra.evaluation.optimizer.QueryJoinOptimizer.JoinVisitor
- All Implemented Interfaces:
QueryModelVisitor<RuntimeException>
- Enclosing class:
QueryJoinOptimizer
protected class QueryJoinOptimizer.JoinVisitor
extends AbstractSimpleQueryModelVisitor<RuntimeException>
This can be extended by subclasses to allow for adjustments to the optimization process.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfillVarFreqMap
(List<Var> varList, M varFreqMap) protected int
getJoinArgs
(TupleExpr tupleExpr, L joinArgs) getStatementPatternVars
(TupleExpr tupleExpr) getSubSelects
(List<TupleExpr> expressions) This method returns all direct sub-selects in the given list of expressions.protected double
getTupleExprCost
(TupleExpr tupleExpr, Map<TupleExpr, Double> cardinalityMap, Map<TupleExpr, List<Var>> varsMap, Map<Var, Integer> varFreqMap) getUnboundVars
(List<Var> vars) void
void
void
meet
(StatementPattern node) reorderSubselects
(List<TupleExpr> subSelects) Determines an optimal ordering of subselect join arguments, based on variable bindings.protected TupleExpr
selectNextTupleExpr
(List<TupleExpr> expressions, Map<TupleExpr, Double> cardinalityMap, Map<TupleExpr, List<Var>> varsMap, Map<Var, Integer> varFreqMap) Selects from a list of tuple expressions the next tuple expression that should be evaluated.Methods inherited from class org.eclipse.rdf4j.query.algebra.helpers.AbstractSimpleQueryModelVisitor
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, meetOther, meetSubQueryValueOperator, meetUnaryTupleOperator, meetUnaryValueOperator, meetUnsupported, meetUpdateExpr
-
Constructor Details
-
JoinVisitor
protected JoinVisitor()
-
-
Method Details
-
meet
- Specified by:
meet
in interfaceQueryModelVisitor<RuntimeException>
- Overrides:
meet
in classAbstractSimpleQueryModelVisitor<RuntimeException>
-
meet
- Specified by:
meet
in interfaceQueryModelVisitor<RuntimeException>
- Overrides:
meet
in classAbstractSimpleQueryModelVisitor<RuntimeException>
- Throws:
RuntimeException
-
meet
- Specified by:
meet
in interfaceQueryModelVisitor<RuntimeException>
- Overrides:
meet
in classAbstractSimpleQueryModelVisitor<RuntimeException>
-
getJoinArgs
-
getStatementPatternVars
-
fillVarFreqMap
-
getSubSelects
-
reorderSubselects
Determines an optimal ordering of subselect join arguments, based on variable bindings. An ordering is considered optimal if for each consecutive element it holds that first of all its shared variables with all previous elements is maximized, and second, the union of all its variables with all previous elements is maximized.Example: reordering
[f] [a b c] [e f] [a d] [b e]
should result in:
[a b c] [a d] [b e] [e f] [f]
- Parameters:
subSelects
- the original ordering of expressions- Returns:
- the optimized ordering of expressions
-
selectNextTupleExpr
protected TupleExpr selectNextTupleExpr(List<TupleExpr> expressions, Map<TupleExpr, Double> cardinalityMap, Map<TupleExpr, List<Var>> varsMap, Map<Var, Integer> varFreqMap) Selects from a list of tuple expressions the next tuple expression that should be evaluated. This method selects the tuple expression with highest number of bound variables, preferring variables that have been bound in other tuple expressions over variables with a fixed value. -
getTupleExprCost
-
getUnboundVars
-
getForeignVarFreq
-