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: Axel Polleres <axel.polleres@deri.org>
Date: Tue, 26 May 2009 13:12:10 +0100
Message-ID: <4A1BDC9A.3040305@deri.org>
To: Simon Schenk <sschenk@uni-koblenz.de>
CC: Steve Harris <steve.harris@garlik.com>, "Seaborne, Andy" <andy.seaborne@hp.com>, Ivan Mikhailov <imikhailov@openlinksw.com>, "public-rdf-dawg@w3.org" <public-rdf-dawg@w3.org>
Simon Schenk wrote:
> Am Dienstag, den 26.05.2009, 11:29 +0100 schrieb Steve Harris:
>> On 26 May 2009, at 11:10, Simon Schenk wrote:
>>
>>> Am Montag, den 25.05.2009, 17:48 +0000 schrieb Seaborne, Andy:
>>>
>>>> Simon/Eric - you gave do you have examples where either MINUS or  
>>>> EXISTS can not easily be used where EXISTS or MINUS can?
>>>>
>>>> The distinguishing example is helpful - seem to me that MINUS needs  
>>>> a slightly artificial form to introduce ?name to be set-compatible  
>>>> with the preceding pattern.  But is this an artefact of the example  
>>>> and is there a counter example of EXISTs having to be slightly  
>>>> artificial?
>>>>
>>>> http://www.w3.org/2009/sparql/wiki/index.php?title=Design:Negation#Distinguish_MINUS_from_UNSAID
>>> I don't think there are cases, which can not be expressed using one of
>>> the forms: EXISTS can be translated into MINUS by extending the  
>>> pattern,
>>> if necessary. However, MINUS really is a bit ugly in many cases.
>>>
>>>>> In addition, I still think that EXISTS without FILTER around are a  
>>>>> bit
>>>>> confusing, esp. if the next clause is OPTIONAL {...}.
>>>> I'm tending to both forms although underneath raw EXISTs because I  
>>>> thing using iut on its own is going to be common.  Internally, it  
>>>> behaves just like a FILTER which is not moved to the end of a BGP.
>>> I think FILTER better captures the intended semantics. I am not sure,
>>> whether an order dependent inline form is intuitive. On the other  
>>> hand,
>>> aesthetically I like it better. :) Why not completely translate it  
>>> into
>>> a FILTER, including a reordering?
>> Well, that means that you have to chuck in extra {}s to say what you  
>> mean, but I'm somewhat sympathetic to the viewpoint. Having two  
>> syntaxes that do the same thing is a bit odd. I prefer it outside  
>> FILTER() myself, but not that strongly.
> 
> Moreover, we still have !BOUND...
> 
>> Won't having it inside FILTER weird the syntax a fair bit? EXISTS(...)  
>> will have to include the whole BGP enchilada... hopefully except  
>> FILTER and EXISTS :)
> 
> You will need a nesting of FILTER / EXISTS to express double negation.
> Yes, there are real world use cases. ;-)

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.

(this said, really not sure where my preference lies... just wanted to 
point out where the subqueries in FILTERs motivation came from from my 
point of view)

Axel

-- 
Dr. Axel Polleres
Digital Enterprise Research Institute, National University of Ireland, 
Galway
email: axel.polleres@deri.org  url: http://www.polleres.net/
Received on Tuesday, 26 May 2009 12:12:54 GMT

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