- From: Jerome Simeon <simeon@research.bell-labs.com>
- Date: Tue, 17 Jul 2001 12:06:53 -0400
- To: "Leonidas Fegaras" <fegaras@lambda.uta.edu>
- Cc: www-xml-query-comments@w3.org, simeon@research.bell-labs.com
Dear Leonidas, This is a response to the following message, which you posted to the XML Query Working Group's comments list: http://lists.w3.org/Archives/Public/www-xml-query-comments/2001Jun/0052.html > > In section 6.2.4.1 (boolean operators) you expressed the semantics of > boolean operators using (simulated) existential quantification. > This may not work very well for the following query: > > for $a in //book > where $a/author/firstname/text() = "John" > and $a/author/lastname/text() = "Smith" > return $a/title > > because it will succeed for the following book: > > <book> > <author><firstname>John<firstname/><lastname>Walter</lastname></author> > <author><firstname>Jim<firstname/><lastname>Smith</lastname></author> > <title>...</title> > </book> > The semantics given in the version of the Formal semantics document reflects the existential quantification of XPath 1.0 [1]. As your query applies a selection at the level of each book, the path expressions $a/author/firstname/text() and $a/author/lastname/text() = "Smith" will indeed return a sequence of values. To deal with that problem, XPath 1.0 relies on an existential quantification for the semantics of predicates. This semantics facilitates querying for well-formed documents, in the context where no schema information is available. In order to select the title of books for which there is one author whose first name is "John" and last name is "Jim", one should write the following query: for $a in //book, $b in $a/author where $b/firstname/text() = "John" and $b/lastname/text() = "Smith" return $a/title In that case, the path expressions $b/firstname/text() and $b/lastname/text() will both return a unique value and existential quantification will not cause a problem. > > An alternative is to enforce the results of [[ E1 ]] and [[ E2 ]] in > [[ E1 = E2 ]] to be singletons. If this is not what the user intended, > then she may still use explicit existential quantification in the query. > I don't feel very strongly about this, but whatever you choose, > you should make it clear with examples. > Thank you for that concrete suggestion. The XML Query working group is aware of some of the problems raised by implicit existential quantification (See [Issue 24 : XPath Type Coercions (xquery-xpath-coercions)] in the XQuery 1.0 document [2]). As we investigate alternatives semantics, we will certainly take your proposal into account. > > By the way, you don't need the outer semantic brackets [[]] at the > righthand sides of the equations in 6.2.4.1. > > A minor typo: At the end of 6.2.1.3: > [[ E/DATA() ]] ==> for $v1 in [[ E ]] return > typed-value([[ E ]]) > should be: > [[ E/DATA() ]] ==> for $v1 in [[ E ]] return > typed-value($v1) > You are right, these are mistakes in the current document. Thank you for pointing these out. We will make the corresponding corrections in the next version of the XQuery 1.0 Formal Semantics document. We appreciate your feedback on the XML Query specifications. Please let us know if this response is satisfactory. If not, please respond to this message, explaining your concerns. Jerome Simeon, On behalf of the XML Query Working Group. References [1] XPath World-Wide Web Consortium XML Path Language (XPath) : Version 1.0. Recommandation, November, 1999. http://www.w3.org/TR/xpath.html [2] XQuery 1.0: An XML Query Language W3C Working Draft 07 June 2001 http://www.w3.org/TR/xquery/ Leonidas Fegaras <fegaras@lambda.uta.edu> writes: > > I was very pleased to read the new formal semantics for XQuery. > It helped me understand XQuery better. I have a comment though: > > In section 6.2.4.1 (boolean operators) you expressed the semantics of > boolean operators using (simulated) existential quantification. > This may not work very well for the following query: > > for $a in //book > where $a/author/firstname/text() = "John" > and $a/author/lastname/text() = "Smith" > return $a/title > > because it will succeed for the following book: > > <book> > <author><firstname>John<firstname/><lastname>Walter</lastname></author> > <author><firstname>Jim<firstname/><lastname>Smith</lastname></author> > <title>...</title> > </book> > > An alternative is to enforce the results of [[ E1 ]] and [[ E2 ]] in > [[ E1 = E2 ]] to be singletons. If this is not what the user intended, > then she may still use explicit existential quantification in the query. > I don't feel very strongly about this, but whatever you choose, > you should make it clear with examples. > > By the way, you don't need the outer semantic brackets [[]] at the > righthand sides of the equations in 6.2.4.1. > > A minor typo: At the end of 6.2.1.3: > [[ E/DATA() ]] ==> for $v1 in [[ E ]] return > typed-value([[ E ]]) > should be: > [[ E/DATA() ]] ==> for $v1 in [[ E ]] return > typed-value($v1) > > Best regards > Leonidas Fegaras > Department of Computer Science and Engineering > The University of Texas at Arlington > 416 Yates Street, 301 Nedderman Hall > P.O. Box 19015 > Arlington, TX 76019 > > email: fegaras@cse.uta.edu > web: http://lambda.uta.edu/ > phone: (817) 272-3629 > fax: (817) 272-3784
Received on Tuesday, 17 July 2001 12:08:03 UTC