use of org.apache.jena.sparql.engine.QueryEngineFactory in project jena by apache.
the class QueryExecDatasetBuilder method build.
@Override
public QueryExec build() {
Objects.requireNonNull(query, "No query for QueryExec");
// Queries can have FROM/FROM NAMED or VALUES to get data.
// Objects.requireNonNull(dataset, "No dataset for QueryExec");
query.setResultVars();
Context cxt = getContext();
QueryEngineFactory qeFactory = QueryEngineRegistry.get().find(query, dataset, cxt);
if (qeFactory == null) {
Log.warn(QueryExecDatasetBuilder.class, "Failed to find a QueryEngineFactory");
return null;
}
// Initial bindings / parameterized query
Query queryActual = query;
String queryStringActual = queryString;
if (substitutionMap != null && !substitutionMap.isEmpty()) {
queryActual = QueryTransformOps.transform(query, substitutionMap);
queryStringActual = null;
}
defaultTimeoutsFromContext(this, cxt);
if (dataset != null)
cxt.set(ARQConstants.sysCurrentDataset, DatasetFactory.wrap(dataset));
if (queryActual != null)
cxt.set(ARQConstants.sysCurrentQuery, queryActual);
QueryExec qExec = new QueryExecDataset(queryActual, queryStringActual, dataset, cxt, qeFactory, initialTimeout, initialTimeoutUnit, overallTimeout, overallTimeoutUnit, initialBinding);
return qExec;
}
Aggregations