Github user kinow commented on the issue:

    https://github.com/apache/jena/pull/114
  
    +1 for the current draft
    
    I would use it 
[here](https://github.com/kinow/jena/blob/a948f300fb40701e49e83db9d03e5d83da8145f6/jena-arq/src/main/java/org/apache/jena/sparql/engine/QueryExecutionBase.java#L358
 and 
[here](https://github.com/kinow/jena/blob/a948f300fb40701e49e83db9d03e5d83da8145f6/jena-arq/src/main/java/org/apache/jena/sparql/engine/JsonIterator.java#L71).
    
    This way instead of looking only at the literals, we'd have the output from 
the table above.
    
    So far I have just two unit tests in my working copy
    
    ```java
        @Test public void testExecJson() {
            // JENA-632
            Query query = QueryFactory.create("JSON { \"s\": ?s , \"p\": ?p , 
\"o\" : ?o } "
                    + "WHERE { ?s ?p ?o }", Syntax.syntaxARQ);
            
            try ( QueryExecution qexec = QueryExecutionFactory.create(query, m) 
) {
                JsonArray jsonArray = qexec.execJson();
                assertNotNull( jsonArray );
                assertEquals(3, jsonArray.size());
            }
        }
    
        @Test public void testExecJsonItems() {
            // JENA-632
            Model model = ModelFactory.createDefaultModel();
            {
                Resource r = model.createResource(AnonId.create("s"));
                Property p = model.getProperty("");
                RDFNode node = ResourceFactory.createTypedLiteral("123", 
XSDDatatype.XSDdecimal);
                model.add(r, p, node);
                r = model.createResource(AnonId.create("s"));
                p = model.getProperty("");
                node = ResourceFactory.createTypedLiteral("abc", 
XSDDatatype.XSDstring);
                model.add(r, p, node);
                r = model.createResource(AnonId.create("s"));
                p = model.getProperty("");
                node = ResourceFactory.createLangLiteral("def", "en");
                model.add(r, p, node);
            }
            Query query = QueryFactory.create("JSON { \"s\": ?s , \"p\": ?p , 
\"o\" : ?o } "
                    + "WHERE { ?s ?p ?o }", Syntax.syntaxARQ);
            
            try ( QueryExecution qexec = QueryExecutionFactory.create(query, 
model) ) {
                Iterator<JsonObject> execJsonItems = qexec.execJsonItems();
                while(execJsonItems.hasNext()) {
                    JsonObject next = execJsonItems.next();
                    System.out.println(next);
                }
            }
    ```
    
    Where the second test is doing - more or less - the same example you 
provided in your previous comment. Once we have the conversion in place, I will 
update it to confirm I get what's expected.
    
    Then after that I was thinking about quickly running with jacoco to see how 
much of this PR is being tested.


---

Reply via email to