HttpResponse response = httpClient.execute(get);
switch(response.getStatusLine().getStatusCode()) {
case 200:
log.debug("SPARQL Query {} evaluated successfully",query);
QueryResultCollector results = new QueryResultCollector();
parse(response.getEntity().getContent(), TupleQueryResultFormat.JSON, results, ValueFactoryImpl.getInstance());
if(!results.getHandledTuple() || results.getBindingSets().isEmpty()) {
return null;
} else {
List<String> fieldNames = results.getBindingNames();
SPARQLResult result = new SPARQLResult(new LinkedHashSet<String>(fieldNames));
//List<?> bindings = resultMap.get("results").get("bindings");
for(BindingSet nextRow : results.getBindingSets()) {
Map<String,RDFNode> row = new HashMap<String, RDFNode>();
for(String nextBindingName : fieldNames) {
if(nextRow.hasBinding(nextBindingName)) {
Binding nextBinding = nextRow.getBinding(nextBindingName);