Re: GRAPH details and test cases

On 26 Jun 2006, at 14:35, Lee Feigenbaum wrote:

>
> "Seaborne, Andy" <andy.seaborne@hp.com> wrote on 06/26/2006  
> 05:13:26 AM:
>
>>> 1/ Nested GRAPH statements
>>>
>>> I didn't find any examples or tests that involved nested GRAPH
> statements,
>>> but the spec made it pretty clear what should happen and SPARQLer
> agrees.
>>>
>>> ng1.n3:
>>>
>>> :s :p :o, :o1 .
>>>
>>> ng2:n3:
>>>
>>> :s :p :o, :o2 .
>>>
>>> query:
>>>
>>> SELECT ?o
>>> FROM NAMED <ng1.n3>
>>> FROM NAMED <ng2.n3>
>>> {
>>>   GRAPH <ng1.n3> {
>>>     GRAPH <ng2.n3> {
>>>       :s :p ?o .
>>>     }
>>>   }
>>> }
>>>
>>> results:
>>>
>>> ?o/:o
>>> ?o/:o2
>>>
>>> why? GRAPH takes the given named graph and places it as the default
> graph
>>> in the RDF dataset against which the inner graph pattern is matched.
> So,
>>> nested graphs basically act as a stack of default-graph contexts for
> the
>>> graph patterns that they contain.
>>
>> What were you expecting?  GRAPH <ng2.n3> makes ng2:n3 the target
>> graph for the
>> pattern { :s :p ?o }, which gives the results shown.  In stack  
>> terms, it
> is a
>> stack of names, the active one being the stack front.  There's not
> merging of
>> graphs
>
> The results that I got were exactly what I was expecting. I was only
> including that case as a potential test case as it's potentially a
> non-obvious situation which would be good to include in the test  
> suite.

Given the behaviour of GRAPH <uri> { ... } I think it would be  
reasonable to expect the results to be limited to the intersection of  
the two graphs.

- Steve

Received on Monday, 26 June 2006 16:31:05 UTC