org.deri.iris.rules.stratification
Class GlobalStratifier

java.lang.Object
  extended by org.deri.iris.rules.stratification.GlobalStratifier
All Implemented Interfaces:
IRuleStratifier

public class GlobalStratifier
extends Object
implements IRuleStratifier

The global stratification algorithm. This algorithm does not modify/create/delete any rules.

See Also:
org.deri.iris.rules.IRuleStratifier#stratify()

Constructor Summary
GlobalStratifier()
           
 
Method Summary
static boolean checkRuleHeadEquality(IRule rule, int stratum)
          Checks if a rule with head equality is stratified.
 List<List<IRule>> stratify(List<IRule> rules)
          Stratify the rules, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobalStratifier

public GlobalStratifier()
Method Detail

stratify

public List<List<IRule>> stratify(List<IRule> rules)
Description copied from interface: IRuleStratifier
Stratify the rules, i.e. arrange them in to groups such that each increasing level of rules can be evaluated before the next higher level of dependent rules.

Specified by:
stratify in interface IRuleStratifier
Parameters:
rules - The collection of rules to stratify
Returns:
The rules arranged in to strata. The number of rules returned may be different to the number provided, because the stratification technique might require the rules to be re-written.

checkRuleHeadEquality

public static boolean checkRuleHeadEquality(IRule rule,
                                            int stratum)
Checks if a rule with head equality is stratified. A program is stratified if and only if rules with head equality are in the bottom stratum and they don't have negated predicates.

Parameters:
rule - The rule to check if stratified.
stratum - The stratum of the rule.
Returns:
true if the rule is stratified, false otherwise.