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

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