Github user kinow commented on a diff in the pull request:
https://github.com/apache/jena/pull/114#discussion_r182394976
--- 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 --
Oh! It was by accident that it got fixed I think?
I copied parts of the `SelectClause()` to `JsonClause()`. More
especifically, the Select had:
```
// Expressions without ()
( LOOKAHEAD(2)
expr = BuiltInCall() { getQuery().addResultVar((Var)null,
expr) ; }
| expr = FunctionCall() { getQuery().addResultVar((Var)null,
expr) ; }
| n = RDFLiteral() { getQuery().addResultVar((Var)null,
NodeValue.makeNode(n)) ; }
| n = NumericLiteral() { getQuery().addResultVar((Var)null,
NodeValue.makeNode(n)) ; }
| n = BooleanLiteral() { getQuery().addResultVar((Var)null,
NodeValue.makeNode(n)) ; }
```
Which became the following for the JSON counterpart:
```
o = Var() { getQuery().addResultVar((Var)o) ;
getQuery().addJsonMapping(s, o) ; }
| o = RDFLiteral() { getQuery().addResultVar(s, NodeValue.makeNode(o)) ;
getQuery().addJsonMapping(s, o) ; }
| o = NumericLiteral() { getQuery().addResultVar(s,
NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; }
| o = BooleanLiteral() { getQuery().addResultVar(s,
NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; }
```
More or less the same. But we have the Var (i.e. for cases like `"title" :
?title`), and then I did not include the expressions (hence the lookahead
removed).
Does it make sense @afs ? If so, we can actually remove the `Number()` and
this whole #if ARQ block. And I believe the code is doing more or less what you
suggested?
Thanks!
Bruno
---