use of org.openrdf.query.Query in project gocd by gocd.
the class SesameGraph method renderSPARQLResultsAsXML.
public void renderSPARQLResultsAsXML(String sparql, OutputStream stream) {
try {
Query query = conn.prepareQuery(QueryLanguage.SPARQL, sparql);
contextualize(query);
if (query instanceof TupleQuery) {
renderTupleQuery(query, new SPARQLResultsXMLWriter(stream));
} else {
renderBooleanQuery(query, new SPARQLBooleanXMLWriter(stream));
}
stream.flush();
} catch (UnsupportedSPARQLStatementException e) {
throw e;
} catch (Exception e) {
throw new ShineRuntimeException("Could not render sparql results as XML: <<" + sparql + ">>", e);
}
}
use of org.openrdf.query.Query in project gocd by gocd.
the class SesameGraph method validate.
public void validate(String arq) {
try {
Query query = conn.prepareQuery(QueryLanguage.SPARQL, arq);
contextualize(query);
} catch (UnsupportedSPARQLStatementException e) {
throw e;
} catch (MalformedQueryException e) {
throw new MalformedSPARQLException(e);
} catch (Exception e) {
throw new ShineRuntimeException(e);
}
}
Aggregations