fr.boreal.backward_chaining.evaluators.QueryRewriter Maven / Gradle / Ivy
package fr.boreal.backward_chaining.evaluators;
import java.util.Collection;
import fr.boreal.model.formula.api.FOFormula;
import org.slf4j.LoggerFactory;
import fr.boreal.model.kb.api.RuleBase;
import fr.boreal.model.query.api.FOQuery;
import fr.boreal.model.ruleCompilation.NoRuleCompilation;
import fr.boreal.model.ruleCompilation.api.RuleCompilation;
import fr.lirmm.boreal.util.evaluator.MultiEvaluator;
/**
* A class for rewriting a collection of FOQuery objects.
*
*/
public class QueryRewriter extends MultiEvaluator {
static {
LOG = LoggerFactory.getLogger(QueryRewriter.class);
}
/**
* Constructs a QueryRewriter with the given collection of queries, rules, and
* compilation. base. assumptions : if a compilation different from
* {@link NoRuleCompilation} is used, than the ruleset should contain only
* non-compilable rules.
*
* @param queries The collection of FOQuery objects to rewrite.
* @param ruleBase The RuleBase containing rules for rewriting. * @param
* compilation The RuleCompilation configuration for rewriting.
*/
public QueryRewriter(Collection> queries, RuleBase ruleBase, RuleCompilation compilation, Integer timeout) {
super(new RewritingInputWrapper(queries, ruleBase, compilation).createRewritingInputs(),
new DefaultRewritingFunction(),timeout,new DefaultQueryRewritingOutputIfTimeoutFunction());
}
}