use of org.apache.jena.tdb.transaction.DatasetGraphTransaction in project jena by apache.
the class T_QuadsObjectIsNull method one.
public static void one() {
Quad q1 = SSE.parseQuad("(<g1> <s1> <p1> '1')");
Quad q2 = SSE.parseQuad("(<g2> <s2> <p2> '2')");
Quad q3 = SSE.parseQuad("(<g3> <s3> <p3> '3')");
DatasetGraphTransaction dsg = (DatasetGraphTransaction) TDBFactory.createDatasetGraph(location);
System.out.println("Start");
dump(dsg);
write(dsg, q1);
write(dsg, q2);
//write(dsg, q3) ;
System.out.println("Finish");
dump(dsg);
}
use of org.apache.jena.tdb.transaction.DatasetGraphTransaction in project jena by apache.
the class TestTDBFactory method testTDBMakerTxn3.
@Test
public void testTDBMakerTxn3() {
// Un-named memory locations
TDBMaker.reset();
DatasetGraph dg1 = TDBMaker.createDatasetGraphTransaction(Location.mem());
DatasetGraph dg2 = TDBMaker.createDatasetGraphTransaction(Location.mem());
DatasetGraph dgBase1 = ((DatasetGraphTransaction) dg1).getBaseDatasetGraph();
DatasetGraph dgBase2 = ((DatasetGraphTransaction) dg2).getBaseDatasetGraph();
assertNotSame(dgBase1, dgBase2);
}
use of org.apache.jena.tdb.transaction.DatasetGraphTransaction in project jena by apache.
the class TestTDBAssembler method createTest.
private void createTest(String filename, Resource type) {
Object thing = AssemblerUtils.build(filename, type);
assertTrue(thing instanceof Dataset);
Dataset ds = (Dataset) thing;
assertTrue(ds.asDatasetGraph() instanceof DatasetGraphTransaction);
assertTrue(ds.supportsTransactions());
ds.close();
}
use of org.apache.jena.tdb.transaction.DatasetGraphTransaction in project jena by apache.
the class TDB method sync.
/** Sync a TDB-backed DatasetGraph. Do nothing if not TDB-backed. */
public static void sync(DatasetGraph dataset) {
if (dataset == null)
return;
// Should be: SystemARQ.sync(dataset) ;
if (dataset instanceof DatasetGraphTDB) {
syncObject(dataset);
return;
}
if (dataset instanceof DatasetGraphTransaction) {
DatasetGraphTransaction dsgt = (DatasetGraphTransaction) dataset;
// This only sync if the dataset has not been used transactionally.
// Can't sync transactional datasets (it's meaningless)
dsgt.syncIfNotTransactional();
return;
}
// May be a general purpose dataset with TDB objects in it.
sync(dataset.getDefaultGraph());
Iterator<Node> iter = dataset.listGraphNodes();
// Avoid iterator concurrency.
iter = Iter.toList(iter).iterator();
for (; iter.hasNext(); ) {
Node n = iter.next();
Graph g = dataset.getGraph(n);
sync(g);
}
}
use of org.apache.jena.tdb.transaction.DatasetGraphTransaction in project jena by apache.
the class DataService method shutdown.
private void shutdown() {
Fuseki.serverLog.info("Shutting down dataset");
dataset.close();
if (dataset instanceof DatasetGraphTransaction) {
DatasetGraphTransaction dsgtxn = (DatasetGraphTransaction) dataset;
StoreConnection.release(dsgtxn.getLocation());
}
dataset = null;
}
Aggregations