Search in sources :

Example 1 with GraphTDB

use of org.apache.jena.tdb.store.GraphTDB 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 TDB
    Graph g = execCxt.getActiveGraph();
    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 SolverLib.execute(graph, pattern, input, filter, execCxt);
}
Also used : Graph(org.apache.jena.graph.Graph) GraphTDB(org.apache.jena.tdb.store.GraphTDB) Tuple(org.apache.jena.atlas.lib.tuple.Tuple)

Example 2 with GraphTDB

use of org.apache.jena.tdb.store.GraphTDB in project jena by apache.

the class TestDatasetTDBPersist method dataset1.

@Test
public void dataset1() {
    Dataset ds = graphLocation.getDataset();
    assertTrue(ds.getDefaultModel().getGraph() instanceof GraphTDB);
    assertTrue(ds.getNamedModel("http://example/").getGraph() instanceof GraphTDB);
}
Also used : Dataset(org.apache.jena.query.Dataset) GraphTDB(org.apache.jena.tdb.store.GraphTDB) Test(org.junit.Test) ConfigTest(org.apache.jena.tdb.ConfigTest) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 3 with GraphTDB

use of org.apache.jena.tdb.store.GraphTDB in project jena by apache.

the class OpExecutorTDB1 method execute.

@Override
protected QueryIterator execute(OpFilter opFilter, QueryIterator input) {
    if (!isForTDB)
        return super.execute(opFilter, input);
    // (filter (bgp ...))
    if (OpBGP.isBGP(opFilter.getSubOp())) {
        // Still may be a TDB graph in a non-TDB dataset (e.g. a named model)
        GraphTDB graph = (GraphTDB) execCxt.getActiveGraph();
        OpBGP opBGP = (OpBGP) opFilter.getSubOp();
        return executeBGP(graph, opBGP, input, opFilter.getExprs(), execCxt);
    }
    // (filter (quadpattern ...))
    if (opFilter.getSubOp() instanceof OpQuadPattern) {
        OpQuadPattern quadPattern = (OpQuadPattern) opFilter.getSubOp();
        DatasetGraphTDB ds = (DatasetGraphTDB) execCxt.getDataset();
        return optimizeExecuteQuads(ds, input, quadPattern.getGraphNode(), quadPattern.getBasicPattern(), opFilter.getExprs(), execCxt);
    }
    // (filter (anything else))
    return super.execute(opFilter, input);
}
Also used : GraphTDB(org.apache.jena.tdb.store.GraphTDB) DatasetGraphTDB(org.apache.jena.tdb.store.DatasetGraphTDB) DatasetGraphTDB(org.apache.jena.tdb.store.DatasetGraphTDB)

Aggregations

GraphTDB (org.apache.jena.tdb.store.GraphTDB)3 BaseTest (org.apache.jena.atlas.junit.BaseTest)1 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)1 Graph (org.apache.jena.graph.Graph)1 Dataset (org.apache.jena.query.Dataset)1 ConfigTest (org.apache.jena.tdb.ConfigTest)1 DatasetGraphTDB (org.apache.jena.tdb.store.DatasetGraphTDB)1 Test (org.junit.Test)1