Package com.hp.hpl.jena.query

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


            QueryExecution qexec = QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql", query);
            // Set the DBpedia specific timeout.
            ((QueryEngineHTTP)qexec).addParam("timeout", "10000") ;

            // Execute.
            ResultSet rs = qexec.execSelect();
            ResultSetFormatter.out(System.out, rs, query);
            qexec.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here


        Query query = QueryFactory.create(prefixes+string) ;
        QuerySolutionMap initValues = null ;
        if ( varName != null )
            initValues = querySolution(varName, value) ;
        QueryExecution qExec = QueryExecutionFactory.create(query, m, initValues) ;
        ResultSet rs = ResultSetFactory.copyResults(qExec.execSelect()) ;
        qExec.close() ;
        return rs ;
    }
   
    private static QuerySolutionMap querySolution(String varName, RDFNode value)
View Full Code Here

        QueryExecution qexec = createQueryExecution(query, dataset) ;
        setAnyTimeouts(qexec, action);

        if ( query.isSelectType() )
        {
            ResultSet rs = qexec.execSelect() ;
           
            // Force some query execution now.
            // Do this to force the query to do something that should touch any underlying database,
            // and hence ensure the communications layer is working.
            // MySQL can time out after 8 hours of an idle connection
View Full Code Here

    final Date a = new Date();
    final QueryExecution qe = QueryExecutionFactory.create(query, model);
    if (query.isAskType()) {
      qe.execAsk();
    } else if (query.isSelectType()) {
      final ResultSet results = qe.execSelect();
      ResultSetFormatter.consume(results);
    }
    qe.close();
    return ((new Date()).getTime() - a.getTime());
  }
View Full Code Here

        final QueryResult qr = new BooleanResult();
        qe.close();
        return qr;
      }
    } else if (query.isSelectType()) {
      final ResultSet results = qe.execSelect();
      final QueryResult list = resultSetToBindingsList(results);
      qe.close();
      return list;
    } else if (query.isConstructType()) {
      final Model model = qe.execConstruct();
View Full Code Here

    Query query = QueryFactory.create(queryString);   
   
    // Execute the query and obtain results
    QueryExecution qe = QueryExecutionFactory.create(query, model);
    ResultSet results = qe.execSelect();

    // Output query results
    ByteArrayOutputStream debug = new ByteArrayOutputStream();
    ResultSetFormatter.out(debug, results, query);
    logger.debug(debug.toString());
View Full Code Here

            // A ResultSet is an iterator - any query solutions returned by .next()
            // are not accessible again.
            // Create a ResultSetRewindable that can be reset to the beginning.
            // Do before first use.
           
            ResultSetRewindable rewindable = ResultSetFactory.makeRewindable(qexec.execSelect()) ;
            ResultSetFormatter.out(rewindable) ;
            rewindable.reset() ;
            ResultSetFormatter.out(rewindable) ;
        }
        finally
View Full Code Here

        System.out.println("Titles: ") ;
       
        try {
            // Assumption: it's a SELECT query.
            ResultSet rs = qexec.execSelect() ;
           
            // The order of results is undefined.
            for ( ; rs.hasNext() ; )
            {
                QuerySolution rb = rs.nextSolution() ;
View Full Code Here

      // Create a SPARQL-DL query execution for the given query and
      // ontology model
      QueryExecution qe = SparqlDLExecutionFactory.create( q, m );
 
      // We want to execute a SELECT query, do it, and return the result set
      ResultSet rs = qe.execSelect();
 
      // There are different things we can do with the result set, for
      // instance iterate over it and process the query solutions or, what we
      // do here, just print out the results
      ResultSetFormatter.out( rs );
View Full Code Here

      // Create a SPARQL-DL query execution for the given query and
      // ontology model
      QueryExecution qe = SparqlDLExecutionFactory.create( q, m );
 
      // We want to execute a SELECT query, do it, and return the result set
      ResultSet rs = qe.execSelect();
 
      // Print the query for better understanding
      System.out.println(q.toString());
     
      // There are different things we can do with the result set, for
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.