public class QueryOptimizer extends Object
The only optimizations performed at the moment are:
Modifier and Type | Class and Description |
---|---|
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 and Description |
---|
QueryOptimizer() |
Modifier and Type | Method and Description |
---|---|
void |
addOptimizer(QueryOptimizerIF optimizer) |
static QueryOptimizer |
getOptimizer(TologQuery query)
INTERNAL: Get hold of an query optimizer instance.
|
List |
optimize(List clauses,
QueryContext context) |
ParsedRule |
optimize(ParsedRule rule) |
TologQuery |
optimize(TologQuery query) |
static List |
reorder(List qclauses,
Set boundvars,
Set literalvars,
String rulename,
CostEstimator estimator)
INTERNAL: Optimizes the order of the query clauses in a context
where the given variables are bound.
|
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 List optimize(List clauses, QueryContext context) throws InvalidQueryException
InvalidQueryException
public static List reorder(List qclauses, Set boundvars, Set literalvars, 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).