Re: can subqueries be executed first in SPARQL? (no, no problem in example)

I should learn that SPARQL evaluation is strange, and not to doubt my
conclusions just because they end up with another way to say that SPARQL
evaluation is strange.  The example I sent out is fine.  (Well, except that I
should have the second argument to Project be a set of variables instead of a
single variable.)


On 06/27/2016 08:28 AM, james anderson wrote:
> 
>> On 2016-06-27, at 16:05, Peter F. Patel-Schneider <pfpschneider@gmail.com
>> <mailto:pfpschneider@gmail.com>> wrote:
>>
>> […]
>>
>> Project(
>>  { (x,:b) |
>>    eval( D(G),
>>      substitute(
>>        Join(
>>          Extend( Z, y, :c ) ,
>>          ToMultiset( Project( ToList( BGP(?z :d ?x) ) , z ) )
>>          )
>>        (x,:b) )
>>      ) /= { } } ,
>>  x
>>  )
>>
>> Project(
>>  { (x,:b) |
>>    eval( D(G),
>>        Join(
>>          Extend( Z, y, :c ) ,
>>          ToMultiset( Project( ToList( BGP(?z :d :b) ) , z ) )
>>          )
>>      ) /= { } } ,
>>  x
>>  )
> 
> if i follow this, this reduction obtains iff the project has no effect on the
> scope the binding for ?x which was established by the outer extend.
> is that intended?

I don't understand what you mean by this reduction obtaining depending on
scoping.  In SPARQL, substitute doesn't consider in-scope variables at all.

Substitute just substitutes every occurrence of a mapped variable with its
mapping, regardless of where the variable occurs.  So substitute substitutes
in the variable argument to Project (which causes problems), in the variable
argument to Extend (which causes problems), in the multisets that result from
VALUES (which causes problems), in expressions (which causes problems with
Bound), in BGPs (which doesn't cause semantic problems), and elsewhere.
(Exists and substitute also have problems with the categorization of their
arguments and return values as well.)

If the subquery was SELECT ?x ?z WHERE { ?z :d ?x }, ?x would still be
substituted.  Actually both occurrences of ?x would be substituted, resulting
in a Project with an IRI where there should be a variable.

The point of this example is to show a case where the definitions do not have
any anomalies and there are also no situations where it could be argued from
the definitions that the reduction does not apply.  Hence the BIND in the
EXISTS argument, which prevents simplification making the argument to the
exists be a ToMultiSet.

> best regards, from berlin,
> 
> 
> ---
> james anderson | james@dydra.com <mailto:james@dydra.com> | http://dydra.com

peter

Received on Monday, 27 June 2016 16:27:44 UTC