Re: another problem with Proposal B

[Second half only.]

>> SELECT ?this WHERE {
>>   ?this a ex:good .
>>   FILTER EXISTS { { SELECT * WHERE { } }
>>                   BIND ( ?this AS ?that )
>>                   ?that a ex:bad } }
>>
>> peter
>>
>
> Simplification applies after syntax parsing, before evaluation.
>
> Inner "SELECT * {}" is a project of no variables of the unit table which is
> left as-is.  So no simplification.
>
> 18.2.4.4
> "The set PV is used later for projection."
>
> 18.2.5.2 Projection
> """
> The set of projection variables, PV, was calculated in the processing of
> SELECT expressions.
>
>     M := Project(M, PV)
> """
>
> There is something to account for in SELECT * but it's not simplification.
>
>     Andy


As far as I can tell the inner select is translated (see last example in
18.2.3) as
  ToMultiSet(Project(Z,{}))

The argument to EXISTS is translated (19.2.2.6) as
  Join( Extend(Join(Z,ToMultiSet(Project(Z,{}))),?that,?this),
     BGP(?that rdf:type ex:bad )

Simplification (18.2.2.8) then results in
  Join( Extend(ToMultiSet(Project(Z,{})),?that,?this),
     BGP(?that rdf:type ex:bad) )

So the EXISTS is translated to
  exists(
    Join( Extend(ToMultiSet(Project(Z,{})),?that,?this),
       BGP(?that rdf:type ex:bad) ) )

Evaluation of the EXISTS with ?this mapped to ex:i proceeds by first doing
the replacement, which ends up with something like
  Join( Extend(ToMultiSet(Project(Join(Z,{{?this,ex:i}}),{})),?that,?this),
     Join(BGP(?that rdf:type ex:bad),{{?this,ex:i}}) )
This is evaluated to
  Join( Extend({{}},?that,?this),
     Join(BGP(?that rdf:type ex:bad),{{?this,ex:i}}) )
and then to
  Join( {{}},
     Join(BGP(?that rdf:type ex:bad),{{?this,ex:i}}) )

The BIND then ends up not having any effect because ?this doesn't have a
binding when it is evaluated, due simplification removing the place where
the FILTER variables might have been joined in.

peter

Received on Tuesday, 18 April 2017 18:24:51 UTC