Package com.hp.hpl.jena.query

Examples of com.hp.hpl.jena.query.QueryExecution.execSelect()


    Query query = QueryFactory
        .create("PREFIX : <src/test/resources/PLOSone-search-results.csv#> SELECT ?author {?x :author ?author ; :doi '10.1371/journal.pone.0095156' }");
   
    QueryExecution qexec = QueryExecutionFactory.create(query, csv);
    ResultSet results = qexec.execSelect();
   
    assertTrue(results.hasNext());
    QuerySolution soln = results.nextSolution();
    assertEquals( "Oshrat Raz,Dorit L Lev,Alexander Battler,Eli I Lev", soln.getLiteral("author").getString());
   
View Full Code Here


    Query query = QueryFactory
        .create("PREFIX : <src/test/resources/Palo_Alto_Trees.csv#> SELECT ?longitude ?latitude {?x :Longitude ?longitude ; :Latitude ?latitude ; :Distance%20from%20Property ?distance . FILTER(?distance > 50 )}");
   
    QueryExecution qexec = QueryExecutionFactory.create(query, csv);
    ResultSet results = qexec.execSelect();
   
    assertTrue(results.hasNext());
    QuerySolution soln = results.nextSolution();
    assertEquals( -122.1566921, soln.getLiteral("longitude").getDouble(), 0);
    assertEquals( 37.4408948, soln.getLiteral("latitude").getDouble(), 0);
View Full Code Here

            //String sparql = "select * where {?s a <http://www.mytravels.com/Itinerary/MovieCityItinerary> }";
           
            Query query = QueryFactory.create(sparql, Syntax.syntaxARQ);
            QueryExecution queryExecution = QueryExecutionFactory.create(query, infModel);
           
            com.hp.hpl.jena.query.ResultSet resultSet = queryExecution.execSelect();
           
            ResultSetFormatter.out(System.out, resultSet);
           
           
        } catch (FileNotFoundException e) {
View Full Code Here

            }
            query = prefix+query;

            try{
                QueryExecution qexec = QueryExecutionFactory.create(query,jenamodel);
                ResultSet results = qexec.execSelect();

                return results;
            }catch (Exception e){
                e.printStackTrace();
                return null;
View Full Code Here

        query.serialize(System.out) ;
        System.out.println();
                                         
        QueryExecution qExec = QueryExecutionFactory.create(query, model) ;
        //LARQ.setDefaultIndex(qExec.getContext(), index) ;
        ResultSetFormatter.out(System.out, qExec.execSelect(), query) ;
        qExec.close() ;
    }

}
View Full Code Here

        QueryExecution qexec = QueryExecutionFactory.create(query, model) ;
        PipedInputStream inputStream = new PipedInputStream();

        try {
            // Assumption: it's a SELECT query.
            ResultSet rs = qexec.execSelect() ;
            if(format.compareTo("XML")==0){
              System.out.println("Processing XML");
//              ResultSetFormatter.outputAsXML(rs);
              ResultSetFormatter.outputAsXML(os, rs);
              os.close();
View Full Code Here

        System.out.println("Processing XML");
        new Thread(
                  new Runnable(){
                    public void run(){
                      try {
                        ResultSet rs = qexec.execSelect() ;
                        ResultSetFormatter.outputAsXML(out, rs);
                  out.close();
                } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
View Full Code Here

    QueryExecution qexec = QueryExecutionFactory.create(query, model);
    PipedInputStream inputStream = new PipedInputStream();

    try {
      // Assumption: it's a SELECT query.
      ResultSet rs = qexec.execSelect();
      if (format.compareTo("XML") == 0) {
        LOG.debug("Processing XML");
        // ResultSetFormatter.outputAsXML(rs);
        ResultSetFormatter.outputAsXML(os, rs);
        os.close();
View Full Code Here

        // Create a single execution of this query, apply to a model
        // which is wrapped up as a Dataset
        final QueryExecution qexec = QueryExecutionFactory.sparqlService(
                repository, query);
        ResultSet rs = qexec.execSelect();
        try
        {
            createTupleList(rs, true, true);
        }
        catch (PipeClosedException e)
View Full Code Here

    Query query = QueryFactory.create(queryString);
//    // Execute the query and obtain results
    QueryExecution qexec = QueryExecutionFactory.create(query, jenaModel);

    try {
      ResultSet results = qexec.execSelect() ;
     
      if (!results.hasNext()) {
        logger.info("query does not return any answer.");
        return null;
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.