[
https://issues.apache.org/jira/browse/JENA-1956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17186477#comment-17186477
]
Andy Seaborne edited comment on JENA-1956 at 8/28/20, 12:06 PM:
----------------------------------------------------------------
The code example would fail to close the query execution. For remote execution,
it is important to close the {{QueryExecution}} object to free up HTTP cache
connections for the cached connection pool.
Note that currently you can use
{noformat}
try (QueryExecution qExec = QueryExecutionFactory.create(...) ) {
qExec.execSelect().forEachRemaining(qs->{...});
}
{noformat}
Also, {{RDFConnection.queryResultSet}} provides this style and ensure that the
internal {{QueryExecution}} is closed.
was (Author: andy.seaborne):
The code example would fail to close the query execution. For remote execution,
it is important to close the {{QueryExecution}} object to free up HTTP cache
connections for the cached connection pool.
Note that currently you can use
{noformat}
try (QueryExecution qExec = QueryExecutionFactory.create(...) ) {
qExec.execSelect().forEachRemaining(qs->{...});
}
{noformat}
Also. {{RDFConnection.queryResultSet}} provides this style and ensure that the
internal {{QueryExecution}} is closed.
> ResultSet should implement Iterable
> -----------------------------------
>
> Key: JENA-1956
> URL: https://issues.apache.org/jira/browse/JENA-1956
> Project: Apache Jena
> Issue Type: Improvement
> Reporter: Jan Martin Keil
> Priority: Major
>
> The class {{ResultSet}} should implement {{Iterable<QuerySolution>}}. That
> would significantly ease query result processing. It would allow to write
> {code:java}
> for (QuerySolution result : QueryExecutionFactory.create(query,
> model).execSelect()) {
> …
> }
> {code}
> instead of
> {code:java}
> ResultSet results = QueryExecutionFactory.create(query, model).execSelect();
> while (results.hasNext()) {
> QuerySolution result = results.next();
> …
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)