- From: Jos De_Roo <jos.deroo@agfa.com>
- Date: Sat, 18 Sep 2004 21:27:16 +0200
- To: "Steve Harris <S.W.Harris" <S.W.Harris@ecs.soton.ac.uk>
- Cc: public-rdf-dawg@w3.org, public-rdf-dawg-request@w3.org
SteveH wrote: > 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: > > SELECT $x > 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. :) Using a capability for multiple queries in the same request that would simply be SELECT ?X WHERE {?X a :Person . ?X a :DogOwner} SELECT ?X WHERE {?X a :Person . ?X :hasPet ?Y . ?Y a :Dog} returning (:Eddie) a q:Answer. (:Mitch) a q:Answer. -- Jos De Roo, AGFA http://www.agfa.com/w3c/jdroo/
Received on Saturday, 18 September 2004 19:27:59 UTC