org.deri.iris.rules.optimisation
Class ReplaceVariablesWithConstantsOptimiser
java.lang.Object
org.deri.iris.rules.optimisation.ReplaceVariablesWithConstantsOptimiser
- All Implemented Interfaces:
- IRuleOptimiser
public class ReplaceVariablesWithConstantsOptimiser
- extends Object
- implements IRuleOptimiser
Replace variables with constants where possible:
e.g. p(?X,?Y) :- q(?X, ?Z), ?Z = 't'
==>> p(?X,?Y) :- q(?X, 't')
This should have the effect of pushing selection criteria in to the evaluation of a relation,
such that fewer tuples are processed.
Problem!
p(?X), ?X = 2 is not the same as p(2), at least at the moment,
because with p(2) the evaluator looks for only p( integer( 2 ) ) in the relation,
whereas p(?X), ?X = 2 will return the entire relation and filter out what equals 2,
i.e. any numeric value.
Not sure how to fix this, but it will involve changing MixedDatatypeRelation.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReplaceVariablesWithConstantsOptimiser
public ReplaceVariablesWithConstantsOptimiser()
optimise
public IRule optimise(IRule rule)
- Description copied from interface:
IRuleOptimiser
- Optimise the rule.
- Specified by:
optimise in interface IRuleOptimiser
- Parameters:
rule - The rule to optimise.
- Returns:
- The optimised rule.