private void addEntailedKBSuccessors(OWLObjectSomeValuesFrom some) {
    TRACKER.start(StaticValues.TIME_KB_SUCCESSORS, BlockOutputMode.COMPLETE, true);
    // add all role-successors entailed by the TBox
    addEntailedTBoxSuccessors(some, m_normalize); // for KB mode only normalize TBox contained roles

    DomainNode<?> toNode = getDomainElement(some.getFiller());

    OWLClass someClass = m_ontologyOperator.getFlatteningTransformer().getIntermediary(some);

    long start = System.currentTimeMillis();
    //		StatStore.getInstance().enterValue("instance accessing", 1.0);
    NodeSet<OWLNamedIndividual> instances =
        m_ontologyOperator.getReasoner().getInstances(someClass, false);
    sum += System.currentTimeMillis() - start;
    //		NodeSet<OWLNamedIndividual> instances =
    // m_ontologyOperator.getReasoner().getInstances(getClassRepresentation(some), false);
    //		LOG.fine(" creating successors to " + some + " from instances: " + instances.toString());
    Iterator<Node<OWLNamedIndividual>> it1 = instances.iterator();
    while (it1.hasNext()) {
      Iterator<OWLNamedIndividual> it2 = it1.next().iterator();
      while (it2.hasNext()) {
        DomainNode<?> from = m_domain.getDomainNode(it2.next());
        if (from != null) {
          //					if(!isSuccessorRepresented(from, getDomainElement(some.getFiller()),
          // (OWLObjectProperty)some.getProperty())){
          from.addSuccessor((OWLObjectProperty) some.getProperty(), toNode);
          //					}
        }
      }
    }
    TRACKER.stop(StaticValues.TIME_KB_SUCCESSORS);
  }
 protected Set<DomainNode<OWLClassExpression>> removeIncludedSuccessors(
     OWLObjectProperty property, DomainNode<?> d, OWLClassExpression newSucc) {
   Set<DomainNode<OWLClassExpression>> removed = new HashSet<DomainNode<OWLClassExpression>>();
   Set<DomainNode<?>> successors = d.getSuccessors(property);
   //		StatStore.getInstance().enterValue("superclass accessing", 1.0);
   //		NodeSet<OWLClass> superClasses = m_ontologyOperator.getReasoner().getSuperClasses(newSucc,
   // false);
   //		Node<OWLClass> eqClasses = m_ontologyOperator.getReasoner().getEquivalentClasses(newSucc);
   NodeSet<OWLClass> superClasses = currentIdSuperClasses;
   if (successors != null) {
     //			Set<DomainNode<?>> mark_removed = new HashSet<DomainNode<?>>();
     Iterator<DomainNode<?>> it = successors.iterator();
     //			for(DomainNode<?> succ : successors){
     while (it.hasNext()) {
       DomainNode<?> succ = it.next();
       if (succ.getId() instanceof OWLClassExpression) { // only inspect class to class relations
         OWLClass succClass = getClassRepresentation((OWLClassExpression) succ.getId());
         // if newSucc is more specific than succ, remove succ
         if (m_useBuffer) {
           if (m_superClassBuffer.get(newSucc).contains(succClass)) {
             it.remove();
             removed.add(m_domain.getDomainNode((OWLClassExpression) succ.getId()));
           }
         } else {
           if (superClasses.containsEntity(succClass)) {
             it.remove();
             removed.add(m_domain.getDomainNode((OWLClassExpression) succ.getId()));
             //						mark_removed.add(succ);
           }
         }
       } // else what about individual domain elements
     }
     //			successors.removeAll(mark_removed);
   }
   return removed;
 }
 protected boolean isSuccessorRepresented(
     DomainNode<?> from, DomainNode<?> to, OWLObjectProperty property) {
   if (from.getId() instanceof OWLClassExpression && to.getId() instanceof OWLClassExpression) {
     Set<DomainNode<?>> successors = from.getSuccessors(property);
     //			StatStore.getInstance().enterValue("subclass accessing", 1.0);
     //			NodeSet<OWLClass> subClasses =
     // m_ontologyOperator.getReasoner().getSubClasses((OWLClass)to.getId(), false);
     NodeSet<OWLClass> subClasses = currentIdSubClasses;
     Node<OWLClass> eqClasses = currentIdEqClasses;
     for (DomainNode<?> succ : successors) {
       // only compare successors to other class domain elements
       if (succ.getId() instanceof OWLClass) {
         //					if(succ.getInstantiators().containsAll(to.getInstantiators())){ // could be done
         // with reasoner
         if (m_useBuffer) {
           if (m_subClassBuffer.get((OWLClass) to.getId()).contains((OWLClass) succ.getId())
               || m_equivalentClassBuffer
                   .get((OWLClass) to.getId())
                   .contains((OWLClass) succ.getId())) {
             return true;
           }
         } else {
           if (subClasses.containsEntity((OWLClass) succ.getId())
               || eqClasses.contains(
                   (OWLClass)
                       succ.getId())) { // if there exists a successors more (or equally) specific
             // than the new one
             return true;
           }
         }
       }
     }
   }
   return false;
 }
  private void addEntailedTBoxSuccessors(OWLObjectSomeValuesFrom some, boolean doNormalizing) {
    //		StatStore.getInstance().enterValue("lookup " + some.getFiller(), 1.0);
    //		StatStore.getInstance().enterValue("restrictions handled", 1.0);
    TRACKER.start(StaticValues.TIME_TBOX_SUCCESSORS, BlockOutputMode.COMPLETE, true);
    //		TRACKER.start("fetch domain element and intermediary", BlockOutputMode.COMPLETE, true);
    DomainNode<?> toNode = getDomainElement(some.getFiller());
    // the super class, intermediary stands for (some r B)
    OWLClass superClass = m_ontologyOperator.getFlatteningTransformer().getIntermediary(some);
    //		TRACKER.stop("fetch domain element and intermediary");
    // add successors from all
    //		TRACKER.start("query elk", BlockOutputMode.COMPLETE, true);
    //		StatStore.getInstance().enterValue("subclass accessing", 1.0);
    NodeSet<OWLClass> classes = m_ontologyOperator.getReasoner().getSubClasses(superClass, false);

    // fill current class relations from Id
    //		StatStore.getInstance().enterValue("subclass accessing", 1.0);
    currentIdSubClasses = m_ontologyOperator.getReasoner().getSubClasses(some.getFiller(), false);
    //		StatStore.getInstance().enterValue("superclass accessing", 1.0);
    currentIdSuperClasses =
        m_ontologyOperator.getReasoner().getSuperClasses(some.getFiller(), false);
    //		StatStore.getInstance().enterValue("equivalent classes accessing", 1.0);
    currentIdEqClasses = m_ontologyOperator.getReasoner().getEquivalentClasses(some.getFiller());

    //		TRACKER.stop("query elk");
    //		LOG.fine(" creating successors to " + some + ": " + classes.toString());
    Iterator<Node<OWLClass>> nodeIt = classes.iterator();
    while (nodeIt.hasNext()) {
      Iterator<OWLClass> it = nodeIt.next().iterator();
      while (it.hasNext()) {
        DomainNode<?> node = m_domain.getDomainNode(it.next());
        // if it.next() yields no domain node, there exists an ABox identity for it
        // and this case is covered by addEntailedKBSuccessors
        if (node != null) {
          if (doNormalizing) {
            //						if(!isSuccessorRepresented(node, (OWLObjectProperty)some.getProperty(),
            // some.getFiller())){
            TRACKER.start("normalizing and adding", BlockOutputMode.COMPLETE, true);
            if (!isSuccessorRepresented(node, toNode, (OWLObjectProperty) some.getProperty())) {
              removeIncludedSuccessors(
                  (OWLObjectProperty) some.getProperty(), node, some.getFiller());

              node.addSuccessor((OWLObjectProperty) some.getProperty(), toNode);
            }
            TRACKER.stop("normalizing and adding");
          } else {
            node.addSuccessor((OWLObjectProperty) some.getProperty(), toNode);
          }
        }
      }
    }
    // add all equivalent class successors
    //		TRACKER.start("query elk", BlockOutputMode.COMPLETE, true);
    Iterator<OWLClass> cIt =
        m_ontologyOperator.getReasoner().getEquivalentClasses(superClass).iterator();
    //		TRACKER.stop("query elk");
    while (cIt.hasNext()) {
      DomainNode<?> node = m_domain.getDomainNode(cIt.next());
      if (node != null) {
        if (doNormalizing) {
          //					if(!isSuccessorRepresented(node, (OWLObjectProperty)some.getProperty(),
          // some.getFiller())){
          TRACKER.start("normalizing and adding", BlockOutputMode.COMPLETE, true);
          if (!isSuccessorRepresented(node, toNode, (OWLObjectProperty) some.getProperty())) {
            removeIncludedSuccessors(
                (OWLObjectProperty) some.getProperty(), node, some.getFiller());

            node.addSuccessor((OWLObjectProperty) some.getProperty(), toNode);
          }
          TRACKER.stop("normalizing and adding");
        } else {
          node.addSuccessor((OWLObjectProperty) some.getProperty(), toNode);
        }
      }
    }
    TRACKER.stop(StaticValues.TIME_TBOX_SUCCESSORS);
  }