/** * @param r The functionalSuper to set. */ @Override public void addFunctionalSuper(final Role r) { for (final Role fs : _functionalSupers) if (fs.isSubRoleOf(r)) { _functionalSupers = SetUtils.remove(fs, _functionalSupers); break; } else if (r.isSubRoleOf(fs)) return; _functionalSupers = SetUtils.add(r, _functionalSupers); }
/** * @param r The functionalSuper to set. */ @Override public void addFunctionalSuper(final Role r) { for (final Role fs : _functionalSupers) if (fs.isSubRoleOf(r)) { _functionalSupers = SetUtils.remove(fs, _functionalSupers); break; } else if (r.isSubRoleOf(fs)) return; _functionalSupers = SetUtils.add(r, _functionalSupers); }
protected EdgeDirection edgeMatches(final Edge edge) { final Role edgeRole = edge.getRole(); final boolean isFwd = edgeRole.isSubRoleOf(_role); final boolean isBwd = _role.getInverse() != null && edgeRole.isSubRoleOf(_role.getInverse()); return isFwd ? isBwd ? EdgeDirection.BOTH : EdgeDirection.FORWARD : isBwd ? EdgeDirection.BACKWARD : null; }
protected EdgeDirection edgeMatches(final Edge edge) { final Role edgeRole = edge.getRole(); final boolean isFwd = edgeRole.isSubRoleOf(_role); final boolean isBwd = _role.getInverse() != null && edgeRole.isSubRoleOf(_role.getInverse()); return isFwd ? isBwd ? EdgeDirection.BOTH : EdgeDirection.FORWARD : isBwd ? EdgeDirection.BACKWARD : null; }
private static boolean subsumes(final Role sup, final Role sub) { final boolean result = sup.isSuperRoleOf(sub); ATermUtils.assertTrue(sub.isSubRoleOf(sup) == result); return result; }
private static boolean subsumes(final Role sup, final Role sub) { final boolean result = sup.isSuperRoleOf(sub); ATermUtils.assertTrue(sub.isSubRoleOf(sup) == result); return result; }
private static boolean isParentMaxSafe(final KnowledgeBase kb, final Role role, final ATermAppl max) { final Role maxR = kb.getRole(max.getArgument(0)); return !role.isSubRoleOf(maxR); }
private static boolean isParentMaxSafe(final KnowledgeBase kb, final Role role, final ATermAppl max) { final Role maxR = kb.getRole(max.getArgument(0)); return !role.isSubRoleOf(maxR); }
private static boolean isMaxSafe(final KnowledgeBase kb, final Role role, final ATermAppl term) { final Role maxR = kb.getRole(term.getArgument(0)); return !role.isSubRoleOf(maxR); }
private static boolean isMaxSafe(final KnowledgeBase kb, final Role role, final ATermAppl term) { final Role maxR = kb.getRole(term.getArgument(0)); return !role.isSubRoleOf(maxR); }
public EdgeList getEdges(final Role role) { final EdgeList result = new EdgeList(); for (final Edge e : this) if (e.getRole().isSubRoleOf(role)) result.addEdge(e); return result; }
public EdgeList getEdges(final Role role) { final EdgeList result = new EdgeList(); for (final Edge e : this) if (e.getRole().isSubRoleOf(role)) result.addEdge(e); return result; }
public int getMinCard(final Role r, final ATermAppl c) { int maxOfMins = 0; for (final ATermAppl minCard : _types[MIN]) { final Role minR = _abox.getRole(minCard.getArgument(0)); final int min = ((ATermInt) minCard.getArgument(1)).getInt(); final ATermAppl minC = (ATermAppl) minCard.getArgument(2); if (minR.isSubRoleOf(r) && maxOfMins < min && (minC.equals(c) || c.equals(TOP))) maxOfMins = min; } return maxOfMins; }
public int getMinCard(final Role r, final ATermAppl c) { int maxOfMins = 0; for (final ATermAppl minCard : _types[MIN]) { final Role minR = _abox.getRole(minCard.getArgument(0)); final int min = ((ATermInt) minCard.getArgument(1)).getInt(); final ATermAppl minC = (ATermAppl) minCard.getArgument(2); if (minR.isSubRoleOf(r) && maxOfMins < min && (minC.equals(c) || c.equals(TOP))) maxOfMins = min; } return maxOfMins; }
private static Bool checkSelfClash(final KnowledgeBase kb, final ATermAppl self, final CachedNode root, final CachedNode otherRoot) { final Role r = kb.getRole(self.getArgument(0)); for (final Edge e : otherRoot.getOutEdges()) if (e.getRole().isSubRoleOf(r) && e.getToName().equals(otherRoot.getName())) { if (_logger.isLoggable(Level.FINE)) _logger.fine(root + " has not(" + self + ") " + otherRoot + " has self edge"); final boolean allIndependent = root.isIndependent() && otherRoot.isIndependent() && e.getDepends().isIndependent(); return allIndependent ? Bool.FALSE : Bool.UNKNOWN; } return null; }
private static Bool checkSelfClash(final KnowledgeBase kb, final ATermAppl self, final CachedNode root, final CachedNode otherRoot) { final Role r = kb.getRole(self.getArgument(0)); for (final Edge e : otherRoot.getOutEdges()) if (e.getRole().isSubRoleOf(r) && e.getToName().equals(otherRoot.getName())) { if (_logger.isLoggable(Level.FINE)) _logger.fine(root + " has not(" + self + ") " + otherRoot + " has self edge"); final boolean allIndependent = root.isIndependent() && otherRoot.isIndependent() && e.getDepends().isIndependent(); return allIndependent ? Bool.FALSE : Bool.UNKNOWN; } return null; }
/** * Checks if this list contains an edge matching the given subject, predicate and object. A null parameter is treated as a wildcard matching every value and * predicates are matched by considering the subproperty hierarchy, i.e. passing the parameter <code>sup</code> to this function will return * <code>true</code> if an edge with subproperty <code>sub</code> exists. * * @param from * @param role * @param to * @return true if contains an edge that match */ public boolean hasEdge(final Individual from, final Role role, final Node to) { for (final Edge e : this) if ((from == null || from.equals(e.getFrom())) && (role == null || e.getRole().isSubRoleOf(role)) && (to == null || to.equals(e.getTo()))) return true; return false; }
private EdgeList findEdges(final Role role, final Individual from, final Node to) { final EdgeList result = new EdgeList(); for (final Edge e : this) if ((from == null || from.equals(e.getFrom())) && (role == null || e.getRole().isSubRoleOf(role)) && (to == null || to.equals(e.getTo()))) result.addEdge(e); return result; }
private EdgeList findEdges(final Role role, final Individual from, final Node to) { final EdgeList result = new EdgeList(); for (final Edge e : this) if ((from == null || from.equals(e.getFrom())) && (role == null || e.getRole().isSubRoleOf(role)) && (to == null || to.equals(e.getTo()))) result.addEdge(e); return result; }
public DependencySet hasMax1(final Role r) { for (final ATermAppl mc : _types[MAX]) { // max(r, n, c) is in normalized form not(min(p, n + 1)) final ATermAppl maxCard = (ATermAppl) mc.getArgument(0); final Role maxR = _abox.getRole(maxCard.getArgument(0)); final int max = ((ATermInt) maxCard.getArgument(1)).getInt() - 1; final ATermAppl maxQ = (ATermAppl) maxCard.getArgument(2); // FIXME returned dependency set might be wrong // if there are two _types max(r,1) and max(p,1) where r subproperty of p // then the dependency set what we return might be wrong if (max == 1 && r.isSubRoleOf(maxR) && ATermUtils.isTop(maxQ)) return getDepends(mc).union(r.getExplainSub(maxR.getName()), _abox.doExplanation()); } return null; }