afs commented on code in PR #2152:
URL: https://github.com/apache/jena/pull/2152#discussion_r1441849132
##########
jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/UpdateBuilderTest.java:
##########
@@ -491,6 +495,38 @@ public void testInsertAndDeleteWithVariableNode() {
assertEquals(builder.makeNode("foo"), t.getObject());
assertTrue(Var.isVar(t.getPredicate()));
}
+
+ @Test
+ public void testInsertAndDeleteWithGraphClauses() {
+ // Test based upon GH-2150
+ // Simplified slightly as the actual URIs used were irrelevant to the
issue
+ RDFConnection conn = RDFConnection.connect(DatasetFactory.create());
+
+ UpdateBuilder updateBuilder = new UpdateBuilder();
+ updateBuilder.addInsert(g, s, p, o);
+
+ SelectBuilder where = new SelectBuilder();
+ where.addWhere(s, p, o);
+ updateBuilder.addGraph(g, where);
+
+
+ SelectBuilder notExists = new SelectBuilder();
+ notExists.addWhere(s, p, o);
+ SelectBuilder where2 = new SelectBuilder();
+ where2.addFilter(where2.getExprFactory().notexists(notExists));
+ updateBuilder.addGraph(g, where2);
+
+ UpdateRequest updateRequest = updateBuilder.buildRequest();
+
+ conn.begin(ReadWrite.WRITE);
+ try {
+ conn.update(updateRequest);
+ conn.commit();
+ } finally {
+ conn.end();
+ }
+ }
+
Review Comment:
Here is a test that focuses on the root cause: not `notexists`, simpler way
to execute `WhereBuilder` to get a group of one.
not sure where it should go - maybe in SelectBuilderTest?
```suggestion
@Test
public void testQueryFilterInGraphClause() {
// Root cause of GH-2150
DatasetGraph dsg = DatasetGraphZero.create();
SelectBuilder selectBuilder = new SelectBuilder();
selectBuilder.addFilter(selectBuilder.makeExpr("true"));
Query query = selectBuilder.build();
QueryExec.dataset(dsg).query(query).select();
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]