Hi Ralph,
The query examples are indeed logically equivalent, although they may appear
syntactically different.
No rearranging is necessary for a widespread SQL query interpreter to "make
sense" of the two latter queries, since the unary NOT operator takes
precedence over binary operators AND or OR.
The following two queries are cut and pasted from MS Access, where they
yield exactly the same results:
Query 2
=======
SELECT books.author, books.title
FROM books
WHERE books.author="ralph" AND Not books.title="the dreamer";
Query 2
=======
SELECT books.author, books.title
FROM books
WHERE Not books.title="the dreamer" AND books.author="ralph";
Best regards,
Poul Henrik
mailto:[log in to unmask]
-----Original Message-----
From: LeVan,Ralph [mailto:[log in to unmask]]
Sent: 24. september 2001 17:40
To: [log in to unmask]
Subject: Re: CQL NOT Operator
Yes, they are very different.
The third query depends on a unary NOT operator and would require
rearranging the query to have it make sense.
The second query also uses a unary NOT operator, but a simple parser could
accommodate the problem and treat the "AND NOT" as a single operator.
Ralph
> -----Original Message-----
> From: Poul Henrik Jørgensen [mailto:[log in to unmask]]
> Sent: Monday, September 24, 2001 11:30 AM
> To: [log in to unmask]
> Subject: Re: CQL NOT Operator
>
>
> Hi Ray,
>
> If we are inventing a new query syntax intended to be
> accessible to the rest
> of the World (i.e. outside the Z39.50 Community), we should
> assume that they
> are familiar with standard Boolean logic - not the Z39.50 Type-1 Query
> syntax.
>
> Is there any difference between the results of the following
> three queries?
>
> 1) Bib1.Author="Ralph" ANDNOT Bib1.Title="The Dreamer"
> 2) Bib1.Author="Ralph" AND NOT Bib1.Title="The Dreamer"
> 3) NOT Bib1.Title="The Dreamer" AND Bib1.Author="Ralph"
>
> Best regards,
> Poul Henrik
> mailto:[log in to unmask]
>
>
>
>
>
>
>
> Best regards,
> Poul Henrik
> mailto:[log in to unmask]
>
>
>
>
> -----Original Message-----
> From: Ray Denenberg [mailto:[log in to unmask]]
> Sent: 24. september 2001 16:22
> To: [log in to unmask]
> Subject: Re: CQL NOT Operator
>
>
> Poul Henrik Jørgensen wrote:
>
> > If alternatively we wish to introduce a new boolean
> operator composed of
> the
> > well binary operator AND in some combination with the unary
> operator NOT,
> > then we should call it something else e.g. either AND-NOT
> or NOT-AND.
>
> We're not introducing a new boolean operator. It's the same
> "and-not" that
> we
> have in the type-1 query. (If you want to view it as some
> combination of
> unary
> NOT and binary AND, fine, but that doesn't change the fact
> that it's the
> same
> binary and-not we've always had in Z39.50.)
>
> --Ray
>
> --
> Ray Denenberg
> Library of Congress
> [log in to unmask]
> 202-707-5795
>
|