Program: 9756
Project: 9756
Buggy source:
/** 
 * This method checks incrementally the consistency of the knowledgebase.
 * @param endpointURI
 */
private void checkForInconsistency(String endpointURI){
  this.endpointURI=endpointURI;
  logger.info("String_Node_Str" + endpointURI);
  PelletOptions.USE_COMPLETION_QUEUE=true;
  PelletOptions.USE_INCREMENTAL_CONSISTENCY=true;
  PelletOptions.USE_SMART_RESTORE=false;
  OWLReasoner reasoner=PelletReasonerFactory.getInstance().createNonBufferingReasoner(ontology);
  overallMonitor.reset();
  reasonerMonitor.reset();
  queryMonitor.reset();
  overallMonitor.start();
  Set<OWLClass> visitedClasses=new HashSet<OWLClass>();
  Set<OWLObjectProperty> visitedObjectProperties=new HashSet<OWLObjectProperty>();
  Set<OWLNamedIndividual> visitedIndividuals=new HashSet<OWLNamedIndividual>();
  Set<OWLClass> classesToVisit=new HashSet<OWLClass>();
  Set<OWLClass> tmp=new HashSet<OWLClass>();
  Set<OWLDisjointClassesAxiom> disjointAxioms=retrieveDisjointClassAxioms();
  manager.addAxioms(ontology,disjointAxioms);
  for (  OWLDisjointClassesAxiom ax : disjointAxioms) {
    for (    OWLClassExpression cl : ax.getClassExpressions()) {
      if (!cl.isAnonymous()) {
        classesToVisit.add(cl.asOWLClass());
      }
    }
  }
  boolean isConsistent=true;
  Set<OWLAxiom> axioms;
  logger.info("String_Node_Str" + classesToVisit.size() + "String_Node_Str");
  for (int i=1; i <= RECURSION_DEPTH; i++) {
    logger.info("String_Node_Str" + i);
    for (    OWLClass cl : classesToVisit) {
      axioms=retrieveAxiomsForClass(cl);
      manager.addAxioms(ontology,axioms);
      if (!axioms.isEmpty()) {
        logger.info("String_Node_Str");
        reasonerMonitor.start();
        isConsistent=reasoner.isConsistent();
        reasonerMonitor.stop();
      }
      for (      OWLAxiom ax : axioms) {
        tmp.addAll(ax.getClassesInSignature());
      }
      if (!isConsistent && BREAK_AFTER_ERROR_FOUND) {
        logger.info("String_Node_Str");
        break;
      }
    }
    logger.info("String_Node_Str" + ontology.getIndividualsInSignature().size() + "String_Node_Str");
    for (    OWLNamedIndividual ind : ontology.getIndividualsInSignature()) {
      if (!visitedIndividuals.contains(ind)) {
        manager.addAxioms(ontology,retrieveAxiomsForIndividual(ind));
        visitedIndividuals.add(ind);
      }
    }
    logger.info("String_Node_Str" + ontology.getObjectPropertiesInSignature().size() + "String_Node_Str");
    for (    OWLObjectProperty prop : ontology.getObjectPropertiesInSignature()) {
      if (!visitedObjectProperties.contains(prop)) {
        manager.addAxioms(ontology,retrieveAxiomsForObjectProperty(prop));
        visitedObjectProperties.add(prop);
      }
    }
    if (!isConsistent && BREAK_AFTER_ERROR_FOUND) {
      break;
    }
    visitedClasses.addAll(classesToVisit);
    tmp.removeAll(visitedClasses);
    classesToVisit.clear();
    classesToVisit.addAll(tmp);
    tmp.clear();
  }
  overallMonitor.stop();
  showStats();
  if (!reasoner.isConsistent()) {
    ExplanationGenerator expGen=new PelletExplanationGenerator(ontology);
    logger.info(expGen.getExplanation(factory.getOWLSubClassOfAxiom(factory.getOWLThing(),factory.getOWLNothing())));
  }
}

Fixed version (ground truth):
/** 
 * This method checks incrementally the consistency of the knowledgebase.
 * @param endpointURI
 */
private void checkForInconsistency(String endpointURI){
  this.endpointURI=endpointURI;
  logger.info("String_Node_Str" + endpointURI);
  PelletOptions.USE_COMPLETION_QUEUE=true;
  PelletOptions.USE_INCREMENTAL_CONSISTENCY=true;
  PelletOptions.USE_SMART_RESTORE=false;
  OWLReasoner reasoner=PelletReasonerFactory.getInstance().createNonBufferingReasoner(ontology);
  overallMonitor.reset();
  reasonerMonitor.reset();
  queryMonitor.reset();
  overallMonitor.start();
  Set<OWLClass> visitedClasses=new HashSet<OWLClass>();
  Set<OWLObjectProperty> visitedObjectProperties=new HashSet<OWLObjectProperty>();
  Set<OWLNamedIndividual> visitedIndividuals=new HashSet<OWLNamedIndividual>();
  Set<OWLClass> classesToVisit=new HashSet<OWLClass>();
  Set<OWLClass> tmp=new HashSet<OWLClass>();
  Set<OWLDisjointClassesAxiom> disjointAxioms=retrieveDisjointClassAxioms();
  manager.addAxioms(ontology,disjointAxioms);
  for (  OWLDisjointClassesAxiom ax : disjointAxioms) {
    for (    OWLClassExpression cl : ax.getClassExpressions()) {
      if (!cl.isAnonymous()) {
        classesToVisit.add(cl.asOWLClass());
      }
    }
  }
  boolean isConsistent=true;
  Set<OWLAxiom> axioms;
  logger.info("String_Node_Str" + classesToVisit.size() + "String_Node_Str");
  for (int i=1; i <= RECURSION_DEPTH; i++) {
    logger.info("String_Node_Str" + i);
    for (    OWLClass cl : classesToVisit) {
      axioms=retrieveAxiomsForClass(cl);
      manager.addAxioms(ontology,axioms);
      if (!axioms.isEmpty()) {
        logger.info("String_Node_Str");
        reasonerMonitor.start();
        isConsistent=reasoner.isConsistent();
        reasonerMonitor.stop();
      }
      for (      OWLAxiom ax : axioms) {
        tmp.addAll(ax.getClassesInSignature());
      }
      if (!isConsistent && BREAK_AFTER_ERROR_FOUND) {
        logger.info("String_Node_Str");
        break;
      }
    }
    logger.info("String_Node_Str" + ontology.getIndividualsInSignature().size() + "String_Node_Str");
    int cnt=0;
    for (    OWLNamedIndividual ind : ontology.getIndividualsInSignature()) {
      if (!visitedIndividuals.contains(ind)) {
        manager.addAxioms(ontology,retrieveAxiomsForIndividual(ind));
        visitedIndividuals.add(ind);
        logger.info("String_Node_Str");
        reasonerMonitor.start();
        isConsistent=reasoner.isConsistent();
        reasonerMonitor.stop();
      }
      if (!isConsistent && BREAK_AFTER_ERROR_FOUND) {
        logger.info("String_Node_Str");
        break;
      }
      cnt++;
      if (cnt == 100) {
        break;
      }
    }
    cnt=0;
    logger.info("String_Node_Str" + ontology.getObjectPropertiesInSignature().size() + "String_Node_Str");
    for (    OWLObjectProperty prop : ontology.getObjectPropertiesInSignature()) {
      if (!visitedObjectProperties.contains(prop)) {
        manager.addAxioms(ontology,retrieveAxiomsForObjectProperty(prop));
        visitedObjectProperties.add(prop);
        logger.info("String_Node_Str");
        reasonerMonitor.start();
        isConsistent=reasoner.isConsistent();
        reasonerMonitor.stop();
      }
      if (!isConsistent && BREAK_AFTER_ERROR_FOUND) {
        logger.info("String_Node_Str");
        break;
      }
      cnt++;
      if (cnt == 100) {
        break;
      }
    }
    if (!isConsistent && BREAK_AFTER_ERROR_FOUND) {
      break;
    }
    visitedClasses.addAll(classesToVisit);
    tmp.removeAll(visitedClasses);
    classesToVisit.clear();
    classesToVisit.addAll(tmp);
    tmp.clear();
  }
  overallMonitor.stop();
  showStats();
  if (!reasoner.isConsistent()) {
    ExplanationGenerator expGen=new PelletExplanationGenerator(ontology);
    logger.info(expGen.getExplanation(factory.getOWLSubClassOfAxiom(factory.getOWLThing(),factory.getOWLNothing())));
  }
}