Hi,
I usually execute a sparql query like this in my code
snarlTemplate.execute(
connection -> {
SelectQueryResult result = null;
try {
DataTypeRowMapper mapper = new DataTypeRowMapper();
Dataset dataset = GraphUtils.buildSelectDataset(userDTO);
SelectQuery query =
connection.select(sparql).dataset(dataset);
if (args != null) {
for (Entry<String, Object> arg : args.entrySet()) {
query.parameter(arg.getKey(), arg.getValue());
}
}
ArrayList<Map<String, Object>> list = new ArrayList<>();
result = query.execute();
if (result == null) {
return list;
}
while (result.hasNext()) {
list.add(mapper.mapRow(result.next()));
}
return list;
} catch (StardogException e) {
log.error("Error sending SELECT query to Stardog", e);
throw new RuntimeException(e);
} catch (QueryExecutionFailure e) {
log.error("Error evaluating SELECT SPARQL query", e);
throw new RuntimeException(e);
} finally {
if (result != null) {
try {
result.close();
} catch (QueryExecutionFailure e) {
log.error(e.toString());
}
}
}
});
My question are
(1) if I can send some hints etc along with the query.
(2) if I can send sth along with the query to tell the server do not do any query optimization etc