Re: definition of top-level binding injection for EXISTS

Peter,

Is this correct?

{
    :subj :pred ?o .
    FILTER EXISTS { GRAPH <g> { ?s ?p ?z . FILTER ( ?z > ?o ) } }
}

=>

{ Initial(t) GRAPH <g> { ?s ?p ?z FILTER ( ?z > ?o ) } }

so the FILTER ( ?z > ?o ) has unbound ?o when evaluated.

     Andy

On 23/09/16 20:59, Peter F. Patel-Schneider wrote:
> Here is the complete proposal for the initial top-level-only binding
> injection definition of EXISTS, taken from a paper by David Martin and
> myself to be presented at ISWC in October.
>
> 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.  It will work much like VALUES except that it will transfer
>    solution mappings through the EXISTS instead of setting up a constant
>    solution mapping.  Initial is a new option for GraphPatternNotTriples in
>    the SPARQL syntax but cannot show up in actual SPARQL code, just during
>    the SPARQL translation process.  Initial takes a single argument that is
>    a token (which can just be an integer).
>
> 2. When collecting FILTER elements replace EXISTS{pattern} in the filter
>    expression with
>      exists(t,translate( {Initial(t) pattern'}))
>    where t is a fresh token, and similarly for NOT EXISTS{pattern}.  Note
>    that the argument to translate, {Initial(t) pattern'} is SPARQL syntax.
>    If pattern is a SubSelect then pattern' is {pattern} otherwise pattern'
>    is just pattern.
>
> 3. Translate Initial(t) as itself.
>
> 4. Change the definition of the exists function to:
>
>    Let mu be the current solution mapping for a filter, t a token, and P a
>    graph pattern: The value exists(t,P) given D(G) is true iff eval(D(G),P')
>    is a non-empty multiset of solution bindings, where P' is P with (its
>    sole occurence of) Initial(t) replaced by mu.
>
>
> Pre-binding can be defined as performing this injection on the
> GroupGraphPattern of the top-level WhereClause of a query (or equivalent for
> certain query forms).
>
>
> peter
>

Received on Wednesday, 28 September 2016 23:49:48 UTC