public Set<P> getParents(P object) { if (object.equals(getRoot())){ return Collections.emptySet(); } Set<P> result = new HashSet<P>(); for (E prop : object.getSuperProperties(ontologies)) { if (!prop.isAnonymous()) { result.add((P) prop); } } if (result.isEmpty() && isReferenced(object)){ result.add(getRoot()); } return result; }
public Set<P> getParents(P object) { getReadLock().lock(); ontologySetReadLock.lock(); try { if (object.equals(getRoot())){ return Collections.emptySet(); } Set<P> result = new HashSet<P>(); for (E prop : object.getSuperProperties(ontologies)) { if (!prop.isAnonymous()) { result.add((P) prop); } } if (result.isEmpty() && isReferenced(object)){ result.add(getRoot()); } return result; } finally { ontologySetReadLock.unlock(); getReadLock().unlock(); } }