org.deri.iris.evaluation.wellfounded
Class ProgramDoubler

java.lang.Object
  extended by org.deri.iris.evaluation.wellfounded.ProgramDoubler

public class ProgramDoubler
extends Object

Program doubler for well-founded semantics evaluation strategy. This class generates the rule-sets and facts for the alternating fixed point algorithm, which is used to compute a well-founded model. The rules and facts for the original logic program are used to instantiate the ProgramDoubler. After which, the extractXXX and getXXX methods are used to retrieve the program fragments used during the alternating fixed point loop.


Field Summary
static String NEGATED_PREDICATE_SUFFIX
          The suffix used to name the 'primed' predicates, i.e.
 
Constructor Summary
ProgramDoubler(List<IRule> rules, IFacts facts, Configuration configuration)
          Constructor.
 
Method Summary
 IFacts extractNegativeFacts(IFacts mixed)
          Extract all the facts associated with primed predicates from the facts provided.
 IFacts extractPositiveFacts(IFacts mixed)
          Extract all the facts associated with unprimed predicates from the facts provided.
 List<IRule> getNegativeRuleBase()
          Get the rules used in the 'negative' part of the AFP loop.
 IFacts getNegativeStartingFacts()
          Get the negative facts used in the alternating fixed point algorithm.
 List<IRule> getPositiveRuleBase()
          Get the rules used in the 'positive' part of the AFP loop.
 IFacts getPositiveStartingFacts()
          Get the positive facts used in the alternating fixed point algorithm.
 List<IRule> getStartingRuleBase()
          Get the rules used to start the AFP algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEGATED_PREDICATE_SUFFIX

public static final String NEGATED_PREDICATE_SUFFIX
The suffix used to name the 'primed' predicates, i.e. those predicate that represent definitely false facts of their unprimed counterparts.

See Also:
Constant Field Values
Constructor Detail

ProgramDoubler

public ProgramDoubler(List<IRule> rules,
                      IFacts facts,
                      Configuration configuration)
Constructor.

Parameters:
rules - The rules from the original program.
facts - The facts from the original program.
configuration - The configuration object for the knowledge base.
Method Detail

extractPositiveFacts

public IFacts extractPositiveFacts(IFacts mixed)
Extract all the facts associated with unprimed predicates from the facts provided.

Parameters:
mixed - The input collection of facts tha can contain a mixture of primed and unprimed predicates.
Returns:
The facts associated with unprimed predicates only.

extractNegativeFacts

public IFacts extractNegativeFacts(IFacts mixed)
Extract all the facts associated with primed predicates from the facts provided.

Parameters:
mixed - The input collection of facts that can contain a mixture of primed and unprimed predicates.
Returns:
The facts associated with primed predicates only.

getPositiveStartingFacts

public IFacts getPositiveStartingFacts()
Get the positive facts used in the alternating fixed point algorithm.

Returns:
The original positive facts, wrapped such that modifications to the returned collection does not modify the original facts.

getNegativeStartingFacts

public IFacts getNegativeStartingFacts()
Get the negative facts used in the alternating fixed point algorithm.

Returns:
The original positive facts, wrapped such that they are associated with primed predicates and such that modifications to the returned collection does not modify the original facts.

getStartingRuleBase

public List<IRule> getStartingRuleBase()
Get the rules used to start the AFP algorithm.

Returns:
The starting rules. These contain only those original rules with no negative body literals.

getNegativeRuleBase

public List<IRule> getNegativeRuleBase()
Get the rules used in the 'negative' part of the AFP loop.

Returns:
The entire rule set modified such that each rule head is primed and each positive body literal is primed.

getPositiveRuleBase

public List<IRule> getPositiveRuleBase()
Get the rules used in the 'positive' part of the AFP loop.

Returns:
The entire rule set modified such that each negated body literal is primed.