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
Specification & Semantics
According to W3C SPARQL 1.1 Query (§12 & §13):
- When a dataset is explicitly defined:
- Specifying
FROM clauses alone leaves the set of named graphs empty; GRAPH ?g or GRAPH <iri> must not match anything and must NOT fall back to storage named graphs.
- Specifying
FROM NAMED clauses alone leaves the default graph empty; triple patterns outside a GRAPH block must evaluate against an empty default graph and must NOT fall back to the storage default graph.
- Triple patterns outside a
GRAPH block must evaluate exclusively against the active default graph.
- When evaluating
GRAPH ?g { ... } where ?g is 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 ?g without matching default graph statements.
- Queries combining
GRAPH with UNION patterns 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-11
dataset-09b, dataset-10b
Join operator with Graph and Union
Technical Context & Points to Investigate
- In
StorageManagerProducer.java, examine how active from and from named restrictions are propagated to statement patterns and whether missing restrictions fall back inappropriately to full store contents.
- In
StorageManagerEdge.java and candidate edge resolution, investigate whether variable graph patterns in GRAPH ?g correctly 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 and GRAPH-UNION joins 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.
Summary
Ensure queries strictly respect the separation between the active default graph and named graphs in SPARQL dataset clauses (
FROM/FROM NAMED), and thatGRAPH ?gpatterns properly iterate over available named graphs.Target Branch
feature/corese-nextSpecification & Semantics
According to W3C SPARQL 1.1 Query (§12 & §13):
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.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.GRAPHblock must evaluate exclusively against the active default graph.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.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 UnionTechnical Context & Points to Investigate
StorageManagerProducer.java, examine how activefromandfrom namedrestrictions are propagated to statement patterns and whether missing restrictions fall back inappropriately to full store contents.StorageManagerEdge.javaand candidate edge resolution, investigate whether variable graph patterns inGRAPH ?gcorrectly isolate named graphs from the default graph.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 NAMEDleave named graphs empty (no storage fallback).[ ] Explicit datasets without
FROMleave the default graph empty (no storage fallback).[ ]
GRAPH ?gbinds exclusively to active named graphs.[ ] Targeted W3C graph tests pass without regressions on existing passing tests.
[ ] 0 SonarLint issues and cognitive complexity < 15.