public NodeSet<OWLClass> getObjectPropertyRanges(OWLObjectPropertyExpression pe, boolean direct)
      throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException,
          TimeOutException {
    refreshCheck();
    try {
      ATermAppl some = ATermUtils.makeSomeValues(ATermUtils.makeInv(term(pe)), ATermUtils.TOP);

      Set<ATermAppl> equivalents = kb.getEquivalentClasses(some);
      if (direct && !equivalents.isEmpty()) {
        return toClassNodeSet(Collections.singleton(equivalents));
      }

      Set<Set<ATermAppl>> result = kb.getSuperClasses(some, direct);
      if (!equivalents.isEmpty()) {
        result.add(equivalents);
      }

      return toClassNodeSet(result);
    } catch (PelletRuntimeException e) {
      throw convert(e);
    }
  }