Package com.hp.hpl.jena.query

Examples of com.hp.hpl.jena.query.ResultSet


  {
    QueryEngine qe;
   
    qe = prepareQuery("SELECT ?subj WHERE { ?subj <urn:ex:TABLE1_FIELD2> 'C' }");
   
    ResultSet res = qe.execSelect();
   
    assertTrue("I have results", res.hasNext());
   
    QuerySolution soln = res.nextSolution();
   
    RDFNode subj = soln.get("subj");
       
    assertEquals("Result is correct", "urn:ex:TABLE1;FIELD1=2;FIELD3=3", ((Resource) subj).getURI());
   
View Full Code Here


  {
    QueryEngine qe;
   
    qe = prepareQuery("SELECT ?s WHERE { ?s a <urn:ex:TABLE1> }");
   
    ResultSet res = qe.execSelect();
   
    assertTrue("I have a result", res.hasNext());
  }
View Full Code Here

        "}"
        );
   
    QueryEngine qe = new LdapQueryEngine(query, config);
    qe.setDataset(DatasetFactory.create());
    ResultSet res = qe.execSelect();
   
    ResultSetFormatter.out(System.out, res);
  }
View Full Code Here

        "}"
        );
   
    QueryEngine qe = new LdapQueryEngine(query, config);
    qe.setDataset(DatasetFactory.create());
    ResultSet res = qe.execSelect();
    assertTrue("I have results", res.hasNext());
    ResultSetFormatter.out(System.out, res);
  }
View Full Code Here

        "}"
        );
   
    QueryEngine qe = new LdapQueryEngine(query, config);
    qe.setDataset(DatasetFactory.create());
    ResultSet res = qe.execSelect();
    assertFalse("I have results", res.hasNext());
  }
View Full Code Here

        "}"
        );
   
    QueryEngine qe = new LdapQueryEngine(query, config);
    qe.setDataset(DatasetFactory.create());
    ResultSet res = qe.execSelect();
    assertTrue("I have results", res.hasNext());
    QuerySolution result = res.nextSolution();
    assertTrue("I have a country", result.contains("country"));
    assertEquals("I have the correct country", Node.createLiteral("GB"), result.get("country").asNode());
  }
View Full Code Here

        "}"
        );
   
    QueryEngine qe = new LdapQueryEngine(query, config);
    qe.setDataset(DatasetFactory.create());
    ResultSet res = qe.execSelect();
    assertTrue("I have results", res.hasNext());
  }
View Full Code Here

        "}"
        );
   
    QueryEngine qe = new LdapQueryEngine(query, config);
    qe.setDataset(DatasetFactory.create());
    ResultSet res = qe.execSelect();
    assertFalse("I have results", res.hasNext());
  }
View Full Code Here

        Store store = StoreFactory.create(storeDesc, conn) ;
       
        Dataset ds = DatasetStore.create(store) ;
        QueryExecution qe = QueryExecutionFactory.create(query, ds) ;
        try {
            ResultSet rs = qe.execSelect() ;
            ResultSetFormatter.out(rs) ;
        } finally { qe.close() ; }
        // Does not close the JDBC connection.
        // Do not call : store.getConnection().close() , which does close the underlying connection.
        store.close() ;
View Full Code Here

        // See http://www.openjena.org/ARQ/app_api.html
       
        Query query = QueryFactory.create(sparqlQueryString) ;
        QueryExecution qexec = QueryExecutionFactory.create(query, dataset) ;
        try {
          ResultSet results = qexec.execSelect() ;
          for ( ; results.hasNext() ; )
          {
              QuerySolution soln = results.nextSolution() ;
              int count = soln.getLiteral("count").getInt() ;
              System.out.println("count = "+count) ;
          }
        } finally { qexec.close() ; }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.query.ResultSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.