nus-yam/ex-repair huggingface dataset:
Program: 9541
Project: 9541
Buggy source:
@Override public void start(){
  stop=false;
  isRunning=true;
  reset();
  treeStartTime=System.nanoTime();
  ELDescriptionTree top=new ELDescriptionTree(reasoner,Thing.instance);
  addDescriptionTree(top,null);
  int loop=0;
  while (!stop && !stoppingCriteriaSatisfied()) {
    SearchTreeNode best=candidates.pollLast();
    List<ELDescriptionTree> refinements=operator.refine(best.getDescriptionTree());
    for (    ELDescriptionTree refinement : refinements) {
      addDescriptionTree(refinement,best);
    }
    loop++;
    if (logger.isTraceEnabled()) {
      logger.trace("String_Node_Str" + best);
      logger.trace(startNode.getTreeString());
      logger.trace("String_Node_Str" + loop + "String_Node_Str");
    }
  }
  logger.info("String_Node_Str" + bestEvaluatedDescriptions.getBest());
  isRunning=false;
}

Fixed version (ground truth):
@Override public void start(){
  stop=false;
  isRunning=true;
  reset();
  treeStartTime=System.nanoTime();
  ELDescriptionTree top=new ELDescriptionTree(reasoner,Thing.instance);
  addDescriptionTree(top,null);
  int loop=0;
  while (!stop && !stoppingCriteriaSatisfied()) {
    SearchTreeNode best=candidates.pollLast();
    List<ELDescriptionTree> refinements=operator.refine(best.getDescriptionTree());
    for (    ELDescriptionTree refinement : refinements) {
      addDescriptionTree(refinement,best);
    }
    loop++;
    if (logger.isTraceEnabled()) {
      logger.trace("String_Node_Str" + best);
      logger.trace(startNode.getTreeString());
      logger.trace("String_Node_Str" + loop + "String_Node_Str");
    }
  }
  logger.info("String_Node_Str" + bestEvaluatedDescriptions.getBest() + "String_Node_Str"+ Helper.prettyPrintNanoSeconds(System.nanoTime() - treeStartTime)+ "String_Node_Str");
  isRunning=false;
}
Program: 9542
Project: 9542
Buggy source:
private boolean stoppingCriteriaSatisfied(){
  if (bestCurrentScore <= minimumTreeScore) {
    return true;
  }
  int maxPosRemaining=(int)Math.ceil(startPosExamplesSize * 0.05d);
  return (currentPosExamples.size() <= maxPosRemaining);
}

Fixed version (ground truth):
private boolean stoppingCriteriaSatisfied(){
  if (currentPosExamples.size() == 0) {
    return true;
  }
  if (bestCurrentScore <= minimumTreeScore) {
    return true;
  }
  if (tryFullCoverage) {
    return false;
  }
 else {
    int maxPosRemaining=(int)Math.ceil(startPosExamplesSize * 0.05d);
    return (currentPosExamples.size() <= maxPosRemaining);
  }
}
Program: 9544
Project: 9544
Buggy source:
private void reset(){
  candidates.clear();
  trees.clear();
  currentSolution.clear();
  bestEvaluatedDescription=learningProblem.evaluate(Thing.instance);
  currentPosExamples=((PosNegLP)getLearningProblem()).getPositiveExamples();
  currentNegExamples=((PosNegLP)getLearningProblem()).getNegativeExamples();
  startPosExamplesSize=currentPosExamples.size();
}

Fixed version (ground truth):
private void reset(){
  candidates.clear();
  trees.clear();
  currentSolution.clear();
  bestEvaluatedDescription=learningProblem.evaluate(Thing.instance);
  currentPosExamples=new TreeSet<Individual>(((PosNegLP)getLearningProblem()).getPositiveExamples());
  currentNegExamples=new TreeSet<Individual>(((PosNegLP)getLearningProblem()).getNegativeExamples());
  startPosExamplesSize=currentPosExamples.size();
}
Program: 9545
Project: 9545
Buggy source:
private void runSPARQL1_0_Mode(){
  Model model=ModelFactory.createDefaultModel();
  int limit=1000;
  int offset=0;
  String baseQuery="String_Node_Str";
  String query=String.format(baseQuery,classToDescribe.getName(),classToDescribe.getName(),limit,offset);
  System.out.println(query);
  Model newModel=executeConstructQuery(query);
  Map<NamedClass,Integer> result=new HashMap<NamedClass,Integer>();
  NamedClass cls;
  Integer oldCnt;
  while (newModel.size() != 0) {
    model.add(newModel);
    query="String_Node_Str";
    ResultSet rs=executeSelectQuery(query,model);
    int total=rs.next().getLiteral("String_Node_Str").getInt();
    query="String_Node_Str" + "String_Node_Str";
    rs=executeSelectQuery(query,model);
    QuerySolution qs;
    while (rs.hasNext()) {
      qs=rs.next();
      System.out.println(qs);
      if (qs.getResource("String_Node_Str") != null && !qs.getResource("String_Node_Str").isAnon()) {
        cls=new NamedClass(qs.getResource("String_Node_Str").getURI());
        int newCnt=qs.getLiteral("String_Node_Str").getInt();
        oldCnt=result.get(cls);
        if (oldCnt == null) {
          oldCnt=Integer.valueOf(newCnt);
        }
 else {
          oldCnt+=newCnt;
        }
        result.put(cls,oldCnt);
      }
    }
    if (!result.isEmpty()) {
      currentlyBestEvaluatedDescriptions=buildEvaluatedClassDescriptions(result,allClasses,total);
    }
    offset+=limit;
    query=String.format(baseQuery,classToDescribe.getName(),classToDescribe.getName(),limit,offset);
    newModel=executeConstructQuery(query);
  }
}

Fixed version (ground truth):
private void runSPARQL1_0_Mode(){
  Model model=ModelFactory.createDefaultModel();
  int limit=1000;
  int offset=0;
  String baseQuery="String_Node_Str";
  String query=String.format(baseQuery,classToDescribe.getName(),classToDescribe.getName(),limit,offset);
  System.out.println(query);
  Model newModel=executeConstructQuery(query);
  Map<NamedClass,Integer> result=new HashMap<NamedClass,Integer>();
  NamedClass cls;
  while (newModel.size() != 0) {
    model.add(newModel);
    query="String_Node_Str";
    ResultSet rs=executeSelectQuery(query,model);
    int total=rs.next().getLiteral("String_Node_Str").getInt();
    query="String_Node_Str" + "String_Node_Str";
    rs=executeSelectQuery(query,model);
    QuerySolution qs;
    while (rs.hasNext()) {
      qs=rs.next();
      if (qs.getResource("String_Node_Str") != null && !qs.getResource("String_Node_Str").isAnon()) {
        cls=new NamedClass(qs.getResource("String_Node_Str").getURI());
        int newCnt=qs.getLiteral("String_Node_Str").getInt();
        result.put(cls,newCnt);
      }
    }
    if (!result.isEmpty()) {
      currentlyBestEvaluatedDescriptions=buildEvaluatedClassDescriptions(result,allClasses,total);
    }
    offset+=limit;
    query=String.format(baseQuery,classToDescribe.getName(),classToDescribe.getName(),limit,offset);
    newModel=executeConstructQuery(query);
  }
}
Program: 9546
Project: 9546
Buggy source:
private void runSPARQL1_1_Mode(){
  int limit=1000;
  int offset=0;
  String queryTemplate="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  String query;
  Map<DatatypeProperty,Integer> result=new HashMap<DatatypeProperty,Integer>();
  DatatypeProperty prop;
  Integer oldCnt;
  boolean repeat=true;
  ResultSet rs=null;
  while (!terminationCriteriaSatisfied() && repeat) {
    query=String.format(queryTemplate,propertyToDescribe,limit,offset);
    rs=executeSelectQuery(query);
    QuerySolution qs;
    repeat=false;
    while (rs.hasNext()) {
      qs=rs.next();
      prop=new DatatypeProperty(qs.getResource("String_Node_Str").getURI());
      int newCnt=qs.getLiteral("String_Node_Str").getInt();
      oldCnt=result.get(prop);
      if (oldCnt == null) {
        oldCnt=Integer.valueOf(newCnt);
      }
      result.put(prop,oldCnt);
      qs.getLiteral("String_Node_Str").getInt();
      repeat=true;
    }
    if (!result.isEmpty()) {
      currentlyBestAxioms=buildAxioms(result,allDataProperties);
      offset+=1000;
    }
  }
}

Fixed version (ground truth):
private void runSPARQL1_1_Mode(){
  int limit=1000;
  int offset=0;
  String queryTemplate="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  String query;
  Map<DatatypeProperty,Integer> result=new HashMap<DatatypeProperty,Integer>();
  DatatypeProperty prop;
  Integer oldCnt;
  boolean repeat=true;
  ResultSet rs=null;
  while (!terminationCriteriaSatisfied() && repeat) {
    query=String.format(queryTemplate,propertyToDescribe,limit,offset);
    rs=executeSelectQuery(query);
    QuerySolution qs;
    repeat=false;
    while (rs.hasNext()) {
      qs=rs.next();
      prop=new DatatypeProperty(qs.getResource("String_Node_Str").getURI());
      int newCnt=qs.getLiteral("String_Node_Str").getInt();
      oldCnt=result.get(prop);
      if (oldCnt == null) {
        oldCnt=Integer.valueOf(newCnt);
      }
      result.put(prop,oldCnt);
      repeat=true;
    }
    if (!result.isEmpty()) {
      currentlyBestAxioms=buildAxioms(result,allDataProperties);
      offset+=1000;
    }
  }
}
Program: 9547
Project: 9547
Buggy source:
private void runSPARQL1_0_Mode(){
  Model model=ModelFactory.createDefaultModel();
  int limit=1000;
  int offset=0;
  String baseQuery="String_Node_Str";
  String query=String.format(baseQuery,propertyToDescribe.getName(),limit,offset);
  Model newModel=executeConstructQuery(query);
  Map<ObjectProperty,Integer> result=new HashMap<ObjectProperty,Integer>();
  while (!terminationCriteriaSatisfied() && newModel.size() != 0) {
    model.add(newModel);
    query="String_Node_Str";
    ObjectProperty prop;
    Integer oldCnt;
    ResultSet rs=executeSelectQuery(query,model);
    QuerySolution qs;
    while (rs.hasNext()) {
      qs=rs.next();
      prop=new ObjectProperty(qs.getResource("String_Node_Str").getURI());
      int newCnt=qs.getLiteral("String_Node_Str").getInt();
      oldCnt=result.get(prop);
      if (oldCnt == null) {
        oldCnt=Integer.valueOf(newCnt);
      }
      result.put(prop,oldCnt);
      qs.getLiteral("String_Node_Str").getInt();
    }
    if (!result.isEmpty()) {
      currentlyBestAxioms=buildAxioms(result);
    }
    offset+=limit;
    query=String.format(baseQuery,propertyToDescribe.getName(),propertyToDescribe.getName(),limit,offset);
    newModel=executeConstructQuery(query);
  }
}

Fixed version (ground truth):
private void runSPARQL1_0_Mode(){
  Model model=ModelFactory.createDefaultModel();
  int limit=1000;
  int offset=0;
  String baseQuery="String_Node_Str";
  String query=String.format(baseQuery,propertyToDescribe.getName(),limit,offset);
  Model newModel=executeConstructQuery(query);
  Map<ObjectProperty,Integer> result=new HashMap<ObjectProperty,Integer>();
  while (!terminationCriteriaSatisfied() && newModel.size() != 0) {
    model.add(newModel);
    query="String_Node_Str";
    ObjectProperty prop;
    Integer oldCnt;
    ResultSet rs=executeSelectQuery(query,model);
    QuerySolution qs;
    while (rs.hasNext()) {
      qs=rs.next();
      prop=new ObjectProperty(qs.getResource("String_Node_Str").getURI());
      int newCnt=qs.getLiteral("String_Node_Str").getInt();
      oldCnt=result.get(prop);
      if (oldCnt == null) {
        oldCnt=Integer.valueOf(newCnt);
      }
      result.put(prop,oldCnt);
      qs.getLiteral("String_Node_Str").getInt();
    }
    if (!result.isEmpty()) {
      currentlyBestAxioms=buildAxioms(result);
    }
    offset+=limit;
    query=String.format(baseQuery,propertyToDescribe.getName(),limit,offset);
    newModel=executeConstructQuery(query);
  }
}
Program: 9548
Project: 9548
Buggy source:
private void runSPARQL1_0_Mode(){
  Model model=ModelFactory.createDefaultModel();
  int limit=1000;
  int offset=0;
  String baseQuery="String_Node_Str";
  String query=String.format(baseQuery,propertyToDescribe.getName(),limit,offset);
  Model newModel=executeConstructQuery(query);
  Map<ObjectProperty,Integer> result=new HashMap<ObjectProperty,Integer>();
  while (!terminationCriteriaSatisfied() && newModel.size() != 0) {
    model.add(newModel);
    query="String_Node_Str";
    ObjectProperty prop;
    Integer oldCnt;
    ResultSet rs=executeSelectQuery(query,model);
    QuerySolution qs;
    while (rs.hasNext()) {
      qs=rs.next();
      prop=new ObjectProperty(qs.getResource("String_Node_Str").getURI());
      int newCnt=qs.getLiteral("String_Node_Str").getInt();
      oldCnt=result.get(prop);
      if (oldCnt == null) {
        oldCnt=Integer.valueOf(newCnt);
      }
      result.put(prop,oldCnt);
      qs.getLiteral("String_Node_Str").getInt();
    }
    if (!result.isEmpty()) {
      currentlyBestAxioms=buildAxioms(result);
    }
    offset+=limit;
    query=String.format(baseQuery,propertyToDescribe.getName(),propertyToDescribe.getName(),limit,offset);
    newModel=executeConstructQuery(query);
  }
}

Fixed version (ground truth):
private void runSPARQL1_0_Mode(){
  Model model=ModelFactory.createDefaultModel();
  int limit=1000;
  int offset=0;
  String baseQuery="String_Node_Str";
  String query=String.format(baseQuery,propertyToDescribe.getName(),limit,offset);
  Model newModel=executeConstructQuery(query);
  Map<ObjectProperty,Integer> result=new HashMap<ObjectProperty,Integer>();
  while (!terminationCriteriaSatisfied() && newModel.size() != 0) {
    model.add(newModel);
    query="String_Node_Str";
    ObjectProperty prop;
    Integer oldCnt;
    ResultSet rs=executeSelectQuery(query,model);
    QuerySolution qs;
    while (rs.hasNext()) {
      qs=rs.next();
      prop=new ObjectProperty(qs.getResource("String_Node_Str").getURI());
      int newCnt=qs.getLiteral("String_Node_Str").getInt();
      oldCnt=result.get(prop);
      if (oldCnt == null) {
        oldCnt=Integer.valueOf(newCnt);
      }
      result.put(prop,oldCnt);
      qs.getLiteral("String_Node_Str").getInt();
    }
    if (!result.isEmpty()) {
      currentlyBestAxioms=buildAxioms(result);
    }
    offset+=limit;
    query=String.format(baseQuery,propertyToDescribe.getName(),limit,offset);
    newModel=executeConstructQuery(query);
  }
}
Program: 9549
Project: 9549
Buggy source:
@Override public String toManchesterSyntaxString(String baseURI,Map<String,String> prefixes){
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toManchesterSyntaxString(String baseURI,Map<String,String> prefixes){
  return role.toManchesterSyntaxString(baseURI,prefixes) + "String_Node_Str" + inverseRole.toManchesterSyntaxString(baseURI,prefixes);
}
Program: 9550
Project: 9550
Buggy source:
@Override public void init() throws ComponentInitException {
  if (endpoint == null) {
    endpoint=new SparqlEndpoint(url,defaultGraphURIs,namedGraphURIs);
  }
  supportsSPARQL_1_1=new SPARQLTasks(endpoint).supportsSPARQL_1_1();
}

Fixed version (ground truth):
@Override public void init() throws ComponentInitException {
  if (!initialized) {
    if (endpoint == null) {
      endpoint=new SparqlEndpoint(url,defaultGraphURIs,namedGraphURIs);
    }
    supportsSPARQL_1_1=new SPARQLTasks(endpoint).supportsSPARQL_1_1();
    initialized=true;
  }
}
Program: 9551
Project: 9551
Buggy source:
/** 
 * Converts Jena result set to JSON.
 * @param resultSet The result set to transform, must be rewindable to prevent errors.
 * @return JSON representation of the result set.
 */
public static String convertResultSetToJSON(ResultSetRewindable resultSet){
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ResultSetFormatter.outputAsJSON(baos,resultSet);
  resultSet.reset();
  try {
    return baos.toString("String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    throw new Error(e);
  }
}

Fixed version (ground truth):
/** 
 * Converts Jena result set to JSON.
 * @param resultSet The result set to transform, must be rewindable to prevent errors.
 * @return JSON representation of the result set.
 */
public static String convertResultSetToJSON(ResultSet resultSet){
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ResultSetFormatter.outputAsJSON(baos,resultSet);
  try {
    return baos.toString("String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    throw new Error(e);
  }
}
Program: 9552
Project: 9552
Buggy source:
public int getPropertyCount(ObjectProperty property){
  String query=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",property.getName());
  ResultSet rs=executeSelectQuery(query);
  int cnt=rs.next().get(rs.getResultVars().get(0)).asLiteral().getInt();
  return cnt;
}

Fixed version (ground truth):
public int getPropertyCount(ObjectProperty property){
  String query=String.format("String_Node_Str",property.getName());
  ResultSet rs=executeSelectQuery(query);
  int cnt=rs.next().get(rs.getResultVars().get(0)).asLiteral().getInt();
  return cnt;
}
Program: 9553
Project: 9553
Buggy source:
public SortedSet<ObjectProperty> getInverseObjectProperties(ObjectProperty property){
  SortedSet<ObjectProperty> inverseObjectProperties=new TreeSet<ObjectProperty>();
  String query="String_Node_Str" + "String_Node_Str".replace("String_Node_Str",property.getName()).replace("String_Node_Str",OWL.inverseOf.getURI());
  System.out.println(query);
  ResultSet rs=executeSelectQuery(query);
  QuerySolution qs;
  while (rs.hasNext()) {
    qs=rs.next();
    inverseObjectProperties.add(new ObjectProperty(qs.getResource("String_Node_Str").getURI()));
  }
  return inverseObjectProperties;
}

Fixed version (ground truth):
public SortedSet<ObjectProperty> getInverseObjectProperties(ObjectProperty property){
  SortedSet<ObjectProperty> inverseObjectProperties=new TreeSet<ObjectProperty>();
  String query="String_Node_Str" + "String_Node_Str".replace("String_Node_Str",property.getName()).replace("String_Node_Str",OWL.inverseOf.getURI());
  ResultSet rs=executeSelectQuery(query);
  QuerySolution qs;
  while (rs.hasNext()) {
    qs=rs.next();
    inverseObjectProperties.add(new ObjectProperty(qs.getResource("String_Node_Str").getURI()));
  }
  return inverseObjectProperties;
}
Program: 9560
Project: 9560
Buggy source:
public RhoDRDown(AbstractReasonerComponent reasoningService,ClassHierarchy subHierarchy,boolean applyAllFilter,boolean applyExistsFilter,boolean useAllConstructor,boolean useExistsConstructor,boolean useHasValueConstructor,int valueFrequencyThreshold,boolean useCardinalityRestrictions,boolean useNegation,boolean useBooleanDatatypes,boolean useDoubleDatatypes,NamedClass startClass,int cardinalityLimit,boolean useStringDatatypes,boolean instanceBasedDisjoints){
  this.reasoner=reasoningService;
  this.subHierarchy=subHierarchy;
  this.applyAllFilter=applyAllFilter;
  this.applyExistsFilter=applyExistsFilter;
  this.useAllConstructor=useAllConstructor;
  this.useExistsConstructor=useExistsConstructor;
  this.useHasValueConstructor=useHasValueConstructor;
  this.frequencyThreshold=valueFrequencyThreshold;
  this.useCardinalityRestrictions=useCardinalityRestrictions;
  this.cardinalityLimit=cardinalityLimit;
  this.useNegation=useNegation;
  this.useBooleanDatatypes=useBooleanDatatypes;
  this.useDoubleDatatypes=useDoubleDatatypes;
  this.useStringDatatypes=useStringDatatypes;
  this.instanceBasedDisjoints=instanceBasedDisjoints;
  if (startClass != null) {
    this.startClass=startClass;
  }
  init();
}

Fixed version (ground truth):
public RhoDRDown(){
}
Program: 9562
Project: 9562
Buggy source:
@Test public void invertedOperatorTest() throws ParseException {
  AbstractReasonerComponent rs=TestOntologies.getTestOntology(TestOntology.RHO1);
  RhoDRDown rho=new RhoDRDown(rs);
  rho.setDropDisjuncts(true);
  RefinementOperator operator=new OperatorInverter(rho);
  Description concept=KBParser.parseConcept("String_Node_Str");
  Set<Description> refinements=operator.refine(concept,6);
  for (  Description refinement : refinements) {
    System.out.println(refinement);
  }
  assertTrue(refinements.size() == 4);
}

Fixed version (ground truth):
@Test public void invertedOperatorTest() throws ParseException {
  AbstractReasonerComponent rs=TestOntologies.getTestOntology(TestOntology.RHO1);
  RhoDRDown rho=new RhoDRDown();
  rho.setReasoner(rs);
  rho.setDropDisjuncts(true);
  RefinementOperator operator=new OperatorInverter(rho);
  Description concept=KBParser.parseConcept("String_Node_Str");
  Set<Description> refinements=operator.refine(concept,6);
  for (  Description refinement : refinements) {
    System.out.println(refinement);
  }
  assertTrue(refinements.size() == 4);
}
Program: 9563
Project: 9563
Buggy source:
@Test public void rhoDRDownTest2() throws ParseException {
  AbstractReasonerComponent reasoner=TestOntologies.getTestOntology(TestOntology.EPC_OE);
  baseURI=reasoner.getBaseURI();
  RhoDRDown op=new RhoDRDown(reasoner);
  Description concept=KBParser.parseConcept("String_Node_Str");
  Set<Description> results=op.refine(concept,10);
  for (  Description result : results) {
    System.out.println(result.toString("String_Node_Str",null));
  }
  int desiredResultSize=116;
  if (results.size() != desiredResultSize) {
    System.out.println(results.size() + "String_Node_Str" + desiredResultSize+ "String_Node_Str");
  }
  assertTrue(results.size() == desiredResultSize);
}

Fixed version (ground truth):
@Test public void rhoDRDownTest2() throws ParseException {
  AbstractReasonerComponent reasoner=TestOntologies.getTestOntology(TestOntology.EPC_OE);
  baseURI=reasoner.getBaseURI();
  RhoDRDown op=new RhoDRDown();
  op.setReasoner(reasoner);
  Description concept=KBParser.parseConcept("String_Node_Str");
  Set<Description> results=op.refine(concept,10);
  for (  Description result : results) {
    System.out.println(result.toString("String_Node_Str",null));
  }
  int desiredResultSize=116;
  if (results.size() != desiredResultSize) {
    System.out.println(results.size() + "String_Node_Str" + desiredResultSize+ "String_Node_Str");
  }
  assertTrue(results.size() == desiredResultSize);
}
Program: 9564
Project: 9564
Buggy source:
@Test public void rhoDownTestPellet(){
  Logger.getRootLogger().setLevel(Level.TRACE);
  AbstractReasonerComponent rs=TestOntologies.getTestOntology(TestOntology.FATHER);
  RhoDRDown rho=new RhoDRDown(rs);
  NamedClass nc=new NamedClass("String_Node_Str");
  Set<Description> refinements=rho.refine(nc,5);
  for (  Description refinement : refinements) {
    System.out.println(refinement);
  }
  System.out.println(rs.getObjectPropertyHierarchy());
  assertTrue(refinements.size() == 8);
}

Fixed version (ground truth):
@Test public void rhoDownTestPellet(){
  Logger.getRootLogger().setLevel(Level.TRACE);
  AbstractReasonerComponent rs=TestOntologies.getTestOntology(TestOntology.FATHER);
  RhoDRDown rho=new RhoDRDown();
  rho.setReasoner(rs);
  NamedClass nc=new NamedClass("String_Node_Str");
  Set<Description> refinements=rho.refine(nc,5);
  for (  Description refinement : refinements) {
    System.out.println(refinement);
  }
  System.out.println(rs.getObjectPropertyHierarchy());
  assertTrue(refinements.size() == 8);
}
Program: 9565
Project: 9565
Buggy source:
@Test public void rhoDRDownTest3() throws ParseException, LearningProblemUnsupportedException {
  AbstractReasonerComponent reasoner=TestOntologies.getTestOntology(TestOntology.KRK_ZERO_ONE);
  baseURI=reasoner.getBaseURI();
  ComponentManager cm=ComponentManager.getInstance();
  AbstractLearningProblem lp=cm.learningProblem(PosNegLPStandard.class,reasoner);
  OCEL la=cm.learningAlgorithm(OCEL.class,lp,reasoner);
  Set<NamedClass> ignoredConcepts=new TreeSet<NamedClass>();
  ignoredConcepts.add(new NamedClass("String_Node_Str"));
  ignoredConcepts.add(new NamedClass("String_Node_Str"));
  Set<NamedClass> usedConcepts=Helper.computeConceptsUsingIgnoreList(reasoner,ignoredConcepts);
  ClassHierarchy classHierarchy=reasoner.getClassHierarchy().cloneAndRestrict(usedConcepts);
  classHierarchy.thinOutSubsumptionHierarchy();
  System.out.println("String_Node_Str");
  RhoDRDown op=new RhoDRDown(reasoner);
  Description concept=KBParser.parseConcept("String_Node_Str");
  Set<Description> results=op.refine(concept,8);
  for (  Description result : results) {
    System.out.println(result.toString("String_Node_Str",null));
  }
  int desiredResultSize=8;
  if (results.size() != desiredResultSize) {
    System.out.println(results.size() + "String_Node_Str" + desiredResultSize+ "String_Node_Str");
  }
  assertTrue(results.size() == desiredResultSize);
}

Fixed version (ground truth):
@Test public void rhoDRDownTest3() throws ParseException, LearningProblemUnsupportedException {
  AbstractReasonerComponent reasoner=TestOntologies.getTestOntology(TestOntology.KRK_ZERO_ONE);
  baseURI=reasoner.getBaseURI();
  ComponentManager cm=ComponentManager.getInstance();
  AbstractLearningProblem lp=cm.learningProblem(PosNegLPStandard.class,reasoner);
  OCEL la=cm.learningAlgorithm(OCEL.class,lp,reasoner);
  Set<NamedClass> ignoredConcepts=new TreeSet<NamedClass>();
  ignoredConcepts.add(new NamedClass("String_Node_Str"));
  ignoredConcepts.add(new NamedClass("String_Node_Str"));
  Set<NamedClass> usedConcepts=Helper.computeConceptsUsingIgnoreList(reasoner,ignoredConcepts);
  ClassHierarchy classHierarchy=reasoner.getClassHierarchy().cloneAndRestrict(usedConcepts);
  classHierarchy.thinOutSubsumptionHierarchy();
  System.out.println("String_Node_Str");
  RhoDRDown op=new RhoDRDown();
  op.setReasoner(reasoner);
  Description concept=KBParser.parseConcept("String_Node_Str");
  Set<Description> results=op.refine(concept,8);
  for (  Description result : results) {
    System.out.println(result.toString("String_Node_Str",null));
  }
  int desiredResultSize=8;
  if (results.size() != desiredResultSize) {
    System.out.println(results.size() + "String_Node_Str" + desiredResultSize+ "String_Node_Str");
  }
  assertTrue(results.size() == desiredResultSize);
}
Program: 9566
Project: 9566
Buggy source:
@Test public void rhoDRDownTest4() throws ParseException, LearningProblemUnsupportedException {
  AbstractReasonerComponent rs=TestOntologies.getTestOntology(TestOntology.RHO1);
  RefinementOperator operator=new RhoDRDown(rs);
  Description concept=KBParser.parseConcept("String_Node_Str");
  Set<Description> refinements=operator.refine(concept,6);
  for (  Description refinement : refinements) {
    System.out.println(refinement);
  }
}

Fixed version (ground truth):
@Test public void rhoDRDownTest4() throws ParseException, LearningProblemUnsupportedException {
  AbstractReasonerComponent rs=TestOntologies.getTestOntology(TestOntology.RHO1);
  RefinementOperator operator=new RhoDRDown();
  ((RhoDRDown)operator).setReasoner(rs);
  Description concept=KBParser.parseConcept("String_Node_Str");
  Set<Description> refinements=operator.refine(concept,6);
  for (  Description refinement : refinements) {
    System.out.println(refinement);
  }
}
Program: 9567
Project: 9567
Buggy source:
/** 
 * Applies the RhoDRDown operator to a concept and checks that the number of refinements is correct.
 */
@Test public void rhoDRDownTest(){
  try {
    String file="String_Node_Str";
    ComponentManager cm=ComponentManager.getInstance();
    AbstractKnowledgeSource ks=cm.knowledgeSource(OWLFile.class);
    try {
      cm.applyConfigEntry(ks,"String_Node_Str",new File(file).toURI().toURL());
    }
 catch (    MalformedURLException e) {
      e.printStackTrace();
    }
    ks.init();
    AbstractReasonerComponent rc=cm.reasoner(OWLAPIReasoner.class,ks);
    rc.init();
    baseURI=rc.getBaseURI();
    RhoDRDown op=new RhoDRDown(rc);
    Description concept=KBParser.parseConcept(uri("String_Node_Str"));
    Set<Description> results=op.refine(concept,4,null);
    for (    Description result : results) {
      System.out.println(result);
    }
    int desiredResultSize=141;
    if (results.size() != desiredResultSize) {
      System.out.println(results.size() + "String_Node_Str" + desiredResultSize+ "String_Node_Str");
    }
    assertTrue(results.size() == desiredResultSize);
  }
 catch (  ComponentInitException e) {
    e.printStackTrace();
  }
catch (  ParseException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Applies the RhoDRDown operator to a concept and checks that the number of refinements is correct.
 */
@Test public void rhoDRDownTest(){
  try {
    String file="String_Node_Str";
    ComponentManager cm=ComponentManager.getInstance();
    AbstractKnowledgeSource ks=cm.knowledgeSource(OWLFile.class);
    try {
      cm.applyConfigEntry(ks,"String_Node_Str",new File(file).toURI().toURL());
    }
 catch (    MalformedURLException e) {
      e.printStackTrace();
    }
    ks.init();
    AbstractReasonerComponent rc=cm.reasoner(OWLAPIReasoner.class,ks);
    rc.init();
    baseURI=rc.getBaseURI();
    RhoDRDown op=new RhoDRDown();
    op.setReasoner(rc);
    Description concept=KBParser.parseConcept(uri("String_Node_Str"));
    Set<Description> results=op.refine(concept,4,null);
    for (    Description result : results) {
      System.out.println(result);
    }
    int desiredResultSize=141;
    if (results.size() != desiredResultSize) {
      System.out.println(results.size() + "String_Node_Str" + desiredResultSize+ "String_Node_Str");
    }
    assertTrue(results.size() == desiredResultSize);
  }
 catch (  ComponentInitException e) {
    e.printStackTrace();
  }
catch (  ParseException e) {
    e.printStackTrace();
  }
}
Program: 9568
Project: 9568
Buggy source:
@Test public void rhoDRDownTest5() throws ParseException, LearningProblemUnsupportedException {
  AbstractReasonerComponent rs=TestOntologies.getTestOntology(TestOntology.SWORE);
  RefinementOperator operator=new RhoDRDown(rs);
  Description concept=KBParser.parseConcept("String_Node_Str");
  System.out.println(concept);
  Set<Description> refinements=operator.refine(concept,7);
  for (  Description refinement : refinements) {
    System.out.println(refinement);
  }
}

Fixed version (ground truth):
@Test public void rhoDRDownTest5() throws ParseException, LearningProblemUnsupportedException {
  AbstractReasonerComponent rs=TestOntologies.getTestOntology(TestOntology.SWORE);
  RefinementOperator operator=new RhoDRDown();
  ((RhoDRDown)operator).setReasoner(rs);
  Description concept=KBParser.parseConcept("String_Node_Str");
  System.out.println(concept);
  Set<Description> refinements=operator.refine(concept,7);
  for (  Description refinement : refinements) {
    System.out.println(refinement);
  }
}
Program: 9569
Project: 9569
Buggy source:
public void run() throws IOException {
  if (writeSpringConfiguration) {
    SpringConfigurationXMLBeanConverter converter=new SpringConfigurationXMLBeanConverter();
    XmlObject xml;
    if (configuration == null) {
      Resource confFileR=new FileSystemResource(confFile);
      configuration=new ConfParserConfiguration(confFileR);
      xml=converter.convert(configuration);
    }
 else {
      xml=converter.convert(configuration);
    }
    String springFilename=confFile.getCanonicalPath().replace("String_Node_Str","String_Node_Str");
    File springFile=new File(springFilename);
    if (springFile.exists()) {
      logger.warn("String_Node_Str" + springFilename + "String_Node_Str");
    }
 else {
      Files.createFile(springFile,xml.toString());
    }
  }
  if (performCrossValidation) {
    AbstractReasonerComponent rs=context.getBean(AbstractReasonerComponent.class);
    PosNegLP lp=context.getBean(PosNegLP.class);
    AbstractCELA la=context.getBean(AbstractCELA.class);
    new CrossValidation(la,lp,rs,nrOfFolds,false);
  }
 else {
    LearningAlgorithm algorithm=context.getBean(LearningAlgorithm.class);
    algorithm.start();
  }
}

Fixed version (ground truth):
public void run() throws IOException {
  if (writeSpringConfiguration) {
    SpringConfigurationXMLBeanConverter converter=new SpringConfigurationXMLBeanConverter();
    XmlObject xml;
    if (configuration == null) {
      Resource confFileR=new FileSystemResource(confFile);
      configuration=new ConfParserConfiguration(confFileR);
      xml=converter.convert(configuration);
    }
 else {
      xml=converter.convert(configuration);
    }
    String springFilename=confFile.getCanonicalPath().replace("String_Node_Str","String_Node_Str");
    File springFile=new File(springFilename);
    if (springFile.exists()) {
      logger.warn("String_Node_Str" + springFilename + "String_Node_Str");
    }
 else {
      Files.createFile(springFile,xml.toString());
    }
  }
  if (performCrossValidation) {
    AbstractReasonerComponent rs=context.getBean(AbstractReasonerComponent.class);
    PosNegLP lp=context.getBean(PosNegLP.class);
    AbstractCELA la=context.getBean(AbstractCELA.class);
    new CrossValidation(la,lp,rs,nrOfFolds,false);
  }
 else {
    knowledgeSource=context.getBean(KnowledgeSource.class);
    algorithm=context.getBean(LearningAlgorithm.class);
    algorithm.start();
  }
}
Program: 9570
Project: 9570
Buggy source:
public static void getAllConfs(File f,String path,HashMap<String,ArrayList<String>> confs){
  path=path + File.separator;
  String[] act=f.list();
  for (int i=0; i < act.length; i++) {
    if (new File(path + act[i]).isDirectory()) {
      getAllConfs(new File(path + act[i]),path + act[i],confs);
    }
 else     if (act[i].endsWith("String_Node_Str")) {
      if (confs.get(path) == null) {
        confs.put(path,new ArrayList<String>());
      }
      confs.get(path).add(act[i].substring(0,act[i].length() - 5));
      conffiles.add(path + act[i]);
    }
  }
}

Fixed version (ground truth):
public static void getAllConfs(File f,String path,Map<String,ArrayList<String>> confs){
  path=path + File.separator;
  String[] act=f.list();
  for (int i=0; i < act.length; i++) {
    if (new File(path + act[i]).isDirectory()) {
      getAllConfs(new File(path + act[i]),path + act[i],confs);
    }
 else     if (act[i].endsWith("String_Node_Str")) {
      if (confs.get(path) == null) {
        confs.put(path,new ArrayList<String>());
      }
      confs.get(path).add(act[i].substring(0,act[i].length() - 5));
      conffiles.add(path + act[i]);
    }
  }
}
Program: 9572
Project: 9572
Buggy source:
private PdbRdfModel extractDataForPdbAndChain(PdbRdfModel model,String pdbID,String chainID){
  PdbRdfModel construct=new PdbRdfModel();
  String queryString="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  if (chainID.length() == 1 && pdbID.length() == 4) {
    queryString+="String_Node_Str" + pdbID.toUpperCase() + "String_Node_Str"+ chainID.toUpperCase()+ "String_Node_Str";
  }
  queryString+="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  System.out.println(queryString);
  Query query=QueryFactory.create(queryString);
  QueryExecution qe=QueryExecutionFactory.create(query,model);
  construct.add(qe.execConstruct());
  qe.close();
  return construct;
}

Fixed version (ground truth):
private PdbRdfModel extractDataForPdbAndChain(PdbRdfModel model,String pdbID,String chainID){
  PdbRdfModel construct=new PdbRdfModel();
  String queryString="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  if (chainID.length() == 1 && pdbID.length() == 4) {
    queryString+="String_Node_Str" + pdbID.toUpperCase() + "String_Node_Str"+ chainID.toUpperCase()+ "String_Node_Str";
  }
  queryString+="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  System.out.println(queryString);
  Query query=QueryFactory.create(queryString);
  QueryExecution qe=QueryExecutionFactory.create(query,model);
  construct.add(qe.execConstruct());
  qe.close();
  return construct;
}
Program: 9573
Project: 9573
Buggy source:
private HashMap<Integer,Resource> createPositionResidueMap(){
  HashMap<Integer,Resource> posres=new HashMap<Integer,Resource>(150);
  Property iib=ResourceFactory.createProperty("String_Node_Str","String_Node_Str");
  ResIterator firstAAs=this.getFirstAA();
  while (firstAAs.hasNext()) {
    Resource firstAA=firstAAs.next();
    Resource nextAA=firstAA;
    Resource currentAA=firstAA;
    do {
      currentAA=nextAA;
      posres.put(new Integer(this.getResiduePosition(currentAA)),currentAA);
      nextAA=_pdbIdModel.getProperty(currentAA,iib).getResource();
    }
 while (currentAA.hasProperty(iib));
  }
  return posres;
}

Fixed version (ground truth):
private HashMap<Integer,Resource> createPositionResidueMap(){
  HashMap<Integer,Resource> posres=new HashMap<Integer,Resource>(150);
  Property iib=ResourceFactory.createProperty("String_Node_Str","String_Node_Str");
  ResIterator firstAAs=this.getFirstAA();
  while (firstAAs.hasNext()) {
    Resource firstAA=firstAAs.next();
    Resource currentAA=firstAA;
    posres.put(new Integer(this.getResiduePosition(currentAA)),currentAA);
    while (currentAA.hasProperty(iib)) {
      currentAA=_pdbIdModel.getProperty(currentAA,iib).getResource();
      posres.put(new Integer(this.getResiduePosition(currentAA)),currentAA);
    }
  }
  return posres;
}
Program: 9574
Project: 9574
Buggy source:
private int getResiduePosition(Resource res){
  Property hasChainPosition=ResourceFactory.createProperty("String_Node_Str","String_Node_Str");
  Property label=ResourceFactory.createProperty("String_Node_Str","String_Node_Str");
  ResourceFactory.createResource();
  NodeIterator residuePosition=_pdbIdModel.listObjectsOfProperty(res,hasChainPosition);
  ArrayList<RDFNode> positionNodes=new ArrayList<RDFNode>();
  ArrayList<String> positionLabels=new ArrayList<String>();
  while (residuePosition.hasNext()) {
    RDFNode positionNode=residuePosition.next();
    positionNodes.add(positionNode);
    NodeIterator positionLabelNodes=_pdbIdModel.listObjectsOfProperty(positionNode.asResource(),label);
    while (positionLabelNodes.hasNext()) {
      positionLabels.add(positionLabelNodes.next().toString());
    }
  }
  Integer position=null;
  if (positionNodes.size() == 1 && positionLabels.size() == 1) {
    String positionLabel=positionLabels.get(0);
    String a=new String("String_Node_Str");
    String b=new String("String_Node_Str");
    position=Integer.parseInt(positionLabel.substring(positionLabel.indexOf(a) + a.length(),positionLabel.indexOf(b)));
  }
 else {
    position=new Integer(0);
    _logger.error("String_Node_Str");
  }
  return position.intValue();
}

Fixed version (ground truth):
private int getResiduePosition(Resource res){
  Property hasChainPosition=ResourceFactory.createProperty("String_Node_Str","String_Node_Str");
  Property hasValue=ResourceFactory.createProperty("String_Node_Str","String_Node_Str");
  ResourceFactory.createResource();
  NodeIterator residuePosition=_pdbIdModel.listObjectsOfProperty(res,hasChainPosition);
  ArrayList<RDFNode> positionNodes=new ArrayList<RDFNode>();
  ArrayList<Integer> positionLabels=new ArrayList<Integer>();
  while (residuePosition.hasNext()) {
    RDFNode positionNode=residuePosition.next();
    positionNodes.add(positionNode);
    NodeIterator positionLabelNodes=_pdbIdModel.listObjectsOfProperty(positionNode.asResource(),hasValue);
    while (positionLabelNodes.hasNext()) {
      positionLabels.add(positionLabelNodes.next().asLiteral().getInt());
    }
  }
  Integer position=null;
  if (positionNodes.size() == 1 && positionLabels.size() == 1) {
    position=positionLabels.get(0);
  }
 else {
    position=new Integer(0);
    _logger.error("String_Node_Str");
  }
  return position.intValue();
}
Program: 9575
Project: 9575
Buggy source:
@Autowired public void setLearningProblem(AbstractLearningProblem learningProblem){
  this.learningProblem=learningProblem;
}

Fixed version (ground truth):
@Autowired public void setLearningProblem(LearningProblem learningProblem){
  this.learningProblem=learningProblem;
}
Program: 9576
Project: 9576
Buggy source:
public AbstractLearningProblem getLearningProblem(){
  return learningProblem;
}

Fixed version (ground truth):
public LearningProblem getLearningProblem(){
  return learningProblem;
}
Program: 9578
Project: 9578
Buggy source:
private String createAnswer(String string){
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  return string;
}

Fixed version (ground truth):
private String createAnswer(String string){
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  string=string.replace("String_Node_Str","String_Node_Str");
  return string;
}
Program: 9580
Project: 9580
Buggy source:
private Description rewriteNode(OENode node){
  Description description=node.getDescription();
  Description niceDescription=minimizer.minimizeClone(description);
  ConceptTransformation.replaceRange(niceDescription,reasoner);
  return niceDescription;
}

Fixed version (ground truth):
private Description rewriteNode(OENode node){
  Description description=node.getDescription();
  Description niceDescription;
  if (useMinimizer) {
    niceDescription=minimizer.minimizeClone(description);
  }
 else {
    niceDescription=description;
  }
  ConceptTransformation.replaceRange(niceDescription,reasoner);
  return niceDescription;
}
Program: 9581
Project: 9581
Buggy source:
private TreeSet<ObjectProperty> getFirstObjectProperties(NodeSet<OWLObjectPropertyExpression> nodeSet){
  TreeSet<ObjectProperty> roles=new TreeSet<ObjectProperty>(roleComparator);
  for (  Node<OWLObjectPropertyExpression> node : nodeSet) {
    if (node.isBottomNode() || node.isTopNode()) {
      continue;
    }
    OWLObjectPropertyExpression property=node.getRepresentativeElement();
    roles.add(new ObjectProperty(property.asOWLObjectProperty().toStringID()));
  }
  roles.remove(new ObjectProperty(factory.getOWLTopObjectProperty().toStringID()));
  roles.remove(new ObjectProperty(factory.getOWLBottomObjectProperty().toStringID()));
  return roles;
}

Fixed version (ground truth):
private TreeSet<ObjectProperty> getFirstObjectProperties(NodeSet<OWLObjectPropertyExpression> nodeSet){
  TreeSet<ObjectProperty> roles=new TreeSet<ObjectProperty>(roleComparator);
  for (  Node<OWLObjectPropertyExpression> node : nodeSet) {
    if (node.isBottomNode() || node.isTopNode()) {
      continue;
    }
    OWLObjectPropertyExpression property=node.getRepresentativeElement();
    if (!property.isAnonymous()) {
      roles.add(new ObjectProperty(property.asOWLObjectProperty().toStringID()));
    }
  }
  roles.remove(new ObjectProperty(factory.getOWLTopObjectProperty().toStringID()));
  roles.remove(new ObjectProperty(factory.getOWLBottomObjectProperty().toStringID()));
  return roles;
}
Program: 9584
Project: 9584
Buggy source:
public ArrayList<String> getPropertys(String element) throws IOException {
  sendServerPropertyRequest(element);
  return do_parsing("String_Node_Str");
}

Fixed version (ground truth):
public ArrayList<String> getPropertys(String element) throws IOException {
  try {
    sendServerPropertyRequest(element);
    return do_parsing("String_Node_Str");
  }
 catch (  Exception e) {
    return null;
  }
}
Program: 9585
Project: 9585
Buggy source:
private List<String> getCandidateURIsSortedBySimilarity(Slot slot){
  logger.info("String_Node_Str" + slot.getWords() + "String_Node_Str");
  mon.start();
  List<String> sortedURIs=new ArrayList<String>();
  SolrSearch index=getIndexBySlotType(slot);
  Map<String,SolrQueryResultSet> uriCache=getCacheBySlotType(slot);
  SortedSet<SolrQueryResultItem> tmp;
  SolrQueryResultSet rs;
  List<String> words;
  if (slot.getSlotType() == SlotType.RESOURCE) {
    words=slot.getWords();
  }
 else {
    words=pruneList(slot.getWords());
  }
  for (  String word : words) {
    tmp=new TreeSet<SolrQueryResultItem>(new SolrQueryResultStringSimilarityComparator(word));
    rs=uriCache.get(word);
    if (rs == null) {
      rs=index.getResourcesWithScores(word,50);
      uriCache.put(word,rs);
    }
    tmp.addAll(rs.getItems());
    int i=0;
    for (    SolrQueryResultItem item : tmp) {
      sortedURIs.add(item.getUri());
      if (i == MAX_URIS_PER_SLOT) {
        break;
      }
      i++;
    }
    tmp.clear();
  }
  slot2URI.put(slot,sortedURIs);
  mon.stop();
  logger.info("String_Node_Str" + mon.getLastValue() + "String_Node_Str");
  logger.info("String_Node_Str" + sortedURIs);
  return sortedURIs;
}

Fixed version (ground truth):
private List<String> getCandidateURIsSortedBySimilarity(Slot slot){
  logger.info("String_Node_Str" + slot.getWords() + "String_Node_Str");
  mon.start();
  List<String> sortedURIs=new ArrayList<String>();
  SolrSearch index=getIndexBySlotType(slot);
  Map<String,SolrQueryResultSet> uriCache=getCacheBySlotType(slot);
  SortedSet<SolrQueryResultItem> tmp;
  SolrQueryResultSet rs;
  List<String> words;
  if (slot.getSlotType() == SlotType.RESOURCE) {
    words=slot.getWords();
  }
 else {
    words=pruneList(slot.getWords());
  }
  for (  String word : words) {
    tmp=new TreeSet<SolrQueryResultItem>(new SolrQueryResultStringSimilarityComparator(word));
    rs=uriCache.get(word);
    if (rs == null) {
      rs=index.getResourcesWithScores(word,50);
      uriCache.put(word,rs);
    }
    tmp.addAll(rs.getItems());
    for (    SolrQueryResultItem item : tmp) {
      if (!sortedURIs.contains(item.getUri())) {
        sortedURIs.add(item.getUri());
      }
      if (sortedURIs.size() == MAX_URIS_PER_SLOT) {
        break;
      }
    }
    tmp.clear();
  }
  slot2URI.put(slot,sortedURIs);
  mon.stop();
  logger.info("String_Node_Str" + mon.getLastValue() + "String_Node_Str");
  logger.info("String_Node_Str" + sortedURIs);
  return sortedURIs;
}
Program: 9586
Project: 9586
Buggy source:
@Override public int compare(SolrQueryResultItem item1,SolrQueryResultItem item2){
  double sim1=Similarity.getSimilarity(s,item1.getLabel());
  double sim2=Similarity.getSimilarity(s,item2.getLabel());
  if (sim1 < sim2) {
    return 1;
  }
 else   if (sim1 > sim2) {
    return -1;
  }
 else {
    return item1.getLabel().compareTo(item2.getLabel());
  }
}

Fixed version (ground truth):
@Override public int compare(SolrQueryResultItem item1,SolrQueryResultItem item2){
  double sim1=0;
  if (cache.containsKey(item1.getLabel())) {
    sim1=cache.get(item1.getLabel());
  }
 else {
    sim1=Similarity.getSimilarity(s,item1.getLabel());
    cache.put(item1.getLabel(),sim1);
  }
  double sim2=0;
  if (cache.containsKey(item2.getLabel())) {
    sim2=cache.get(item2.getLabel());
  }
 else {
    sim2=Similarity.getSimilarity(s,item2.getLabel());
    cache.put(item2.getLabel(),sim2);
  }
  if (sim1 < sim2) {
    return 1;
  }
 else   if (sim1 > sim2) {
    return -1;
  }
 else {
    int val=item1.getLabel().compareTo(item2.getLabel());
    if (val == 0) {
      return item1.getUri().compareTo(item2.getUri());
    }
    return val;
  }
}
Program: 9587
Project: 9587
Buggy source:
public SolrQueryResultStringSimilarityComparator(String s){
  this.s=s;
}

Fixed version (ground truth):
public SolrQueryResultStringSimilarityComparator(String s){
  this.s=s;
  cache=new HashMap<String,Double>();
}