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