Program: 9531
Project: 9531
Buggy source:
private OWLOntology computeCoherentOntologyRootBased(OWLOntology ontology){
  OWLOntologyManager man=incoherentOntology.getOWLOntologyManager();
  factory=man.getOWLDataFactory();
  logger.info("String_Node_Str");
  long startTime=System.currentTimeMillis();
  StructureBasedRootClassFinder rootFinder=new StructureBasedRootClassFinder(reasoner);
  Set<OWLClass> unsatClasses=rootFinder.getRootUnsatisfiableClasses();
  Set<OWLClass> derivedUnsatClasses=rootFinder.getDerivedUnsatisfiableClasses();
  logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
  int rootCnt=unsatClasses.size();
  int derivedCnt=derivedUnsatClasses.size();
  int cnt=rootCnt + derivedCnt;
  int unsatPropCnt=unsatObjectProperties.size();
  logger.info("String_Node_Str" + cnt + "String_Node_Str"+ rootCnt+ "String_Node_Str");
  if (unsatClasses.isEmpty()) {
    return incoherentOntology;
  }
  logger.info("String_Node_Str");
  startTime=System.currentTimeMillis();
  entity2ModuleMap.putAll(extractModules(unsatClasses));
  logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
  logger.info("String_Node_Str");
  startTime=System.currentTimeMillis();
  entity2Explanations.putAll(getInitialExplanations(unsatClasses));
  if (computeParallel) {
    entity2Explanations.putAll(getInitialExplanations(unsatObjectProperties));
  }
  logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
  if (computeParallel) {
    cnt+=unsatPropCnt;
  }
  while (cnt >= 0) {
    removeAppropriateAxiom();
    logger.info("String_Node_Str");
    startTime=System.currentTimeMillis();
    reasoner.classify();
    logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
    logger.info("String_Node_Str");
    startTime=System.currentTimeMillis();
    rootFinder=new StructureBasedRootClassFinder(reasoner);
    unsatClasses=rootFinder.getRootUnsatisfiableClasses();
    derivedUnsatClasses=rootFinder.getDerivedUnsatisfiableClasses();
    rootCnt=unsatClasses.size();
    derivedCnt=derivedUnsatClasses.size();
    logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
    logger.info("String_Node_Str" + (rootCnt + derivedCnt) + "String_Node_Str"+ rootCnt+ "String_Node_Str");
    if (computeParallel) {
      unsatObjectProperties=getUnsatisfiableObjectProperties(reasoner);
      logger.info("String_Node_Str" + unsatObjectProperties.size());
    }
    if (cnt - (rootCnt + derivedCnt) >= 1 || (unsatPropCnt - unsatObjectProperties.size()) >= 1) {
      cnt=rootCnt + derivedCnt;
      save("String_Node_Str" + cnt + "String_Node_Str"+ unsatPropCnt+ "String_Node_Str");
      cnt=rootCnt + derivedCnt;
      unsatPropCnt=unsatObjectProperties.size();
      if (computeParallel) {
        cnt+=unsatPropCnt;
      }
    }
    logger.info("String_Node_Str");
    startTime=System.currentTimeMillis();
    refillExplanations(unsatClasses,entity2Explanations);
    if (computeParallel) {
      refillExplanations(unsatObjectProperties,entity2Explanations);
    }
    logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
    System.gc();
  }
  entity2Explanations.clear();
  entity2ModuleMap.clear();
  if (!computeParallel) {
    unsatObjectProperties=getUnsatisfiableObjectProperties(reasoner);
    logger.info("String_Node_Str" + unsatObjectProperties.size());
    entity2ModuleMap.putAll(extractModules(unsatObjectProperties));
    while (!unsatObjectProperties.isEmpty()) {
      removeAppropriateAxiom();
      logger.info("String_Node_Str");
      startTime=System.currentTimeMillis();
      reasoner.classify();
      logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
      unsatObjectProperties=getUnsatisfiableObjectProperties(reasoner);
      logger.info("String_Node_Str" + unsatObjectProperties.size());
      if ((unsatPropCnt - unsatObjectProperties.size()) >= 1) {
        save("String_Node_Str" + cnt + "String_Node_Str"+ unsatPropCnt+ "String_Node_Str");
        unsatPropCnt=unsatObjectProperties.size();
      }
      logger.info("String_Node_Str");
      startTime=System.currentTimeMillis();
      refillExplanations(unsatObjectProperties,entity2Explanations);
      logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
      System.gc();
    }
  }
  try {
    incoherentOntology.getOWLOntologyManager().saveOntology(getOntologyWithAnnotations(incoherentOntology),new RDFXMLOntologyFormat(),new BufferedOutputStream(new FileOutputStream("String_Node_Str")));
  }
 catch (  OWLOntologyStorageException e) {
    e.printStackTrace();
  }
catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
  return getOntologyWithAnnotations(incoherentOntology);
}

Fixed version (ground truth):
private OWLOntology computeCoherentOntologyRootBased(OWLOntology ontology){
  OWLOntologyManager man=incoherentOntology.getOWLOntologyManager();
  factory=man.getOWLDataFactory();
  logger.info("String_Node_Str");
  long startTime=System.currentTimeMillis();
  StructureBasedRootClassFinder rootFinder=new StructureBasedRootClassFinder(reasoner);
  Set<OWLClass> unsatClasses=rootFinder.getRootUnsatisfiableClasses();
  Set<OWLClass> derivedUnsatClasses=rootFinder.getDerivedUnsatisfiableClasses();
  logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
  int rootCnt=unsatClasses.size();
  int derivedCnt=derivedUnsatClasses.size();
  int cnt=rootCnt + derivedCnt;
  int unsatPropCnt=unsatObjectProperties.size();
  logger.info("String_Node_Str" + cnt + "String_Node_Str"+ rootCnt+ "String_Node_Str");
  if (unsatClasses.isEmpty()) {
    unsatClasses=derivedUnsatClasses;
  }
  if (unsatClasses.isEmpty()) {
    return incoherentOntology;
  }
  logger.info("String_Node_Str");
  startTime=System.currentTimeMillis();
  entity2ModuleMap.putAll(extractModules(unsatClasses));
  logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
  logger.info("String_Node_Str");
  startTime=System.currentTimeMillis();
  entity2Explanations.putAll(getInitialExplanations(unsatClasses));
  if (computeParallel) {
    entity2Explanations.putAll(getInitialExplanations(unsatObjectProperties));
  }
  logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
  if (computeParallel) {
    cnt+=unsatPropCnt;
  }
  while (cnt >= 0) {
    removeAppropriateAxiom();
    logger.info("String_Node_Str");
    startTime=System.currentTimeMillis();
    reasoner.classify();
    logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
    logger.info("String_Node_Str");
    startTime=System.currentTimeMillis();
    rootFinder=new StructureBasedRootClassFinder(reasoner);
    unsatClasses=rootFinder.getRootUnsatisfiableClasses();
    derivedUnsatClasses=rootFinder.getDerivedUnsatisfiableClasses();
    rootCnt=unsatClasses.size();
    derivedCnt=derivedUnsatClasses.size();
    logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
    logger.info("String_Node_Str" + (rootCnt + derivedCnt) + "String_Node_Str"+ rootCnt+ "String_Node_Str");
    if (unsatClasses.isEmpty()) {
      unsatClasses=derivedUnsatClasses;
    }
    if (computeParallel) {
      unsatObjectProperties=getUnsatisfiableObjectProperties(reasoner);
      logger.info("String_Node_Str" + unsatObjectProperties.size());
    }
    if (cnt - (rootCnt + derivedCnt) >= 1 || (unsatPropCnt - unsatObjectProperties.size()) >= 1) {
      cnt=rootCnt + derivedCnt;
      save("String_Node_Str" + cnt + "String_Node_Str"+ unsatPropCnt+ "String_Node_Str");
      cnt=rootCnt + derivedCnt;
      unsatPropCnt=unsatObjectProperties.size();
      if (computeParallel) {
        cnt+=unsatPropCnt;
      }
    }
    logger.info("String_Node_Str");
    startTime=System.currentTimeMillis();
    refillExplanations(unsatClasses,entity2Explanations);
    if (computeParallel) {
      refillExplanations(unsatObjectProperties,entity2Explanations);
    }
    logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
    System.gc();
  }
  entity2Explanations.clear();
  entity2ModuleMap.clear();
  if (!computeParallel) {
    unsatObjectProperties=getUnsatisfiableObjectProperties(reasoner);
    logger.info("String_Node_Str" + unsatObjectProperties.size());
    entity2ModuleMap.putAll(extractModules(unsatObjectProperties));
    while (!unsatObjectProperties.isEmpty()) {
      removeAppropriateAxiom();
      logger.info("String_Node_Str");
      startTime=System.currentTimeMillis();
      reasoner.classify();
      logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
      unsatObjectProperties=getUnsatisfiableObjectProperties(reasoner);
      logger.info("String_Node_Str" + unsatObjectProperties.size());
      if ((unsatPropCnt - unsatObjectProperties.size()) >= 1) {
        save("String_Node_Str" + cnt + "String_Node_Str"+ unsatPropCnt+ "String_Node_Str");
        unsatPropCnt=unsatObjectProperties.size();
      }
      logger.info("String_Node_Str");
      startTime=System.currentTimeMillis();
      refillExplanations(unsatObjectProperties,entity2Explanations);
      logger.info("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
      System.gc();
    }
  }
  try {
    incoherentOntology.getOWLOntologyManager().saveOntology(getOntologyWithAnnotations(incoherentOntology),new RDFXMLOntologyFormat(),new BufferedOutputStream(new FileOutputStream("String_Node_Str")));
  }
 catch (  OWLOntologyStorageException e) {
    e.printStackTrace();
  }
catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
  return getOntologyWithAnnotations(incoherentOntology);
}