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

-- 
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 10:34:01 UTC