- From: Lee Feigenbaum <lee@thefigtrees.net>
- Date: Mon, 06 Jul 2009 20:58:36 -0400
- To: Eric Prud'hommeaux <eric@w3.org>
- CC: public-rdf-dawg@w3.org
Eric Prud'hommeaux wrote: > I've been noodling on this for a while, trying to see practical > differences between MINUS (evaluated purely bottom-up) and UNSAID > (which appears to seed the outermost BGP with variable bindings from > outside). > > I implemented UNSAID probably 6 years ago in Algae2, and I complained > bitterly that the bottom-up semantics of SPARQL were confusing for > users. Despite that, I have to say that MINUS is much more clear to me > as UNSAID carries variable bindings into nested evaluations in ways I > don't fully understand. For the moment, I'm excerpting only to the "real" data ones, since I find them a lot easier to think about. > > Data D3 > _:eric :givenname "eric"; :holdsAccout <act1>. <act1> :accountName "eric". > _:bobS :givenname "bob" ; :holdsAccout <act2>. <act2> :accountName "bobs". > _:eve :givenname "eve" ; :holdsAccout <act3>. > ( > or in tabular form for brevity: > givenname holdsAccount accountName > _:eric "eric" <act1> "eric" > _:bobS "bob" <act2> "bobs" > _:eve "eve" <act3> > ) > > Find the folks for whom I need to create accounts based on their given name: > > Query M3: > ?who foaf:givenname ?name > MINUS { > ?who foaf:holdsAccount ?act > OPTIONAL { > ?act foaf:accountName ?name . > } > } > Result M3: > ?who ?name ?who ?act ?name ?who ?name > _:eric "eric" _:eric <act1> "eric" _:bobS "bob" > _:bobS "bob" - _:bobS <act2> "bobS" = _:eve "eve" > _:eve "eve" _:eve <act3> > > > Query U3: > ?who foaf:givenname ?name > MINUS { > ?who foaf:holdsAccount ?act > OPTIONAL { > ?act foaf:accountName ?name . > } > } Do you mean s/MINUS/UNSAID, I imagine > Result U3 (extrapolated from UNSAID results above): > ?who ?nam > _:eve "eve" If I understand UNSAID correctly, you'd do the above MINUS query as: ?who foaf:givenname ?name . UNSAID { ?who foaf:holdsAccount ?act . ?act foaf:accountName ?name . } "People with a certain name for whom it is unsaid that their account has the same name." Is that right or wrong? If it's right, I find (to me) the UNSAID way to be a much more natural way of writing this query - I'm not actually convinced the MINUS version is any clearer than OPTIONAL + !bound :-) Lee > > > Note, these are untested, please verify.
Received on Tuesday, 7 July 2009 00:59:33 UTC