W3C home > Mailing lists > Public > public-sparql-dev@w3.org > April to June 2016

Re: can subqueries be executed first in SPARQL?

From: Axel Polleres <droxel@gmail.com>
Date: Fri, 17 Jun 2016 09:52:38 +0200
Cc: public-sparql-dev@w3.org
Message-Id: <0CCEC4A7-E0E0-4B4C-BA69-8B7076EAAEAB@gmail.com>
To: james anderson <james@dydra.com>, pfpschneider@gmail.com
Hi all,

interesting discussion...

First, let me say that I find the claim that something is "broken" here exaggerated.
EXISTS is defined in a semantically unambiguous way, it is just what it is.

The corner case about blank nodes is still quite interesting.

On a side note, we had proposed a solution for this problem in XSPARQL [1,2]
where we treated the problem of matching blank nodes in nested queries (cf. page 12 of [1]) in a manner that might rather reflect what you're looking for.

best regards,
Axel


1. Stefan Bischof, Stefan Decker, Thomas Krennwallner, Nuno Lopes, Axel Polleres:
Mapping between RDF and XML with XSPARQL. J. Data Semantics 1(3): 147-185 (2012) 
http://link.springer.com/article/10.1007%2Fs13740-012-0008-7

2. http://xsparql.sourceforge.net/
--
url: http://www.polleres.net/  twitter: @AxelPolleres

> On 17 Jun 2016, at 03:58, james anderson <james@dydra.com> wrote:
> 
> good morning;
> 
>> On 2016-06-17, at 01:11, Peter F. Patel-Schneider <pfpschneider@gmail.com> wrote:
>> 
>>> […]
>> 
>> OOPS.  In my attempt to make an easy example I forgot that I needed to
>> worry about which variables can be reported back.  I also should avoid other
>> known problems with EXISTS (like using an in-scope variable as a SELECT
>> variable).
>> 
>> One fix is to go to something like
>> SELECT ?x WHERE {
>>   ?x :a ?y .
>>   FILTER EXISTS {
>>     SELECT ?z WHERE { ?z ?w ?v . FILTER sameTerm(?x,?y) }
>>   }
>> }
>> where evaluating the inner SELECT logically first results in no solutions
>> because ?x and ?y are unbound.
> 
> given this form:
> 
> Input:
> 
>  1 SELECT ?x WHERE {
>  2    ?x a ?y .
>  3    FILTER EXISTS {
>  4      SELECT ?z WHERE { ?z ?w ?v . FILTER sameTerm(?x,?y) }
>  5    }
>  6  }
> 
> Algebra structure:
> 
>  1 (base <http://example/base/>
>  2   (project (?x)
>  3     (filter (exists
>  4                (project (?z)
>  5                  (filter (sameTerm ?x ?y)
>  6                    (bgp (triple ?z ?w ?v)))))
>  7       (bgp (triple ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?y)))))
> 
> why would the result change were the project evaluated logically later?
> 
> best regards, from berlin,
> ---
> james anderson | james@dydra.com | http://dydra.com
> 
> 
> 
> 
> 
> 
Received on Friday, 17 June 2016 07:53:10 UTC

This archive was generated by hypermail 2.3.1 : Friday, 17 June 2016 07:53:11 UTC