コード例 #1
0
 @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());
 }
コード例 #2
0
  @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();
  }
コード例 #3
0
ファイル: DatasetFactory.java プロジェクト: hmottestad/jena
 /**
  * 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);
 }
コード例 #4
0
ファイル: DatasetFactory.java プロジェクト: hmottestad/jena
 /**
  * Wrap a {@link DatasetGraph} to make a dataset
  *
  * @param dataset DatasetGraph
  * @return Dataset
  */
 public static Dataset wrap(final DatasetGraph dataset) {
   return DatasetImpl.wrap(dataset);
 }