- From: <bugzilla@wiggum.w3.org>
- Date: Fri, 07 Oct 2005 16:48:38 +0000
- To: public-qt-comments@w3.org
- Cc:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=2331
Summary: FLWORExpr and QuantifiedExpr symmetry.
Product: XPath / XQuery / XSLT
Version: Last Call drafts
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: XQuery
AssignedTo: chamberl@almaden.ibm.com
ReportedBy: dholmes@tibco.com
QAContact: public-qt-comments@w3.org
In studying FLWOR and Quantified expressions together, I noted some
differences that struck me as rather odd and indicated that the Quantified
expression might be incomplete.
1. FLOWRExpr supports assignment of a full sequence to a variable whereas
QuantifiedExpr does not. More precisely, FLWORExpr supports both "in" and ":="
clauses whereas QuantifiedExpr only supports "in".
2. FLOWRExpr supports positional variables for its "in" clause whereas
QuantifiedExpr does not.
In addition, I had also wondered whether the use of both "for" and "in"
together, and "let and "::=" together was somewhat redundant. The grammar
requires me to prefix a "for" or a "let" token when the "=" or "::=" token
already defines my intention (There may be some practical parser consideration
I'm missing here).
It seems to me that there might be a more uniform syntax that solves all of
these problems and also emphasizes the functional nature of the language.
ReturnExpr ::= "given" BindingSpecification WhereClause?
OrderByClause? "return" ExprSingle
QuantifiedExpr ::= "given" BindingSpecification ("some"|"every") ExprSingle
BindingSpecification ::= (InClause | AssignClause)+
InClause ::= "$" VarName TypeDeclaration? "in" ExprSingle PositionalVar?
AssignClause ::= "$" VarName TypeDeclaration? ":=" ExprSingle
I've suggested moving the PositionalVar to the end to simplify parsing.
Examples:
given $x in (1,2,3), $y := (2,3,4) return $x + $y
if (given $x in (1,2,3), $y := (2,3,4) some $x + $y = 4) then ...
Received on Friday, 7 October 2005 16:50:33 UTC