Search in sources :

Example 1 with DatasetGraphTDB

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

the class DatasetBuilderTxn method buildReadonly.

private DatasetGraphTDB buildReadonly() {
    BlockMgrBuilder blockMgrBuilder = new BlockMgrBuilderReadonly();
    NodeTableBuilder nodeTableBuilder = new NodeTableBuilderReadonly();
    DatasetBuilderStd x = new DatasetBuilderStd(blockMgrBuilder, nodeTableBuilder);
    DatasetGraphTDB dsg2 = x._build(dsg.getLocation(), dsg.getConfig().params, false, dsg.getReorderTransform());
    return dsg2;
}
Also used : NodeTableBuilder(org.apache.jena.tdb.setup.NodeTableBuilder) DatasetBuilderStd(org.apache.jena.tdb.setup.DatasetBuilderStd) BlockMgrBuilder(org.apache.jena.tdb.setup.BlockMgrBuilder) DatasetGraphTDB(org.apache.jena.tdb.store.DatasetGraphTDB)

Example 2 with DatasetGraphTDB

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

the class DatasetBuilderTxn method buildWritable.

private DatasetGraphTDB buildWritable() {
    BlockMgrBuilder blockMgrBuilder = new BlockMgrBuilderTx();
    NodeTableBuilder nodeTableBuilder = new NodeTableBuilderTx();
    DatasetBuilderStd x = new DatasetBuilderStd(blockMgrBuilder, nodeTableBuilder);
    DatasetGraphTDB dsg2 = x._build(dsg.getLocation(), dsg.getConfig().params, true, dsg.getReorderTransform());
    dsg2.getContext().putAll(dsg.getContext());
    return dsg2;
}
Also used : NodeTableBuilder(org.apache.jena.tdb.setup.NodeTableBuilder) DatasetBuilderStd(org.apache.jena.tdb.setup.DatasetBuilderStd) BlockMgrBuilder(org.apache.jena.tdb.setup.BlockMgrBuilder) DatasetGraphTDB(org.apache.jena.tdb.store.DatasetGraphTDB)

Example 3 with DatasetGraphTDB

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

the class DatasetBuilderTxn method build.

public DatasetGraphTxn build(Transaction transaction, ReadWrite mode, DatasetGraphTDB dsg) {
    this.blockMgrs = dsg.getConfig().blockMgrs;
    this.nodeTables = dsg.getConfig().nodeTables;
    this.txn = transaction;
    this.dsg = dsg;
    DatasetGraphTDB dsgTDB;
    switch(mode) {
        case READ:
            dsgTDB = buildReadonly();
            break;
        case WRITE:
            dsgTDB = buildWritable();
            break;
        // Silly Java.
        default:
            dsgTDB = null;
    }
    DatasetGraphTxn dsgTxn = new DatasetGraphTxn(dsgTDB, txn);
    // Copy context. Changes not propagated back to the base dataset. 
    dsgTxn.getContext().putAll(dsg.getContext());
    return dsgTxn;
}
Also used : DatasetGraphTDB(org.apache.jena.tdb.store.DatasetGraphTDB)

Example 4 with DatasetGraphTDB

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

the class DatasetGraphTransaction method _close.

@Override
protected void _close() {
    if (isClosed)
        return;
    if (!sConn.haveUsedInTransaction()) {
        synchronized (this) {
            if (isClosed)
                return;
            isClosed = true;
            if (!sConn.isValid()) {
                // the StoreConnection.
                return;
            }
            DatasetGraphTDB dsg = sConn.getBaseDataset();
            dsg.sync();
            dsg.close();
            StoreConnection.release(getLocation());
            return;
        }
    }
    if (isInTransaction()) {
        TDB.logInfo.warn("Attempt to close a DatasetGraphTransaction while a transaction is active - ignored close (" + getLocation() + ")");
        return;
    }
    txn.remove();
    inTransaction.remove();
    isClosed = true;
}
Also used : DatasetGraphTDB(org.apache.jena.tdb.store.DatasetGraphTDB)

Example 5 with DatasetGraphTDB

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

the class JournalControl method replay.

public static void replay(Transaction transaction) {
    if (syslog.isDebugEnabled())
        syslog.debug("Replay " + transaction.getLabel());
    Journal journal = transaction.getJournal();
    DatasetGraphTDB dsg = transaction.getBaseDataset();
    // Currently, we (crudely) replay the whole journal.
    replay(journal, dsg.getConfig());
}
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