Restore SPARQL expression-error semantics
Deferred constant-folding value errors to runtime evaluation so an error in an unselected branch no longer causes valid SPARQL result rows to be dropped.
eclipse-rdf4j/rdf4j · #6074
Standards correctness
RDF4J now defers constant-expression errors until evaluation so SPARQL OR, AND, IF, COALESCE, and BIND follow their defined branch and error semantics.
Problem
Precompilation immediately surfaced errors from constant expressions such as integer division by zero. That bypassed SPARQL's three-valued logical rules and lazy IF branches, so queries such as true OR error and IF(true, value, error) incorrectly lost matching rows.
Approach
Converts constant-folding failures into evaluation steps and defers preparation errors for OR, AND, and IF operands. Runtime evaluation can then apply the existing SPARQL rules, while BIND leaves an erroring expression unbound instead of failing the query.
Impact and scope
- Restores standards-defined result semantics for logical expressions and conditional branches instead of silently dropping valid rows.
- Resolves both the OR regression in GH-6056 and the unselected IF-branch regression in GH-6055.
- Covers every RDF4J QueryEvaluationMode and extends the correction across OR, AND, IF, COALESCE, and BIND.
- Targets the maintained patch-release branch while accounting for the adjacent constant-folding work already present on the development branch.
Validation
- Added a dedicated expression-semantics suite covering erroring operands and branches across every query-evaluation mode.
- Updated the filter-and-values rewrite regression to preserve the row whose unselected IF branch errors.
- The complete named hosted matrix passed formatting, compile, Java 11 and 25 builds, integration and slow tests, package assembly, frontend tests, and both E2E jobs; an upstream contributor confirmed the change was ready to merge.