nus-yam/ex-repair huggingface dataset:
Program: 9698
Project: 9698
Buggy source:
public ScoreTwoValued(int conceptLength,double percentPerLengthUnit,Set<Individual> posAsPos,Set<Individual> posAsNeg,Set<Individual> negAsPos,Set<Individual> negAsNeg){
  this.conceptLength=conceptLength;
  this.percentPerLengthUnit=percentPerLengthUnit;
  this.posAsPos=posAsPos;
  this.posAsNeg=posAsNeg;
  this.negAsPos=negAsPos;
  this.negAsNeg=negAsNeg;
  nrOfExamples=posAsPos.size() + posAsNeg.size() + negAsPos.size()+ negAsNeg.size();
  computeScore();
}

Fixed version (ground truth):
public ScoreTwoValued(int conceptLength,double percentPerLengthUnit,Set<Individual> posAsPos,Set<Individual> posAsNeg,Set<Individual> negAsPos,Set<Individual> negAsNeg,double accuracy){
  this.conceptLength=conceptLength;
  this.percentPerLengthUnit=percentPerLengthUnit;
  this.posAsPos=posAsPos;
  this.posAsNeg=posAsNeg;
  this.negAsPos=negAsPos;
  this.negAsNeg=negAsNeg;
  nrOfExamples=posAsPos.size() + posAsNeg.size() + negAsPos.size()+ negAsNeg.size();
  this.accuracy=accuracy;
  score=accuracy - 1 - percentPerLengthUnit * conceptLength;
}
Program: 9699
Project: 9699
Buggy source:
@Test public void posNegLPLearningTests() throws ComponentInitException {
  KB kb=new KB();
  String ns="String_Node_Str";
  NamedClass[] nc=new NamedClass[5];
  for (int i=0; i < 5; i++) {
    nc[i]=new NamedClass(ns + "String_Node_Str" + i);
  }
  Individual[] ind=new Individual[100];
  for (int i=0; i < 100; i++) {
    ind[i]=new Individual(ns + "String_Node_Str" + i);
  }
  for (int i=0; i < 100; i++) {
    kb.addAxiom(new ClassAssertionAxiom(Thing.instance,ind[i]));
  }
  for (int i=0; i < 20; i++) {
    kb.addAxiom(new ClassAssertionAxiom(nc[0],ind[i]));
  }
  for (int i=10; i < 30; i++) {
    kb.addAxiom(new ClassAssertionAxiom(nc[1],ind[i]));
  }
  for (int i=10; i < 50; i++) {
    kb.addAxiom(new ClassAssertionAxiom(nc[2],ind[i]));
  }
  for (int i=8; i < 13; i++) {
    kb.addAxiom(new ClassAssertionAxiom(nc[3],ind[i]));
  }
  ComponentManager cm=ComponentManager.getInstance();
  KnowledgeSource ks=new KBFile(kb);
  ReasonerComponent reasoner=cm.reasoner(OWLAPIReasoner.class,ks);
  PosNegLPStandard problem=cm.learningProblem(PosNegLPStandard.class,reasoner);
  ks.init();
  reasoner.init();
  Individual[] pos1=new Individual[]{ind[1],ind[2]};
  Individual[] neg1=new Individual[]{ind[3],ind[4]};
  HeuristicTests.configurePosNegStandardLP(problem,pos1,neg1,"String_Node_Str",false);
}

Fixed version (ground truth):
@Test public void posNegLPLearningTests() throws ComponentInitException {
  KB kb=new KB();
  String ns="String_Node_Str";
  NamedClass[] nc=new NamedClass[5];
  for (int i=0; i < 5; i++) {
    nc[i]=new NamedClass(ns + "String_Node_Str" + i);
  }
  Individual[] ind=new Individual[100];
  for (int i=0; i < 100; i++) {
    ind[i]=new Individual(ns + "String_Node_Str" + i);
  }
  for (int i=0; i < 100; i++) {
    kb.addAxiom(new ClassAssertionAxiom(Thing.instance,ind[i]));
  }
  kb.addAxiom(new ClassAssertionAxiom(nc[0],ind[0]));
  kb.addAxiom(new ClassAssertionAxiom(nc[0],ind[1]));
  kb.addAxiom(new ClassAssertionAxiom(nc[0],ind[5]));
  kb.addAxiom(new ClassAssertionAxiom(nc[1],ind[0]));
  kb.addAxiom(new ClassAssertionAxiom(nc[1],ind[1]));
  kb.addAxiom(new ClassAssertionAxiom(nc[1],ind[2]));
  kb.addAxiom(new ClassAssertionAxiom(nc[1],ind[5]));
  ComponentManager cm=ComponentManager.getInstance();
  KnowledgeSource ks=new KBFile(kb);
  ReasonerComponent reasoner=cm.reasoner(OWLAPIReasoner.class,ks);
  PosNegLPStandard problem=cm.learningProblem(PosNegLPStandard.class,reasoner);
  ks.init();
  reasoner.init();
  Individual[] pos1=new Individual[]{ind[0],ind[1],ind[2],ind[3],ind[4]};
  Individual[] neg1=new Individual[]{ind[5],ind[6],ind[7],ind[8],ind[9]};
  HeuristicTests.configurePosNegStandardLP(problem,pos1,neg1,"String_Node_Str",false);
  assertEqualsPosNegLPStandard(problem,nc[0],0.5);
  assertEqualsPosNegLPStandard(problem,nc[1],2 / 3d);
  HeuristicTests.configurePosNegStandardLP(problem,pos1,neg1,"String_Node_Str",true);
  assertEqualsPosNegLPStandard(problem,nc[0],0.5);
  assertEqualsPosNegLPStandard(problem,nc[1],2 / 3d);
}
Program: 9700
Project: 9700
Buggy source:
private String getNewResource(QueryTree<N> tree,List<String> knownResources){
  int i=0;
  int chunkSize=10;
  SortedSet<String> foundResources=getResources(tree,chunkSize,chunkSize * i);
  foundResources.removeAll(knownResources);
  QueryTree<N> newTree;
  while (!foundResources.isEmpty()) {
    for (    String resource : foundResources) {
      newTree=getQueryTree(resource);
      if (!newTree.isSubsumedBy(lgg)) {
        return resource;
      }
    }
    i++;
    foundResources=getResources(tree,chunkSize,chunkSize * i);
    foundResources.removeAll(knownResources);
  }
  logger.debug("String_Node_Str");
  return null;
}

Fixed version (ground truth):
private String getNewResource(QueryTree<N> tree,List<String> knownResources){
  int i=0;
  int chunkSize=40;
  SortedSet<String> foundResources;
  QueryTree<N> newTree;
  int foundSize;
  do {
    foundResources=getResources(tree,chunkSize,chunkSize * i);
    foundSize=foundResources.size();
    foundResources.removeAll(knownResources);
    for (    String resource : foundResources) {
      newTree=getQueryTree(resource);
      if (!newTree.isSubsumedBy(lgg)) {
        return resource;
      }
    }
    i++;
  }
 while (foundSize == chunkSize);
  logger.debug("String_Node_Str");
  return null;
}
Program: 9701
Project: 9701
Buggy source:
private void limitEqualEdgesToLeafs(QueryTree<N> tree,int maxEqualEdgeCount){
  Set<QueryTree<N>> parents=new HashSet<QueryTree<N>>();
  for (  QueryTree<N> leaf : tree.getLeafs()) {
    if (leaf.getUserObject().equals("String_Node_Str")) {
      parents.add(leaf.getParent());
    }
  }
  for (  QueryTree<N> parent : parents) {
    for (    Object edge : parent.getEdges()) {
      int cnt=0;
      for (      QueryTree<N> child : parent.getChildren(edge)) {
        if (child.getUserObject().equals("String_Node_Str")) {
          if (child.isLeaf()) {
            cnt++;
            if (cnt > maxEqualEdgeCount) {
              parent.removeChild((QueryTreeImpl<N>)child);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void limitEqualEdgesToLeafs(QueryTree<N> tree,int maxEqualEdgeCount){
  Set<QueryTree<N>> parents=new HashSet<QueryTree<N>>();
  for (  QueryTree<N> leaf : tree.getLeafs()) {
    if (leaf.getUserObject().equals("String_Node_Str")) {
      parents.add(leaf.getParent());
    }
  }
  for (  QueryTree<N> parent : parents) {
    for (    Object edge : parent.getEdges()) {
      int cnt=0;
      boolean existsResourceChild=false;
      for (      QueryTree<N> child : parent.getChildren(edge)) {
        if (!child.getUserObject().equals("String_Node_Str")) {
          existsResourceChild=true;
          break;
        }
      }
      for (      QueryTree<N> child : parent.getChildren(edge)) {
        if (child.getUserObject().equals("String_Node_Str")) {
          if (child.isLeaf()) {
            cnt++;
            if (existsResourceChild || cnt > maxEqualEdgeCount) {
              parent.removeChild((QueryTreeImpl<N>)child);
            }
          }
        }
      }
    }
  }
}
Program: 9702
Project: 9702
Buggy source:
public void simplifyTree(QueryTree<N> tree,List<QueryTree<N>> negTrees){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
    logger.debug("String_Node_Str" + TreeHelper.getAbbreviatedTreeRepresentation(tree,endpoint.getBaseURI(),endpoint.getPrefixes()));
  }
  List<Object> path;
  boolean pathExists;
  for (  QueryTree<N> leaf : tree.getLeafs()) {
    pathExists=false;
    path=getPathFromRootToNode(leaf);
    if (leaf.getParent().getUserObject().equals("String_Node_Str")) {
      pathExists=true;
      for (      QueryTree<N> negTree : negTrees) {
        if (!pathExists(leaf,new ArrayList<Object>(path),negTree)) {
          pathExists=false;
          break;
        }
      }
    }
    if (pathExists) {
      leaf.getParent().removeChild((QueryTreeImpl<N>)leaf);
    }
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + TreeHelper.getAbbreviatedTreeRepresentation(tree,endpoint.getBaseURI(),endpoint.getPrefixes()));
  }
}

Fixed version (ground truth):
public void simplifyTree(QueryTree<N> tree,List<QueryTree<N>> negTrees){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
    logger.debug("String_Node_Str" + TreeHelper.getAbbreviatedTreeRepresentation(tree,endpoint.getBaseURI(),endpoint.getPrefixes()));
    int i=1;
    for (    QueryTree<N> negTree : negTrees) {
      logger.debug("String_Node_Str" + i++ + "String_Node_Str"+ negTrees.size()+ "String_Node_Str"+ TreeHelper.getAbbreviatedTreeRepresentation(negTree,endpoint.getBaseURI(),endpoint.getPrefixes()));
    }
  }
  List<Object> path;
  boolean pathExists;
  for (  QueryTree<N> leaf : tree.getLeafs()) {
    pathExists=false;
    path=getPathFromRootToNode(leaf);
    if (leaf.getParent().getUserObject().equals("String_Node_Str")) {
      pathExists=true;
      for (      QueryTree<N> negTree : negTrees) {
        if (!pathExists(leaf,new ArrayList<Object>(path),negTree)) {
          pathExists=false;
          break;
        }
      }
    }
    if (pathExists) {
      leaf.getParent().removeChild((QueryTreeImpl<N>)leaf);
    }
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + TreeHelper.getAbbreviatedTreeRepresentation(tree,endpoint.getBaseURI(),endpoint.getPrefixes()));
  }
}
Program: 9703
Project: 9703
Buggy source:
private boolean pathExists(QueryTree<N> leaf,List<Object> path,QueryTree<N> tree){
  List<QueryTree<N>> negLeaves;
  Object lastEdge=path.remove(path.size() - 1);
  for (  QueryTree<N> node : getNodesByPath(tree,path)) {
    negLeaves=node.getChildren(lastEdge);
    if (negLeaves.isEmpty()) {
      break;
    }
 else {
      if (leaf.getUserObject().equals("String_Node_Str")) {
        return true;
      }
      for (      QueryTree<N> negLeaf : negLeaves) {
        if (negLeaf.getUserObject().equals(leaf.getUserObject())) {
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean pathExists(QueryTree<N> leaf,List<Object> path,QueryTree<N> tree){
  List<QueryTree<N>> negLeaves;
  Object lastEdge=path.remove(path.size() - 1);
  for (  QueryTree<N> node : getNodesByPath(tree,path)) {
    negLeaves=node.getChildren(lastEdge);
    boolean exists=false;
    if (negLeaves.isEmpty()) {
      return false;
    }
 else {
      if (leaf.getUserObject().equals("String_Node_Str")) {
        return true;
      }
      for (      QueryTree<N> negLeaf : negLeaves) {
        if (negLeaf.getUserObject().equals(leaf.getUserObject())) {
          exists=true;
          break;
        }
      }
    }
    if (!exists) {
      return false;
    }
  }
  return true;
}
Program: 9704
Project: 9704
Buggy source:
private String getNewResource(QueryTree<N> tree,List<String> knownResources){
  int i=0;
  int chunkSize=10;
  SortedSet<String> foundResources=getResources(tree,10,chunkSize * i);
  foundResources.removeAll(knownResources);
  QueryTree<N> newTree;
  while (!foundResources.isEmpty()) {
    for (    String resource : foundResources) {
      newTree=getQueryTree(resource);
      if (!newTree.isSubsumedBy(lgg)) {
        return resource;
      }
    }
    i++;
    foundResources=getResources(tree,10,chunkSize * i);
  }
  logger.debug("String_Node_Str");
  return null;
}

Fixed version (ground truth):
private String getNewResource(QueryTree<N> tree,List<String> knownResources){
  int i=0;
  int chunkSize=10;
  SortedSet<String> foundResources=getResources(tree,10,chunkSize * i);
  foundResources.removeAll(knownResources);
  QueryTree<N> newTree;
  while (!foundResources.isEmpty()) {
    for (    String resource : foundResources) {
      newTree=getQueryTree(resource);
      if (!newTree.isSubsumedBy(lgg)) {
        return resource;
      }
    }
    i++;
    foundResources=getResources(tree,10,chunkSize * i);
    foundResources.removeAll(knownResources);
  }
  logger.debug("String_Node_Str");
  return null;
}
Program: 9705
Project: 9705
Buggy source:
private void buildSPARQLQueryString(QueryTree<N> tree,StringBuilder sb,boolean filtered,int cnt){
  Object subject=null;
  if (tree.getUserObject().equals("String_Node_Str")) {
    subject="String_Node_Str" + cnt++;
  }
 else {
    subject="String_Node_Str" + tree.getUserObject() + "String_Node_Str";
  }
  Object predicate;
  Object object;
  if (!tree.isLeaf()) {
    for (    QueryTree<N> child : tree.getChildren()) {
      predicate=tree.getEdge(child);
      if (filtered) {
        if (Filter.getAllFilterProperties().contains(predicate.toString())) {
          continue;
        }
      }
      object=child.getUserObject();
      boolean objectIsResource=!object.equals("String_Node_Str");
      if (!objectIsResource) {
        object="String_Node_Str" + cnt;
      }
 else       if (((String)object).startsWith("String_Node_Str")) {
        object="String_Node_Str" + object + "String_Node_Str";
      }
      sb.append(subject).append("String_Node_Str").append(predicate).append("String_Node_Str").append(object).append("String_Node_Str");
      if (!objectIsResource) {
        buildSPARQLQueryString(child,sb,filtered,cnt);
      }
    }
  }
}

Fixed version (ground truth):
private void buildSPARQLQueryString(QueryTree<N> tree,StringBuilder sb,boolean filtered,int cnt){
  Object subject=null;
  if (tree.getUserObject().equals("String_Node_Str")) {
    subject="String_Node_Str" + cnt++;
  }
 else {
    subject="String_Node_Str" + tree.getUserObject() + "String_Node_Str";
  }
  Object predicate;
  Object object;
  if (!tree.isLeaf()) {
    for (    QueryTree<N> child : tree.getChildren()) {
      if (child.isLiteralNode()) {
        continue;
      }
      predicate=tree.getEdge(child);
      if (((String)predicate).startsWith("String_Node_Str")) {
        continue;
      }
      if (filtered) {
        if (Filter.getAllFilterProperties().contains(predicate.toString())) {
          continue;
        }
      }
      object=child.getUserObject();
      boolean objectIsResource=!object.equals("String_Node_Str");
      if (!objectIsResource) {
        object="String_Node_Str" + cnt;
      }
 else       if (((String)object).startsWith("String_Node_Str")) {
        object="String_Node_Str" + object + "String_Node_Str";
      }
      sb.append(subject).append("String_Node_Str").append(predicate).append("String_Node_Str").append(object).append("String_Node_Str");
      if (!objectIsResource) {
        buildSPARQLQueryString(child,sb,filtered,cnt);
      }
    }
  }
}
Program: 9706
Project: 9706
Buggy source:
private SortedSet<String> getResources(QueryTree<N> tree){
  SortedSet<String> resources=new TreeSet<String>();
  query=tree.toSPARQLQueryString();
  query=getDistinctQuery(query);
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str" + query);
  }
  String result=cache.executeSelectQuery(endpoint,getLimitedQuery(query));
  ResultSetRewindable 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> getResources(QueryTree<N> tree){
  SortedSet<String> resources=new TreeSet<String>();
  query=tree.toSPARQLQueryString();
  query=getLimitedQuery(query);
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str" + query);
  }
  String result=cache.executeSelectQuery(endpoint,query);
  ResultSetRewindable 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: 9707
Project: 9707
Buggy source:
private String getLimitedQuery(String query){
  return query + "String_Node_Str" + (limit + 1);
}

Fixed version (ground truth):
private String getLimitedQuery(String query){
  query="String_Node_Str" + query.substring(7);
  return query + "String_Node_Str" + (limit + 1);
}
Program: 9711
Project: 9711
Buggy source:
private QueryTree<N> createFilteredTree(QueryTree<N> tree){
  QueryTree<N> filteredTree=new QueryTreeImpl<N>(tree.getUserObject());
  filteredTree.setId(nodeId);
  QueryTree<N> subTree;
  Object predicate;
  for (  QueryTree<N> child : tree.getChildren()) {
    if (child.isLiteralNode()) {
      continue;
    }
    predicate=tree.getEdge(child);
    if (((String)predicate).startsWith("String_Node_Str")) {
      continue;
    }
    this.nodeId++;
    subTree=createFilteredTree(child);
    subTree.setLiteralNode(child.isLiteralNode());
    subTree.setResourceNode(child.isResourceNode());
    filteredTree.addChild((QueryTreeImpl<N>)subTree,tree.getEdge(child));
  }
  return filteredTree;
}

Fixed version (ground truth):
private QueryTree<N> createFilteredTree(QueryTree<N> tree){
  QueryTree<N> filteredTree=new QueryTreeImpl<N>(tree.getUserObject());
  filteredTree.setId(nodeId);
  QueryTree<N> subTree;
  Object predicate;
  for (  QueryTree<N> child : tree.getChildren()) {
    predicate=tree.getEdge(child);
    if (((String)predicate).startsWith("String_Node_Str")) {
      continue;
    }
    this.nodeId++;
    subTree=createFilteredTree(child);
    subTree.setLiteralNode(child.isLiteralNode());
    subTree.setResourceNode(child.isResourceNode());
    filteredTree.addChild((QueryTreeImpl<N>)subTree,tree.getEdge(child));
  }
  return filteredTree;
}
Program: 9712
Project: 9712
Buggy source:
private List<GeneralisedQueryTree<N>> getAllowedGeneralisationsSortedByMatrix(GeneralisedQueryTree<N> tree){
  List<QueryTreeChange> changes=new ArrayList<QueryTreeChange>();
  System.err.println(tree.getQueryTree().getStringRepresentation());
  QueryTreeChange lastChange=tree.getLastChange();
  for (  QueryTree<N> node : getPossibleNodes2Change(tree.getQueryTree())) {
    if (lastChange.getType() == ChangeType.REMOVE_NODE) {
      if (node.getUserObject().equals("String_Node_Str") && node.getId() < lastChange.getNodeId()) {
        changes.add(new QueryTreeChange(node.getId(),ChangeType.REMOVE_NODE));
      }
    }
 else {
      if (node.getUserObject().equals("String_Node_Str")) {
        changes.add(new QueryTreeChange(node.getId(),ChangeType.REMOVE_NODE));
      }
 else {
        changes.add(new QueryTreeChange(node.getId(),ChangeType.REPLACE_LABEL));
      }
    }
  }
  System.out.println();
  List<GeneralisedQueryTree<N>> gens=getAllowedGeneralisations(tree);
  Collections.sort(gens,comparator);
  return gens;
}

Fixed version (ground truth):
private List<QueryTreeChange> getAllowedGeneralisationsSortedByMatrix(GeneralisedQueryTree<N> tree){
  List<QueryTreeChange> changes=new ArrayList<QueryTreeChange>();
  QueryTreeChange lastChange=tree.getLastChange();
  for (  QueryTree<N> node : getPossibleNodes2Change(tree.getQueryTree())) {
    if (lastChange.getType() == ChangeType.REMOVE_NODE) {
      if (node.getUserObject().equals("String_Node_Str") && node.getId() < lastChange.getNodeId()) {
        changes.add(new QueryTreeChange(node.getId(),ChangeType.REMOVE_NODE));
      }
    }
 else {
      if (node.getUserObject().equals("String_Node_Str")) {
        changes.add(new QueryTreeChange(node.getId(),ChangeType.REMOVE_NODE));
      }
 else       if (lastChange.getNodeId() < node.getId()) {
        changes.add(new QueryTreeChange(node.getId(),ChangeType.REPLACE_LABEL));
      }
    }
  }
  return changes;
}
Program: 9715
Project: 9715
Buggy source:
private int getResultCount(String query,SparqlEndpoint endpoint,ExtractionDBCache cache){
  com.hp.hpl.jena.query.ResultSet rs=SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint,query));
  SortedSet<String> resources=new TreeSet<String>();
  QuerySolution qs;
  while (rs.hasNext()) {
    qs=rs.next();
    if (qs.get("String_Node_Str").isURIResource()) {
      resources.add(qs.get("String_Node_Str").asResource().getURI());
    }
  }
  return resources.size();
}

Fixed version (ground truth):
private int getResultCount(String query,SparqlEndpoint endpoint,ExtractionDBCache cache){
  com.hp.hpl.jena.query.ResultSet rs=SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint,getDistinctQuery(query)));
  SortedSet<String> resources=new TreeSet<String>();
  QuerySolution qs;
  while (rs.hasNext()) {
    qs=rs.next();
    if (qs.get("String_Node_Str").isURIResource()) {
      resources.add(qs.get("String_Node_Str").asResource().getURI());
    }
  }
  return resources.size();
}
Program: 9716
Project: 9716
Buggy source:
private SortedSet<String> getResources(QueryTree<N> tree){
  SortedSet<String> resources=new TreeSet<String>();
  query=tree.toSPARQLQueryString();
  query=getLimitedQuery(query);
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str" + query);
  }
  String result=cache.executeSelectQuery(endpoint,query);
  ResultSetRewindable 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> getResources(QueryTree<N> tree){
  SortedSet<String> resources=new TreeSet<String>();
  query=tree.toSPARQLQueryString();
  query=getDistinctQuery(query);
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str" + getLimitedQuery(query));
  }
  String result=cache.executeSelectQuery(endpoint,getLimitedQuery(query));
  ResultSetRewindable 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: 9717
Project: 9717
Buggy source:
private String getLimitedQuery(String query){
  query="String_Node_Str" + query.substring(7);
  return query + "String_Node_Str" + (limit + 1);
}

Fixed version (ground truth):
private String getLimitedQuery(String query){
  return query + "String_Node_Str" + (limit + 1);
}
Program: 9719
Project: 9719
Buggy source:
private void fillTree(QueryTreeImpl<String> tree,SortedMap<String,SortedSet<Statement>> resource2Statements){
  if (resource2Statements.containsKey(tree.getUserObject())) {
    QueryTreeImpl<String> subTree;
    for (    Statement st : resource2Statements.get(tree.getUserObject())) {
      if (Filter.getAllFilterProperties().contains(st.getPredicate().toString())) {
        continue;
      }
      if (st.getObject().isLiteral()) {
        Literal lit=st.getLiteral();
        StringBuilder sb=new StringBuilder();
        sb.append("String_Node_Str").append(lit.getLexicalForm()).append("String_Node_Str");
        if (lit.getDatatypeURI() != null) {
          sb.append("String_Node_Str").append(lit.getDatatypeURI()).append("String_Node_Str");
        }
        if (!lit.getLanguage().isEmpty()) {
          sb.append("String_Node_Str").append(lit.getLanguage());
        }
        tree.addChild(new QueryTreeImpl<String>(sb.toString()),st.getPredicate().toString());
      }
 else {
        if (!tree.getUserObjectPathToRoot().contains(st.getObject().toString())) {
          subTree=new QueryTreeImpl<String>(st.getObject().toString());
          tree.addChild(subTree,st.getPredicate().toString());
          fillTree(subTree,resource2Statements);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void fillTree(QueryTreeImpl<String> tree,SortedMap<String,SortedSet<Statement>> resource2Statements){
  if (resource2Statements.containsKey(tree.getUserObject())) {
    QueryTreeImpl<String> subTree;
    for (    Statement st : resource2Statements.get(tree.getUserObject())) {
      if (Filter.getAllFilterProperties().contains(st.getPredicate().toString())) {
        continue;
      }
      if (st.getObject().isLiteral()) {
        Literal lit=st.getLiteral();
        StringBuilder sb=new StringBuilder();
        sb.append("String_Node_Str").append(lit.getLexicalForm()).append("String_Node_Str");
        if (lit.getDatatypeURI() != null) {
          sb.append("String_Node_Str").append(lit.getDatatypeURI()).append("String_Node_Str");
        }
        if (!lit.getLanguage().isEmpty()) {
          sb.append("String_Node_Str").append(lit.getLanguage());
        }
        tree.addChild(new QueryTreeImpl<String>(sb.toString()),st.getPredicate().toString());
      }
 else {
        if (tree.getUserObjectPathToRoot().size() < 3 && !tree.getUserObjectPathToRoot().contains(st.getObject().toString())) {
          subTree=new QueryTreeImpl<String>(st.getObject().toString());
          tree.addChild(subTree,st.getPredicate().toString());
          fillTree(subTree,resource2Statements);
        }
      }
    }
  }
}
Program: 9720
Project: 9720
Buggy source:
public SPARQLQueryGeneratorImpl(String endpointURL){
  this.endpointURL=endpointURL;
  modelGen=new ModelGenerator(endpointURL);
}

Fixed version (ground truth):
public SPARQLQueryGeneratorImpl(NBRStrategy nbrStrategy){
  this.nbrStrategy=nbrStrategy;
}
Program: 9721
Project: 9721
Buggy source:
private void learnPosNeg(){
  logger.info("String_Node_Str");
  Monitor lggMonitor=MonitorFactory.getTimeMonitor("String_Node_Str");
  lggMonitor.start();
  LGGGenerator<String> lggGenerator=new LGGGeneratorImpl<String>();
  QueryTree<String> lgg=lggGenerator.getLGG(posQueryTrees);
  lggMonitor.stop();
  logger.info("String_Node_Str");
  logger.info(lgg.getStringRepresentation());
  logger.info("String_Node_Str" + lggMonitor.getTotal() + "String_Node_Str");
  Monitor nbrMonitor=MonitorFactory.getTimeMonitor("String_Node_Str");
  nbrMonitor.start();
  NBRGenerator<String> nbrGenerator=new NBRGeneratorImpl<String>();
  int i=1;
  for (  QueryTree<String> nbr : nbrGenerator.getNBRs(lgg,negQueryTrees)) {
    logger.info("String_Node_Str" + i++);
    logger.info(nbr.getStringRepresentation());
    resultQueries.add(nbr.toSPARQLQueryString(true));
    resultTrees.add(nbr);
  }
  nbrMonitor.stop();
  logger.info("String_Node_Str" + nbrMonitor.getTotal() + "String_Node_Str");
}

Fixed version (ground truth):
private void learnPosNeg(){
  logger.info("String_Node_Str");
  Monitor lggMonitor=MonitorFactory.getTimeMonitor("String_Node_Str");
  lggMonitor.start();
  LGGGenerator<String> lggGenerator=new LGGGeneratorImpl<String>();
  lgg=lggGenerator.getLGG(posQueryTrees);
  lggMonitor.stop();
  logger.info("String_Node_Str");
  logger.info(lgg.getStringRepresentation());
  logger.info("String_Node_Str" + lggMonitor.getTotal() + "String_Node_Str");
  Monitor nbrMonitor=MonitorFactory.getTimeMonitor("String_Node_Str");
  nbrMonitor.start();
  NBRGenerator<String> nbrGenerator=new NBRGeneratorImpl<String>(nbrStrategy);
  int i=1;
  for (  QueryTree<String> nbr : nbrGenerator.getNBRs(lgg,negQueryTrees)) {
    logger.info("String_Node_Str" + i++);
    logger.info(nbr.getStringRepresentation());
    resultQueries.add(nbr.toSPARQLQueryString(true));
    resultTrees.add(nbr);
  }
  nbrMonitor.stop();
  logger.info("String_Node_Str" + nbrMonitor.getTotal() + "String_Node_Str");
}
Program: 9722
Project: 9722
Buggy source:
private void writeTriples2DB(String key,String value){
  try {
    PreparedStatement ps=conn.prepareStatement("String_Node_Str");
    ps.setBytes(1,md5(key));
    java.sql.ResultSet rs=ps.executeQuery();
    if (rs.next()) {
      int id=rs.getInt("String_Node_Str");
      ps=conn.prepareStatement("String_Node_Str");
      ps.setClob(1,new StringReader(value));
      ps.setTimestamp(2,new java.sql.Timestamp(new java.util.Date().getTime()));
      ps.setInt(3,id);
      ps.executeUpdate();
    }
 else {
      ps=conn.prepareStatement("String_Node_Str");
      ps.setBytes(1,md5(key));
      ps.setClob(2,new StringReader(value));
      ps.setTimestamp(3,new java.sql.Timestamp(new java.util.Date().getTime()));
      ps.addBatch();
    }
  }
 catch (  SQLException e) {
    logger.error("String_Node_Str" + key + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void writeTriples2DB(String key,String value){
  try {
    PreparedStatement ps=conn.prepareStatement("String_Node_Str");
    ps.setBytes(1,md5(key));
    java.sql.ResultSet rs=ps.executeQuery();
    if (rs.next()) {
      int id=rs.getInt("String_Node_Str");
      ps=conn.prepareStatement("String_Node_Str");
      ps.setClob(1,new StringReader(value));
      ps.setTimestamp(2,new java.sql.Timestamp(new java.util.Date().getTime()));
      ps.setInt(3,id);
      ps.executeUpdate();
    }
 else {
      ps=conn.prepareStatement("String_Node_Str");
      ps.setBytes(1,md5(key));
      ps.setClob(2,new StringReader(value));
      ps.setTimestamp(3,new java.sql.Timestamp(new java.util.Date().getTime()));
      ps.executeUpdate();
    }
  }
 catch (  SQLException e) {
    logger.error("String_Node_Str" + key + "String_Node_Str",e);
  }
}
Program: 9723
Project: 9723
Buggy source:
private int getResourceID(String resource){
  int id=-1;
  try {
    PreparedStatement ps=conn.prepareStatement("String_Node_Str");
    ps.setBytes(1,md5(resource));
    java.sql.ResultSet rs=ps.executeQuery();
    if (rs.next()) {
      id=rs.getInt("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    logger.error("String_Node_Str" + resource + "String_Node_Str",e);
    e.printStackTrace();
  }
  return -1;
}

Fixed version (ground truth):
private int getResourceID(String resource){
  int id=-1;
  try {
    PreparedStatement ps=conn.prepareStatement("String_Node_Str");
    ps.setBytes(1,md5(resource));
    java.sql.ResultSet rs=ps.executeQuery();
    if (rs.next()) {
      id=rs.getInt("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    logger.error("String_Node_Str" + resource + "String_Node_Str",e);
    e.printStackTrace();
  }
  return id;
}
Program: 9725
Project: 9725
Buggy source:
private Model getModelIncrementallyRec(String resource,int depth){
  logger.debug("String_Node_Str" + resource);
  Query query=makeConstructQuery(resource);
  logger.debug("String_Node_Str");
  logger.debug("String_Node_Str" + query.toString());
  queryMonitor.start();
  QueryExecution qexec=QueryExecutionFactory.sparqlService(endpoint.getURL().toString(),query,endpoint.getDefaultGraphURIs(),endpoint.getNamedGraphURIs());
  Model model=qexec.execConstruct();
  logger.debug("String_Node_Str" + model.size() + "String_Node_Str");
  Statement st=null;
  for (Iterator<Statement> i=model.listStatements(); i.hasNext(); st=i.next()) {
    logger.debug(st);
  }
  if (depth < recursionDepth) {
    Model tmp=ModelFactory.createDefaultModel();
    for (Iterator<Statement> i=model.listStatements(); i.hasNext(); ) {
      st=i.next();
      if (st.getObject().isURIResource()) {
        tmp.add(getModelIncrementallyRec(st.getObject().toString(),depth++));
      }
    }
    model.add(tmp);
  }
  return model;
}

Fixed version (ground truth):
private Model getModelIncrementallyRec(String resource,int depth){
  logger.debug("String_Node_Str" + resource);
  Query query=makeConstructQuery(resource,predicateFilters);
  logger.debug("String_Node_Str");
  logger.debug("String_Node_Str" + query.toString());
  queryMonitor.start();
  QueryExecution qexec=QueryExecutionFactory.sparqlService(endpoint.getURL().toString(),query,endpoint.getDefaultGraphURIs(),endpoint.getNamedGraphURIs());
  Model model=qexec.execConstruct();
  logger.debug("String_Node_Str" + model.size() + "String_Node_Str");
  Statement st=null;
  for (Iterator<Statement> i=model.listStatements(); i.hasNext(); st=i.next()) {
    logger.debug(st);
  }
  if (depth < recursionDepth) {
    Model tmp=ModelFactory.createDefaultModel();
    for (Iterator<Statement> i=model.listStatements(); i.hasNext(); ) {
      st=i.next();
      if (st.getObject().isURIResource()) {
        tmp.add(getModelIncrementallyRec(st.getObject().toString(),depth + 1));
      }
    }
    model.add(tmp);
  }
  return model;
}
Program: 9727
Project: 9727
Buggy source:
public Model createModel(String resource,Strategy strategy,int recursionDepth){
  this.recursionDepth=recursionDepth;
  if (strategy == Strategy.INCREMENTALLY) {
    return getModelIncrementallyRec(resource,0);
  }
 else   if (strategy == Strategy.CHUNKS) {
    return getModel(resource);
  }
 else   if (strategy == null) {
    return getModelOptional(resource);
  }
  return ModelFactory.createDefaultModel();
}

Fixed version (ground truth):
public Model createModel(String resource,Strategy strategy,int recursionDepth){
  this.recursionDepth=recursionDepth;
  if (strategy == Strategy.INCREMENTALLY) {
    return getModelIncrementallyRec(resource,0);
  }
 else   if (strategy == Strategy.CHUNKS) {
    return getModelChunked(resource);
  }
  return ModelFactory.createDefaultModel();
}
Program: 9728
Project: 9728
Buggy source:
/** 
 * A SPARQL CONSTRUCT query is created, to get a RDF graph for the given example.
 * @param example The example resource for which a CONSTRUCT query is created.
 * @return The JENA ARQ Query object.
 */
private Query makeConstructQuery(String example){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(example).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(example).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  Query query=QueryFactory.create(sb.toString());
  return query;
}

Fixed version (ground truth):
/** 
 * A SPARQL CONSTRUCT query is created, to get a RDF graph for the given example.
 * @param example The example resource for which a CONSTRUCT query is created.
 * @return The JENA ARQ Query object.
 */
private Query makeConstructQuery(String example,Set<String> predicateFilters){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(example).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str").append(example).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str");
  for (  String predicate : predicateFilters) {
    sb.append("String_Node_Str").append(predicate).append("String_Node_Str");
  }
  sb.append("String_Node_Str");
  Query query=QueryFactory.create(sb.toString());
  return query;
}
Program: 9731
Project: 9731
Buggy source:
public static void main(String[] args) throws ClassNotFoundException, SQLException, NoSuchAlgorithmException, UnsupportedEncodingException {
  SparqlEndpoint endpoint=SparqlEndpoint.getEndpointLOCALDBpedia();
  String resource="String_Node_Str";
  String query="String_Node_Str" + resource + "String_Node_Str"+ resource+ "String_Node_Str";
  System.out.println("String_Node_Str" + query);
  ExtractionDBCache h2=new ExtractionDBCache("String_Node_Str");
  long startTime=System.nanoTime();
  Model m=h2.executeConstructQuery(endpoint,query);
  for (int i=0; i < 1000; i++) {
    h2.executeConstructQuery(endpoint,query);
  }
  long runTime=System.nanoTime() - startTime;
  System.out.println("String_Node_Str" + Helper.prettyPrintNanoSeconds(runTime));
  System.out.println(ExtractionDBCache.toNTriple(m));
}

Fixed version (ground truth):
public static void main(String[] args) throws ClassNotFoundException, SQLException, NoSuchAlgorithmException, UnsupportedEncodingException {
  SparqlEndpoint endpoint=SparqlEndpoint.getEndpointDBpediaLiveAKSW();
  String resource="String_Node_Str";
  String query="String_Node_Str" + resource + "String_Node_Str"+ resource+ "String_Node_Str";
  System.out.println("String_Node_Str" + query);
  ExtractionDBCache h2=new ExtractionDBCache("String_Node_Str");
  long startTime=System.nanoTime();
  Model m=h2.executeConstructQuery(endpoint,query);
  long runTime=System.nanoTime() - startTime;
  System.out.println("String_Node_Str" + Helper.prettyPrintNanoSeconds(runTime));
  System.out.println(ExtractionDBCache.toNTriple(m));
}
Program: 9735
Project: 9735
Buggy source:
public static void main(String args[]) throws ComponentInitException, FileNotFoundException, ParseException {
  SimpleLayout layout=new SimpleLayout();
  ConsoleAppender consoleAppender=new ConsoleAppender(layout);
  logger.removeAllAppenders();
  logger.addAppender(consoleAppender);
  logger.setLevel(Level.DEBUG);
  String filenameTrain=args[0];
  String filenameTest=args[1];
  Start start=new Start(new File(filenameTrain));
  start.start(false);
  Description solution=start.getLearningAlgorithm().getCurrentlyBestDescription();
  logger.setLevel(Level.WARN);
  Start startTest=new Start(new File(filenameTest));
  ReasonerComponent rs=startTest.getReasonerComponent();
  LearningProblem lp=startTest.getLearningProblem();
  Set<Individual> result=rs.getIndividuals(solution);
  System.out.println("String_Node_Str" + result);
  ScorePosNeg score=(ScorePosNeg)lp.computeScore(solution);
  System.out.println(score);
}

Fixed version (ground truth):
public static void main(String args[]) throws ComponentInitException, FileNotFoundException, ParseException, org.dllearner.confparser.ParseException {
  SimpleLayout layout=new SimpleLayout();
  ConsoleAppender consoleAppender=new ConsoleAppender(layout);
  logger.removeAllAppenders();
  logger.addAppender(consoleAppender);
  logger.setLevel(Level.DEBUG);
  String filenameTrain=args[0];
  String filenameTest=args[1];
  Start start=new Start(new File(filenameTrain));
  start.start(false);
  Description solution=start.getLearningAlgorithm().getCurrentlyBestDescription();
  logger.setLevel(Level.WARN);
  Start startTest=new Start(new File(filenameTest));
  ReasonerComponent rs=startTest.getReasonerComponent();
  LearningProblem lp=startTest.getLearningProblem();
  Set<Individual> result=rs.getIndividuals(solution);
  System.out.println("String_Node_Str" + result);
  ScorePosNeg score=(ScorePosNeg)lp.computeScore(solution);
  System.out.println(score);
}
Program: 9736
Project: 9736
Buggy source:
/** 
 * Writes documentation for all components available in this <code>ComponentManager</code> instance. It goes through all components (sorted by their type) and all the configuration options of the components. Explanations, default values, allowed values for the options are collected and the obtained string is written in a file. 
 * @param file The documentation file.
 */
public void writeConfigDocumentation(File file){
  String doc="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  for (  Class<? extends Component> component : knowledgeSources) {
    if (component != SparqlKnowledgeSource.class) {
      continue;
    }
    doc+=getComponentConfigString(component,KnowledgeSource.class);
  }
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  for (  Class<? extends Component> component : reasonerComponents) {
    doc+=getComponentConfigString(component,ReasonerComponent.class);
  }
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  for (  Class<? extends Component> component : learningProblems) {
    doc+=getComponentConfigString(component,LearningProblem.class);
  }
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  for (  Class<? extends Component> component : learningAlgorithms) {
    doc+=getComponentConfigString(component,LearningAlgorithm.class);
  }
  Files.createFile(file,doc);
}

Fixed version (ground truth):
/** 
 * Writes documentation for all components available in this <code>ComponentManager</code> instance. It goes through all components (sorted by their type) and all the configuration options of the components. Explanations, default values, allowed values for the options are collected and the obtained string is written in a file. 
 * @param file The documentation file.
 */
public void writeConfigDocumentation(File file){
  String doc="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  for (  Class<? extends Component> component : cm.getKnowledgeSources()) {
    if (component != SparqlKnowledgeSource.class) {
      continue;
    }
    doc+=getComponentConfigString(component,KnowledgeSource.class);
  }
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  for (  Class<? extends Component> component : cm.getReasonerComponents()) {
    doc+=getComponentConfigString(component,ReasonerComponent.class);
  }
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  for (  Class<? extends Component> component : cm.getLearningProblems()) {
    doc+=getComponentConfigString(component,LearningProblem.class);
  }
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  doc+="String_Node_Str";
  for (  Class<? extends Component> component : cm.getLearningAlgorithms()) {
    doc+=getComponentConfigString(component,LearningAlgorithm.class);
  }
  Files.createFile(file,doc);
}
Program: 9737
Project: 9737
Buggy source:
private String getComponentConfigString(Class<? extends Component> component,Class<? extends Component> componentType){
  String componentDescription="String_Node_Str" + invokeStaticMethod(component,"String_Node_Str") + "String_Node_Str"+ component.getName()+ "String_Node_Str";
  String str=componentDescription + "String_Node_Str";
  String cli=confMapper.getComponentTypeString(componentType);
  String usage=confMapper.getComponentString(component);
  for (int i=0; i < componentDescription.length(); i++) {
    str+="String_Node_Str";
  }
  str+="String_Node_Str";
  if (componentType.equals(KnowledgeSource.class)) {
    str+="String_Node_Str" + cli + "String_Node_Str"+ usage.toUpperCase()+ "String_Node_Str";
  }
 else {
    str+="String_Node_Str" + cli + "String_Node_Str"+ usage+ "String_Node_Str";
  }
  for (  ConfigOption<?> option : componentOptions.get(component)) {
    String val=(option.getDefaultValue() == null) ? "String_Node_Str" : option.getDefaultValue() + "String_Node_Str";
    str+=option.toString() + "String_Node_Str" + usage+ "String_Node_Str"+ option.getName()+ "String_Node_Str"+ val+ "String_Node_Str";
  }
  return str + "String_Node_Str";
}

Fixed version (ground truth):
private String getComponentConfigString(Class<? extends Component> component,Class<? extends Component> componentType){
  String componentDescription="String_Node_Str" + cm.getComponentName(component);
  String str=componentDescription + "String_Node_Str";
  String cli=confMapper.getComponentTypeString(componentType);
  String usage=confMapper.getComponentString(component);
  for (int i=0; i < componentDescription.length(); i++) {
    str+="String_Node_Str";
  }
  str+="String_Node_Str";
  if (componentType.equals(KnowledgeSource.class)) {
    str+="String_Node_Str" + cli + "String_Node_Str"+ usage.toUpperCase()+ "String_Node_Str";
  }
 else {
    str+="String_Node_Str" + cli + "String_Node_Str"+ usage+ "String_Node_Str";
  }
  for (  ConfigOption<?> option : ComponentManager.getConfigOptions(component)) {
    String val=(option.getDefaultValue() == null) ? "String_Node_Str" : option.getDefaultValue() + "String_Node_Str";
    str+=option.toString() + "String_Node_Str" + usage+ "String_Node_Str"+ option.getName()+ "String_Node_Str"+ val+ "String_Node_Str";
  }
  return str + "String_Node_Str";
}
Program: 9740
Project: 9740
Buggy source:
private void compute(QueryTree<N> posExampleTree,Set<QueryTree<N>> negExampleTrees,Set<QueryTree<N>> nbrs){
  QueryTree<N> nbr=new QueryTreeImpl<N>(posExampleTree);
  for (  QueryTree<N> n : nbrs) {
    for (    QueryTree<N> leaf1 : nbr.getLeafs()) {
      for (      QueryTree<N> leaf2 : n.getLeafs()) {
        if (leaf1.getUserObject().equals(leaf2.getUserObject())) {
          leaf1.getParent().removeChild((QueryTreeImpl<N>)leaf1);
        }
      }
    }
  }
  if (!subsumesTrees(nbr,negExampleTrees)) {
    Set<QueryTree<N>> tested=new HashSet<QueryTree<N>>();
    Object edge;
    QueryTree<N> parent;
    while (!(tested.size() == nbr.getLeafs().size())) {
      for (      QueryTree<N> leaf : nbr.getLeafs()) {
        parent=leaf.getParent();
        edge=parent.getEdge(leaf);
        parent.removeChild((QueryTreeImpl<N>)leaf);
        boolean isSubsumedBy=false;
        for (        QueryTree<N> negTree : negExampleTrees) {
          isSubsumedBy=negTree.isSubsumedBy(nbr);
          if (isSubsumedBy) {
            break;
          }
        }
        if (isSubsumedBy) {
          tested.add(leaf);
          parent.addChild((QueryTreeImpl<N>)leaf,edge);
        }
      }
    }
    nbrs.add(nbr);
    compute(posExampleTree,negExampleTrees,nbrs);
  }
}

Fixed version (ground truth):
private void compute(QueryTree<N> posExampleTree,Set<QueryTree<N>> negExampleTrees,Set<QueryTree<N>> nbrs){
  QueryTree<N> nbr=new QueryTreeImpl<N>(posExampleTree);
  if (subsumesTrees(posExampleTree,negExampleTrees)) {
    return;
  }
  for (  QueryTree<N> n : nbrs) {
    removeTree(nbr,n);
  }
  if (!subsumesTrees(nbr,negExampleTrees)) {
    Set<QueryTree<N>> tested=new HashSet<QueryTree<N>>();
    Object edge;
    QueryTree<N> parent;
    while (!(tested.size() == nbr.getLeafs().size())) {
      for (      QueryTree<N> leaf : nbr.getLeafs()) {
        parent=leaf.getParent();
        edge=parent.getEdge(leaf);
        parent.removeChild((QueryTreeImpl<N>)leaf);
        boolean isSubsumedBy=false;
        for (        QueryTree<N> negTree : negExampleTrees) {
          isSubsumedBy=negTree.isSubsumedBy(nbr);
          if (isSubsumedBy) {
            break;
          }
        }
        if (isSubsumedBy) {
          tested.add(leaf);
          parent.addChild((QueryTreeImpl<N>)leaf,edge);
        }
      }
    }
    nbrs.add(nbr);
    compute(posExampleTree,negExampleTrees,nbrs);
  }
}
Program: 9741
Project: 9741
Buggy source:
@Override public QueryTree<N> computeNBR(QueryTree<N> posExampleTree,Set<QueryTree<N>> negExampleTrees){
  QueryTree<N> nbr=new QueryTreeImpl<N>(posExampleTree);
  Set<QueryTree<N>> tested=new HashSet<QueryTree<N>>();
  Object edge;
  QueryTree<N> parent;
  while (!(tested.size() == nbr.getLeafs().size())) {
    for (    QueryTree<N> leaf : nbr.getLeafs()) {
      parent=leaf.getParent();
      edge=parent.getEdge(leaf);
      parent.removeChild((QueryTreeImpl<N>)leaf);
      boolean isSubsumedBy=false;
      for (      QueryTree<N> negTree : negExampleTrees) {
        isSubsumedBy=negTree.isSubsumedBy(nbr);
        if (isSubsumedBy) {
          break;
        }
      }
      if (isSubsumedBy) {
        tested.add(leaf);
        parent.addChild((QueryTreeImpl<N>)leaf,edge);
      }
    }
  }
  System.out.println(nbr.getLeafs());
  return nbr;
}

Fixed version (ground truth):
@Override public QueryTree<N> computeNBR(QueryTree<N> posExampleTree,Set<QueryTree<N>> negExampleTrees){
  QueryTree<N> nbr=new QueryTreeImpl<N>(posExampleTree);
  if (subsumesTrees(posExampleTree,negExampleTrees)) {
    return nbr;
  }
  Set<QueryTree<N>> tested=new HashSet<QueryTree<N>>();
  Object edge;
  QueryTree<N> parent;
  while (!(tested.size() == nbr.getLeafs().size())) {
    for (    QueryTree<N> leaf : nbr.getLeafs()) {
      parent=leaf.getParent();
      edge=parent.getEdge(leaf);
      parent.removeChild((QueryTreeImpl<N>)leaf);
      boolean isSubsumedBy=false;
      for (      QueryTree<N> negTree : negExampleTrees) {
        isSubsumedBy=negTree.isSubsumedBy(nbr);
        if (isSubsumedBy) {
          break;
        }
      }
      if (isSubsumedBy) {
        tested.add(leaf);
        parent.addChild((QueryTreeImpl<N>)leaf,edge);
      }
    }
  }
  return nbr;
}