|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.ontopia.topicmaps.query.impl.utils.QueryOptimizer
public class QueryOptimizer
INTERNAL: An optimizer class that knows how to rewrite queries to equivalent, but more efficient queries. Used by the different query processor implementations to improve performance. Note that the only optimizations this class should perform are those which are independent of the tolog implementation used and which only rely on the semantics of tolog.
The only optimizations performed at the moment are:
Nested Class Summary | |
---|---|
static class |
QueryOptimizer.AbstractQueryOptimizer
|
static class |
QueryOptimizer.AddTypeToRolePlayer
INTERNAL: |
static class |
QueryOptimizer.HierarchyWalker
Replaces simple recursive rules with a more efficient custom implementation that just wraps the recursive step. |
static class |
QueryOptimizer.NextPreviousOptimizer
INTERNAL: Optimizes queries that look for the next or the previous value in a sequence from a given start value to not load all values and then do it the hard way, but instead to use a sorted index. |
static class |
QueryOptimizer.PumpClause
|
static class |
QueryOptimizer.PumpPredicate
|
static class |
QueryOptimizer.RecursivePruner
This optimizer adds RemoveDuplicatesPredicate on both sides of recursive calls within predicate rules. |
static class |
QueryOptimizer.Reorderer
INTERNAL: Optimizes the query by reordering the clauses into the optimal order for evaluation. |
static class |
QueryOptimizer.RuleInliner
INTERNAL: Optimizes the query by inlining all rules which are simple aliases for a single predicate. |
static class |
QueryOptimizer.StringPrefixOptimizer
INTERNAL: Optimizes queries that do lookup of occurrences by string value, then filter the string value by a prefix. |
static class |
QueryOptimizer.TypeConflictResolver
Finds cases of conflicting variables and resolves them by replacing predicates which can never succeed with DynamicFailurePredicate. |
Constructor Summary | |
---|---|
QueryOptimizer()
|
Method Summary | |
---|---|
void |
addOptimizer(QueryOptimizerIF optimizer)
|
static QueryOptimizer |
getOptimizer(TologQuery query)
INTERNAL: Get hold of an query optimizer instance. |
java.util.List |
optimize(java.util.List clauses,
QueryContext context)
|
ParsedRule |
optimize(ParsedRule rule)
|
TologQuery |
optimize(TologQuery query)
|
static java.util.List |
reorder(java.util.List qclauses,
java.util.Set boundvars,
java.util.Set literalvars,
java.lang.String rulename,
CostEstimator estimator)
INTERNAL: Optimizes the order of the query clauses in a context where the given variables are bound. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueryOptimizer()
Method Detail |
---|
public static QueryOptimizer getOptimizer(TologQuery query)
query
- The parsed query.public void addOptimizer(QueryOptimizerIF optimizer)
public TologQuery optimize(TologQuery query) throws InvalidQueryException
InvalidQueryException
public ParsedRule optimize(ParsedRule rule) throws InvalidQueryException
InvalidQueryException
public java.util.List optimize(java.util.List clauses, QueryContext context) throws InvalidQueryException
InvalidQueryException
public static java.util.List reorder(java.util.List qclauses, java.util.Set boundvars, java.util.Set literalvars, java.lang.String rulename, CostEstimator estimator)
qclauses
- The list of clauses to be reordered.boundvars
- Contains the variables bound when we get hereliteralvars
- Contains the variables representing literals.
Only an issue in rules.rulename
- The name of the current rule (so we can delay
recursive evaluation).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |