use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class AbstractStoreConnections method store_5.
@Test
public void store_5() {
// No transaction. Make sure StoreConnection.release cleans up OK.
StoreConnection sConn = getStoreConnection();
Location loc = sConn.getLocation();
DatasetGraph dsg = sConn.getBaseDataset();
dsg.add(q);
assertTrue(dsg.contains(q));
StoreConnection.release(loc);
sConn = StoreConnection.make(loc);
dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q));
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class QueryExecutionBase method execConstructDataset.
@Override
public Dataset execConstructDataset(Dataset dataset) {
DatasetGraph dsg = dataset.asDatasetGraph();
try {
execConstructQuads().forEachRemaining(dsg::add);
insertPrefixesInto(dataset);
} finally {
this.close();
}
return dataset;
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class QueryExecutionBase method init.
private void init() {
DatasetGraph dsg = (dataset == null) ? null : dataset.asDatasetGraph();
context = Context.setupContext(context, dsg);
if (query != null)
context.put(ARQConstants.sysCurrentQuery, query);
// NB: Setting timeouts via the context after creating a QueryExecutionBase
// will not work. But we can't move it until the point the execution starts because of
// get and set timeout operations on this object.
setAnyTimeouts();
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class QueryExecutionBase method prepareDataset.
private static DatasetGraph prepareDataset(Dataset dataset, Query query) {
if (dataset != null)
return dataset.asDatasetGraph();
if (!query.hasDatasetDescription())
//Query.Log.warn(this, "No data for query (no URL, no model)");
throw new QueryExecException("No dataset description for query");
String baseURI = query.getBaseURI();
if (baseURI == null)
baseURI = IRIResolver.chooseBaseURI().toString();
DatasetGraph dsg = DatasetUtils.createDatasetGraph(query.getDatasetDescription(), baseURI);
return dsg;
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class QueryExecutionBase method getPlan.
public Plan getPlan() {
if (plan == null) {
DatasetGraph dsg = prepareDataset(dataset, query);
Binding inputBinding = null;
if (initialBinding != null)
inputBinding = BindingUtils.asBinding(initialBinding);
if (inputBinding == null)
inputBinding = BindingRoot.create();
plan = qeFactory.create(query, dsg, inputBinding, getContext());
}
return plan;
}
Aggregations