Search in sources :

Example 1 with DatasetStore

use of org.apache.jena.sdb.store.DatasetStore in project jena by apache.

the class Ex1 method main.

public static void main(String... argv) {
    String queryString = "SELECT * { ?s ?p ?o }";
    Query query = QueryFactory.create(queryString);
    Store store = SDBFactory.connectStore("sdb.ttl");
    // Must be a DatasetStore to trigger the SDB query engine.
    // Creating a graph from the Store, and adding it to a general
    // purpose dataset will not necesarily exploit full SQL generation.
    // The right answers will be obtained but slowly.
    Dataset ds = DatasetStore.create(store);
    QueryExecution qe = QueryExecutionFactory.create(query, ds);
    try {
        ResultSet rs = qe.execSelect();
        ResultSetFormatter.out(rs);
    } finally {
        qe.close();
    }
    // Close the SDB conenction which also closes the underlying JDBC connection.
    store.getConnection().close();
    store.close();
}
Also used : Store(org.apache.jena.sdb.Store) DatasetStore(org.apache.jena.sdb.store.DatasetStore)

Aggregations

Store (org.apache.jena.sdb.Store)1 DatasetStore (org.apache.jena.sdb.store.DatasetStore)1