use of org.apache.jena.tdb2.store.GraphViewSwitchable in project jena by apache.
the class StageGeneratorDirectTDB method execute.
@Override
public QueryIterator execute(BasicPattern pattern, QueryIterator input, ExecutionContext execCxt) {
// --- In case this isn't for TDB2
Graph g = execCxt.getActiveGraph();
if (g instanceof GraphViewSwitchable) {
GraphViewSwitchable gvs = (GraphViewSwitchable) g;
g = gvs.getBaseGraph();
}
if (!(g instanceof GraphTDB))
// Not us - bounce up the StageGenerator chain
return above.execute(pattern, input, execCxt);
GraphTDB graph = (GraphTDB) g;
Predicate<Tuple<NodeId>> filter = QC2.getFilter(execCxt.getContext());
return PatternMatchTDB2.execute(graph, pattern, input, filter, execCxt);
}
use of org.apache.jena.tdb2.store.GraphViewSwitchable in project jena by apache.
the class TestTDBAssembler method testGraph.
private static void testGraph(String assemblerFile, boolean named) {
Object thing = null;
try {
thing = AssemblerUtils.build(assemblerFile, VocabTDB2.tGraphTDB);
} catch (AssemblerException e) {
e.getCause().printStackTrace(System.err);
throw e;
}
assertTrue(thing instanceof Model);
Graph graph = ((Model) thing).getGraph();
assertTrue(graph instanceof GraphViewSwitchable);
DatasetGraphSwitchable dsg = ((GraphViewSwitchable) graph).getDataset();
if (dsg != null)
dsg.close();
}
use of org.apache.jena.tdb2.store.GraphViewSwitchable in project jena by apache.
the class TestTDBAssembler method createGraphEmbed.
@Test
public void createGraphEmbed() {
String f = dirAssem + "/tdb-graph-embed.ttl";
Object thing = null;
try {
thing = AssemblerUtils.build(f, JA.Model);
} catch (AssemblerException e) {
e.getCause().printStackTrace(System.err);
throw e;
}
assertTrue(thing instanceof Model);
Graph graph = ((Model) thing).getGraph();
assertTrue(graph instanceof GraphViewSwitchable);
DatasetGraphSwitchable ds = ((GraphViewSwitchable) graph).getDataset();
if (ds != null)
ds.close();
}
Aggregations