use of fr.lirmm.graphik.graal.forward_chaining.halting_condition.FrontierRestrictedChaseHaltingCondition in project graal by graphik-team.
the class MFAProperty method check.
/**
*/
@Override
public int check(AnalyserRuleSet ruleSet) {
RuleSet R = translateToMFA(ruleSet);
AtomSet A = Rules.criticalInstance(ruleSet);
Chase chase = new ChaseWithGRD<AtomSet>(new DefaultGraphOfRuleDependencies(R), A, new DefaultRuleApplier<AtomSet>(new FrontierRestrictedChaseHaltingCondition()));
DefaultConjunctiveQuery Q = new DefaultConjunctiveQuery();
DefaultAtom q = new DefaultAtom(C);
q.setTerm(0, FAKE);
Q.getAtomSet().add(q);
try {
while (chase.hasNext()) {
chase.next();
if (SmartHomomorphism.instance().exist(Q, A)) {
return -1;
}
}
} catch (ChaseException e) {
LOGGER.warn("An error occurs during the chase: ", e);
return 0;
} catch (HomomorphismException e) {
LOGGER.warn("An error occurs during the homomorphism: ", e);
return 0;
}
return 1;
}
Aggregations