[VIVO-1031] Always execute SDB queries against the dataset and not the default model
This commit is contained in:
parent
48790b7525
commit
db0bb6a5e6
1 changed files with 4 additions and 12 deletions
|
@ -146,18 +146,10 @@ public class RDFServiceSDB extends RDFServiceJena implements RDFService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected QueryExecution createQueryExecution(String queryString, Query q, Dataset d) {
|
protected QueryExecution createQueryExecution(String queryString, Query q, Dataset d) {
|
||||||
// query performance with OPTIONAL can be dramatically improved on SDB by
|
return QueryExecutionFactory.create(q, d);
|
||||||
// using the default model (union model) instead of the dataset, so long as
|
|
||||||
// we're not querying particular named graphs
|
|
||||||
|
|
||||||
Matcher optional = OPTIONAL_PATTERN.matcher(queryString);
|
// This used to execute against the default model if the query included an OPTIONAL
|
||||||
Matcher graph = GRAPH_PATTERN.matcher(queryString);
|
// However, in recent Jena this turns out to be much slower than executing against the dataset directly
|
||||||
|
|
||||||
if (optional.find() && !graph.find()) {
|
|
||||||
return QueryExecutionFactory.create(q, d.getDefaultModel());
|
|
||||||
} else {
|
|
||||||
return QueryExecutionFactory.create(q, d);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue