/** * Constructs a wrapper for the specified {@code resultSet}. * * @param resultSet * the result set to wrap. */ public ResultSetMemWrapper(ResultSet resultSet) { super(new ResultSetMem(resultSet)); }
/** * Take a copy of a result set - the result set returns is an in-memory * copy. It is not attached to the original query execution object which can * be closed. * * @param results * @return ResultSet */ static public ResultSetRewindable copyResults(ResultSet results) { return new ResultSetMem(results); }
/** Take a copy of a result set - the result set returns is an in-memory copy. * It is not attached to the original query execution object which can be closed. * @param results * @return ResultSet */ static public ResultSetRewindable copyResults(ResultSet results) { return new ResultSetMem(results) ; }
/** * Constructs a wrapper for the specified {@code resultSet}. * * @param resultSet * the result set to wrap. */ public ResultSetWrapper(ResultSet resultSet) { // puts the content of the resultset into memory if the specified // resultset is not an in-memory resultset. super(new ResultSetMem(resultSet)); }
/** * Create an in-memory result set from an array of * ResulSets. It is assumed that all the ResultSets * from the array have the same variables. * * @param sets the ResultSets to concatenate. */ public static ResultSet union(ResultSet... sets) { return new ResultSetMem(sets); }
/** Turn an existing result set into a rewindable one. * May take a copy - uses up the result set passed in. * @param resultSet * @return ResultSetRewindable */ static public ResultSetRewindable makeRewindable(ResultSet resultSet) { return new ResultSetMem(resultSet) ; }
/** * Turn an existing result set into a rewindable one. * May take a copy but this is not guarantted * Uses up the result set passed in which is no longer valid as a ResultSet. * * @param resultSet * @return ResultSetRewindable */ static public ResultSetRewindable makeRewindable(ResultSet resultSet) { if ( resultSet instanceof ResultSetRewindable ) { ResultSetRewindable rsw = (ResultSetRewindable)resultSet ; rsw.reset() ; return rsw ; } return new ResultSetMem(resultSet); }
ResultSetRewindable resultSetRewindable = new ResultSetMem(resultSet) ;
private ResultSet execSelect(String queryStr) { // long startTime1 = System.currentTimeMillis(); // try { // // RepositoryConnection conn = getConnection(); // try { // GraphQuery q = conn.prepareGraphQuery(QueryLanguage.SPARQL, queryStr); // q.evaluate(); // } catch (MalformedQueryException e) { // throw new RuntimeException(e); // } finally { // conn.close(); // } // } catch (Exception re) { // //log.info(re,re); // } // log.info((System.currentTimeMillis() - startTime1) + " to execute via sesame"); long startTime = System.currentTimeMillis(); Query askQuery = QueryFactory.create(queryStr); QueryExecution qe = QueryExecutionFactory.sparqlService(endpointURI, askQuery); try { return new ResultSetMem(qe.execSelect()); } finally { //log.info((System.currentTimeMillis() - startTime) + " to execute via Jena"); qe.close(); } }