Search in sources :

Example 6 with DatasetGraphTDB

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

the class OpExecutorTDB1 method execute.

@Override
protected QueryIterator execute(OpQuadPattern quadPattern, QueryIterator input) {
    if (!isForTDB)
        return super.execute(quadPattern, input);
    //        DatasetGraph dg = execCxt.getDataset() ;
    //        if ( ! ( dg instanceof DatasetGraphTDB ) )
    //            throw new InternalErrorException("Not a TDB backed dataset in quad pattern execution") ;
    DatasetGraphTDB ds = (DatasetGraphTDB) execCxt.getDataset();
    BasicPattern bgp = quadPattern.getBasicPattern();
    Node gn = quadPattern.getGraphNode();
    return optimizeExecuteQuads(ds, input, gn, bgp, null, execCxt);
}
Also used : Node(org.apache.jena.graph.Node) BasicPattern(org.apache.jena.sparql.core.BasicPattern) DatasetGraphTDB(org.apache.jena.tdb.store.DatasetGraphTDB)

Example 7 with DatasetGraphTDB

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

the class tdbstats method exec.

@Override
protected void exec() {
    DatasetGraphTDB dsg = getDatasetGraphTDB();
    Node gn = getGraphName();
    StatsResults results = stats(dsg, gn);
    Stats.write(System.out, results);
}
Also used : Node(org.apache.jena.graph.Node) StatsResults(org.apache.jena.tdb.solver.stats.StatsResults) DatasetGraphTDB(org.apache.jena.tdb.store.DatasetGraphTDB)

Example 8 with DatasetGraphTDB

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

the class dumpnodetable method exec.

@Override
protected void exec() {
    List<String> tripleIndexes = Arrays.asList(Names.tripleIndexes);
    List<String> quadIndexes = Arrays.asList(Names.quadIndexes);
    Location loc = modLocation.getLocation();
    StoreConnection sConn = StoreConnection.make(loc);
    DatasetGraphTDB dsg = sConn.getBaseDataset();
    NodeTable nodeTable = dsg.getQuadTable().getNodeTupleTable().getNodeTable();
    dump(System.out, nodeTable);
}
Also used : StoreConnection(org.apache.jena.tdb.StoreConnection) NodeTable(org.apache.jena.tdb.store.nodetable.NodeTable) Location(org.apache.jena.tdb.base.file.Location) ModLocation(tdb.cmdline.ModLocation) DatasetGraphTDB(org.apache.jena.tdb.store.DatasetGraphTDB)

Example 9 with DatasetGraphTDB

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

the class tdbnode method exec.

@Override
protected void exec() {
    DatasetGraphTDB dsg = getDatasetGraphTDB();
    NodeTable nodeTable = dsg.getTripleTable().getNodeTupleTable().getNodeTable();
    Iterator<String> iter = super.getPositional().iterator();
    if (!iter.hasNext()) {
        System.err.println("No node ids");
        return;
    }
    for (; iter.hasNext(); ) {
        String id = iter.next();
        try {
            long x = Long.parseLong(id);
            NodeId nodeId = new NodeId(x);
            Node n = nodeTable.getNodeForNodeId(nodeId);
            //System.out.printf("%s [%d] => %s\n", id, x, n) ;
            Hash h = new Hash(SystemTDB.LenNodeHash);
            NodeLib.setHash(h, n);
            String str = Bytes.asHex(h.getBytes());
            System.out.printf("%s %08d 0x%s # %s\n", id, x, str, n);
        } catch (Exception ex) {
            System.out.println("Failed to decode: " + id);
        }
    }
}
Also used : Node(org.apache.jena.graph.Node) NodeId(org.apache.jena.tdb.store.NodeId) Hash(org.apache.jena.tdb.store.Hash) NodeTable(org.apache.jena.tdb.store.nodetable.NodeTable) DatasetGraphTDB(org.apache.jena.tdb.store.DatasetGraphTDB)

Example 10 with DatasetGraphTDB

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

the class tdbrecovery method exec.

@Override
protected void exec() {
    DatasetGraphTDB dsg = super.getDatasetGraphTDB();
    // Just creating the DSG does a recovery so this is not (currently) necessary:
    // This may change (not immediately recovering on start up).
    JournalControl.recovery(dsg);
}
Also used : DatasetGraphTDB(org.apache.jena.tdb.store.DatasetGraphTDB)

Aggregations

DatasetGraphTDB (org.apache.jena.tdb.store.DatasetGraphTDB)24 Node (org.apache.jena.graph.Node)5 BaseTest (org.apache.jena.atlas.junit.BaseTest)4 NodeTable (org.apache.jena.tdb.store.nodetable.NodeTable)4 Test (org.junit.Test)4 StoreConnection (org.apache.jena.tdb.StoreConnection)3 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)2 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)2 Quad (org.apache.jena.sparql.core.Quad)2 BlockMgrBuilder (org.apache.jena.tdb.setup.BlockMgrBuilder)2 DatasetBuilderStd (org.apache.jena.tdb.setup.DatasetBuilderStd)2 NodeTableBuilder (org.apache.jena.tdb.setup.NodeTableBuilder)2 NodeId (org.apache.jena.tdb.store.NodeId)2 DatasetGraphTxn (org.apache.jena.tdb.transaction.DatasetGraphTxn)2 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1 HashSet (java.util.HashSet)1 Predicate (java.util.function.Predicate)1 AtlasException (org.apache.jena.atlas.AtlasException)1