private Set<OWLClassExpression> getInferredParents(
     OWLOntology sourceOntology, OWLClass child, Set<OWLClass> viewed) {
   Set<OWLClassExpression> result = new TreeSet<OWLClassExpression>();
   if (!viewed.contains(child)) {
     viewed.add(child);
     Set<OWLClassExpression> parents = new TreeSet<OWLClassExpression>();
     parents.addAll(child.getSuperClasses(sourceOntology));
     parents.addAll(child.getEquivalentClasses(sourceOntology));
     for (OWLClassExpression parent : parents) {
       if (parent instanceof OWLClass) {
         result.add(parent);
         result.addAll(getInferredParents(sourceOntology, (OWLClass) parent, viewed));
       } else if (parent instanceof OWLObjectIntersectionOf) {
         Set<OWLClassExpression> inferredParents =
             ((OWLObjectIntersectionOf) parent).getOperands();
         result.addAll(inferredParents);
         for (OWLClassExpression inferredParent : inferredParents) {
           if (inferredParent instanceof OWLClass) {
             result.addAll(getInferredParents(sourceOntology, (OWLClass) inferredParent, viewed));
           }
         }
       } else {
         result.add(parent);
       }
     }
   }
   return result;
 }
  protected Concept getParentConcept(
      OWLOntology o, OWLClass ontologyClass, File inDir, Authorizations authorizations)
      throws IOException {
    Set<OWLClassExpression> superClasses = ontologyClass.getSuperClasses(o);
    if (superClasses.size() == 0) {
      return getEntityConcept();
    } else if (superClasses.size() == 1) {
      OWLClassExpression superClassExpr = superClasses.iterator().next();
      OWLClass superClass = superClassExpr.asOWLClass();
      String superClassUri = superClass.getIRI().toString();
      Concept parent = getConceptByIRI(superClassUri);
      if (parent != null) {
        return parent;
      }

      parent = importOntologyClass(o, superClass, inDir, authorizations);
      if (parent == null) {
        throw new LumifyException("Could not find or create parent: " + superClass);
      }
      return parent;
    } else {
      throw new LumifyException(
          "Unhandled multiple super classes. Found " + superClasses.size() + ", expected 0 or 1.");
    }
  }