private int countResult(QuestOWLResultSet rs, boolean stdout) throws OWLException {
   int counter = 0;
   while (rs.nextRow()) {
     counter++;
     if (stdout) {
       for (int column = 1; column <= rs.getColumCount(); column++) {
         OWLObject binding = rs.getOWLObject(column);
         System.out.print(binding.toString() + ", ");
       }
       System.out.print("\n");
     }
   }
   return counter;
 }
  private int executeQuery(String q) throws OWLException {
    String prefix =
        "PREFIX : <http://it.unibz.krdb/obda/ontologies/quest-typing-test.owl#> \n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> \n PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>";
    String query = prefix + " " + q;

    QuestOWLResultSet res = st.executeTuple(query);
    int count = 0;
    int columns = res.getColumCount();
    while (res.nextRow()) {
      for (int i = 0; i < columns; i++) {
        OWLObject o = res.getOWLObject(i + 1);
        System.out.println(o.toString());
      }
      count += 1;
    }
    res.close();
    return count;
  }