W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > May 2011

Re: Proposal for simplifying FILTER semantics

From: Axel Polleres <axel.polleres@deri.org>
Date: Tue, 10 May 2011 15:16:14 +0100
Cc: <public-rdf-dawg-comments@w3.org>
Message-Id: <08827870-16BC-4EFC-A85B-C2C5697A02D4@deri.org>
To: Markus Krötzsch <markus.kroetzsch@comlab.ox.ac.uk>
Markus, 

This is in respons of your comments
 http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2011May/0000.html
and
 http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2011May/0003.html


I was looking at your page http://korrekt.org/page/The_State_of_the_UNION

First of all, it seems you disregard the power of BIND and EXISTS, new constructs in SPARQL1.1 which seems to solve your use cases.

E.g., BIND does the job for your first example:

 SELECT ?x WHERE {
  { ?x :population ?number FILTER( ?number>1000000 ) }
  UNION
  { BIND (:Luxemburg AS ?x ) ?x :population  ?number }
 }

and seems to cover your stated requirement that 

"* Define FILTER in such a way that it can *create* new solution mappings, just like BGP. "

The difference between FILTER and BIND - by design - is that BIND creates bindings while FILTER only filters solutions.


As for your second requirement:
"* Instead of applying filters after matching, the generated solution
mappings of a FILTER would directly be joined with other parts of the
query."
let's turn to your second example

 "Find all ?x locatedIn ?y, where ?y is the USA or a state of the USA."

Here, similar to above

 SELECT ?x WHERE {
  { BIND (:USA AS ?y) ?x locatedIn ?y }
  UNION
  { ?y :stateOf :USA . ?x locatedIn ?y }
 }

seems to do the job. Similarly, a FILTERs only version is possible, however, within FILTERs you can't use UNION, but you can use || in combination with EXISTS here to express the desired filter conditions over patterns:

 SELECT ?x WHERE {
   ?x locatedIn ?y 
   FILTER  ( ?y = :USA || EXISTS( ?y :stateOf :USA ) )
 }

the additional condition 

 "?y has at least 10 million inhabitants or is in the pacific"

can be added likewise.

Summarising, I think your request 

 "Concretely, one would need to make the following modifications:
    change the formal semantics to treat FILTERs like patterns, not
    like post-processing features, 
 "
is already addressed by the EXISTS feature of SPARQL 1.1 which readily provides this feature, and seems to address your use
case. Additionally, the new BIND feature allows you to create bindings.

Finally, as for your proposal in you second mail
 http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2011May/0003.html
Please note that your suggested change of the semantics would affect backwards compatibility with SPARQL1.0, which our charter explicitly discourages [1].

We'd appreciate if you could indicate whether this response adequately addresses your comment.

Regards,

Axel (on behalf of the SPARQL WG)

1. http://www.w3.org/2009/05/sparql-phase-II-charter.html#scope
Received on Tuesday, 10 May 2011 14:16:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 10 May 2011 14:16:44 GMT