W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > April to June 2009

Re: [ACTION-18] use case on !ASK in FILTERS to emulate negation

From: Steve Harris <steve.harris@garlik.com>
Date: Tue, 26 May 2009 14:21:34 +0100
Cc: Axel Polleres <axel.polleres@deri.org>, "Seaborne, Andy" <andy.seaborne@hp.com>, Ivan Mikhailov <imikhailov@openlinksw.com>, "public-rdf-dawg@w3.org" <public-rdf-dawg@w3.org>
Message-Id: <34AD8090-4B5E-4694-B5BE-AD4C2C936F53@garlik.com>
To: Simon Schenk <sschenk@uni-koblenz.de>

On 26 May 2009, at 13:54, Simon Schenk wrote:

> Am Dienstag, den 26.05.2009, 13:12 +0100 schrieb Axel Polleres:
>
>> When thinking about subqueries in FILTERs instead of just as
>> UNSAID/NOTEXISTS, I had rather thought about use cases where the
>> subquery appears in a complex filter expression...
>>
>>
>> E.g. let's say you look for persons who don't have an email address
>> (foaf:mbox) but an foaf:mbox_sha1sum or a foaf:homepage.
>>
>>
>> SELECT ?x
>> { ?x a foaf:Person
>>   FILTER (  ! EXISTS{ ?x foaf:mbox [] }
>>            && ( EXISTS{ ?x foaf:mbox [] }
>>                 || EXISTS{ ?x foaf:homepage [] } ) )
>> }
>>
>>
>> How'd you write that with the non-filter version? How'd you write  
>> that
>> with the non-filter version? Probably here a version with UNION and
>> UNSAID instead would also not look much nicer.
>
> SELECT ?x
> { ?x a foaf:Person .
>  UNSAID {?x foaf:mbox []} .
>  { { ?x foaf:mbox_sha1sum }
>    UNION
>    { ?x foaf:homepage [] }
>  }
> }

Or

SELECT ?x {
   ?x a foaf:Person .
   ?x ?prop [] .
   UNSAID { ?x foaf:mbox [] }
   FILTER(?prop = foaf:mbox_sha1sum || ?prop = foaf:homepage)
}

- Steve

-- 
Steve Harris
Garlik Limited, 2 Sheen Road, Richmond, TW9 1AE, UK
+44(0)20 8973 2465  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10  
9AD
Received on Tuesday, 26 May 2009 13:22:24 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:38 GMT