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

Re: Negation section text updated.

From: Steve Harris <steve.harris@garlik.com>
Date: Thu, 20 May 2010 09:23:07 +0100
Cc: SPARQL Working Group <public-rdf-dawg@w3.org>
Message-Id: <A964A74B-393F-4333-BA2C-6A241F774AA6@garlik.com>
To: Olivier Corby <Olivier.Corby@sophia.inria.fr>
On 2010-05-20, at 08:27, Olivier Corby wrote:

> Some remarks on negation.
> 
> 
> 
> 8 Negation
> 
> "one based filtering results"
> ->
> one based on filtering results
> 
> 
> 8.1 Filtering Using Graph Patterns
> 
> "Filering of query solutions"
> ->
> Filtering
> 
> 
> Note that there are two syntax for negation :
> 
> filter(not exists PAT)
> 
> filter(! exists PAT)

However, NOT doesn't appear to by a synonym of !, so it's not legal to write FILTER(NOT ?x=1), which seems a little odd.

I think we should either add a NOT operator, or remove NOT from EXISTS, and just use !.

> 8.1.2 Testing For the Presence of a Pattern
> 
> EXISTS { ?person foaf:name ?name }
> ->
> FILTER EXISTS { ?person foaf:name ?name }
> 
> 
> 8.2 Removing bindings
> 
> "then to calculates"
> ->
> then calculates
> 
> 
> 8.3 Relationship and difference between NOT EXISTS and MINUS
> 
> evaulation
> ->
> evaluation
> 
> 
> "Note: NOT EXISTS as a graph pattern is translated into an
> algebra filter and positioned exactly where it occurs in the graph pattern,
> unlike a FILTER expression which is applied over the whole group it occurs
> in, as done during algebra translation. See below."
> 
> Isn't this note obsolete as NOT EXISTS is proposed to be a filter ?
> 
> 
> 8.3 Relationship and difference between NOT EXISTS and MINUS
> 
> Introduction to Negation :
> "The SPARQL query language incoporates two styles of negation, [one ...] and one based on removing solutions related to another pattern."
> 
> PREFIX : <http://example/>
> SELECT *
> {
> ?s ?p ?o
> MINUS { :a :b :c }
> }
> 
> evaluates to result set with one query solution:
> 
> <http://example/a> <http://example/b> <http://example/c>
> 
> 
> So I write a MINUS to remove solution :a :b :c and I get solution :a :b :c

Well, { :a :b :c } is a pattern, not a solution, so I don't understand the source of confusion.

{ ?s ?p ?o . FILTER(?s=:a && ?p=:b && ?o=:c) } has zero or more solutions, which are what you expected I think, but it's still a pattern. There is probably a more elegant way to write that with BINDINGS, but I'm not that familiar with it.

- Steve

-- 
Steve Harris, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  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 Thursday, 20 May 2010 08:50:16 GMT

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