- From: Seaborne, Andy <andy.seaborne@hp.com>
- Date: Thu, 28 Jun 2007 16:30:46 +0100
- To: Steve Harris <steve.harris@garlik.com>
- CC: RDF Data Access Working Group <public-rdf-dawg@w3.org>
Steve Harris wrote: > On 28 Jun 2007, at 14:10, Seaborne, Andy wrote: >> >> Steve Harris wrote: > >>>> This is not the same case as the next example because of teh >>>> extra {} below: This is: >>>> >>>> (leftjoin >>>> (BGP [triple ?person :department ?dept]) >>>> (BGP [triple ?person :project ?proj]) >>>> (= ?dept <http://example/technology>)) >>> Yeah, Lee explained that to me on IRC, I meant to post something >>> saying what I'd missed last night, but forgot. Sorry. >>> I have {} blindness apparently, my mental parser just chops them out. >>> I do regard it as odd (and undesirable) that >>> :x :p ?v . { :x :q ?w . OPTIONAL { :x :p ?v2 } FILTER (...) } >>> is different to >>> :x :p ?v . :x :q ?w . OPTIONAL { :x :p ?v2 FILTER (...) } >>> but that's maybe just down to my defective mental parser :) >> It's a consequence of bottom-up evaluation. The {} have scope >> implications. > > Yes, but only in some cases it seems. > >> Consider evaluating some function, which has two arguments each of >> which use a variable x (could be a relational algebra but the point >> is general evaluation) >> >> function(A(x), B(x)) >> >> Does B(x) see the value of x from A(x)? Bottom up, the answer is >> "no": the evaluation of A(x) and B(x) are isolated from each other. > > Well, it depends what you mean by "see" surely? It's an > implementation decision whether you pass values of x on, you can do A > (x1), b(x2), x = x1 U x2 if you like. Yes - and passing the value on is OK if, and only if, it does not affect the overall results. That's an implementation detail (ARQ does it even in memory because it is such a huge saving on intermediate space). ... > > I think (hope) it's true that OPTIONAL(A, B, F) = (A ]X] (B s(F))), > modulo the scope thing. depends on what your notation means :-) Can s(F) access a binding from A? If so, it's true. ... > > Well, they behave differently. > > (1) ?x :p ?y { ?x :r ?w } OPTIONAL { ?x :q ?z } (leftjoin (join (BGP [triple ?x :p ?y]) (BGP [triple ?x :r ?w]) ) (BGP [triple ?x :q ?z]) ) > and > (2) ?x :p ?y OPTIONAL { ?x :r ?w } OPTIONAL{ ?x :q ?z } (leftjoin (leftjoin (BGP [triple ?x :p ?y]) (BGP [triple ?x :r ?w]) ) (BGP [triple ?x :q ?z]) ) so they are the same shape, with different operators at the first operation point. > > are different as far as I can tell. IIUC the righthand optional only > shares the middle ?x in (1) and both in (2)? > > It seems to me that the whole language would be much easier to > understand and implement if there were no scope. That would be the other design (top-down evaluation). For the well-designed queries that Jorge et al identify , the answers are the same. > > It's my feeling that the CR document does not explain them adequately > in any case. I've read every section that mentions "scope" (mostly > concerning only bNodes AFAICT) twice, and the whole document once > through, and I still don't see where it's defined, or see an > illuminating example. Open to suggestions here: it does fallout automatically by the algebra because it's written as functional evaluation which implies scoping: http://en.wikipedia.org/wiki/Evaluation_strategy and "Strict evaluation" made easier because there are no state-affecting side effects in evaluation. Andy > > - Steve -- Hewlett-Packard Limited Registered Office: Cain Road, Bracknell, Berks RG12 1HN Registered No: 690597 England
Received on Thursday, 28 June 2007 15:30:59 UTC