use of org.openrdf.query.resultio.sparqlxml.SPARQLBooleanXMLWriter 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);
}
}
Aggregations