Interaction of GRAPH graph patterns and subqueries
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 712
- Avg merge
- 15h 41m
- Merged PRs (30d)
- 53
Description
### Version
5.2.0
### Question
Hello,
I have some questions about the interaction of GRAPH graph patterns and subquries.
I am using version 5.2.0.
Assume the scenario described below.
First, I load a graph into two separate named graphs.
```sparql
LOAD INTO GRAPH ;
LOAD INTO GRAPH
```
Both graphs contain 16 triples.
The query provided below, returns the triples found in both graphs, which results in 32 solutions. Here, `?g` is always unbound.
```sparql
SELECT * WHERE {
GRAPH ?g {
{
SELECT ?s ?p ?o WHERE {
?s ?p ?o
}
}
}
}
```
The query provided below also returns 32 results. In this case, `?g` is always assigned a value (i.e., `` or ``)
```sparql
SELECT * WHERE {
GRAPH ?g {
{
SELECT * WHERE {
?s ?p ?o
}
}
}
}
```
I have the following questions:
- First, why do these queries return different results?
- Second, why does the second query return 32 results?
For both queries, I was expecting 64 results: Cartesian product between the results of the subqueries (32 results) and the possbible values for `?g` (2 named graphs).
Thank you in advance.
Contributor guide
Research direction
No source file or test entry point is named. Start by running the two supplied SPARQL queries on Jena 5.2.0 after loading the two named graphs, then inspect GRAPH and subquery variable-scope behavior. Done means providing a clear explanation of the differing bindings and result counts, or identifying a reproducible implementation defect.
Written by the indexing model from the issue text.
Assessment
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100