public Set<P> getChildren(P object) { if (object.equals(getRoot())){ return Collections.unmodifiableSet(subPropertiesOfRoot); } final Set<P> result = new HashSet<P>(); for (E subProp : object.getSubProperties(ontologies)){ // Don't add the sub property if it is a parent of // itself - i.e. prevent cycles if (!subProp.isAnonymous() && !getAncestors((P)subProp).contains(subProp)) { result.add((P)subProp); } } return result; }
public Set<P> getChildren(P object) { getReadLock().lock(); ontologySetReadLock.lock(); try { if (object.equals(getRoot())){ return Collections.unmodifiableSet(subPropertiesOfRoot); } final Set<P> result = new HashSet<P>(); for (E subProp : object.getSubProperties(ontologies)){ // Don't add the sub property if it is a parent of // itself - i.e. prevent cycles if (!subProp.isAnonymous() && !getAncestors((P)subProp).contains(subProp)) { result.add((P)subProp); } } return result; } finally { ontologySetReadLock.unlock(); getReadLock().unlock(); } }