W3C home > Mailing lists > Public > www-rdf-interest@w3.org > November 2003

Re: Semantic Web Phase 2 Activity - Protocol - Query Language

From: Steve Harris <S.W.Harris@ecs.soton.ac.uk>
Date: Tue, 11 Nov 2003 18:48:55 +0000
To: www-rdf-interest@w3.org
Message-ID: <20031111184855.GN18188@ecs.soton.ac.uk>

On Tue, Nov 11, 2003 at 05:34:49 -0000, Seaborne, Andy wrote:
> Hi there - I have an example query with optional triples and I wondered what
> the various systems do with it:
> 
> Thanks to Jeremy Carroll for this example.
> 
> Consider the data:
> 
> <x> <p> <y> .
> <x> <q> <z> .
> 
> and the query:
> 
> [ <x> <p> ?a ]
> [ <x> <q> ?a ]
> 
> where [] is an optional match.
> 
> ?? Does the query match the data?

Yes, because you have all optional patterns, so it will match anything

> ?? What does it return?

?a = null (?a has no valid bindings)

> ?? Does it matter whether it is constructing a graph or returning variable
> bindings?

I hope not :) The possible graphs are:

<x> <p> ?a   or  <x> <p> ?a  or  <x> <q> ?a  or  [nothing]
<x> <q> ?a   
 
> PS Follow on problem - what if by inference <y> owl:sameAs <z> ?

Then the graph becomes (IIRC)

<x> <p> <y>
<x> <p> <z>
<x> <q> <y>
<x> <q> <z>

so you will get

?a = <y>
?a = <z>
?a = null

The all left joins case is not particularly interesting, I'm not even sure
you can express that in SQL.

- Steve
Received on Tuesday, 11 November 2003 13:49:43 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:44:45 UTC