public Set<ATermAppl> getExplanation(final RulesToATermTranslator translator) { if (_explanation == null) _explanation = singleton(translator.translate(this)); return _explanation; }
public ATermAppl translate(final Rule rule) { _term = null; visit(rule); return _term; }
@Test public void ruleInteractionWithInverses() { // Tests #446 classes(_A); objectProperties(_p, _q, _r, _f); dataProperties(_p); individuals(_a, _b, _c); final AtomIVariable x = new AtomIVariable("x"); final AtomIVariable y = new AtomIVariable("y"); final AtomIVariable z = new AtomIVariable("z"); _kb.addSymmetricProperty(_p); _kb.addInverseProperty(_q, _r); _kb.addPropertyValue(_p, _c, _a); _kb.addPropertyValue(_f, _a, _b); final List<RuleAtom> body = Arrays.<RuleAtom> asList(new IndividualPropertyAtom(_f, x, y), new IndividualPropertyAtom(_p, x, z)); final List<RuleAtom> head = Arrays.<RuleAtom> asList(new IndividualPropertyAtom(_r, z, y)); final Rule rule = new Rule(head, body); _kb.addRule(rule); explainEntailment(_kb.hasPropertyValue(_b, _q, _c), ATermUtils.makePropAtom(_p, _c, _a), ATermUtils.makePropAtom(_f, _a, _b), ATermUtils.makeSymmetric(_p), ATermUtils.makeInvProp(_q, _r), new RulesToATermTranslator().translate(rule)); }
public ContinuousRulesStrategy(final ABox abox) { super(abox); _bindingStrategy = new BindingGeneratorStrategyImpl(abox); _partialBindings = new ConcurrentLinkedQueue<>(); _unsafeRules = new HashSet<>(); _rulesApplied = new HashMap<>(); _atermTranslator = new RulesToATermTranslator(); _ruleAtomAsserter = new RuleAtomAsserter(); _atomTester = new TrivialSatisfactionHelpers(abox); }
public ContinuousRulesStrategy(final ABox abox) { super(abox); _bindingStrategy = new BindingGeneratorStrategyImpl(abox); _partialBindings = new ConcurrentLinkedQueue<>(); _unsafeRules = new HashSet<>(); _rulesApplied = new HashMap<>(); _atermTranslator = new RulesToATermTranslator(); _ruleAtomAsserter = new RuleAtomAsserter(); _atomTester = new TrivialSatisfactionHelpers(abox); }
public Set<ATermAppl> getExplanation(final RulesToATermTranslator translator) { if (_explanation == null) _explanation = singleton(translator.translate(this)); return _explanation; }
public ATermAppl translate(final Rule rule) { _term = null; visit(rule); return _term; }
public void visit(final Rule rule) { final ATermAppl[] head = new ATermAppl[rule.getHead().size()]; final ATermAppl[] body = new ATermAppl[rule.getBody().size()]; int i = 0; for (final RuleAtom atom : rule.getHead()) head[i++] = translate(atom); i = 0; for (final RuleAtom atom : rule.getBody()) body[i++] = translate(atom); _term = ATermUtils.makeRule(rule.getName(), head, body); }
public void visit(final Rule rule) { final ATermAppl[] head = new ATermAppl[rule.getHead().size()]; final ATermAppl[] body = new ATermAppl[rule.getBody().size()]; int i = 0; for (final RuleAtom atom : rule.getHead()) head[i++] = translate(atom); i = 0; for (final RuleAtom atom : rule.getBody()) body[i++] = translate(atom); _term = ATermUtils.makeRule(rule.getName(), head, body); }
/** * {@inheritDoc} */ @Override public void visit(final DataRangeAtom atom) { final ATermAppl d = atom.getPredicate(); final ATermAppl l = translate(atom.getArgument()); _term = ATermUtils.makeTypeAtom(l, d); }
/** * {@inheritDoc} */ @Override public void visit(final ClassAtom atom) { final ATermAppl c = atom.getPredicate(); final ATermAppl i = translate(atom.getArgument()); _term = ATermUtils.makeTypeAtom(i, c); }
/** * {@inheritDoc} */ @Override public void visit(final DataRangeAtom atom) { final ATermAppl d = atom.getPredicate(); final ATermAppl l = translate(atom.getArgument()); _term = ATermUtils.makeTypeAtom(l, d); }