#470 [BRIDGE] Add Minus/Optional conversion#483
Conversation
Test Results 431 files 431 suites 21s ⏱️ Results for commit 09ee2bd. ♻️ This comment has been updated with latest results. |
|
|
I added integration coverage for the full next bridge path and fixed a MINUS scoping issue found by those tests. Variables that only appear inside MINUS are no longer resolved as visible body variables for SELECT, ORDER BY, DESCRIBE, or CONSTRUCT, while OPTIONAL variables remain visible as expected. |
|
There was a problem hiding this comment.
Pull request overview
This PR tightens MINUS scoping semantics in the SPARQL bridge so that variables that occur only inside MINUS { ... } are treated as internal evaluation nodes (not visible/projectable bindings), and it adds tests to lock down OPTIONAL/MINUS compilation structure and scoping behavior.
Changes:
- Update
CoreseAstQueryBuilderto resolve “visible” variables from the outer pattern scope only (excluding MINUS/EXISTS-collected query nodes) for projection/DESCRIBE/ORDER BY/CONSTRUCT-template variable reuse. - Add/extend unit tests covering OPTIONAL/MINUS compilation shape and the visibility rules (SELECT *, explicit projection, ORDER BY, DESCRIBE, CONSTRUCT template).
- Introduce a dedicated minus-scope test validating how KGRAM collects pattern nodes vs query nodes.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/fr/inria/corese/core/next/query/impl/sparql/bridge/CoreseAstQueryBuilder.java | Restricts variable resolution to nodes visible from the outer pattern scope (avoids leaking MINUS-only variables into projection, ORDER BY, DESCRIBE, and template node reuse). |
| src/test/java/fr/inria/corese/core/next/query/impl/sparql/bridge/WhereCompilerTest.java | Adds tests ensuring OPTIONAL/MINUS are compiled with the expected grouping/associativity and that OPTIONAL-local filters stay inside the OPTIONAL right-hand side. |
| src/test/java/fr/inria/corese/core/next/query/impl/sparql/bridge/CoreseAstQueryBuilderTest.java | Adds tests asserting SELECT * / explicit projection / ORDER BY behavior for MINUS-only vs OPTIONAL-introduced variables. |
| src/test/java/fr/inria/corese/core/next/query/impl/sparql/bridge/CoreseAstQueryBuilderMinusScopeTest.java | New test verifying MINUS-only variables are collected as query nodes (not pattern nodes), while OPTIONAL variables remain in the outer pattern scope. |
| src/test/java/fr/inria/corese/core/next/query/impl/sparql/bridge/CoreseAstQueryBuilderDescribeTest.java | Adds regression coverage: DESCRIBE must reject variables only occurring in MINUS. |
| src/test/java/fr/inria/corese/core/next/query/impl/sparql/bridge/CoreseAstQueryBuilderConstructTest.java | Adds regression coverage: template variables that only occur in MINUS remain “fresh” template vars and must not reuse internal MINUS nodes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.