@Override
public QueryResults getResults() throws BadEndpointInitializationException,
UnssupportedQueryTypeException, IOException {
initializeQuery();
QueryResults queryResults = new QueryResults();
QueryExecution qe = QueryExecutionFactory.create(this.query, this.datasource);
if (isSelectQuery()) { // SELECT
ResultSet results = qe.execSelect();
queryResults.setType(QueryResultsType.RESULTSET);
queryResults.setSet(results);
qe.close();
} else if (isAskQuery()) { // ASK
boolean ask = qe.execAsk();
queryResults.setType(QueryResultsType.BOOLEAN);
queryResults.setBool(ask);
qe.close();
} else if (isDescribeQuery()) { // DESCRIBE
Model result = qe.execDescribe();
//result.setNsPrefixes(model.getNsPrefixMap());
queryResults.setType(QueryResultsType.MODEL);
queryResults.setModel(result);
qe.close();
} else if (isConstructQuery()) { // CONSTRUCT
Model result = qe.execConstruct();
//result.setNsPrefixes(model.getNsPrefixMap());
queryResults.setType(QueryResultsType.MODEL);
queryResults.setModel(result);
qe.close();
} else {
logger.error("Unsupported query type");
throw new UnssupportedQueryTypeException();
}