Search in sources :

Example 6 with DatasetGraphTransaction

use of org.apache.jena.tdb.transaction.DatasetGraphTransaction in project jena by apache.

the class ExTDB_Txn3 method main.

public static void main(String... argv) {
    DatasetGraphTransaction dsg = (DatasetGraphTransaction) TDBFactory.createDatasetGraph();
    // Start READ transaction. 
    dsg.begin(ReadWrite.READ);
    try {
        // Do some queries
        String sparqlQueryString1 = "SELECT (count(*) AS ?count) { ?s ?p ?o }";
        execQuery(sparqlQueryString1, dsg);
    } finally {
        dsg.end();
    }
}
Also used : DatasetGraphTransaction(org.apache.jena.tdb.transaction.DatasetGraphTransaction)

Example 7 with DatasetGraphTransaction

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;
}
Also used : DatasetGraphTransaction(org.apache.jena.tdb.transaction.DatasetGraphTransaction)

Example 8 with DatasetGraphTransaction

use of org.apache.jena.tdb.transaction.DatasetGraphTransaction in project jena by apache.

the class TestTDBFactory method testTDBMakerTxn2.

@Test
public void testTDBMakerTxn2() {
    // Named memory locations
    TDBMaker.reset();
    DatasetGraph dg1 = TDBMaker.createDatasetGraphTransaction(Location.mem("FOO"));
    DatasetGraph dg2 = TDBMaker.createDatasetGraphTransaction(Location.mem("FOO"));
    DatasetGraph dgBase1 = ((DatasetGraphTransaction) dg1).getBaseDatasetGraph();
    DatasetGraph dgBase2 = ((DatasetGraphTransaction) dg2).getBaseDatasetGraph();
    assertSame(dgBase1, dgBase2);
}
Also used : DatasetGraphTransaction(org.apache.jena.tdb.transaction.DatasetGraphTransaction) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 9 with DatasetGraphTransaction

use of org.apache.jena.tdb.transaction.DatasetGraphTransaction in project jena by apache.

the class TestTDBFactory method testTDBMakerTxn1.

@Test
public void testTDBMakerTxn1() {
    TDBMaker.reset();
    DatasetGraph dg1 = TDBMaker.createDatasetGraphTransaction(Location.create(DIR));
    DatasetGraph dg2 = TDBMaker.createDatasetGraphTransaction(Location.create(DIR));
    DatasetGraph dgBase1 = ((DatasetGraphTransaction) dg1).getBaseDatasetGraph();
    DatasetGraph dgBase2 = ((DatasetGraphTransaction) dg2).getBaseDatasetGraph();
    assertSame(dgBase1, dgBase2);
}
Also used : DatasetGraphTransaction(org.apache.jena.tdb.transaction.DatasetGraphTransaction) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Aggregations

DatasetGraphTransaction (org.apache.jena.tdb.transaction.DatasetGraphTransaction)9 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)4 BaseTest (org.apache.jena.atlas.junit.BaseTest)3 Test (org.junit.Test)3 ModDataset (arq.cmdline.ModDataset)1 CmdException (jena.cmd.CmdException)1 Graph (org.apache.jena.graph.Graph)1 Node (org.apache.jena.graph.Node)1 Dataset (org.apache.jena.query.Dataset)1 InfGraph (org.apache.jena.reasoner.InfGraph)1 JenaException (org.apache.jena.shared.JenaException)1 Quad (org.apache.jena.sparql.core.Quad)1 DatasetGraphTDB (org.apache.jena.tdb.store.DatasetGraphTDB)1