Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/114#discussion_r176029548
  
    --- Diff: jena-arq/Grammar/master.jj ---
    @@ -2176,6 +2251,19 @@ String String() : { Token t ; String lex ; }
         }
     }
     
    +#ifdef ARQ
    +Number Number() : { Token t ; Number number ; }
    +{
    +  (
    +    t = < INTEGER > { number = integerValue(t.image) ; }
    +  | t = < DECIMAL > { number = doubleValue(t.image) ; }
    --- End diff --
    
    Would this be simpler? 
    
    Generate `Node` from the parser, 
    The data  structure is then `Map<String, Node> jsonMapping`.
    To use, lookup variables in the binding to get a `Node` and also use the 
`Node`s from `jsonMapping`.
    
    In the grammar, use `NumericLiteral() | BooleanLiteral()`, which return 
`Node`, then the sign of numbers is also handled.  as well as booleans. When 
needing the item for making the JSON, apply `RDFTerm2Json`, as is done when a 
variable is used and turned into a Json value.
    
    There isn't a standard alone string rule returning a `Node`. The `String()` 
returns a string (it is used to make a RDF Literal, optional ^^ and @ parts) - 
to unify handling turn the string into a `Node` with 
`NodeFactory.createLiteral(t.image)`.



---

Reply via email to