RE: Question about the syntax for queries

Alan, 
	As you point out the original 00 syntax was incorrect. That was an
error corrected in the 01 version. The correction in 01 probably needs
further work as well -- it defines AND and OR as accepting exactly
two-arguments instead of any list of 2 or more. If there are no objections
I'll go ahead and update the document to use the syntax you provided below.

-Saveen

-----Original Message-----
From: Babich, Alan [mailto:ABabich@filenet.com]
Sent: Friday, April 17, 1998 1:12 PM
To: Saveen Reddy (Exchange)
Cc: www-webdav-dasl@w3.org
Subject: Question about the syntax for queries


Sauveen:

The "00" spec. has

 <!ELEMENT and    (expr+) >
 <!ELEMENT or     (expr+) >

to define the syntax for "and" and "or" expressions. 
However, "and" and "or" are binary operators
(which we would like to extend to be n-ary operators, 
since they are associative and commutative). 
My understanding of "+" in XML is that it means 
"one or more". So, the way I read the above
syntax is that it allows an "and" expression to have
one operand. For example,

<d:and> 
    <d:term>
        <d:lt>
            <d:value> 
                <d:prop>X</d:prop>
            </d:value>
            <d:value>
                <d:literal>1</d:literal>
            </d:value>
        </d:lt> 
    </d:term
</d:and>

or, translating into the usual mathematical
notation, "AND X > 1".

However, "and" is not a unary operator, i.e., it takes 
at least two operands. So, shouldn't the syntax be

 <!ELEMENT and    (expr, expr+) >
 <!ELEMENT or     (expr, expr+) >

to force at least two operands for "and" and "or"?

Now, I realize that we could extend "and" and
"or" to unary operators by defining them to be
the identity operator if they have just one operand.
However, I would oppose that, as it would not be
doing a favor to any implementer translating
the XML query expression into SQL or whatever
he needs to translate it to. The implementer would have to 
make a special case out of that, but nothing
is gained for the effort. I would rather have
unary "and" and "or" operators be illegal
syntax by using the revised syntax shown above.

I'm new to XML, so I may have missed the point,
so, what are your comments?

Alan Babich

Received on Monday, 20 April 1998 17:11:25 UTC