org.deri.iris.evaluation.stratifiedbottomup
Class EvaluationUtilities

java.lang.Object
  extended by org.deri.iris.evaluation.stratifiedbottomup.EvaluationUtilities

public class EvaluationUtilities
extends Object

A collection of useful evaluation steps.


Field Summary
protected  Configuration mConfiguration
          The knowledge-base configuration object.
 
Constructor Summary
EvaluationUtilities(Configuration configuration)
          Constructor.
 
Method Summary
 List<IRule> applyRuleOptimisers(List<IRule> rules)
          Optimise a collection of rules by applying each of the rule optimisations to each rule in turn.
 List<IRule> applyRuleSafetyProcessor(List<IRule> rules)
          Check the given rules for rule-safety (unbound variables).
 List<IRule> reOrderRules(List<IRule> rules)
          Attempt to re-order the rules of a stratum such that the dependent rules are evaluated first.
 List<List<IRule>> stratify(List<IRule> rules)
          Apply each of the stratifiers in turn until stratification is achieved.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mConfiguration

protected final Configuration mConfiguration
The knowledge-base configuration object.

Constructor Detail

EvaluationUtilities

public EvaluationUtilities(Configuration configuration)
Constructor.

Parameters:
configuration - The knowledge-base configuration object.
Method Detail

stratify

public List<List<IRule>> stratify(List<IRule> rules)
                           throws ProgramNotStratifiedException
Apply each of the stratifiers in turn until stratification is achieved.

Parameters:
rules - The input rules.
Returns:
A collection of collections of rules arranged in to strata. The rules in each stratum might be different from the imput rules.
Throws:
ProgramNotStratifiedException - If none of the stratification algorithms successfully stratified the rule set.

reOrderRules

public List<IRule> reOrderRules(List<IRule> rules)
Attempt to re-order the rules of a stratum such that the dependent rules are evaluated first.

Parameters:
rules - The strata of rules to re-order.
Returns:
The re-ordered rules.

applyRuleOptimisers

public List<IRule> applyRuleOptimisers(List<IRule> rules)
Optimise a collection of rules by applying each of the rule optimisations to each rule in turn.

Parameters:
rules - A collection of rules to optimise.
Returns:
A list of optimised rules.

applyRuleSafetyProcessor

public List<IRule> applyRuleSafetyProcessor(List<IRule> rules)
                                     throws RuleUnsafeException
Check the given rules for rule-safety (unbound variables). In the future, this method will be allowed to modify the input rules.

Parameters:
rules - The rules to check.
Returns:
The collection of safe rules.
Throws:
RuleUnsafeException