* @return
* @throws SimalRepositoryException
*/
public SparqlResult getSparqlQueryResult(String queryStr)
throws SimalRepositoryException {
SparqlResult sparqlResult = null;
QueryExecution qe = null;
try {
Query query = QueryFactory.create(queryStr);
qe = QueryExecutionFactory.create(query, model);
ResultSet results = qe.execSelect();
sparqlResult = new SparqlResult(results.getResultVars());
while (results.hasNext()) {
QuerySolution soln = results.nextSolution();
List<RDFNode> result = new ArrayList<RDFNode>();
Iterator<String> varNamesIter = soln.varNames();
while (varNamesIter.hasNext()) {
String varName = varNamesIter.next();
result.add(soln.get(varName));
}
sparqlResult.addResult(result);
}
} catch (QueryException e) {
String message = "QueryException when trying to SPARQLquery with query: "
+ queryStr;