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

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_r182390129
  
    --- Diff: jena-arq/Grammar/master.jj ---
    @@ -326,6 +361,46 @@ void AskQuery() : {}
       SolutionModifier()
     }
     
    +#ifdef ARQ
    +void JsonQuery() : {}
    +{
    +  JsonClause()
    +  ( DatasetClause() )*
    +  WhereClause()
    +  SolutionModifier()
    +}
    +
    +void JsonClause() : { Object o ; String s ; Token t; }
    +{
    +  <JSON> { getQuery().setQueryJsonType() ; }
    +  <LBRACE>
    +  s = String()
    +  // PNAME_NS would eval true before COLON (default namescape) so we make 
sure we got what we were expecting
    +  t = < PNAME_NS > {
    +    if ( ! t.image.equals(":") )
    +      throwParseException("Prefix name expression not legal at this point 
: "+t.image, t.beginLine, t.beginColumn) ;
    +  }
    +  (
    +    o = Var() { getQuery().addResultVar((Var) o) ; 
getQuery().addJsonMapping(s, o) ; }
    +  | o = String() { getQuery().addJsonMapping(s, o) ; }
    +  | o = Number() { getQuery().addJsonMapping(s, o) ; }
    +  )
    +  (
    +    <COMMA> s = String()
    +    t = < PNAME_NS > {
    +      if ( ! t.image.equals(":") )
    +        throwParseException("Prefix name expression not legal at this 
point : "+t.image, t.beginLine, t.beginColumn) ;
    +    }
    +    (
    +      o = Var() { getQuery().addResultVar((Var) o) ; 
getQuery().addJsonMapping(s, o) ; }
    +    | o = String() { getQuery().addJsonMapping(s, o) ; }
    +    | o = Number() { getQuery().addJsonMapping(s, o) ; }
    +    )
    --- End diff --
    
    Good idea! Using your TestJsonEval.java as base, and doing a quick change 
in the master.jj and grammars, to support it.


> 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)

Reply via email to