Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/415#discussion_r186377839
  
    --- 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 --
    
    They are checking expectations to be defensive against misbehaving remote 
servers. Otherwise the app will get a less helpful exception on the attempt 
cast performed by `getAsArray` or `getAsObject`.


---

Reply via email to