[ 
https://issues.apache.org/jira/browse/JENA-632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14317408#comment-14317408
 ] 

Bruno P. Kinoshita commented on JENA-632:
-----------------------------------------

Using the {{books.ttl}} example dataset, and the following query:

{code:title=query-sparql.sparql|borderStyle=solid}
PREFIX purl: <http://purl.org/dc/elements/1.1/>
PREFIX w3: <http://www.w3.org/2001/vcard-rdf/3.0#> 
PREFIX : <http://example.org/book/> 

SELECT ?author ?title 
WHERE 
{
?book purl:creator ?author .
?book purl:title ?title . 
FILTER (?author = 'J.K. Rowling')
}
{code}

Produces the following result set.

{code}
----------------------------------------------------------------
| author         | title                                       |
================================================================
| "J.K. Rowling" | "Harry Potter and the Order of the Phoenix" |
| "J.K. Rowling" | "Harry Potter and the Philosopher's Stone"  |
| "J.K. Rowling" | "Harry Potter and the Half-Blood Prince"    |
| "J.K. Rowling" | "Harry Potter and the Deathly Hallows"      |
----------------------------------------------------------------
{code}

And the JSON query.

{code:title=query-json.sparql|borderStyle=solid}
PREFIX purl: <http://purl.org/dc/elements/1.1/>
PREFIX w3: <http://www.w3.org/2001/vcard-rdf/3.0#> 
PREFIX : <http://example.org/book/> 

JSON {
"author": ?author, 
"title": ?title 
}
WHERE 
{
?book purl:creator ?author .
?book purl:title ?title . 
FILTER (?author = 'J.K. Rowling')
}
{code}

Produces:

{code}
[ { 
    "author" : "J.K. Rowling" ,
    "title" : "Harry Potter and the Order of the Phoenix"
  } ,
  { 
    "author" : "J.K. Rowling" ,
    "title" : "Harry Potter and the Philosopher's Stone"
  } ,
  { 
    "author" : "J.K. Rowling" ,
    "title" : "Harry Potter and the Half-Blood Prince"
  } ,
  { 
    "author" : "J.K. Rowling" ,
    "title" : "Harry Potter and the Deathly Hallows"
  }
]
{code}

How are we supposed to handle this kind of data set in JSON queries? 

> 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
>            Priority: Minor
>              Labels: java, javacc
>
> 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
(v6.3.4#6332)

Reply via email to