org.deri.iris.rules.optimisation
Class ReOrderLiteralsOptimiser
java.lang.Object
org.deri.iris.rules.optimisation.ReOrderLiteralsOptimiser
- All Implemented Interfaces:
- IRuleOptimiser
public class ReOrderLiteralsOptimiser
- extends Object
- implements IRuleOptimiser
Re-order literals.
The RuleCompiler will be forced to re-order literals when it fails to set
up the variable bindings between consecutive sub-goals.
However, it might be possible to speed things up by selecting the most restrictive
sub-goals (in the search sense) first.
e.g. p(x,y) :- z!=x, x> p(x,y) :- q(x), r(y), x
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReOrderLiteralsOptimiser
public ReOrderLiteralsOptimiser()
optimise
public IRule optimise(IRule rule)
- First version. It works, but it is not very efficient.
TODO
Improve the whole thing to make it more elegant.
This might interfere with magic sets, which orders sub-goals appropriately.
- Specified by:
optimise in interface IRuleOptimiser
- Parameters:
rule - The rule to optimise.
- Returns:
- The optimised rule.