return prunedExplanation;
// create an ontology from the explanation axioms
OWLOntology debuggingOntology = OWL.Ontology( explanation );
DefinitionTracker defTracker = new DefinitionTracker( debuggingOntology );
// since explanation size is generally small we can create and use a
// completely new reasoner rather than destroying the state on already
// existing reasoner
PelletReasoner reasoner = getReasonerFactory().createNonBufferingReasoner( debuggingOntology );
if( !defTracker.isDefined( unsatClass ) ) {
log.warning( "Some of the entities in " + unsatClass
+ " are not defined in the explanation " + explanation );
}
if( isSatisfiable( reasoner, unsatClass, true ) ) {
log.warning( "Explanation incomplete: Concept " + unsatClass
+ " is satisfiable in the explanation " + explanation );
}
// simply remove axioms one at a time. If the unsatClass turns
// satisfiable then we know that axiom cannot be a part of minimal
// explanation
for( OWLAxiom axiom : explanation ) {
if( log.isLoggable( Level.FINER ) )
log.finer( "Try pruning " + axiom );
if( !incremental) {
reasoner.dispose();
}
OntologyUtils.removeAxioms( debuggingOntology, axiom );
if( !incremental) {
reasoner = getReasonerFactory().createNonBufferingReasoner( debuggingOntology );
}
reasoner.getKB().prepare();
if( defTracker.isDefined( unsatClass )
&& !isSatisfiable( reasoner, unsatClass, false ) ) {
// does not affect satisfiability so remove from the results
prunedExplanation.remove( axiom );
if( log.isLoggable( Level.FINER ) )