Does this work for nested objects as well? For example to select a list of 
books by authors:


    JSON [
        {
            "author": ?author
            "books" [ "title": ?title ]
        }
    ]
    WHERE
    {
        ...
    }


to produce


[
    {
        "author": "author 1",
        "books": [ "book1", "book2", ... ]
    },
    {
        "author": "author 2",
        "books": [ "book1", "book2", ... ]
    },
    {
        "author": "author 3",
        "books": [ "book1", "book2", ... ]
    },
    ....
]





 
 

Sent: Monday, July 02, 2018 at 2:21 PM
From: "Andy Seaborne" <a...@apache.org>
To: users@jena.apache.org
Subject: Re: [ANN] Apache Jena 3.8.0
Jena 3.8.0 introduces a new SPARQL extension to easily produce JSON
output for further JSON-centric handling.

Example:

PREFIX purl: <http://purl.org/dc/elements/1.1/>

JSON {
"author": ?author,
"title": ?title
}
WHERE
{
?book purl:creator ?author .
?book purl:title ?title .
FILTER regex(?author,'Rowling','i')
}

to produce:

[
{
"book": "http://example.org/book/book6[http://example.org/book/book6]";,
"title": "Harry Potter and the Half-Blood Prince"
},
{
"book": "http://example.org/book/book7[http://example.org/book/book7]";,
"title": "Harry Potter and the Deathly Hallows"
},
]



For more information:

https://jena.apache.org/documentation/query/generate-json-from-sparql.html[https://jena.apache.org/documentation/query/generate-json-from-sparql.html]

Andy

Reply via email to