[
https://issues.apache.org/jira/browse/JENA-1566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16524995#comment-16524995
]
ASF GitHub Bot commented on JENA-1566:
--------------------------------------
Github user afs commented on a diff in the pull request:
https://github.com/apache/jena/pull/440#discussion_r198479304
--- Diff:
jena-arq/src/test/java/org/apache/jena/sparql/syntax/TestSSE_Builder.java ---
@@ -233,4 +247,54 @@ public void testBuildExpr_14() {
"(!= ?x ?y)") ;
}
+ @Test
+ public void testBuildTable_01() {
+ Op expected = OpTable.unit();
+ Op actual = SSE.parseOp("(table unit)");
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testBuildTable_02() {
+ Op expected = OpTable.empty();
+ Op actual = SSE.parseOp("(table empty)");
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testBuildTable_03() {
+ Op expected = OpTable.create(TableFactory.create(Var.alloc("x"),
NodeConst.nodeTrue));
+ Op actual = SSE.parseOp("(table (vars ?x) (row (?x true)))");
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testBuildTableBad_01() {
+ try {
+ SSE.parseOp("(table (vars ?x) (row (?x (table unit))))");
+ Assert.fail("Parsing should fail");
+ } catch (ExprBuildException e) {
+ // OK
+ }
+ }
+
+ @Test
+ public void testBuildTableBad_02() {
+ try {
+ SSE.parseOp("(table (vars ?x) (row (?x _:anon)))");
+ Assert.fail("Parsing should fail");
--- End diff --
Shouldn't this parse OK?
Even though SPARQL syntax does not allow blank nodes in VALUES, it seem to
be no harm to have the `(table)` parsing be more general. The `Table` class is
a list of `Binding`s and `Binding` can have blank nodes. `Table` can used for
intermediate results like in the ref engine.
> Unable to parse VALUES clause containing boolean literal bindings
> -----------------------------------------------------------------
>
> Key: JENA-1566
> URL: https://issues.apache.org/jira/browse/JENA-1566
> Project: Apache Jena
> Issue Type: Bug
> Components: ARQ
> Affects Versions: Jena 3.7.0
> Reporter: Lee Kitching
> Assignee: Rob Vesse
> Priority: Major
>
> Compiling the query
>
> SELECT ?b WHERE \{ VALUES ?b { true } }
>
> into a query algebra:
>
>
> Query q = QueryFactory.create("SELECT ?b WHERE \{ VALUES ?b { true }}");
> Op a = Algebra.compile(q);
>
> results in
> {{(project}}
> {{ (?b)}}
> {{ (table}}
> {{ (vars ?b)}}
> {{ (row}}
> {{ (?b true))))}}
>
> Attempting to parse this string representation throws an exception:
> {{SSE.parseOp("(project (?b) (table (vars ?b) (row (?b true))))");}}
> {quote} org.apache.jena.sparql.sse.builders.ExprBuildException "Not a
> node: true"
> [org.apache.jena.sparql.sse.builders.BuilderLib exception
> "BuilderLib.java" 140]
> [org.apache.jena.sparql.sse.builders.BuilderLib broken "BuilderLib.java"
> 147]
> [org.apache.jena.sparql.sse.builders.BuilderLib broken "BuilderLib.java"
> 129]
> [org.apache.jena.sparql.sse.builders.BuilderLib checkNode
> "BuilderLib.java" 32]
> [org.apache.jena.sparql.sse.builders.BuilderBinding buildBinding
> "BuilderBinding.java" 64]
> [org.apache.jena.sparql.sse.builders.BuilderBinding build
> "BuilderBinding.java" 36]
> [org.apache.jena.sparql.sse.builders.BuilderTable build
> "BuilderTable.java" 73]
> [org.apache.jena.sparql.sse.builders.BuilderOp$1 make "BuilderOp.java"
> 209]
> [org.apache.jena.sparql.sse.builders.BuilderOp build "BuilderOp.java"
> 128]
> [org.apache.jena.sparql.sse.builders.BuilderOp build "BuilderOp.java"
> 162]
> [org.apache.jena.sparql.sse.builders.BuilderOp$26 make "BuilderOp.java"
> 672]
> [org.apache.jena.sparql.sse.builders.BuilderOp build "BuilderOp.java"
> 128]
> [org.apache.jena.sparql.sse.builders.BuilderOp build "BuilderOp.java" 59]
> [org.apache.jena.sparql.algebra.Algebra parse "Algebra.java" 121]
> [org.apache.jena.sparql.algebra.Algebra parse "Algebra.java" 109]
> [org.apache.jena.sparql.sse.SSE parseOp "SSE.java" 287]
> {quote}
> As a bit of background, we are trying to rewrite SPARQL queries using ARQ in
> Clojure (as described in JENA-1468). The current process is:
> Parse SPARQL query -> Compile to Op -> serialise to string -> parse as SSE ->
> modify SSE -> serialise to string -> Parse to Op -> convert to SPARQL query
> This issue is causing the 'parse as SSE' step to fail.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)