nus-yam/ex-repair huggingface dataset:
Program: 9457
Project: 9457
Buggy source:
public void testEquivalentDataPropertiesAxiomLearning() throws Exception {
  EquivalentDataPropertyAxiomLearner l=new EquivalentDataPropertyAxiomLearner(ks);
  l.setMaxExecutionTimeInSeconds(maxExecutionTimeInSeconds);
  l.setPropertyToDescribe(equivDataProperty);
  l.init();
  l.start();
  System.out.println(l.getCurrentlyBestEvaluatedAxioms(nrOfAxioms));
}

Fixed version (ground truth):
public void testEquivalentDataPropertiesAxiomLearning() throws Exception {
  EquivalentDataPropertyAxiomLearner l=new EquivalentDataPropertyAxiomLearner(ks);
  l.setMaxExecutionTimeInSeconds(maxExecutionTimeInSeconds);
  l.setEntityToDescribe(equivDataProperty);
  l.init();
  l.start();
  System.out.println(l.getCurrentlyBestEvaluatedAxioms(nrOfAxioms));
}
Program: 9458
Project: 9458
Buggy source:
public void testFunctionalPropertyAxiomLearnining() throws Exception {
  FunctionalObjectPropertyAxiomLearner l=new FunctionalObjectPropertyAxiomLearner(ks);
  l.setMaxExecutionTimeInSeconds(maxExecutionTimeInSeconds);
  l.setPropertyToDescribe(functional);
  l.init();
  l.start();
  System.out.println(l.getCurrentlyBestEvaluatedAxioms(nrOfAxioms));
}

Fixed version (ground truth):
public void testFunctionalPropertyAxiomLearnining() throws Exception {
  FunctionalObjectPropertyAxiomLearner l=new FunctionalObjectPropertyAxiomLearner(ks);
  l.setMaxExecutionTimeInSeconds(maxExecutionTimeInSeconds);
  l.setEntityToDescribe(functional);
  l.init();
  l.start();
  System.out.println(l.getCurrentlyBestEvaluatedAxioms(nrOfAxioms));
}
Program: 9459
Project: 9459
Buggy source:
public void testSymmetricPropertyAxiomLearning() throws Exception {
  SymmetricObjectPropertyAxiomLearner l=new SymmetricObjectPropertyAxiomLearner(ks);
  l.setMaxExecutionTimeInSeconds(maxExecutionTimeInSeconds);
  l.setPropertyToDescribe(symmetric);
  l.init();
  l.start();
  System.out.println(l.getCurrentlyBestEvaluatedAxioms(nrOfAxioms));
}

Fixed version (ground truth):
public void testSymmetricPropertyAxiomLearning() throws Exception {
  SymmetricObjectPropertyAxiomLearner l=new SymmetricObjectPropertyAxiomLearner(ks);
  l.setMaxExecutionTimeInSeconds(maxExecutionTimeInSeconds);
  l.setEntityToDescribe(symmetric);
  l.init();
  l.start();
  System.out.println(l.getCurrentlyBestEvaluatedAxioms(nrOfAxioms));
}
Program: 9461
Project: 9461
Buggy source:
public void testObjectPropertyDomainAxiomLearning() throws Exception {
  ObjectPropertyDomainAxiomLearner2 l=new ObjectPropertyDomainAxiomLearner2(ks);
  l.setMaxExecutionTimeInSeconds(maxExecutionTimeInSeconds);
  l.setPropertyToDescribe(op1);
  l.init();
  l.start();
  EvaluatedAxiom<OWLObjectPropertyDomainAxiom> evAxiom=l.getCurrentlyBestEvaluatedAxiom();
  System.out.println(evAxiom);
  double actualScore=evAxiom.getScore().getAccuracy();
  int cntA=100;
  int cntB=50;
  int cntAB=70;
  double beta=3.0;
  double precision=Heuristics.getConfidenceInterval95WaldAverage(cntB,cntAB);
  double recall=Heuristics.getConfidenceInterval95WaldAverage(cntA,cntAB);
  double expectedScore=Heuristics.getFScore(recall,precision,beta);
  assertEquals("String_Node_Str",expectedScore,actualScore,0d);
}

Fixed version (ground truth):
public void testObjectPropertyDomainAxiomLearning() throws Exception {
  ObjectPropertyDomainAxiomLearner2 l=new ObjectPropertyDomainAxiomLearner2(ks);
  l.setMaxExecutionTimeInSeconds(maxExecutionTimeInSeconds);
  l.setEntityToDescribe(op1);
  l.init();
  l.start();
  EvaluatedAxiom<OWLObjectPropertyDomainAxiom> evAxiom=l.getCurrentlyBestEvaluatedAxiom();
  System.out.println(evAxiom);
  double actualScore=evAxiom.getScore().getAccuracy();
  int cntA=100;
  int cntB=50;
  int cntAB=70;
  double beta=3.0;
  double precision=Heuristics.getConfidenceInterval95WaldAverage(cntB,cntAB);
  double recall=Heuristics.getConfidenceInterval95WaldAverage(cntA,cntAB);
  double expectedScore=Heuristics.getFScore(recall,precision,beta);
  assertEquals("String_Node_Str",expectedScore,actualScore,0d);
}
Program: 9462
Project: 9462
Buggy source:
public EvaluatedAxiom<OWLDisjointClassesAxiom> computeDisjointess(OWLClass clsA,OWLClass clsB){
  logger.debug("String_Node_Str" + clsA + "String_Node_Str"+ clsB+ "String_Node_Str");
  if (clsA.equals(clsB)) {
    return new EvaluatedAxiom<OWLDisjointClassesAxiom>(df.getOWLDisjointClassesAxiom(clsA,clsB),new AxiomScore(0d,1d));
  }
  ;
  if (reasoner.isSuperClassOf(clsA,clsB) || reasoner.isSuperClassOf(clsB,clsA)) {
    return new EvaluatedAxiom<OWLDisjointClassesAxiom>(df.getOWLDisjointClassesAxiom(clsA,clsB),new AxiomScore(0d,1d));
  }
  ;
  double scoreValue=0;
  int instanceCountA=reasoner.getPopularity(clsA);
  int instanceCountB=reasoner.getPopularity(clsB);
  if (instanceCountA > 0 && instanceCountB > 0) {
    int instanceCountAB=reasoner.getPopularity(df.getOWLObjectIntersectionOf(clsA,clsB));
    double precision=Heuristics.getConfidenceInterval95WaldAverage(instanceCountB,instanceCountAB);
    double recall=Heuristics.getConfidenceInterval95WaldAverage(instanceCountA,instanceCountAB);
    scoreValue=1 - Heuristics.getFScore(recall,precision);
  }
  AxiomScore score=new AxiomScore(scoreValue);
  return new EvaluatedAxiom<OWLDisjointClassesAxiom>(df.getOWLDisjointClassesAxiom(clsA,clsB),score);
}

Fixed version (ground truth):
public EvaluatedAxiom<OWLDisjointClassesAxiom> computeDisjointess(OWLClass clsA,OWLClass clsB){
  logger.debug("String_Node_Str" + clsA + "String_Node_Str"+ clsB+ "String_Node_Str");
  if (clsA.equals(clsB)) {
    return new EvaluatedAxiom<OWLDisjointClassesAxiom>(df.getOWLDisjointClassesAxiom(clsA,clsB),new AxiomScore(0d,1d));
  }
  ;
  if (reasoner.isSuperClassOf(clsA,clsB) || reasoner.isSuperClassOf(clsB,clsA)) {
    return new EvaluatedAxiom<OWLDisjointClassesAxiom>(df.getOWLDisjointClassesAxiom(clsA,clsB),new AxiomScore(0d,1d));
  }
  ;
  double scoreValue=0;
  int instanceCountA=reasoner.getPopularity(clsA);
  int instanceCountB=reasoner.getPopularity(clsB);
  if (instanceCountA > 0 && instanceCountB > 0) {
    int instanceCountAB=reasoner.getPopularityOf(df.getOWLObjectIntersectionOf(clsA,clsB));
    double precision=Heuristics.getConfidenceInterval95WaldAverage(instanceCountB,instanceCountAB);
    double recall=Heuristics.getConfidenceInterval95WaldAverage(instanceCountA,instanceCountAB);
    scoreValue=1 - Heuristics.getFScore(recall,precision);
  }
  AxiomScore score=new AxiomScore(scoreValue);
  return new EvaluatedAxiom<OWLDisjointClassesAxiom>(df.getOWLDisjointClassesAxiom(clsA,clsB),score);
}
Program: 9463
Project: 9463
Buggy source:
private Set<EvaluatedDescription> computeDisjointessOfSiblings(OWLClass cls){
  Set<EvaluatedDescription> evaluatedDescriptions=new HashSet<EvaluatedDescription>();
  int instanceCountA=reasoner.getPopularity(cls);
  if (instanceCountA > 0) {
    Set<OWLClass> siblingClasses=reasoner.getSiblingClasses(cls);
    for (    OWLClass sib : siblingClasses) {
      int instanceCountB=reasoner.getPopularity(sib);
      if (instanceCountB > 0) {
        int instanceCountAB=reasoner.getPopularity(df.getOWLObjectIntersectionOf(cls,sib));
        double precision=Heuristics.getConfidenceInterval95WaldAverage(instanceCountB,instanceCountAB);
        double recall=Heuristics.getConfidenceInterval95WaldAverage(instanceCountA,instanceCountAB);
        double score=1 - Heuristics.getFScore(recall,precision);
        EvaluatedDescription evalDesc=new EvaluatedDescription(sib,new AxiomScore(score));
        evaluatedDescriptions.add(evalDesc);
      }
    }
  }
  return evaluatedDescriptions;
}

Fixed version (ground truth):
private Set<EvaluatedDescription> computeDisjointessOfSiblings(OWLClass cls){
  Set<EvaluatedDescription> evaluatedDescriptions=new HashSet<EvaluatedDescription>();
  int instanceCountA=reasoner.getPopularity(cls);
  if (instanceCountA > 0) {
    Set<OWLClass> siblingClasses=reasoner.getSiblingClasses(cls);
    for (    OWLClass sib : siblingClasses) {
      int instanceCountB=reasoner.getPopularity(sib);
      if (instanceCountB > 0) {
        int instanceCountAB=reasoner.getPopularityOf(df.getOWLObjectIntersectionOf(cls,sib));
        double precision=Heuristics.getConfidenceInterval95WaldAverage(instanceCountB,instanceCountAB);
        double recall=Heuristics.getConfidenceInterval95WaldAverage(instanceCountA,instanceCountAB);
        double score=1 - Heuristics.getFScore(recall,precision);
        EvaluatedDescription evalDesc=new EvaluatedDescription(sib,new AxiomScore(score));
        evaluatedDescriptions.add(evalDesc);
      }
    }
  }
  return evaluatedDescriptions;
}
Program: 9464
Project: 9464
Buggy source:
@Override public Set<OWLObjectPropertyAssertionAxiom> getNegativeExamples(EvaluatedAxiom<OWLInverseFunctionalObjectPropertyAxiom> evaluatedAxiom){
  OWLInverseFunctionalObjectPropertyAxiom axiom=evaluatedAxiom.getAxiom();
  negExamplesQueryTemplate.setIri("String_Node_Str",axiom.getProperty().asOWLObjectProperty().toStringID());
  Set<OWLObjectPropertyAssertionAxiom> negExamples=new TreeSet<OWLObjectPropertyAssertionAxiom>();
  ResultSet rs;
  if (workingModel != null) {
    rs=executeSelectQuery(negExamplesQueryTemplate.toString(),workingModel);
  }
 else {
    rs=executeSelectQuery(negExamplesQueryTemplate.toString());
  }
  while (rs.hasNext()) {
    QuerySolution qs=rs.next();
    OWLIndividual object=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    OWLIndividual subject=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    negExamples.add(df.getOWLObjectPropertyAssertionAxiom(propertyToDescribe,subject,object));
    subject=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    negExamples.add(df.getOWLObjectPropertyAssertionAxiom(propertyToDescribe,subject,object));
  }
  return negExamples;
}

Fixed version (ground truth):
@Override public Set<OWLObjectPropertyAssertionAxiom> getNegativeExamples(EvaluatedAxiom<OWLInverseFunctionalObjectPropertyAxiom> evaluatedAxiom){
  OWLInverseFunctionalObjectPropertyAxiom axiom=evaluatedAxiom.getAxiom();
  negExamplesQueryTemplate.setIri("String_Node_Str",axiom.getProperty().asOWLObjectProperty().toStringID());
  Set<OWLObjectPropertyAssertionAxiom> negExamples=new TreeSet<OWLObjectPropertyAssertionAxiom>();
  ResultSet rs=executeSelectQuery(negExamplesQueryTemplate.toString());
  while (rs.hasNext()) {
    QuerySolution qs=rs.next();
    OWLIndividual object=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    OWLIndividual subject1=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    OWLIndividual subject2=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    negExamples.add(df.getOWLObjectPropertyAssertionAxiom(propertyToDescribe,subject1,object));
    negExamples.add(df.getOWLObjectPropertyAssertionAxiom(propertyToDescribe,subject2,object));
  }
  return negExamples;
}
Program: 9465
Project: 9465
Buggy source:
public static void main(String[] args) throws Exception {
  InverseFunctionalObjectPropertyAxiomLearner l=new InverseFunctionalObjectPropertyAxiomLearner(new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpedia()));
  l.setPropertyToDescribe(new OWLDataFactoryImpl().getOWLObjectProperty(IRI.create("String_Node_Str")));
  l.setMaxExecutionTimeInSeconds(5);
  l.setForceSPARQL_1_0_Mode(true);
  l.init();
  l.start();
  List<EvaluatedAxiom<OWLInverseFunctionalObjectPropertyAxiom>> axioms=l.getCurrentlyBestEvaluatedAxioms(5);
  System.out.println(axioms);
  for (  EvaluatedAxiom<OWLInverseFunctionalObjectPropertyAxiom> axiom : axioms) {
    l.explainScore(axiom);
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  InverseFunctionalObjectPropertyAxiomLearner l=new InverseFunctionalObjectPropertyAxiomLearner(new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpediaLiveAKSW()));
  l.setPropertyToDescribe(new OWLDataFactoryImpl().getOWLObjectProperty(IRI.create("String_Node_Str")));
  l.setMaxExecutionTimeInSeconds(5);
  l.init();
  l.start();
  List<EvaluatedAxiom<OWLInverseFunctionalObjectPropertyAxiom>> axioms=l.getCurrentlyBestEvaluatedAxioms(5);
  System.out.println(axioms);
  for (  EvaluatedAxiom<OWLInverseFunctionalObjectPropertyAxiom> axiom : axioms) {
    l.explainScore(axiom);
  }
}
Program: 9466
Project: 9466
Buggy source:
@Override public Set<OWLObjectPropertyAssertionAxiom> getNegativeExamples(EvaluatedAxiom<T> evaluatedAxiom){
  T axiom=evaluatedAxiom.getAxiom();
  negExamplesQueryTemplate.setIri("String_Node_Str",axiom.getProperty().asOWLObjectProperty().toStringID());
  Set<OWLObjectPropertyAssertionAxiom> negExamples=new TreeSet<OWLObjectPropertyAssertionAxiom>();
  ResultSet rs;
  if (workingModel != null) {
    rs=executeSelectQuery(negExamplesQueryTemplate.toString(),workingModel);
  }
 else {
    rs=executeSelectQuery(negExamplesQueryTemplate.toString());
  }
  while (rs.hasNext()) {
    QuerySolution qs=rs.next();
    OWLIndividual subject=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    OWLIndividual object=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    negExamples.add(df.getOWLObjectPropertyAssertionAxiom(propertyToDescribe,subject,object));
  }
  return negExamples;
}

Fixed version (ground truth):
@Override public Set<OWLObjectPropertyAssertionAxiom> getNegativeExamples(EvaluatedAxiom<T> evaluatedAxiom){
  T axiom=evaluatedAxiom.getAxiom();
  negExamplesQueryTemplate.setIri("String_Node_Str",axiom.getProperty().asOWLObjectProperty().toStringID());
  Set<OWLObjectPropertyAssertionAxiom> negExamples=new TreeSet<OWLObjectPropertyAssertionAxiom>();
  ResultSet rs;
  if (workingModel != null) {
    rs=executeSelectQuery(negExamplesQueryTemplate.toString(),workingModel);
  }
 else {
    rs=executeSelectQuery(negExamplesQueryTemplate.toString());
  }
  List<String> vars=rs.getResultVars();
  boolean onlySubject=vars.size() == 1;
  while (rs.hasNext()) {
    QuerySolution qs=rs.next();
    OWLIndividual subject=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    OWLIndividual object=df.getOWLNamedIndividual(IRI.create(qs.getResource(onlySubject ? "String_Node_Str" : "String_Node_Str").getURI()));
    negExamples.add(df.getOWLObjectPropertyAssertionAxiom(propertyToDescribe,subject,object));
  }
  return negExamples;
}
Program: 9467
Project: 9467
Buggy source:
@Override public void setPropertyToDescribe(OWLObjectProperty propertyToDescribe){
  super.setPropertyToDescribe(propertyToDescribe);
  POS_FREQUENCY_QUERY.setIri("String_Node_Str",propertyToDescribe.toStringID());
  ALREADY_DECLARED_QUERY.setIri("String_Node_Str",propertyToDescribe.toStringID());
  GET_SAMPLE_QUERY.setIri("String_Node_Str",propertyToDescribe.toStringID());
  IRI type;
  if (axiomType.equals(AxiomType.SYMMETRIC_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_SYMMETRIC_PROPERTY.getIRI();
  }
 else   if (axiomType.equals(AxiomType.ASYMMETRIC_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_ASYMMETRIC_PROPERTY.getIRI();
  }
 else   if (axiomType.equals(AxiomType.FUNCTIONAL_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_FUNCTIONAL_PROPERTY.getIRI();
  }
 else   if (axiomType.equals(AxiomType.INVERSE_FUNCTIONAL_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_INVERSE_FUNCTIONAL_PROPERTY.getIRI();
  }
 else   if (axiomType.equals(AxiomType.REFLEXIVE_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_REFLEXIVE_PROPERTY.getIRI();
  }
 else   if (axiomType.equals(AxiomType.IRREFLEXIVE_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_IRREFLEXIVE_PROPERTY.getIRI();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + axiomType);
  }
  ALREADY_DECLARED_QUERY.setIri("String_Node_Str",type.toString());
}

Fixed version (ground truth):
@Override public void setPropertyToDescribe(OWLObjectProperty propertyToDescribe){
  super.setPropertyToDescribe(propertyToDescribe);
  POS_FREQUENCY_QUERY.setIri("String_Node_Str",propertyToDescribe.toStringID());
  ALREADY_DECLARED_QUERY.setIri("String_Node_Str",propertyToDescribe.toStringID());
  GET_SAMPLE_QUERY.setIri("String_Node_Str",propertyToDescribe.toStringID());
  IRI type;
  if (axiomType.equals(AxiomType.SYMMETRIC_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_SYMMETRIC_PROPERTY.getIRI();
  }
 else   if (axiomType.equals(AxiomType.ASYMMETRIC_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_ASYMMETRIC_PROPERTY.getIRI();
  }
 else   if (axiomType.equals(AxiomType.FUNCTIONAL_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_FUNCTIONAL_PROPERTY.getIRI();
  }
 else   if (axiomType.equals(AxiomType.INVERSE_FUNCTIONAL_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_INVERSE_FUNCTIONAL_PROPERTY.getIRI();
  }
 else   if (axiomType.equals(AxiomType.REFLEXIVE_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_REFLEXIVE_PROPERTY.getIRI();
  }
 else   if (axiomType.equals(AxiomType.IRREFLEXIVE_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_IRREFLEXIVE_PROPERTY.getIRI();
  }
 else   if (axiomType.equals(AxiomType.TRANSITIVE_OBJECT_PROPERTY)) {
    type=OWLRDFVocabulary.OWL_TRANSITIVE_PROPERTY.getIRI();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + axiomType);
  }
  ALREADY_DECLARED_QUERY.setIri("String_Node_Str",type.toString());
}
Program: 9468
Project: 9468
Buggy source:
@Override public Set<OWLObjectPropertyAssertionAxiom> getPositiveExamples(EvaluatedAxiom<T> evAxiom){
  T axiom=evAxiom.getAxiom();
  posExamplesQueryTemplate.setIri("String_Node_Str",axiom.getProperty().asOWLObjectProperty().toStringID());
  Set<OWLObjectPropertyAssertionAxiom> posExamples=new TreeSet<OWLObjectPropertyAssertionAxiom>();
  ResultSet rs=executeSelectQuery(posExamplesQueryTemplate.toString());
  while (rs.hasNext()) {
    QuerySolution qs=rs.next();
    OWLIndividual subject=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    OWLIndividual object=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    posExamples.add(df.getOWLObjectPropertyAssertionAxiom(entityToDescribe,subject,object));
  }
  return posExamples;
}

Fixed version (ground truth):
@Override public Set<OWLObjectPropertyAssertionAxiom> getPositiveExamples(EvaluatedAxiom<T> evAxiom){
  T axiom=evAxiom.getAxiom();
  posExamplesQueryTemplate.setIri("String_Node_Str",axiom.getProperty().asOWLObjectProperty().toStringID());
  Set<OWLObjectPropertyAssertionAxiom> posExamples=new TreeSet<OWLObjectPropertyAssertionAxiom>();
  ResultSet rs=executeSelectQuery(posExamplesQueryTemplate.toString());
  List<String> vars=rs.getResultVars();
  boolean onlySubject=vars.size() == 1;
  while (rs.hasNext()) {
    QuerySolution qs=rs.next();
    OWLIndividual subject=df.getOWLNamedIndividual(IRI.create(qs.getResource("String_Node_Str").getURI()));
    OWLIndividual object=df.getOWLNamedIndividual(IRI.create(qs.getResource(onlySubject ? "String_Node_Str" : "String_Node_Str").getURI()));
    posExamples.add(df.getOWLObjectPropertyAssertionAxiom(entityToDescribe,subject,object));
  }
  return posExamples;
}
Program: 9469
Project: 9469
Buggy source:
public void simplifyTree(QueryTree<N> tree,List<QueryTree<N>> negTrees){
  if (tree.getChildren().isEmpty()) {
    return;
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
    logger.debug("String_Node_Str" + TreeHelper.getAbbreviatedTreeRepresentation(tree,endpoint.getBaseURI(),endpoint.getPrefixes()));
    int i=1;
  }
  List<Object> path;
  boolean pathExists;
  for (  QueryTree<N> leaf : tree.getLeafs()) {
    pathExists=false;
    path=getPathFromRootToNode(leaf);
    pathExists=true;
    for (    QueryTree<N> negTree : negTrees) {
      if (!pathExists(leaf,new ArrayList<Object>(path),negTree)) {
        pathExists=false;
        break;
      }
    }
    if (pathExists) {
      String pathString="String_Node_Str" + leaf.getParent().getUserObject() + "String_Node_Str"+ leaf.getParent().getEdge(leaf)+ "String_Node_Str"+ leaf.getUserObject()+ "String_Node_Str";
      leaf.getParent().removeChild((QueryTreeImpl<N>)leaf);
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + pathString + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public void simplifyTree(QueryTree<N> tree,List<QueryTree<N>> negTrees){
  if (tree.getChildren().isEmpty()) {
    return;
  }
  System.out.println(tree.getStringRepresentation());
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
    logger.debug("String_Node_Str" + TreeHelper.getAbbreviatedTreeRepresentation(tree,endpoint.getBaseURI(),endpoint.getPrefixes()));
    int i=1;
  }
  List<Object> path;
  boolean pathExists;
  for (  QueryTree<N> leaf : tree.getLeafs()) {
    pathExists=false;
    path=getPathFromRootToNode(leaf);
    pathExists=true;
    for (    QueryTree<N> negTree : negTrees) {
      if (!pathExists(leaf,new ArrayList<Object>(path),negTree)) {
        pathExists=false;
        break;
      }
    }
    if (pathExists) {
      String pathString="String_Node_Str" + leaf.getParent().getUserObject() + "String_Node_Str"+ leaf.getParent().getEdge(leaf)+ "String_Node_Str"+ leaf.getUserObject()+ "String_Node_Str";
      leaf.getParent().removeChild((QueryTreeImpl<N>)leaf);
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + pathString + "String_Node_Str");
      }
    }
  }
}
Program: 9470
Project: 9470
Buggy source:
private TreeSet<Description> refineNode(OENode node){
  nodes.remove(node);
  int horizExp=node.getHorizontalExpansion();
  TreeSet<Description> refinements=(TreeSet<Description>)operator.refine(node.getDescription(),horizExp + 1);
  System.out.println(refinements);
  node.incHorizontalExpansion();
  node.setRefinementCount(refinements.size());
  nodes.add(node);
  return refinements;
}

Fixed version (ground truth):
private TreeSet<Description> refineNode(OENode node){
  nodes.remove(node);
  int horizExp=node.getHorizontalExpansion();
  TreeSet<Description> refinements=(TreeSet<Description>)operator.refine(node.getDescription(),horizExp + 1);
  node.incHorizontalExpansion();
  node.setRefinementCount(refinements.size());
  nodes.add(node);
  return refinements;
}
Program: 9471
Project: 9471
Buggy source:
private SortedSet<String> getAllResources(String query){
  SortedSet<String> resources=new TreeSet<String>();
  query="String_Node_Str" + query.substring(7) + "String_Node_Str";
  ResultSet rs;
  if (selectCache == null) {
    rs=executeSelectQuery(query);
  }
 else {
    String result=selectCache.executeSelectQuery(endpoint,query);
    rs=SparqlQuery.convertJSONtoResultSet(result);
  }
  String uri;
  QuerySolution qs;
  while (rs.hasNext()) {
    qs=rs.next();
    uri=qs.getResource("String_Node_Str").getURI();
    resources.add(uri);
  }
  return resources;
}

Fixed version (ground truth):
private SortedSet<String> getAllResources(String query){
  SortedSet<String> resources=new TreeSet<String>();
  query=query + "String_Node_Str";
  ResultSet rs;
  if (selectCache == null) {
    rs=executeSelectQuery(query);
  }
 else {
    String result=selectCache.executeSelectQuery(endpoint,query);
    rs=SparqlQuery.convertJSONtoResultSet(result);
  }
  String uri;
  QuerySolution qs;
  while (rs.hasNext()) {
    qs=rs.next();
    uri=qs.getResource("String_Node_Str").getURI();
    resources.add(uri);
  }
  return resources;
}
Program: 9473
Project: 9473
Buggy source:
public PostLGG(SPARQLEndpointEx endpoint){
  this.endpoint=endpoint;
}

Fixed version (ground truth):
public PostLGG(){
}
Program: 9474
Project: 9474
Buggy source:
public void simplifyTree(QueryTree<N> tree,List<QueryTree<N>> negTrees){
  if (tree.getChildren().isEmpty()) {
    return;
  }
  System.out.println(tree.getStringRepresentation());
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
    logger.debug("String_Node_Str" + TreeHelper.getAbbreviatedTreeRepresentation(tree,endpoint.getBaseURI(),endpoint.getPrefixes()));
    int i=1;
  }
  List<Object> path;
  boolean pathExists;
  for (  QueryTree<N> leaf : tree.getLeafs()) {
    pathExists=false;
    path=getPathFromRootToNode(leaf);
    pathExists=true;
    for (    QueryTree<N> negTree : negTrees) {
      if (!pathExists(leaf,new ArrayList<Object>(path),negTree)) {
        pathExists=false;
        break;
      }
    }
    if (pathExists) {
      String pathString="String_Node_Str" + leaf.getParent().getUserObject() + "String_Node_Str"+ leaf.getParent().getEdge(leaf)+ "String_Node_Str"+ leaf.getUserObject()+ "String_Node_Str";
      leaf.getParent().removeChild((QueryTreeImpl<N>)leaf);
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + pathString + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public void simplifyTree(QueryTree<N> tree,List<QueryTree<N>> negTrees){
  if (tree.getChildren().isEmpty()) {
    return;
  }
  if (logger.isDebugEnabled()) {
    String s;
    if (endpoint != null) {
      s=TreeHelper.getAbbreviatedTreeRepresentation(tree,endpoint.getBaseURI(),endpoint.getPrefixes());
    }
 else {
      s=tree.getStringRepresentation();
    }
    logger.debug("String_Node_Str");
    logger.debug("String_Node_Str" + s);
    int i=1;
  }
  List<Object> path;
  boolean pathExists;
  for (  QueryTree<N> leaf : tree.getLeafs()) {
    pathExists=false;
    path=getPathFromRootToNode(leaf);
    pathExists=true;
    for (    QueryTree<N> negTree : negTrees) {
      if (!pathExists(leaf,new ArrayList<Object>(path),negTree)) {
        pathExists=false;
        break;
      }
    }
    if (pathExists) {
      String pathString="String_Node_Str" + leaf.getParent().getUserObject() + "String_Node_Str"+ leaf.getParent().getEdge(leaf)+ "String_Node_Str"+ leaf.getUserObject()+ "String_Node_Str";
      leaf.getParent().removeChild((QueryTreeImpl<N>)leaf);
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + pathString + "String_Node_Str");
      }
    }
  }
}
Program: 9475
Project: 9475
Buggy source:
@Override public QueryTree<N> getLGG(List<QueryTree<N>> trees,boolean learnFilters){
  nodeId=0;
  List<QueryTree<N>> treeList=new ArrayList<QueryTree<N>>(trees);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
  for (int i=0; i < treeList.size(); i++) {
    if (logger.isDebugEnabled()) {
      logger.debug(treeList.get(i).getStringRepresentation());
    }
    if (i != treeList.size() - 1) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str");
      }
    }
  }
  if (trees.size() == 1) {
    return trees.iterator().next();
  }
  Monitor mon=MonitorFactory.getTimeMonitor("String_Node_Str");
  mon.start();
  QueryTree<N> lgg=getLGG(treeList.get(0),treeList.get(1),learnFilters);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + lgg.getStringRepresentation());
  }
  for (int i=2; i < treeList.size(); i++) {
    lgg=getLGG(lgg,treeList.get(i),learnFilters);
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + (i + 1) + "String_Node_Str"+ lgg.getStringRepresentation());
    }
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
    logger.debug(lgg.getStringRepresentation());
  }
  mon.stop();
  addNumbering(lgg);
  return lgg;
}

Fixed version (ground truth):
@Override public QueryTree<N> getLGG(List<QueryTree<N>> trees,boolean learnFilters){
  nodeId=0;
  List<QueryTree<N>> treeList=new ArrayList<QueryTree<N>>(trees);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
  for (int i=0; i < treeList.size(); i++) {
    if (logger.isDebugEnabled()) {
      logger.debug(treeList.get(i).getStringRepresentation());
    }
    if (i != treeList.size() - 1) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str");
      }
    }
  }
  if (trees.size() == 1) {
    return trees.iterator().next();
  }
  Monitor mon=MonitorFactory.getTimeMonitor("String_Node_Str");
  mon.start();
  QueryTree<N> lgg=computeLGG(treeList.get(0),treeList.get(1),learnFilters);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + lgg.getStringRepresentation());
  }
  for (int i=2; i < treeList.size(); i++) {
    nodeId=0;
    lgg=computeLGG(lgg,treeList.get(i),learnFilters);
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + (i + 1) + "String_Node_Str"+ lgg.getStringRepresentation());
    }
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
    logger.debug(lgg.getStringRepresentation());
  }
  mon.stop();
  addNumbering(lgg);
  return lgg;
}
Program: 9477
Project: 9477
Buggy source:
public Set<Entity> getCandidates(Annotation annotation){
  System.out.println(annotation);
  return candidatesTrie.getCandidateEntities(annotation.getMatchedString());
}

Fixed version (ground truth):
public Set<Entity> getCandidates(Annotation annotation){
  return candidatesTrie.getCandidateEntities(annotation.getMatchedString());
}
Program: 9478
Project: 9478
Buggy source:
public void addEntry(String s,Entity e,String originalString){
  FullTokenEntitySetPair candidates;
  if (trie.contains(s))   candidates=trie.get(s);
 else   candidates=new FullTokenEntitySetPair(originalString);
  candidates.addEntity(e);
  trie.put(s,candidates);
}

Fixed version (ground truth):
public void addEntry(String s,Entity e,String originalString){
  s=s.trim();
  FullTokenEntitySetPair candidates;
  if (trie.contains(s))   candidates=trie.get(s);
 else   candidates=new FullTokenEntitySetPair(originalString);
  candidates.addEntity(e);
  trie.put(s,candidates);
}
Program: 9479
Project: 9479
Buggy source:
public void buildTrie(OWLOntology ontology,NameGenerator nameGenerator){
  this.trie=new PrefixTrie<FullTokenEntitySetPair>();
  Map<Entity,Set<String>> relevantText=entityTextRetriever.getRelevantText(ontology);
  for (  Entity entity : relevantText.keySet()) {
    for (    String text : relevantText.get(entity)) {
      text=StringUtils.join(LinguisticUtil.getInstance().getWordsFromCamelCase(text),"String_Node_Str");
      text=StringUtils.join(LinguisticUtil.getInstance().getWordsFromUnderscored(text),"String_Node_Str");
      if (text.trim().isEmpty()) {
        continue;
      }
      text=text.trim();
      addEntry(text,entity);
      addSubsequencesWordNet(entity,text);
      for (      String alternativeText : nameGenerator.getAlternativeText(text)) {
        addEntry(alternativeText.toLowerCase(),entity,text);
      }
    }
  }
}

Fixed version (ground truth):
public void buildTrie(OWLOntology ontology,NameGenerator nameGenerator){
  this.trie=new PrefixTrie<FullTokenEntitySetPair>();
  Map<Entity,Set<String>> relevantText=entityTextRetriever.getRelevantText(ontology);
  for (  Entity entity : relevantText.keySet()) {
    for (    String text : relevantText.get(entity)) {
      text=StringUtils.join(LinguisticUtil.getInstance().getWordsFromCamelCase(text),"String_Node_Str");
      text=StringUtils.join(LinguisticUtil.getInstance().getWordsFromUnderscored(text),"String_Node_Str");
      if (text.trim().isEmpty()) {
        continue;
      }
      addEntry(text,entity);
      addSubsequencesWordNet(entity,text);
      for (      String alternativeText : nameGenerator.getAlternativeText(text)) {
        addEntry(alternativeText.toLowerCase(),entity,text);
      }
    }
  }
}
Program: 9480
Project: 9480
Buggy source:
@Override public SemanticAnnotation disambiguate(Annotation annotation,Set<Entity> candidateEntities){
  if (!candidateEntities.isEmpty()) {
    List<String> tokenContext=contextExtractor.extractContext(annotation);
    double maxScore=Double.MIN_VALUE;
    Entity bestEntity=null;
    for (    Entity entity : candidateEntities) {
      Set<String> entityContext=StructuralEntityContext.getContextInNaturalLanguage(ontology,entity);
      double score=computeScore(tokenContext,entityContext);
      if (score > maxScore) {
        maxScore=score;
        bestEntity=entity;
      }
    }
    return new SemanticAnnotation(annotation,bestEntity);
  }
  return null;
}

Fixed version (ground truth):
@Override public SemanticAnnotation disambiguate(Annotation annotation,Set<Entity> candidateEntities){
  if (!candidateEntities.isEmpty()) {
    List<String> tokenContext=contextExtractor.extractContext(annotation);
    double maxScore=Double.NEGATIVE_INFINITY;
    Entity bestEntity=null;
    for (    Entity entity : candidateEntities) {
      Set<String> entityContext=StructuralEntityContext.getContextInNaturalLanguage(ontology,entity);
      double score=computeScore(tokenContext,entityContext);
      if (score > maxScore) {
        maxScore=score;
        bestEntity=entity;
      }
    }
    return new SemanticAnnotation(annotation,bestEntity);
  }
  return null;
}
Program: 9481
Project: 9481
Buggy source:
public Set<Entity> getCandidates(Annotation annotation){
  return candidatesTrie.getCandidateEntities(annotation.getMatchedString());
}

Fixed version (ground truth):
public Set<Entity> getCandidates(Annotation annotation){
  System.out.println(annotation);
  return candidatesTrie.getCandidateEntities(annotation.getMatchedString());
}
Program: 9482
Project: 9482
Buggy source:
/** 
 * Returns for each entity in the ontology all relevant text, i.e. eitherthe annotations or the short form of the IRI as fallback.
 * @return
 */
@Override public Map<Entity,Set<String>> getRelevantText(OWLOntology ontology){
  Map<Entity,Set<String>> entity2RelevantText=new HashMap<Entity,Set<String>>();
  Set<OWLEntity> schemaEntities=new HashSet<OWLEntity>();
  schemaEntities.addAll(ontology.getClassesInSignature());
  schemaEntities.addAll(ontology.getObjectPropertiesInSignature());
  schemaEntities.addAll(ontology.getDataPropertiesInSignature());
  schemaEntities.remove(OWL_THING);
  Map<String,Double> relevantText;
  for (  OWLEntity owlEntity : schemaEntities) {
    Entity entity=OWLAPIConverter.getEntity(owlEntity);
    relevantText=getRelevantText(entity);
    entity2RelevantText.put(entity,relevantText.keySet());
  }
  return entity2RelevantText;
}

Fixed version (ground truth):
/** 
 * Returns for each entity in the ontology all relevant text, i.e. either the annotations or the short form of the IRI as fallback.
 * @return
 */
@Override public Map<Entity,Set<String>> getRelevantText(OWLOntology ontology){
  Map<Entity,Set<String>> entity2RelevantText=new HashMap<Entity,Set<String>>();
  Set<OWLEntity> schemaEntities=new HashSet<OWLEntity>();
  schemaEntities.addAll(ontology.getClassesInSignature());
  schemaEntities.addAll(ontology.getObjectPropertiesInSignature());
  schemaEntities.addAll(ontology.getDataPropertiesInSignature());
  schemaEntities.remove(OWL_THING);
  Map<String,Double> relevantText;
  for (  OWLEntity owlEntity : schemaEntities) {
    Entity entity=OWLAPIConverter.getEntity(owlEntity);
    relevantText=getRelevantText(entity);
    entity2RelevantText.put(entity,relevantText.keySet());
  }
  return entity2RelevantText;
}
Program: 9483
Project: 9483
Buggy source:
public double getNodeScore(OENode node){
  double score=node.getAccuracy();
  if (!node.isRoot()) {
    double parentAccuracy=node.getParent().getAccuracy();
    score+=(parentAccuracy - score) * gainBonusFactor;
  }
 else {
    score+=startNodeBonus;
  }
  score-=node.getHorizontalExpansion() * expansionPenaltyFactor;
  score-=node.getRefinementCount() * nodeRefinementPenalty;
  Description expression=node.getExpression();
  System.out.println(expression);
  Set<Entity> entities=expression.getSignature();
  double sum=0;
  for (  Entity entity : entities) {
    double relevance=entityRelevance.containsKey(entity) ? entityRelevance.get(entity) : 0;
    System.out.println(entity + "String_Node_Str" + relevance);
    if (!Double.isInfinite(relevance)) {
      sum+=relevance;
    }
  }
  score+=nlpBonusFactor * sum;
  return score;
}

Fixed version (ground truth):
public double getNodeScore(OENode node){
  double score=node.getAccuracy();
  if (!node.isRoot()) {
    double parentAccuracy=node.getParent().getAccuracy();
    score+=(parentAccuracy - score) * gainBonusFactor;
  }
 else {
    score+=startNodeBonus;
  }
  score-=node.getHorizontalExpansion() * expansionPenaltyFactor;
  score-=node.getRefinementCount() * nodeRefinementPenalty;
  Description expression=node.getExpression();
  Set<Entity> entities=expression.getSignature();
  double sum=0;
  for (  Entity entity : entities) {
    double relevance=entityRelevance.containsKey(entity) ? entityRelevance.get(entity) : 0;
    if (!Double.isInfinite(relevance)) {
      sum+=relevance;
    }
  }
  score+=nlpBonusFactor * sum;
  return score;
}
Program: 9484
Project: 9484
Buggy source:
@Override public SemanticAnnotation disambiguate(Annotation annotation,Set<Entity> candidateEntities){
  String token=annotation.getToken();
  for (  Entity entity : candidateEntities) {
    Set<String> labels=getLabels(entity);
    for (    String label : labels) {
      if (label.equals(token)) {
        return new SemanticAnnotation(annotation,entity);
      }
    }
    String shortForm=sfp.getShortForm(IRI.create(entity.getURI()));
    if (annotation.equals(shortForm)) {
      return new SemanticAnnotation(annotation,entity);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public SemanticAnnotation disambiguate(Annotation annotation,Set<Entity> candidateEntities){
  logger.debug("String_Node_Str" + annotation);
  logger.debug("String_Node_Str" + candidateEntities);
  String token=annotation.getToken().trim();
  for (  Entity entity : candidateEntities) {
    Set<String> labels=getLabels(entity);
    for (    String label : labels) {
      if (label.equals(token)) {
        logger.debug("String_Node_Str" + entity);
        return new SemanticAnnotation(annotation,entity);
      }
    }
    String shortForm=sfp.getShortForm(IRI.create(entity.getURI()));
    if (annotation.equals(shortForm)) {
      logger.debug("String_Node_Str" + entity);
      return new SemanticAnnotation(annotation,entity);
    }
  }
  return null;
}
Program: 9485
Project: 9485
Buggy source:
/** 
 * Returns the total number of documents contained in the index.
 * @return the total number of documents contained in the index
 */
public int getSize(){
  return index.size();
}

Fixed version (ground truth):
/** 
 * Returns the total number of documents contained in the index.
 * @return the total number of documents contained in the index
 */
public int getSize(){
  return size;
}
Program: 9486
Project: 9486
Buggy source:
/** 
 * Initializes the semantic index to use   {@code ontology} for finding all labels of an entity and{@code syntacticIndex} to query for documents containing these labels.
 * @param ontology       ontology to retrieve entity labels from
 * @param syntacticIndex index to query for documents containing the labels
 */
public SimpleSemanticIndex(OWLOntology ontology,SyntacticIndex syntacticIndex){
  super(ontology);
  SimpleEntityCandidatesTrie trie=new SimpleEntityCandidatesTrie(new RDFSLabelEntityTextRetriever(ontology),ontology);
  trie.printTrie();
  setSemanticAnnotator(new SemanticAnnotator(new SimpleWordSenseDisambiguation(ontology),new TrieEntityCandidateGenerator(ontology,trie),new TrieLinguisticAnnotator(trie)));
}

Fixed version (ground truth):
/** 
 * Initializes the semantic index to use   {@code ontology} for finding all labels of an entity and{@code syntacticIndex} to query for documents containing these labels.
 * @param ontology       ontology to retrieve entity labels from
 * @param syntacticIndex index to query for documents containing the labels
 */
public SimpleSemanticIndex(OWLOntology ontology,SyntacticIndex syntacticIndex){
  super(ontology);
  SimpleEntityCandidatesTrie trie=new SimpleEntityCandidatesTrie(new RDFSLabelEntityTextRetriever(ontology),ontology);
  setSemanticAnnotator(new SemanticAnnotator(new SimpleWordSenseDisambiguation(ontology),new TrieEntityCandidateGenerator(ontology,trie),new TrieLinguisticAnnotator(trie)));
}
Program: 9487
Project: 9487
Buggy source:
@Override public double getNormalizedRelevance(Entity entityA,Entity entityB){
  Set<AnnotatedDocument> documentsA=index.getDocuments(entityA);
  Set<AnnotatedDocument> documentsB=index.getDocuments(entityB);
  Set<AnnotatedDocument> documentsAB=Sets.intersection(documentsA,documentsB);
  int nrOfDocuments=index.getSize();
  double pA=nrOfDocuments == 0 ? 0 : ((double)documentsA.size() / (double)nrOfDocuments);
  double pB=nrOfDocuments == 0 ? 0 : ((double)documentsB.size() / (double)nrOfDocuments);
  double pAB=nrOfDocuments == 0 ? 0 : ((double)documentsAB.size() / (double)nrOfDocuments);
  if (pA * pB == 0) {
    return 0;
  }
  double pmi=Math.log(pAB / pA * pB);
  double normalizedPMI=(pmi / -Math.log(pAB) + 1) / 2;
  return normalizedPMI;
}

Fixed version (ground truth):
@Override public double getNormalizedRelevance(Entity entityA,Entity entityB){
  Set<AnnotatedDocument> documentsA=index.getDocuments(entityA);
  Set<AnnotatedDocument> documentsB=index.getDocuments(entityB);
  Set<AnnotatedDocument> documentsAB=Sets.intersection(documentsA,documentsB);
  int nrOfDocuments=index.getSize();
  double pA=nrOfDocuments == 0 ? 0 : ((double)documentsA.size() / (double)nrOfDocuments);
  double pB=nrOfDocuments == 0 ? 0 : ((double)documentsB.size() / (double)nrOfDocuments);
  double pAB=nrOfDocuments == 0 ? 0 : ((double)documentsAB.size() / (double)nrOfDocuments);
  if (pAB == 0 || pA * pB == 0) {
    return 0;
  }
  double pmi=Math.log(pAB / (pA * pB));
  double denominator=-Math.log(pAB);
  if (denominator == 0) {
    return 0;
  }
  double normalizedPMI=(pmi / denominator + 1) / 2;
  return normalizedPMI;
}
Program: 9488
Project: 9488
Buggy source:
public static Map<Entity,Double> getRelevantEntities(Entity entity,OWLOntology ontology,RelevanceMetric metric){
  Map<Entity,Double> relevantEntities=new HashMap<Entity,Double>();
  Set<OWLEntity> owlEntities=new HashSet<OWLEntity>();
  owlEntities.addAll(ontology.getClassesInSignature());
  owlEntities.addAll(ontology.getDataPropertiesInSignature());
  owlEntities.addAll(ontology.getObjectPropertiesInSignature());
  Set<Entity> otherEntities=OWLAPIConverter.getEntities(owlEntities);
  for (  Entity otherEntity : otherEntities) {
    double relevance=metric.getNormalizedRelevance(entity,otherEntity);
    relevantEntities.put(otherEntity,relevance);
  }
  return relevantEntities;
}

Fixed version (ground truth):
public static Map<Entity,Double> getRelevantEntities(Entity entity,OWLOntology ontology,RelevanceMetric metric){
  System.out.println(entity);
  Map<Entity,Double> relevantEntities=new HashMap<Entity,Double>();
  Set<OWLEntity> owlEntities=new HashSet<OWLEntity>();
  owlEntities.addAll(ontology.getClassesInSignature());
  owlEntities.addAll(ontology.getDataPropertiesInSignature());
  owlEntities.addAll(ontology.getObjectPropertiesInSignature());
  Set<Entity> otherEntities=OWLAPIConverter.getEntities(owlEntities);
  otherEntities.remove(entity);
  for (  Entity otherEntity : otherEntities) {
    double relevance=metric.getNormalizedRelevance(entity,otherEntity);
    System.out.println(otherEntity + "String_Node_Str" + relevance);
    relevantEntities.put(otherEntity,relevance);
  }
  return relevantEntities;
}
Program: 9489
Project: 9489
Buggy source:
/** 
 * Returns the normalized form of the given word. If the word contains spaces, each part separated by spaces is normalized independently and joined afterwards. If there is an error normalizing the given word, the word itself is returned.
 * @param word the word to get normalized form for
 * @return normalized form of the word or the word itself on an error
 */
public String getNormalizedForm(String word){
  StringBuilder res=new StringBuilder();
  boolean first=true;
  ArrayList<String> singleWords=new ArrayList<String>();
  Collections.addAll(singleWords,word.trim().split("String_Node_Str"));
  for (  String w : singleWords) {
    try {
      if (first) {
        first=false;
      }
 else {
        res.append("String_Node_Str");
      }
      res.append(lemmatizeSingleWord(word));
    }
 catch (    Exception e) {
      throw new RuntimeException(e);
    }
  }
  return res.toString();
}

Fixed version (ground truth):
/** 
 * Returns the normalized form of the given word. If the word contains spaces, each part separated by spaces is normalized independently and joined afterwards. If there is an error normalizing the given word, the word itself is returned.
 * @param word the word to get normalized form for
 * @return normalized form of the word or the word itself on an error
 */
public String getNormalizedForm(String word){
  StringBuilder res=new StringBuilder();
  boolean first=true;
  ArrayList<String> singleWords=new ArrayList<String>();
  Collections.addAll(singleWords,word.trim().split("String_Node_Str"));
  for (  String w : singleWords) {
    try {
      if (first) {
        first=false;
      }
 else {
        res.append("String_Node_Str");
      }
      res.append(lemmatizeSingleWord(w));
    }
 catch (    Exception e) {
      throw new RuntimeException(e);
    }
  }
  return res.toString();
}
Program: 9490
Project: 9490
Buggy source:
@Override public Set<Entity> getCandidateEntities(String s){
  return trie.get(s);
}

Fixed version (ground truth):
@Override public Set<Entity> getCandidateEntities(String s){
  Set<Entity> res=trie.get(s);
  return res == null ? new HashSet<Entity>() : trie.get(s);
}
Program: 9491
Project: 9491
Buggy source:
@Override public Set<Annotation> annotate(Document document){
  String s=document.getRawContent();
  Set<Annotation> annotations=new HashSet<Annotation>();
  Pattern pattern=Pattern.compile("String_Node_Str");
  Matcher matcher=pattern.matcher(s);
  while (matcher.find()) {
    annotations.add(new Annotation(document,matcher.start(),matcher.end() - matcher.start()));
  }
  return annotations;
}

Fixed version (ground truth):
@Override public Set<Annotation> annotate(Document document){
  String s=document.getRawContent().trim();
  Set<Annotation> annotations=new HashSet<Annotation>();
  Pattern pattern=Pattern.compile("String_Node_Str");
  Matcher matcher=pattern.matcher(s);
  int start=0;
  while (matcher.find()) {
    int end=matcher.start();
    annotations.add(new Annotation(document,start,end - start));
    start=matcher.end();
  }
  if (start < s.length() - 1) {
    annotations.add(new Annotation(document,start,s.length() - start));
  }
  return annotations;
}
Program: 9492
Project: 9492
Buggy source:
/** 
 * Returns the set of annotated documents which reference the given entity using one of its surface forms.
 * @param entity entity to retrieve documents
 * @return documents referencing given entity
 */
public Set<AnnotatedDocument> getDocuments(Entity entity){
  Set<AnnotatedDocument> annotatedDocuments=index.get(entity);
  return annotatedDocuments;
}

Fixed version (ground truth):
/** 
 * Returns the set of annotated documents which reference the given entity using one of its surface forms.
 * @param entity entity to retrieve documents
 * @return documents referencing given entity
 */
public Set<AnnotatedDocument> getDocuments(Entity entity){
  if (index == null) {
    System.err.println("String_Node_Str");
    System.exit(1);
  }
  Set<AnnotatedDocument> annotatedDocuments=index.get(entity);
  return annotatedDocuments;
}