use of uk.ac.ebi.spot.goci.sparql.exception.SparqlQueryException in project goci by EBISPOT.
the class SparqlTemplate method ask.
public boolean ask(String sparql) {
sparql = getPrefixString().concat(sparql);
if (askCache.containsKey(sparql)) {
return askCache.get(sparql);
}
Graph g = getJenaQueryExecutionService().getDefaultGraph();
Query q1 = QueryFactory.create(sparql, Syntax.syntaxARQ);
QueryExecution execute = null;
try {
execute = getJenaQueryExecutionService().getQueryExecution(g, q1, false);
boolean result = execute.execAsk();
askCache.put(sparql, result);
return result;
} catch (LodeException e) {
throw new SparqlQueryException("Failed to execute ask '" + sparql + "'", e);
} finally {
if (execute != null) {
execute.close();
if (g != null) {
g.close();
}
}
}
}
Aggregations