Re: Scope of blank nodes in TriG?

On 2011-10-14, at 11:57, Ian Davis wrote:

> On Fri, Oct 14, 2011 at 11:45 AM, William Waites <wwaites@tardis.ed.ac.uk> wrote:
> On Fri, 14 Oct 2011 10:45:34 +0100, Ian Davis <ian.davis@talis.com> said:
> 
>    iand> Example Document 3 in the TriG spec[1] shows the same blank
>    iand> node label being used in different graphs. My interpretation
>    iand> of the example is that those blank nodes are distinct,
>    iand> i.e. the scope of blank node labels is the graph not the
>    iand> TriG document. How do the main graph stores behave? Is it
>    iand> possible to put the same blank node into two different
>    iand> graphs? If so, this information would not be serializable in
>    iand> TriG if my interpretation is correct.
> 
> I agree with your interpretation. However 4store appears to have
> different behaviour here:
> 
>    @prefix ex: <http://example.org/>.
> 
>    ex:g1 {
>      _:s a ex:T
>    }
> 
>    ex:g2 {
>      _:s a ex:T
>    }
> 
> And this query:
> 
>    SELECT * WHERE {
>        { GRAPH <http://example.org/g1> { ?s ?p ?o } } UNION
>        { GRAPH <http://example.org/g2> { ?s ?p ?o } }
>    }
> 
> Shows the bnodes as having been merged when you run it here:
> 
>    http://gallows.inf.ed.ac.uk/data/test/
> 
> (note, I converted the TriG document to N-Quads to import it but I
> don't think that should matter)
> 
> 
> I think  it does matter. What was the N-Quads document that was thew result of the conversion.

Agreed, but also the Trig support in 4store is pretty recent, so probably didn't have the philosophical aspects deeply though out.

> For comparison I loaded the following quads into Jena/TDB
> 
> _:bnode <http://example.com/p> "foo" <http://example.com/g1> .
> _:bnode <http://example.com/p> "bar" <http://example.com/g2> .
> 
> And get merged results from the query "describe ?s where { graph ?g {?s ?p ?o}}"
> 
> [] <http://example.com/p> "foo" ; <http://example.com/p> "bar" .

I would agree with that behaviour for nquads, as there's no obvious syntactic scope, or other rationale for scoping bNodes in nquads.

I have no strong feelings on what Trig should do, but if bNodes are allowed to span graphs, but scoped to { … } in Trig, then stores would have to skolemise on export to preserve the relationship. That's not the end of the world.

- Steve

-- 
Steve Harris, CTO, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD

Received on Friday, 14 October 2011 11:09:45 UTC