@Override protected void doApplyToNamespace(final RemoteRepository repo, final UUID uuid) throws Exception { repo.prepareGraphQuery(queryStr, uuid).evaluate(); }
@Override public ICloseableIterator<Statement> evaluateGraph(final String query) { try { // Setup the query. final IPreparedGraphQuery q = m_repo.prepareGraphQuery(query); // Note: evaluate() runs asynchronously and must be closed(). final GraphQueryResult res = q.evaluate(); // Will close the GraphQueryResult. return new Sesame2BigdataIterator<Statement, QueryEvaluationException>( res); } catch (Exception ex) { throw new RuntimeException("query=" + query, ex); } }
@Override public GraphQueryResult evaluate() throws QueryEvaluationException { try { configureConnectOptions(q); return q.evaluate(); } catch (Exception ex) { throw new QueryEvaluationException(ex); } }
@Override public ICloseableIterator<Statement> evaluateGraph(final String query) { try { // Setup the query. final IPreparedGraphQuery q = m_repo.prepareGraphQuery(query); // Note: evaluate() runs asynchronously and must be closed(). final GraphQueryResult res = q.evaluate(); // Will close the GraphQueryResult. return new Sesame2BigdataIterator<Statement, QueryEvaluationException>( res); } catch (Exception ex) { throw new RuntimeException("query=" + query, ex); } }
@Override protected void doApplyToNamespace(final RemoteRepository repo, final UUID uuid) throws Exception { repo.prepareGraphQuery(queryStr, uuid).evaluate(); }
/** * Preferred version executes the {@link IPreparedGraphQuery} and ensures * that the {@link GraphQueryResult} is closed. * * @param preparedQuery * The prepared query. * * @return The resulting graph. * * @throws Exception */ static protected Graph asGraph(final IPreparedGraphQuery preparedQuery) throws Exception { final GraphQueryResult result = preparedQuery.evaluate(); try { final Graph g = new LinkedHashModel(); while (result.hasNext()) { g.add(result.next()); } return g; } finally { result.close(); } }
/** * Preferred version executes the {@link IPreparedGraphQuery} and ensures * that the {@link GraphQueryResult} is closed. * * @param preparedQuery * The prepared query. * * @return The resulting graph. * * @throws Exception */ static protected Graph asGraph(final IPreparedGraphQuery preparedQuery) throws Exception { final GraphQueryResult result = preparedQuery.evaluate(); try { final Graph g = new LinkedHashModel(); while (result.hasNext()) { g.add(result.next()); } return g; } finally { result.close(); } }