Search in sources :

Example 1 with SDBConnection

use of org.apache.jena.sdb.sql.SDBConnection in project jena by apache.

the class StoreCreator method getIndexDB2.

public static Store getIndexDB2() {
    if (sdbdb2i == null) {
        JDBC.loadDriverDB2();
        String url = JDBC.makeURL("db2", "sweb-sdb-4:50000", "TEST2I");
        SDBConnection sdb = new SDBConnection(url, "user", "password");
        StoreDesc desc = new StoreDesc(LayoutType.LayoutTripleNodesIndex, DatabaseType.DB2);
        sdbdb2i = new StoreTriplesNodesIndexDB2(sdb, desc);
        sdbdb2i.getTableFormatter().create();
    }
    sdbdb2i.getTableFormatter().truncate();
    return sdbdb2i;
}
Also used : StoreDesc(org.apache.jena.sdb.StoreDesc) SDBConnection(org.apache.jena.sdb.sql.SDBConnection)

Example 2 with SDBConnection

use of org.apache.jena.sdb.sql.SDBConnection in project jena by apache.

the class StoreCreator method getIndexOracle.

public static Store getIndexOracle() {
    if (sdboi == null) {
        JDBC.loadDriverOracle();
        String url = JDBC.makeURL("oracle:thin", "localhost:1521", "XE");
        SDBConnection sdb = new SDBConnection(url, "test2-index", "test2-index");
        StoreDesc desc = new StoreDesc(LayoutType.LayoutTripleNodesIndex, DatabaseType.Oracle);
        sdboi = new StoreTriplesNodesIndexOracle(sdb, desc);
        sdboi.getTableFormatter().create();
    } else
        sdboi.getTableFormatter().truncate();
    return sdboi;
}
Also used : StoreDesc(org.apache.jena.sdb.StoreDesc) SDBConnection(org.apache.jena.sdb.sql.SDBConnection)

Example 3 with SDBConnection

use of org.apache.jena.sdb.sql.SDBConnection in project jena by apache.

the class StoreCreator method getHashDerby.

public static Store getHashDerby() {
    if (sdbdh == null) {
        JDBC.loadDriverDerby();
        String url = JDBC.makeURL("derby", "localhost", "DB/test2-hash");
        SDBConnection sdb = new SDBConnection(url, null, null);
        StoreDesc desc = new StoreDesc(LayoutType.LayoutTripleNodesHash, DatabaseType.Derby);
        sdbdh = new StoreTriplesNodesHashDerby(sdb, desc);
        sdbdh.getTableFormatter().create();
    } else
        sdbdh.getTableFormatter().truncate();
    return sdbdh;
}
Also used : StoreDesc(org.apache.jena.sdb.StoreDesc) SDBConnection(org.apache.jena.sdb.sql.SDBConnection)

Example 4 with SDBConnection

use of org.apache.jena.sdb.sql.SDBConnection in project jena by apache.

the class StoreCreator method getIndexHSQL.

public static Store getIndexHSQL() {
    if (sdbhsi == null) {
        JDBC.loadDriverHSQL();
        SDBConnection sdb = SDBFactory.createConnection("jdbc:hsqldb:mem:aname", "sa", "");
        StoreDesc desc = new StoreDesc(LayoutType.LayoutTripleNodesIndex, DatabaseType.HSQLDB);
        sdbhsi = new StoreTriplesNodesIndexHSQL(sdb, desc);
        sdbhsi.getTableFormatter().create();
    } else
        sdbhsi.getTableFormatter().truncate();
    return sdbhsi;
}
Also used : StoreDesc(org.apache.jena.sdb.StoreDesc) SDBConnection(org.apache.jena.sdb.sql.SDBConnection)

Example 5 with SDBConnection

use of org.apache.jena.sdb.sql.SDBConnection in project jena by apache.

the class TestConnection method connection_1.

@Test
public void connection_1() {
    SDBConnection conn1 = SDBFactory.createConnection(conn);
    Store store1 = StoreFactory.create(storeDesc, conn1);
    // Reset
    store1.getTableFormatter().format();
    SDBConnection conn2 = SDBFactory.createConnection(conn);
    Store store2 = StoreFactory.create(storeDesc, conn2);
    Model model1 = SDBFactory.connectDefaultModel(store1);
    Model model2 = SDBFactory.connectDefaultModel(store2);
    Resource s = model1.createResource();
    Property p = model1.createProperty("http://example/p");
    // These are autocommit so two stores should be OK (but not a good design paradigm)
    model1.add(s, p, "model1");
    model2.add(s, p, "model2");
    assertEquals(2, model1.size());
    assertEquals(2, model2.size());
    assertTrue(model1.isIsomorphicWith(model2));
}
Also used : SDBConnection(org.apache.jena.sdb.sql.SDBConnection) Model(org.apache.jena.rdf.model.Model) Resource(org.apache.jena.rdf.model.Resource) Store(org.apache.jena.sdb.Store) Property(org.apache.jena.rdf.model.Property) Test(org.junit.Test)

Aggregations

SDBConnection (org.apache.jena.sdb.sql.SDBConnection)21 StoreDesc (org.apache.jena.sdb.StoreDesc)18 Store (org.apache.jena.sdb.Store)5 DatasetStore (org.apache.jena.sdb.store.DatasetStore)2 Test (org.junit.Test)2 Graph (org.apache.jena.graph.Graph)1 Triple (org.apache.jena.graph.Triple)1 Model (org.apache.jena.rdf.model.Model)1 Property (org.apache.jena.rdf.model.Property)1 Resource (org.apache.jena.rdf.model.Resource)1