- From: Leigh Dodds <leigh@ldodds.com>
 - Date: Fri, 1 Feb 2008 20:39:28 +0000
 - To: "Lee Feigenbaum" <lee@thefigtrees.net>
 - Cc: "Richard Newman" <rnewman@franz.com>, "Max Voelkel" <voelkel@fzi.de>, public-sparql-dev@w3.org
 
> This should work:
>
> SELECT ?x {
>    ?x a ex:A .
>    OPTIONAL {
>      ?x a ?type .
>      FILTER(?type != ex:A)
>    }
>    FILTER(!bound(?type))
> }
>
> The OPTIONAL here tries to find a different type for the same resource
> (?x). If it succeeds then ?type is bound to a second class, so we filter
> out that case at the top-level.
And it does. I just ran it twinkle and it produces the expected
single result.
Nice work. I spent a long time scratching my head with that one.
Didn't occur to me to split the FILTERs into the separate OPTIONAL
patterns.
Fun!
L.
Received on Friday, 1 February 2008 20:39:41 UTC