- From: Peter F. Patel-Schneider <pfpschneider@gmail.com>
- Date: Thu, 23 Jun 2016 13:34:17 -0700
- To: RDF Data Shapes Working Group <public-data-shapes-wg@w3.org>
EXISTS in SPARQL can be fixed as follows: 1/ Add a new construct, Initial, to the SPARQL syntax and algebra. Initial will be used to set up the initial multiset of solution mappings inside an EXISTS. 2/ When collecting FILTER elements replace EXISTS{P} in the filter expression with exists(Initial(t),translate( { Initial(t) P' } )) where t is a fresh token and similarly for NOT EXISTS{P}. If P is a SubSelect then P' is { P } otherwise P' is just P. 3/ Translate Initial(t) as itself. 4/ Change the definition of the exists function to: Let u be the current solution mapping for a filter, t a token, and P a graph pattern: The value exists(Initial(t),P) given D(G) is true iff eval(D(G),P') is a non-empty sequence, where P' is P with Initial(t) replaced by { u }. Pre-binding can be specified in a very similar fashion. Pre-binding just adds Initial(0) to the query's WHERE clause just as EXISTS does to its argument and evaluates the query by replacing the Initial(0) by a solution mapping mapping the pre-bound variables to the desired values. Pre-binding can even be generalized to use a multiset of solution mapppings. Peter F. Patel-Schneider
Received on Thursday, 23 June 2016 20:34:51 UTC