/** * Sets the _blocker to the parent of _current _blocker and checks if if the new _blocker candidate is allowed to block. Root _nodes are not allowed to * block. * * @return <code>true</code> if the new _blocker candidate is allowed to block */ public boolean moveBlockerUp() { _blocker = _blocker.getParent(); _rolesToBlocked = null; return !_blocker.isRoot(); }
/** * Sets the _blocker to the parent of _current _blocker and checks if if the new _blocker candidate is allowed to block. Root _nodes are not allowed to * block. * * @return <code>true</code> if the new _blocker candidate is allowed to block */ public boolean moveBlockerUp() { _blocker = _blocker.getParent(); _rolesToBlocked = null; return !_blocker.isRoot(); }
public boolean isIndirectlyBlocked(final Individual blocked) { final Individual parent = blocked.getParent(); if (parent == null) return false; blocked.setBlocked(isBlocked(parent)); return blocked.isBlocked(); }
public boolean isIndirectlyBlocked(final Individual blocked) { final Individual parent = blocked.getParent(); if (parent == null) return false; blocked.setBlocked(isBlocked(parent)); return blocked.isBlocked(); }
private static boolean parentNeedsExpanding(final Individual x) { if (x.isRoot()) return false; final Individual parent = x.getParent(); return parent.canApply(Node.ATOM) || parent.canApply(Node.OR) || parent.canApply(Node.SOME) || parent.canApply(Node.MIN) || parent.canApply(Node.MAX); }
private static boolean isBlockedByChain(final BlockingContext cxt, final ATermList chain, final ATermAppl c) { final Role firstRole = cxt._blocked.getABox().getRole(chain.getFirst()); return !cxt.getIncomingRoles().contains(firstRole.getInverse()) && cxt._blocked.getParent().hasType(ATermUtils.makeAllValues(chain.getNext(), c)); } }
private static boolean parentNeedsExpanding(final Individual x) { if (x.isRoot()) return false; final Individual parent = x.getParent(); return parent.canApply(Node.ATOM) || parent.canApply(Node.OR) || parent.canApply(Node.SOME) || parent.canApply(Node.MIN) || parent.canApply(Node.MAX); }
private static boolean isBlockedByChain(final BlockingContext cxt, final ATermList chain, final ATermAppl c) { final Role firstRole = cxt._blocked.getABox().getRole(chain.getFirst()); return !cxt.getIncomingRoles().contains(firstRole.getInverse()) && cxt._blocked.getParent().hasType(ATermUtils.makeAllValues(chain.getNext(), c)); } }
/** * Returns the roles that points to the given _individual from its parent. * * @param ind _individual to check * @return the roles that points to the given _individual from its parent */ public static Set<Role> getIncomingRoles(final Individual ind) { Set<Role> rolesToBlocked = null; for (final Edge e : ind.getInEdges()) if (e.getFrom().equals(ind.getParent())) if (rolesToBlocked == null) rolesToBlocked = e.getRole().getSuperRoles(); else if (!rolesToBlocked.contains(e.getRole())) { rolesToBlocked = SetUtils.create(rolesToBlocked); rolesToBlocked.addAll(e.getRole().getSuperRoles()); } return rolesToBlocked; }
/** * Returns the roles that points to the given _individual from its parent. * * @param ind _individual to check * @return the roles that points to the given _individual from its parent */ public static Set<Role> getIncomingRoles(final Individual ind) { Set<Role> rolesToBlocked = null; for (final Edge e : ind.getInEdges()) if (e.getFrom().equals(ind.getParent())) if (rolesToBlocked == null) rolesToBlocked = e.getRole().getSuperRoles(); else if (!rolesToBlocked.contains(e.getRole())) { rolesToBlocked = SetUtils.create(rolesToBlocked); rolesToBlocked.addAll(e.getRole().getSuperRoles()); } return rolesToBlocked; }
protected boolean isDirectlyBlockedInt(final Individual blocked) { final Individual parentBlocked = blocked.getParent(); if (blocked.isRoot() || parentBlocked.isRoot()) return false; final BlockingContext cxt = new BlockingContext(blocked); while (cxt.moveBlockerUp()) if (isDirectlyBlockedBy(cxt)) { blocked.setBlocked(true); _logger.finer(() -> blocked + " blocked by " + cxt._blocker); return true; } if (OpenlletOptions.USE_ANYWHERE_BLOCKING) { assert cxt._blocker.isRoot(); return isDirectlyBlockedByDescendant(cxt); } return false; }
protected boolean isDirectlyBlockedInt(final Individual blocked) { final Individual parentBlocked = blocked.getParent(); if (blocked.isRoot() || parentBlocked.isRoot()) return false; final BlockingContext cxt = new BlockingContext(blocked); while (cxt.moveBlockerUp()) if (isDirectlyBlockedBy(cxt)) { blocked.setBlocked(true); _logger.finer(() -> blocked + " blocked by " + cxt._blocker); return true; } if (OpenlletOptions.USE_ANYWHERE_BLOCKING) { assert cxt._blocker.isRoot(); return isDirectlyBlockedByDescendant(cxt); } return false; }
protected Edge getParentEdge(final Individual ind) { Edge result = null; Role role = null; final Individual parent = ind.getParent(); for (final Edge e : ind.getInEdges()) if (e.getFrom().equals(parent)) if (role == null) { role = e.getRole(); result = e; } else if (e.getRole().isSubRoleOf(role)) { role = e.getRole(); result = e; } assert result != null; return result; }
protected Edge getParentEdge(final Individual ind) { Edge result = null; Role role = null; final Individual parent = ind.getParent(); for (final Edge e : ind.getInEdges()) if (e.getFrom().equals(parent)) if (role == null) { role = e.getRole(); result = e; } else if (e.getRole().isSubRoleOf(role)) { role = e.getRole(); result = e; } assert result != null; return result; }
protected boolean isDirectlyBlockedByDescendant(final BlockingContext cxt) { if (cxt._blocked.getParent().equals(cxt._blocker)) return false; if (!cxt._blocker.isRoot() && isDirectlyBlockedBy(cxt)) { cxt._blocked.setBlocked(true); _logger.finer(() -> cxt._blocked + " _blocked by " + cxt._blocker); return true; } final Individual blocker = cxt._blocker; for (final Edge e : blocker.getOutEdges()) { final Node child = e.getTo(); if (cxt.moveBlockerDown(child)) { if (isDirectlyBlockedByDescendant(cxt) || cxt._blocker.isRoot()) return true; cxt.moveBlockerUp(); } } return false; }
protected boolean isDirectlyBlockedByDescendant(final BlockingContext cxt) { if (cxt._blocked.getParent().equals(cxt._blocker)) return false; if (!cxt._blocker.isRoot() && isDirectlyBlockedBy(cxt)) { cxt._blocked.setBlocked(true); _logger.finer(() -> cxt._blocked + " _blocked by " + cxt._blocker); return true; } final Individual blocker = cxt._blocker; for (final Edge e : blocker.getOutEdges()) { final Node child = e.getTo(); if (cxt.moveBlockerDown(child)) { if (isDirectlyBlockedByDescendant(cxt) || cxt._blocker.isRoot()) return true; cxt.moveBlockerUp(); } } return false; }
private static boolean block4(final BlockingContext cxt, final ATermAppl term) { final Role t = cxt._blocked.getABox().getRole(term.getArgument(0)); final int m; final ATermAppl c; if (ATermUtils.isMin(term)) { c = (ATermAppl) term.getArgument(2); m = ((ATermInt) term.getArgument(1)).getInt(); } else { c = ATermUtils.negate((ATermAppl) term.getArgument(1)); m = 1; } if (t.isDatatypeRole()) return true; if (cxt.isRSuccessor(t.getInverse()) && cxt._blocked.getParent().hasType(c)) return true; return cxt._blocker.getRSuccessors(t, c).size() >= m; } }
private static boolean block4(final BlockingContext cxt, final ATermAppl term) { final Role t = cxt._blocked.getABox().getRole(term.getArgument(0)); final int m; final ATermAppl c; if (ATermUtils.isMin(term)) { c = (ATermAppl) term.getArgument(2); m = ((ATermInt) term.getArgument(1)).getInt(); } else { c = ATermUtils.negate((ATermAppl) term.getArgument(1)); m = 1; } if (t.isDatatypeRole()) return true; if (cxt.isRSuccessor(t.getInverse()) && cxt._blocked.getParent().hasType(c)) return true; return cxt._blocker.getRSuccessors(t, c).size() >= m; } }