W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2004

Re: sample query involving disjunction

From: Steve Harris <S.W.Harris@ecs.soton.ac.uk>
Date: Fri, 17 Sep 2004 10:57:45 +0100
To: public-rdf-dawg@w3.org
Message-ID: <20040917095745.GD11138@login.ecs.soton.ac.uk>

On Fri, Sep 17, 2004 at 02:42:37AM -0700, Rob Shearer wrote:
> A user wishes to find all the people who are either of type dog owner or own a pet who is  a dog. (In the common case of no inferencing this is a pretty realistic  query.) Some sample data:
> Rob type Person
> Eddie type Person
> Eddie type DogOwner
> Mitch type Person
> Mitch hasPet Fido
> Fido type  Dog
> query
> select $x
> where ($x type  Person)
>       (($x type DogOwner) OR
>        (($x hasPet $y) ($y type Dog))
> Is this query correct?

Looks good to me, an OPTIONAL equivalent would be:

WHERE ($x type Person)
OPTIONAL ($x type $typeA)
OPTIONAL ($x hasPet $y) ($y type $typeB)
AND $typeA = DogOwner || $typeB == Dog

[OT note] I found using $'s for this query quite distracting.

- Steve
Received on Friday, 17 September 2004 09:57:48 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:00:45 UTC