Repository navigation
[Query] Enforce default vs named graph separation and variable graph iteration in SPARQL datasets #598
Copy link
Copy link
Closed
Labels
featureNew feature or capabilityNew feature or capabilityw3c-conformanceW3C standards compliance (SPARQL 1.1, Turtle, RDF 1.1)W3C standards compliance (SPARQL 1.1, Turtle, RDF 1.1)
Description
Summary
Ensure queries strictly respect the separation between the active default graph and named graphs in SPARQL dataset clauses (FROM / FROM NAMED), and that GRAPH ?g patterns properly iterate over available named graphs.
Target Branch
feature/corese-next
Specification & Semantics
According to W3C SPARQL 1.1 Query (§12 & §13):
- When a dataset is explicitly defined:
- Specifying
FROMclauses alone leaves the set of named graphs empty;GRAPH ?gorGRAPH <iri>must not match anything and must NOT fall back to storage named graphs. - Specifying
FROM NAMEDclauses alone leaves the default graph empty; triple patterns outside aGRAPHblock must evaluate against an empty default graph and must NOT fall back to the storage default graph.
- Specifying
- Triple patterns outside a
GRAPHblock must evaluate exclusively against the active default graph. - When evaluating
GRAPH ?g { ... }where?gis an unbound variable, execution must iterate over each active named graph defined in the dataset (or storage named graphs if no explicit dataset is defined), binding?gwithout matching default graph statements. - Queries combining
GRAPHwithUNIONpatterns must correctly preserve solutions from each branch.
Targeted W3C SPARQL 1.0 / 1.1 Test Cases
graph-02(Data: named graph / Query: default graph)graph-05(Data: default and named / Query: default graph)graph-07(Data: default and named / Query: all data by UNION)graph-08,graph-09,graph-10b,graph-11dataset-09b,dataset-10bJoin operator with Graph and Union
Technical Context & Points to Investigate
- In
StorageManagerProducer.java, examine how activefromandfrom namedrestrictions are propagated to statement patterns and whether missing restrictions fall back inappropriately to full store contents. - In
StorageManagerEdge.javaand candidate edge resolution, investigate whether variable graph patterns inGRAPH ?gcorrectly isolate named graphs from the default graph. - Recommend proceeding incrementally: first isolate and verify default graph scoping (
graph-02,graph-05), then address variable iteration andGRAPH-UNIONjoins in a separate step.
Acceptance Criteria
[ ] Reproducible unit tests demonstrate default graph isolation and named graph scoping.
[ ] Explicit datasets without FROM NAMED leave named graphs empty (no storage fallback).
[ ] Explicit datasets without FROM leave the default graph empty (no storage fallback).
[ ] GRAPH ?g binds exclusively to active named graphs.
[ ] Targeted W3C graph tests pass without regressions on existing passing tests.
[ ] 0 SonarLint issues and cognitive complexity < 15.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew feature or capabilityNew feature or capabilityw3c-conformanceW3C standards compliance (SPARQL 1.1, Turtle, RDF 1.1)W3C standards compliance (SPARQL 1.1, Turtle, RDF 1.1)
Activity
#598 [Query] Enforce default vs named graph separation and variable g…
Feature/598 query enforce default vs named graph separation (#610)
remiceres commentedon Sep 23, 2026
Resolved by #610. Default vs named graph separation and variable graph iteration are strictly enforced, passing all targeted W3C SPARQL graph and dataset tests.