W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > January to March 2010

Re: Query 1.1 Review

From: Andy Seaborne <andy.seaborne@talis.com>
Date: Tue, 05 Jan 2010 13:53:25 +0000
Message-ID: <4B434455.50102@talis.com>
To: matthew.perry@oracle.com
CC: W3C SPARQL Working Group <public-rdf-dawg@w3.org>, steve.harris@garlik.com, "Das,Souripriya" <souripriya.das@oracle.com>


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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:41 GMT