// so we call the appropriate execution method:
Query query = QueryFactory.create(sparqlQuery);
// only one of these results is captured
TriplesIterator tripleIter = null;
ValueSetIterator valSetIter = null;
Boolean askResult = null;
queryResult.setContentType("text/plain");
// SELECT
if ( query.isSelectType() ) {
valSetIter = sq.select();
}
// DESCRIBE
else if ( query.isDescribeType() ) {
tripleIter = sq.describe();
}
// CONSTRUCT
else if ( query.isConstructType() ) {
tripleIter = sq.construct();
}
// ASK
else if ( query.isAskType() ) {
askResult = Boolean.valueOf(sq.ask());
}
if ( valSetIter != null ) {
queryResult.setIsEmpty(! valSetIter.hasNext());
String res;
if ( form.equalsIgnoreCase("html") ) {
queryResult.setContentType("text/html");
res = AgUtils.getResultInHtml(log, valSetIter);