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";,
    "title": "Harry Potter and the Half-Blood Prince"
  },
  {
    "book": "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

    Andy

Reply via email to