You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enforce SPARQL 1.1 blank node scope validation during parsing and semantic analysis. According to W3C SPARQL 1.1 (§5.1.1 & §4.1.4), a blank node label (e.g. _:a) is scoped strictly to a single Basic Graph Pattern (BGP). Reusing the same label across disjoint BGPs (e.g. across UNION, OPTIONAL, GRAPH, or separate pattern blocks) is a syntax/scope violation and must be rejected.
Target Branch
Branch: feature/corese-next
Specification & Semantics
# VALID: same label reused within the same BGPSELECT*WHERE {
_:a :p ?x .
_:a :q ?y .
}
# INVALID: same label reused across distinct BGPsSELECT*WHERE {
{ _:a :p ?x }
UNION
{ _:a :q ?y }
}
In termFromBlankNode(SparqlParser.BlankNodeContext ctx), blank node labels are currently collected globally in blankNodeLabels without tracking their declaring BGP.
Scope Validation:
Implement validation (either during AST construction or via a BlankNodeScopeValidationRule in fr.inria.corese.core.next.query.impl.sparql.parser.semantic.rule).
Reject with QuerySyntaxException / QueryValidationException when a label appears in more than one distinct BGP.
Targeted W3C SPARQL 1.0 / 1.1 Test Cases
syn-bad-UNION-breaks-BGP
syn-bad-OPT-breaks-BGP
syn-bad-GRAPH-breaks-BGP
syn-blabel-cross-union-bad
syn-blabel-cross-optional-bad
syn-blabel-cross-graph-bad
syn-bad-34.rq through syn-bad-38.rq
Verification
Unit tests (corese-core):
./gradlew test --tests "fr.inria.corese.core.next.query.impl.sparql.parser.SparqlParserValidationTest"
W3C conformance (corese-w3c):
./gradlew test --tests "fr.inria.corese.w3c.sparql10.Sparql10DynamicTest"
Acceptance Criteria
Reusing a blank node label within the same BGP is accepted.
Reusing a blank node label across UNION, OPTIONAL, GRAPH, or disjoint BGPs is rejected.
The 11 targeted syn-bad-* and syn-blabel-* tests pass in Sparql10DynamicTest.
Activity
[-][Query] Implement SPARQL negative syntax rejection and blank node scoping in ANTLR parser[/-][+][Query] Enforce SPARQL 1.1 blank node scope validation across graph patterns[/+]remiceres commentedon Sep 24, 2026
Resolved by #611 (via #607). SPARQL 1.1 BGP blank node scoping fully enforced.