title: How to efficiently compute disjointness with OWLAPI?
body: <p>I'm profiling my application that is OWLAPI based and the only bottleneck I found was about computing <strong>disjointness</strong>.
  I have to check if each class is disjoint from other classes and, if this is <em>asserted</em> or <em>inferred</em>.</p>
  
  <p>It seems to be heavy to compute, because unlike for the equivalence which is based on the <em>Node</em> data structure (and it is efficient to retrieve data), the disjointness is based on the <em>NodeSet</em> in this way I'm forced to perform more loops.
  This is the procedure I use:</p>
  
  <pre><code>private void computeDisjointness(OWLClass clazz) {
  
      NodeSet&lt;OWLClass&gt; disjointSetsFromCls = reasoner.getDisjointClasses(clazz);
      for (Node&lt;OWLClass&gt; singleDisjoinSet : disjointSetsFromCls) {
          for (OWLClass item : singleDisjoinSet) {
               for (OWLDisjointClassesAxiom disjAxiom : ontology.getAxioms(AxiomType.DISJOINT_CLASSES)) {
                   if(disjAxiom.containsEntityInSignature(item))
                    {
                     //asserted
                    }
                    else
                    {
                    //derived
                    }
          }
      }
  }
  </code></pre>
  
  <p>As you can see, the bottleneck is given by the 3 for loops that slow down the application; moreover, the procedure <em>computeDisjointness</em> is executed for each class of the ontology.</p>
  
  <p>Is there a more efficient way to get the disjointness and check if the axioms are asserted or derived?</p>