protected boolean interactsWithInversesComplex(final KnowledgeBase kb, final Role role) { for (final ATermAppl p : _expressivity.getAnonInverses()) { final Role anonRole = kb.getRole(p); if (anonRole.hasComplexSubRole() && anonRole.getFSM().getAlpahabet().contains(role)) return true; } return false; }
protected boolean interactsWithInversesComplex(final KnowledgeBase kb, final Role role) { for (final ATermAppl p : _expressivity.getAnonInverses()) { final Role anonRole = kb.getRole(p); if (anonRole.hasComplexSubRole() && anonRole.getFSM().getAlpahabet().contains(role)) return true; } return false; }
@Override public boolean absorb(final Set<ATermAppl> terms, final Set<ATermAppl> explanation) { for (final ATermAppl term : terms) { if (!isSomeValues(term)) continue; final ATermAppl p = (ATermAppl) term.getArgument(0); final Role role = _kb.getRole(p); if (role == null || role.hasComplexSubRole()) continue; final ATermAppl disjunction = disjunction(terms); _kb.addDomain(p, disjunction, explanation); _logger.fine(() -> "Add dom: " + ATermUtils.toString(p) + " " + ATermUtils.toString(disjunction)); _absorbedAxioms.addAll(explanation); return true; } return false; } }
@Override public boolean absorb(final Set<ATermAppl> terms, final Set<ATermAppl> explanation) { for (final ATermAppl term : terms) { if (!isSomeValues(term)) continue; final ATermAppl p = (ATermAppl) term.getArgument(0); final Role role = _kb.getRole(p); if (role == null || role.hasComplexSubRole()) continue; final ATermAppl disjunction = disjunction(terms); _kb.addDomain(p, disjunction, explanation); _logger.fine(() -> "Add dom: " + ATermUtils.toString(p) + " " + ATermUtils.toString(disjunction)); _absorbedAxioms.addAll(explanation); return true; } return false; } }
private static Bool checkAllValuesClash(final KnowledgeBase kb, final ATermAppl av, final CachedNode root, final CachedNode otherRoot) { ATerm r = av.getArgument(0); if (r.getType() == ATerm.LIST) r = ((ATermList) r).getFirst(); final Role role = kb.getRole(r); if (null == role) // FIXME : null is unexpected. return Bool.UNKNOWN; if (!role.hasComplexSubRole()) { if (otherRoot.hasRNeighbor(role)) { if (_logger.isLoggable(Level.FINE)) _logger.fine(root + " has " + av + " " + otherRoot + " has " + role + " _neighbor"); return Bool.UNKNOWN; } } else { final TransitionGraph<Role> tg = role.getFSM(); for (final Transition<Role> t : tg.getInitialState().getTransitions()) if (otherRoot.hasRNeighbor(t.getName())) { if (_logger.isLoggable(Level.FINE)) _logger.fine(root + " has " + av + " " + otherRoot + " has " + t.getName() + " _neighbor"); return Bool.UNKNOWN; } } return null; }
@Override public void getObjectPropertyValues(final ATermAppl s, final Role role, final Set<ATermAppl> knowns, final Set<ATermAppl> unknowns, final boolean getSames) { assert isComplete() : "Initial consistency check has not been performed!"; Individual subj = getIndividual(s); boolean isIndependent = true; if (subj.isMerged()) { isIndependent = subj.getMergeDependency(true).isIndependent(); subj = subj.getSame(); } if (role.isSimple()) getSimpleObjectPropertyValues(subj, role, knowns, unknowns, getSames); else if (!role.hasComplexSubRole()) getTransitivePropertyValues(subj, role, knowns, unknowns, getSames, new HashMap<Individual, Set<Role>>(), true); else { final TransitionGraph<Role> tg = role.getFSM(); getComplexObjectPropertyValues(subj, tg.getInitialState(), tg, knowns, unknowns, getSames, new HashMap<Individual, Set<State<Role>>>(), true); } if (!isIndependent) { unknowns.addAll(knowns); knowns.clear(); } }
private static Bool checkAllValuesClash(final KnowledgeBase kb, final ATermAppl av, final CachedNode root, final CachedNode otherRoot) { ATerm r = av.getArgument(0); if (r.getType() == ATerm.LIST) r = ((ATermList) r).getFirst(); final Role role = kb.getRole(r); if (null == role) // FIXME : null is unexpected. return Bool.UNKNOWN; if (!role.hasComplexSubRole()) { if (otherRoot.hasRNeighbor(role)) { if (_logger.isLoggable(Level.FINE)) _logger.fine(root + " has " + av + " " + otherRoot + " has " + role + " _neighbor"); return Bool.UNKNOWN; } } else { final TransitionGraph<Role> tg = role.getFSM(); for (final Transition<Role> t : tg.getInitialState().getTransitions()) if (otherRoot.hasRNeighbor(t.getName())) { if (_logger.isLoggable(Level.FINE)) _logger.fine(root + " has " + av + " " + otherRoot + " has " + t.getName() + " _neighbor"); return Bool.UNKNOWN; } } return null; }
@Override public void getObjectPropertyValues(final ATermAppl s, final Role role, final Set<ATermAppl> knowns, final Set<ATermAppl> unknowns, final boolean getSames) { assert isComplete() : "Initial consistency check has not been performed!"; Individual subj = getIndividual(s); boolean isIndependent = true; if (subj.isMerged()) { isIndependent = subj.getMergeDependency(true).isIndependent(); subj = subj.getSame(); } if (role.isSimple()) getSimpleObjectPropertyValues(subj, role, knowns, unknowns, getSames); else if (!role.hasComplexSubRole()) getTransitivePropertyValues(subj, role, knowns, unknowns, getSames, new HashMap<Individual, Set<Role>>(), true); else { final TransitionGraph<Role> tg = role.getFSM(); getComplexObjectPropertyValues(subj, tg.getInitialState(), tg, knowns, unknowns, getSames, new HashMap<Individual, Set<State<Role>>>(), true); } if (!isIndependent) { unknowns.addAll(knowns); knowns.clear(); } }
continue; if (role.hasComplexSubRole()) continue; if (_kb.getRole(r).hasComplexSubRole() || !ATermUtils.isTop(q)) continue;
continue; if (role.hasComplexSubRole()) continue; if (_kb.getRole(r).hasComplexSubRole() || !ATermUtils.isTop(q)) continue;
private static boolean isAllValuesSafe(final KnowledgeBase kb, final Individual parent, final Role role, final ATermAppl term) { final Role s = kb.getRole(term.getArgument(0)); if (!s.hasComplexSubRole()) { final ATermAppl c = (ATermAppl) term.getArgument(1); if (role.isSubRoleOf(s) && !parent.hasType(c)) return false; } else { final TransitionGraph<Role> tg = s.getFSM(); for (final Transition<Role> t : tg.getInitialState().getTransitions()) if (role.isSubRoleOf(t.getName())) return false; } return true; }
private static boolean isAllValuesSafe(final KnowledgeBase kb, final Individual parent, final Role role, final ATermAppl term) { final Role s = kb.getRole(term.getArgument(0)); if (!s.hasComplexSubRole()) { final ATermAppl c = (ATermAppl) term.getArgument(1); if (role.isSubRoleOf(s) && !parent.hasType(c)) return false; } else { final TransitionGraph<Role> tg = s.getFSM(); for (final Transition<Role> t : tg.getInitialState().getTransitions()) if (role.isSubRoleOf(t.getName())) return false; } return true; }
if (!isRootNominal(kb, val)) if (!role.hasComplexSubRole()) found = pNode.hasRNeighbor(role); else
if (!isRootNominal(kb, val)) if (!role.hasComplexSubRole()) found = pNode.hasRNeighbor(role); else
msg = "transitivity axiom"; else if (r.hasComplexSubRole()) msg = "complex sub property axiom";
msg = "transitivity axiom"; else if (r.hasComplexSubRole()) msg = "complex sub property axiom";
if (!r.getDisjointRoles().isEmpty()) _expressivity.setHasDisjointRoles(true); if (r.hasComplexSubRole()) _expressivity.setHasComplexSubRoles(true);
msg = "transitivity axiom"; else if (r.hasComplexSubRole()) msg = "complex sub property axiom";
if (!r.getDisjointRoles().isEmpty()) _expressivity.setHasDisjointRoles(true); if (r.hasComplexSubRole()) _expressivity.setHasComplexSubRoles(true);
@Test public void testPropertyChainInvalid() { final OntModel model = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC); model.read(_base + "propertyChainInvalid.owl"); model.prepare(); final KnowledgeBase kb = ((PelletInfGraph) model.getGraph()).getKB(); for (final Role r : kb.getRBox().getRoles().values()) if (!ATermUtils.isBuiltinProperty(r.getName())) { assertTrue(r + " is not simple", r.isSimple()); assertFalse(r + " is transitive", r.isTransitive()); assertFalse(r + " has complex sub roles", r.hasComplexSubRole()); } }