You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by "arimu1 (via GitHub)" <gi...@apache.org> on 2026/09/12 23:55:23 UTC
[PR] GH-3707: Preserve subquery when adding optional QueryBuilder [jena]
arimu1 opened a new pull request, #4218:
URL: https://github.com/apache/jena/pull/4218
Fixes #3707
## Summary
- `addOptional(AbstractQueryBuilder)` now wraps the nested builder as an `OPTIONAL { SELECT ... WHERE ... }` subquery via `ElementSubQuery`, instead of copying only its WHERE `ElementGroup`.
- Applies to SELECT/ASK/CONSTRUCT/DESCRIBE/WHERE builders and UPDATE `WhereQuadHolder`.
## Problem
Adding a nested `SelectBuilder` with `select.addOptional(selectOptional)` dropped the inner `SELECT` variables and produced a flat optional BGP (reporter’s ORDER BY / subquery use case).
## Test plan
- [x] `mvn -pl jena-querybuilder -Dtest=SelectBuilderTest#testAddOptionalNestedSelectBuilder test` (reproduces issue #3707 snippet; asserts nested SELECT and both triple patterns inside OPTIONAL)
Made with [Cursor](https://cursor.com)
--
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: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org