use of org.apache.jena.tdb.transaction.DatasetGraphTxn in project jena by apache.
the class TDBBackup method backup.
public static void backup(Location location, OutputStream backupfile) {
Dataset ds = TDBFactory.createDataset(location);
StoreConnection sConn = StoreConnection.make(location);
DatasetGraphTxn dsg = sConn.begin(ReadWrite.READ, "backup");
RDFDataMgr.write(backupfile, dsg, Lang.NQUADS);
dsg.end();
}
use of org.apache.jena.tdb.transaction.DatasetGraphTxn in project jena by apache.
the class TestTransRestart method setupTxn.
private void setupTxn() {
StoreConnection.release(location);
FileOps.clearDirectory(path);
StoreConnection sc = StoreConnection.make(location);
DatasetGraphTxn dsg = sc.begin(ReadWrite.WRITE);
dsg.add(quad1);
dsg.commit();
dsg.end();
sc.flush();
StoreConnection.release(location);
}
use of org.apache.jena.tdb.transaction.DatasetGraphTxn in project jena by apache.
the class AbstractTestTransSeq method trans_01.
// Basics.
@Test
public void trans_01() {
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsg = sConn.begin(ReadWrite.READ);
dsg.end();
}
use of org.apache.jena.tdb.transaction.DatasetGraphTxn in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_01.
@Test
public void trans_readBlock_01() {
// READ(start)-WRITE(commit)-READ(finish)-check
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.READ);
DatasetGraphTxn dsgW = sConn.begin(ReadWrite.WRITE);
dsgW.add(q);
dsgW.commit();
dsgW.end();
assertFalse(dsgR1.contains(q));
dsgR1.end();
//**** Not hitting the queue ****
// Order of tweaking counters?
// also writer and counters?
DatasetGraphTxn dsgR2 = sConn.begin(ReadWrite.READ);
assertTrue(dsgR2.contains(q));
dsgR2.end();
sConn.flush();
DatasetGraph dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q));
}
use of org.apache.jena.tdb.transaction.DatasetGraphTxn in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_03.
@Test
public void trans_readBlock_03() {
// READ(start)-WRITE(commit)-WRITE(commit)-READ(finish)-check
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.READ);
DatasetGraphTxn dsgW1 = sConn.begin(ReadWrite.WRITE);
dsgW1.add(q1);
dsgW1.commit();
dsgW1.end();
assertFalse(dsgR1.contains(q1));
DatasetGraphTxn dsgW2 = sConn.begin(ReadWrite.WRITE);
dsgW2.add(q2);
dsgW2.commit();
dsgW2.end();
assertFalse(dsgR1.contains(q1));
assertFalse(dsgR1.contains(q2));
dsgR1.end();
DatasetGraphTxn dsgR2 = sConn.begin(ReadWrite.READ);
assertTrue(dsgR2.contains(q1));
assertTrue(dsgR2.contains(q2));
dsgR2.end();
sConn.flush();
DatasetGraph dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q1));
assertTrue(dsg.contains(q2));
}
Aggregations