Re: Issue-3 - Blank nodes substituted into BGPs act as variables

On Jul 14, 2016, at 9:57 AM, Peter F. Patel-Schneider <pfpschneider@gmail.com> wrote:
> 
> Both expectations and behaviour here are consistent with joining a
> single-element multiset of solution bindings to the unmodified BGP.  Given
> this, my view is that EXISTS should be defined in this way.
> 
> That is, the pattern that is evaluated for this EXISTS should be
> 
> Join( { { (?s, _:s1) } }, BGP(?s :p 1) )
> 
> instead of
> 
> BGP(_:s1 :p 1)
> 
> I believe that this approach is suitable not just here but as the complete
> definition of EXISTS.  The details of the approach involve injecting a special
> syntactic token into the argument of EXISTS that is then replaced by the
> multiset during Filter evaluation.  Variations of this approach are possible,
> matching much of the behaviour of different SPARQL implementations of EXISTS.

That seems like a reasonable approach when the EXISTS pattern is just a BGP, but doesn't it quickly fail when the pattern is more complex?

SELECT * WHERE { ?s :p ?o FILTER EXISTS { ?x :q ?y FILTER(?y = ?o) } }

If you inject a multiset to be joined at the top level of the exists pattern, it will join with the filter, right? But the filter depends on the substituted value of ?o being available, so will necessarily fail as ?o will always be unbound during evaluation.

.greg

Received on Thursday, 14 July 2016 17:06:27 UTC