@Test public void testQueryWorks() { ReconnectingDatasetGraph toQuery = (ReconnectingDatasetGraph) ((Dataset) AssemblerUtils.build("basic.ttl", SDBConnect.TYPE)).asDatasetGraph(); toQuery.getDatasetGraph().getStore().getTableFormatter().format(); Dataset ds = DatasetImpl.wrap(toQuery); // Dataset ds = new DatasetImpl(toQuery); QueryExecution qe = QueryExecutionFactory.create("ASK { ?s ?p ?o }", ds); assertTrue("Querying works", !qe.execAsk()); }
@Test public void testFullQueryWorks() { ReconnectingDatasetGraph toQuery = (ReconnectingDatasetGraph) ((Dataset) AssemblerUtils.build("basic.ttl", SDBConnect.TYPE)).asDatasetGraph(); toQuery.getDatasetGraph().getStore().getTableFormatter().format(); Dataset ds = DatasetImpl.wrap(toQuery); // Dataset ds = new DatasetImpl(toQuery); QueryExecution qe = QueryExecutionFactory.create("SELECT * { ?s ?p ?o }", ds); ResultSet r = qe.execSelect(); assertTrue("Querying works", !r.hasNext()); qe.close(); qe = QueryExecutionFactory.create("SELECT * { graph ?g { ?s ?p ?o } }", ds); r = qe.execSelect(); assertTrue("Querying with named graphs works", !r.hasNext()); qe.close(); }
/** * Wrap a {@link DatasetGraph} to make a dataset * * @param dataset DatasetGraph * @return Dataset * @deprecated Use {@link #wrap} */ @Deprecated public static Dataset create(final DatasetGraph dataset) { return DatasetImpl.wrap(dataset); }
/** * Wrap a {@link DatasetGraph} to make a dataset * * @param dataset DatasetGraph * @return Dataset */ public static Dataset wrap(final DatasetGraph dataset) { return DatasetImpl.wrap(dataset); }