org.deri.iris.evaluation
Class OptimisedProgramStrategyAdaptor

java.lang.Object
  extended by org.deri.iris.evaluation.OptimisedProgramStrategyAdaptor
All Implemented Interfaces:
IEvaluationStrategy

public class OptimisedProgramStrategyAdaptor
extends Object
implements IEvaluationStrategy

An evaluation strategy adaptor that uses program optimisations.
This adaptor applies the optimisations each time a query is executed. This requires a new evaluation strategy to also be created for each query.


Constructor Summary
OptimisedProgramStrategyAdaptor(IFacts facts, List<IRule> rules, Configuration configuration)
          Constructor.
 
Method Summary
 IRelation evaluateQuery(IQuery query, List<IVariable> outputVariables)
          Evaluate a query and optionally return the variable bindings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptimisedProgramStrategyAdaptor

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

Parameters:
facts - The original program's facts (which will not get modified).
rules - The original program's rules.
configuration - The knowledge-base configuration object.
Method Detail

evaluateQuery

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

Specified by:
evaluateQuery in interface IEvaluationStrategy
Parameters:
query - The query to evaluate.
outputVariables - If this is not null, it will be filled with the variable bindings of the result relation, i.e. there will be one variable instance for each term (in one row) of the results set
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 evaluation fails for any other reason.