public final class StaticOptimizer extends Object
DefaultEvaluationPlan2
, but lined up with the AST API instead of the
Rule and IPredicate API.Constructor and Description |
---|
StaticOptimizer(StaticOptimizer parent,
List<IReorderableNode> nodes) |
Modifier and Type | Method and Description |
---|---|
long |
cardinality(int tailIndex)
Return the cardinality of a particular tail, which is the range count if
not optional and infinite if optional.
|
protected long |
computeJoinCardinality(com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d1,
com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d2)
This is the secret sauce.
|
long |
getCardinality() |
protected int |
getNextTailThatSharesVarsWithAncestry()
Get the next tail (unused, non-optional) that shares a var with the
ancestry.
|
int[] |
getOrder() |
protected Set<String> |
getVars(int tail)
Get the named variables for a given tail.
|
protected boolean |
hasSharedVars(com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d1,
com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d2)
Look for shared variables.
|
protected boolean |
hasUnsharedVars(com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d1,
com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d2)
Look for unshared variables.
|
long |
rangeCount(int tailIndex)
Return the range count for the predicate, ignoring any bindings.
|
protected boolean |
sharesVarsWithAncestry(int tail)
Check to see if the specified tail shares any variables with the
ancestry.
|
String |
toString() |
public StaticOptimizer(StaticOptimizer parent, List<IReorderableNode> nodes)
public int[] getOrder()
public long rangeCount(int tailIndex)
tailIndex
- The index of the predicate in the tail of the rule.public long cardinality(int tailIndex)
protected long computeJoinCardinality(com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d1, com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d2)
TODO: Any join involving an optional will have infinite cardinality, so that optionals get placed at the end.
d1
- the first join dimensiond2
- the second join dimensionprotected Set<String> getVars(int tail)
tail
- the tailprotected boolean hasSharedVars(com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d1, com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d2)
d1
- the first join dimensiond2
- the second join dimensionprotected boolean sharesVarsWithAncestry(int tail)
protected int getNextTailThatSharesVarsWithAncestry()
protected boolean hasUnsharedVars(com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d1, com.bigdata.rdf.sparql.ast.optimizers.StaticOptimizer.IJoinDimension d2)
d1
- the first join dimensiond2
- the second join dimensionpublic long getCardinality()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.