W3C home > Mailing lists > Public > www-ql@w3.org > April to June 2001

RE: Contents of WHERE a predicate?

From: Evan Lenz <elenz@xyzfind.com>
Date: Tue, 24 Apr 2001 16:11:38 -0700
To: "Howard Katz" <howardk@fatdog.com>, <www-ql@w3.org>
Message-ID: <BNEMICIEADHDDOIKLHNCOEDMECAA.elenz@xyzfind.com>
Howard Katz wrote:
> Maybe I wasn't clear enough. I'm trying to understand how two LET queries
> differ, when one uses an inline XPath predicate,
>
>      LET $book := //book[  title = 'Data on the Web'  ]
>      RETURN
>             $book
>
> and the other uses a WHERE:
>
>     LET $book := //book
>     WHERE $book/title = 'Data on the Web'
>     RETURN
>            $book
>
> I'm trying to see if there's anything interesting or significant to be
> learned when that's the only distinction between the two. If you
> change one
> of the LET statements to a FOR, then that's a different problem
> and not the
> one I'm looking at here.

Okay, I think you're implying that some rule dictates that the above two
queries mean the same thing. That's definitely not the case. In the first
query, the comparison is evaluated once for every book element in the
document. In the second query, the comparison is evaluated only once,
period. Think of "WHERE" as "IF" without an "ELSE" and maybe that will make
more sense.

Evan
Received on Tuesday, 24 April 2001 19:11:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 22 July 2006 00:10:17 GMT