Re: Query 1.1 Review

On 05/01/2010 1:39 PM, Matt Perry wrote:
> Hi,
>
> I wanted to get one clarification. See the comment below.
>
> Thanks,
> Matt
>
> Andy Seaborne wrote:
>>

>> The use in FILTER allows combining (with || because && does not add
>> anything - FILTERS in evolving && can be split up ) with other filter
>> tests e.g.
>>
>> FILTER ( EXISTS{:x :age "validated"} || ?age >= 21 )
>>
> Could we control the ordering with extra {} and just have EXISTS / NOT
> EXISTS apply to the whole pattern?
> Would
>
> { ?a :p1 ?b
> NOT EXISTS ( ?a :p2 ?c )
> ?a :p3 ?c }
>
> be equivalent to
>
> { { ?a :p1 ?b
> NOT EXISTS ( ?a :p2 ?c ) }
> { ?a :p3 ?c } }
>

Those two are equivalent and we could do that but I think it makes the 
more common usage harder which seems to me to be bad design.

Translation to the necessary algebra will put the filter (algebra 
operator) in the right place for evaluation so the filter is applied to 
the whol of a pattern - it just happens to be the "?a :p1 ?b" part.

There isn't a new filter-like operator for that.  At the algenbra level, 
there is only one "exists" (and "substitute") expression terms.

8.3 Mapping from Abstract Syntax to Algebra ==>

{ ?s rdf:type <t>
   NOT EXISTS { ?s <p> ?v }
   ?s :p ?o
}
(join
    (filter (not (exists { ?s <p> ?v }))
       (bgp (triple (?s rdf:type <t>))))
    (bgp (triple (?s :p ?o))))


Also there is the text:
[[
Note: NOT EXISTS as a graph pattern operator between patterns P1 and P2 
is equivalent to the filter form:

P1 NOT EXISTS {P2}

{P1 FILTER (NOT EXISTS {P2})}
]]

The join here also appears with other pattern operators like several 
GRAPH or GRAPHS and BGPs mixed.

	Andy

Received on Tuesday, 5 January 2010 13:53:57 UTC