while (!orderedMups.isEmpty()) {
if (progressMonitor.isCancelled()) {
return;
}
OWLAxiom axiom = orderedMups.get(0);
orderedMups.remove(0);
if (allMups.size() == maxExplanations) {
if (log.isLoggable(Level.FINE))
log.fine("Computed " + maxExplanations + "explanations");
return;
}
if (log.isLoggable(Level.FINE))
log.fine("Removing axiom: " + axiom + " " + currentPathContents.size() + " more removed: " + currentPathContents);
// Remove the current axiom from all the ontologies it is included
// in
Set<OWLOntology> ontologies = OntologyUtils.removeAxiom(axiom, getReasoner()
.getLoadedOntologies(), getOntologyManager());
// Removal may have dereferenced some entities, if so declarations are added
Set<OWLEntity> sig = getSignature( axiom );
List<OWLDeclarationAxiom> temporaryDeclarations = new ArrayList<OWLDeclarationAxiom>(
sig.size() );
for( OWLEntity e : sig ) {
boolean referenced = false;
for( Iterator<OWLOntology> i = ontologies.iterator(); !referenced && i.hasNext(); ) {
for( Iterator<OWLAxiom> j = i.next().getReferencingAxioms( e ).iterator(); !referenced
&& j.hasNext(); ) {
OWLAxiom a = j.next();
referenced = a.isLogicalAxiom() || (a instanceof OWLDeclarationAxiom);
}
}
if( !referenced ) {
OWLDeclarationAxiom declaration = getOntologyManager().getOWLDataFactory().getOWLDeclarationAxiom( e );
temporaryDeclarations.add( declaration );