[
https://issues.apache.org/jira/browse/JENA-632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16401763#comment-16401763
]
ASF GitHub Bot commented on JENA-632:
-------------------------------------
Github user kinow commented on a diff in the pull request:
https://github.com/apache/jena/pull/114#discussion_r175061201
--- Diff:
jena-arq/src/main/java/org/apache/jena/query/ResultSetFormatter.java ---
@@ -516,6 +520,41 @@ static public void outputAsJSON(boolean booleanResult)
static public void outputAsJSON(OutputStream outStream, boolean
booleanResult)
{ output(outStream, booleanResult, SPARQLResultSetJSON) ; }
+ /** Output an iterator of JSON values.
+ *
+ * @param outStream output stream
+ * @param jsonItems The JSON values
+ */
+ public static void outputAsJSON(OutputStream outStream,
Iterator<JsonObject> jsonItems)
+ {
+ JSWriter jWriter = new JSWriter(outStream) ;
+ jWriter.startArray() ;
+ jWriter.startOutput() ;
+ while (jsonItems.hasNext())
+ {
+ jWriter.startObject() ;
+ JsonObject jsonItem = jsonItems.next() ;
+ for (Entry<String, JsonValue> entry: jsonItem.entrySet())
+ {
+ JsonValue value = entry.getValue() ;
+ String val = "";
+ if (value.isString()) {
--- End diff --
@afs but here I didn't have a `Node`, only the `JsonValue`, and had to
convert from `JsonValue` to `String`
> Generate JSON from SPARQL directly.
> -----------------------------------
>
> Key: JENA-632
> URL: https://issues.apache.org/jira/browse/JENA-632
> Project: Apache Jena
> Issue Type: Improvement
> Components: ARQ, Fuseki
> Reporter: Andy Seaborne
> Assignee: Bruno P. Kinoshita
> Priority: Minor
> Labels: java, javacc
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> The capability to generate JSON directly from a SPARQL (or extended SPARQL)
> query would enable the creation of JSON data API over published linked data.
> This project would cover:
> # Design and publication of a design.
> # Refinement of design based on community feed
> # Implementation, including testing.
> # Refinement of implementation based on community feed
> Skills required: Java, some parser work, design and discussion with the user
> community, basic understanding of HTTP and content negotiation.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)