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

Re: [sub-select] Some examples and discussion

From: Steve Harris <steve.harris@garlik.com>
Date: Thu, 12 Mar 2009 16:23:00 +0000
Message-Id: <BA146DE4-162B-44E9-8DE2-21181DCC1CB9@garlik.com>
To: SPARQL Working Group <public-rdf-dawg@w3.org>
On 12 Mar 2009, at 13:43, Seaborne, Andy wrote:
>
>
>> -----Original Message-----
>> From: public-rdf-dawg-request@w3.org [mailto:public-rdf-dawg-
>> request@w3.org] On Behalf Of Steve Harris
>> Sent: 12 March 2009 10:33
>> To: SPARQL Working Group
>> Subject: Re: [sub-select] Some examples and discussion
>>
>> On 12 Mar 2009, at 06:39, Lee Feigenbaum wrote:
>>> The idea of using ASK queries in expressions appeals to me as well,
>>> though it doesn't necessarily read as well as !EXISTS in SQL. The
>>> verbosity is similar though, I guess.
>>
>> Similar, and it's one less bit of syntax. My personal preference is
>> for fewer, more flexible verbs. But it's just a matter of taste.
>>
>>> I'm curious as to the interplay between:
>>>
>>> projected expressions
>>> sub-selects
>>> assignment
>>>
>>> Is there a combination of these that makes the 3rd irrelevant? Or
>>> pairs of them that are far more useful when included together?
>>> That's the sort of thing I'm working to wrap my head around.
>>
>> Yes, if you have projected expressions then you effectively get
>> assignments:
>>
>>    SELECT ?x
>>    WHERE {
>>       ?x :age ?age .
>>       FILTER(?age >= ?min_age)
>>       (SELECT 18 AS ?min_age)
>>    }
>>
>> Is equivalent to:
>>
>>    SELECT ?x
>>    WHERE {
>>       ?x :age ?age .
>>       FILTER(?age >= ?min_age)
>>       LET(?min_age := 18)
>>    }
>
> Steve - good example because it's different and a bit more tricky.   
> Let (err - no pun intended) me work though the details.  This is a  
> more tricky example than the one I gave because syntactically you  
> assign after the use of ?min_age in the FILTER which raises the  
> necessary question of scope and order.

Yeah, I did that deliberately to provoke the question of scope. At the  
time of writing I was in favour of that working, but having doodled a  
bit I think it doesn't make much sense, and the scoping can be lexical  
order without any problems.

- Steve

-- 
Steve Harris
Garlik Limited
2 Sheen Road
Richmond  TW9 1AE

T   +44(0)20 8973 2465
F   +44(0)20 8973 2301
www.garlik.com

Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10  
9AD
Received on Thursday, 12 March 2009 16:23:40 GMT

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