Program: 9579
Project: 9579
Buggy source:
/** 
 * Method gets a String and takes the information from the templator to creat a Sparql query.
 * @param question question in natural language
 * @return ArrayList of Sparql queries.
 */
private ArrayList<String> getQuery(String question){
  ArrayList<String> lstquery=new ArrayList<String>();
  Set<BasicQueryTemplate> querytemps=btemplator.buildBasicQueries(question);
  for (  BasicQueryTemplate temp : querytemps) {
    String query;
    String selTerms="String_Node_Str";
    for (    SPARQL_Term terms : temp.getSelTerms())     selTerms=selTerms + (terms.toString()) + "String_Node_Str";
    String conditions="String_Node_Str";
    for (    Path condition : temp.getConditions())     conditions=conditions + (condition.toString()) + "String_Node_Str";
    String filters="String_Node_Str";
    for (    SPARQL_Filter tmp : temp.getFilters())     filters=filters + tmp + "String_Node_Str";
    System.out.println("String_Node_Str");
    query="String_Node_Str" + temp.getQt().toString() + "String_Node_Str"+ selTerms+ "String_Node_Str"+ conditions.replace("String_Node_Str","String_Node_Str")+ "String_Node_Str"+ filters;
    String[] slots=null;
    for (    Slot slot : temp.getSlots()) {
      String tmp=slot.toString();
      tmp=tmp.replace("String_Node_Str","String_Node_Str");
      tmp=tmp.replace("String_Node_Str","String_Node_Str");
      tmp=tmp.replace("String_Node_Str","String_Node_Str");
      tmp=tmp.replace("String_Node_Str","String_Node_Str");
      tmp=tmp.replace("String_Node_Str","String_Node_Str");
      String[] array=tmp.split("String_Node_Str");
      String replace;
      if (array[0].length() < 2)       replace="String_Node_Str" + array[0] + "String_Node_Str";
 else       replace="String_Node_Str" + array[0];
      query=query.replace(replace,"String_Node_Str" + hm.get(array[1].toLowerCase()) + "String_Node_Str");
    }
    lstquery.add(query);
  }
  return lstquery;
}

Fixed version (ground truth):
/** 
 * Method gets a String and takes the information from the templator to creat a Sparql query.
 * @param question question in natural language
 * @return ArrayList of Sparql queries.
 */
private ArrayList<String> getQuery(String question){
  ArrayList<String> lstquery=new ArrayList<String>();
  Set<BasicQueryTemplate> querytemps=btemplator.buildBasicQueries(question);
  for (  BasicQueryTemplate temp : querytemps) {
    String query;
    String selTerms="String_Node_Str";
    for (    SPARQL_Term terms : temp.getSelTerms())     selTerms=selTerms + (terms.toString()) + "String_Node_Str";
    String conditions="String_Node_Str";
    for (    Path condition : temp.getConditions())     conditions=conditions + (condition.toString()) + "String_Node_Str";
    String filters="String_Node_Str";
    for (    SPARQL_Filter tmp : temp.getFilters())     filters=filters + tmp + "String_Node_Str";
    System.out.println("String_Node_Str");
    query="String_Node_Str" + temp.getQt().toString() + "String_Node_Str"+ selTerms+ "String_Node_Str"+ conditions.replace("String_Node_Str","String_Node_Str")+ "String_Node_Str"+ filters;
    String conditions_new="String_Node_Str";
    for (    Path condition : temp.getConditions()) {
      String[] tmp_upside=condition.toString().split("String_Node_Str");
      String tmp_conditions_new="String_Node_Str";
      for (      String con : tmp_upside)       tmp_conditions_new=con + "String_Node_Str" + tmp_conditions_new;
      tmp_conditions_new=tmp_conditions_new.replace("String_Node_Str","String_Node_Str");
      tmp_conditions_new=tmp_conditions_new + "String_Node_Str";
      conditions_new=conditions_new + tmp_conditions_new;
    }
    System.out.println("String_Node_Str" + conditions);
    System.out.println("String_Node_Str" + conditions_new);
    String query_upside_down="String_Node_Str" + temp.getQt().toString() + "String_Node_Str"+ selTerms+ "String_Node_Str"+ conditions_new.replace("String_Node_Str","String_Node_Str")+ "String_Node_Str"+ filters;
    String[] slots=null;
    for (    Slot slot : temp.getSlots()) {
      String tmp=slot.toString();
      tmp=tmp.replace("String_Node_Str","String_Node_Str");
      tmp=tmp.replace("String_Node_Str","String_Node_Str");
      tmp=tmp.replace("String_Node_Str","String_Node_Str");
      tmp=tmp.replace("String_Node_Str","String_Node_Str");
      tmp=tmp.replace("String_Node_Str","String_Node_Str");
      String[] array=tmp.split("String_Node_Str");
      String replace;
      if (array[0].length() < 2)       replace="String_Node_Str" + array[0] + "String_Node_Str";
 else       replace="String_Node_Str" + array[0];
      String hm_result=hm.get(array[1].toLowerCase());
      try {
        if (hm_result.contains("String_Node_Str"))         hm_result=hm_result.replace("String_Node_Str","String_Node_Str");
      }
 catch (      Exception e) {
      }
      query=query.replace(replace,"String_Node_Str" + hm_result + "String_Node_Str");
      query_upside_down=query_upside_down.replace(replace,"String_Node_Str" + hm_result + "String_Node_Str");
    }
    lstquery.add(query);
    lstquery.add(query_upside_down);
  }
  return lstquery;
}