org.deri.iris
Class KnowledgeBase

java.lang.Object
  extended by org.deri.iris.KnowledgeBase
All Implemented Interfaces:
IKnowledgeBase

public class KnowledgeBase
extends Object
implements IKnowledgeBase

The concrete knowledge-base.


Constructor Summary
KnowledgeBase(Map<IPredicate,IRelation> inputFacts, List<IRule> rules, Configuration configuration)
          Constructor.
 
Method Summary
 IRelation execute(IQuery query)
          Execute a query over this knowledge-base.
 IRelation execute(IQuery query, List<IVariable> variableBindings)
          Evaluate a query and optionally return the variable bindings.
 List<IRule> getRules()
          Get the rules hidden within the knowledge-base.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KnowledgeBase

public KnowledgeBase(Map<IPredicate,IRelation> inputFacts,
                     List<IRule> rules,
                     Configuration configuration)
              throws EvaluationException
Constructor.

Parameters:
facts - The starting facts for the knowledge-base.
rules - The rules of the knowledge-base.
configuration - The configuration object for the knowledge-base.
Throws:
EvaluationException
EvaluationException
Method Detail

execute

public IRelation execute(IQuery query,
                         List<IVariable> variableBindings)
                  throws EvaluationException
Description copied from interface: IKnowledgeBase
Evaluate a query and optionally return the variable bindings.

Specified by:
execute in interface IKnowledgeBase
Parameters:
query - The query to evaluate.
Returns:
The relation of results.
Throws:
ProgramNotStratifiedException - If the program (knowledge-base)can not be stratified
RuleUnsafeException - If the program (knowledge-base) contains an unsafe rule.
EvaluationException - If the execution of a query fails for any other reason.

execute

public IRelation execute(IQuery query)
                  throws EvaluationException
Description copied from interface: IKnowledgeBase
Execute a query over this knowledge-base.

Specified by:
execute in interface IKnowledgeBase
Parameters:
query - The query to evaluate.
Returns:
The relation of results.
Throws:
ProgramNotStratifiedException - If the program (knowledge-base)can not be stratified
RuleUnsafeException - If the program (knowledge-base) contains an unsafe rule.
EvaluationException - If the execution of a query fails for any other reason.

getRules

public List<IRule> getRules()
Description copied from interface: IKnowledgeBase
Get the rules hidden within the knowledge-base.

Specified by:
getRules in interface IKnowledgeBase
Returns:
The unmodifiable list of rules.

toString

public String toString()
Overrides:
toString in class Object