[
https://issues.apache.org/jira/browse/JENA-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16465739#comment-16465739
]
ASF GitHub Bot commented on JENA-1543:
--------------------------------------
Github user kinow commented on a diff in the pull request:
https://github.com/apache/jena/pull/415#discussion_r186383751
--- Diff:
jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java
---
@@ -538,13 +539,29 @@ else if (
actualContentType.equals(WebContent.contentTypeJSON))
@Override
public JsonArray execJson()
{
- throw new NotImplemented("JSON queries not implemented for remote
calls") ;
+ checkNotClosed();
+ HttpQuery httpQuery = makeHttpQuery();
+ httpQuery.setAccept(WebContent.contentTypeJSON);
+ InputStream in = httpQuery.exec();
+ JsonValue v = JSON.parseAny(in);
+ if ( ! v.isArray() )
+ {}
+ return v.getAsArray();
}
@Override
public Iterator<JsonObject> execJsonItems()
{
- throw new NotImplemented("JSON queries not implemented for remote
calls") ;
+ // Non-streaming.
+ // TODO Integrate with the JSON parser to stream the results.
+ JsonArray array = execJson().getAsArray();
+ List<JsonObject> x = new ArrayList<>(array.size());
+ array.forEach(elt->{
+ if ( ! elt.isObject())
--- End diff --
Oh, now I see the `throew new QueryExecException`, but I could swear I had
seen as `if (...) {}` before in GitHub. My bad.
> Remote execution of JSON queries
> --------------------------------
>
> Key: JENA-1543
> URL: https://issues.apache.org/jira/browse/JENA-1543
> Project: Apache Jena
> Issue Type: Improvement
> Components: ARQ
> Affects Versions: Jena 3.8.0
> Reporter: Andy Seaborne
> Assignee: Andy Seaborne
> Priority: Major
> Fix For: Jena 3.8.0
>
>
> Provide remote execution of JSON queries (JENA-632).
> {noformat}
> String qs= "JSON { 'abc': ?X } WHERE {BIND (now() As ?X)}";
> Query query = QueryFactory.create(qs, Syntax.syntaxARQ);
> try ( QueryExecution qExec =
> QueryExecutionFactory.sparqlService("http://localhost:3030/ds", query)) {
> QueryExecUtils.executeQuery(qExec);
> }
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)