- From: Michael Rys <mrys@microsoft.com>
- Date: Tue, 12 Sep 2006 11:40:06 -0700
- To: "Sudanagunta, Vas" <Vas.Sudanagunta@dig.com>, <public-qt-comments@w3.org>
- Message-ID: <07D2490E9E33124B8ED67F01E828B9E702768C8B@RED-MSG-70.redmond.corp.microsoft.com>
Dear Vas Sudanagunta Thanks you very much for your well-written change proposal. The XQuery working group reviewed your change proposal and decided to keep its current syntax because it felt that your proposal did not really address any blocking issue while it introduces a couple of new issues that the current syntax does not have. Some of the issues that we identified were: 1. Moving as first/as last towards the back poses problems to the parser. That's why we moved it earlier. 2. Adding the SiblingExpr as an additional component poses composability issues regarding the language: a. If you allow any expression, you can get very strange semantics like insert <a/> into /b after /c. What does that mean? b. If you restrict the expressions to relative paths: insert <a/> into /b after c/d vs into /b/c after d? c. If you restrict the expression to a single QName: how do you specify predicates on the SiblingExpr. We have discussed this in detail in the working group both during the initial design and now during the review of your proposal and feel that the current syntax has less issues and also provides for better optimizability. We encourage your feedback and proposals but would like to encourage you to use the current bugzilla website at http://www.w3.org/Bugs/Public/, since it allows us better issue tracking than the public comment list which is better suited for discussions of issues. Thanks Michael (speaking for the W3C XQuery working group) ________________________________ From: public-qt-comments-request@w3.org [mailto:public-qt-comments-request@w3.org] On Behalf Of Sudanagunta, Vas Sent: Friday, September 08, 2006 3:57 PM To: public-qt-comments@w3.org Subject: [UPDATE] Propose consistent semantics for target expressions Hello, I'd like to suggest a change to the syntax of Insert expressions. Current Insert expression syntax <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#id-insert> seems less than ideal as the target expression sometimes does not represent the node that will actually be modified. This is anomalous among updating expressions. It is even inconsistent with the insert into versions of the Insert expression. Below is a modified syntax for Insert Expression that has consistent semantics for the target expression. Functionality is unchanged. I am not an expert in grammar design; there may be a better syntax than this. Neither am I an expert in the XQuery grammar - so I'm sure there are flaws in the way I represent my proposed changes. Inserts or modified sections are highlighted, though deletions are sometimes emphasized with red strikeout. Vas Sudanagunta Walt Disney Internet Group 2.3.1 Insert [142] InsertExpr <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#prod-xquery-InsertExpr> ::= "do" "insert" SourceExpr <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#doc-xquery-SourceExpr> "into" TargetExpr <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#doc-xquery-TargetExpr> ( ("as" ("first" | "last")) | ("after" SiblingExpr) | ("before" SiblingExpr) )? [146] SourceExpr <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#prod-xquery-SourceExpr> ::= ExprSingle <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#doc-xquery-ExprSingle> [147] TargetExpr <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#prod-xquery-TargetExpr> ::= ExprSingle <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#doc-xquery-ExprSingle> SiblingExpr ::= ExprSingle <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#doc-xquery-ExprSingle> An insert expression inserts copies of one or more nodes as children of a designated node in an XDM instance <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-xdm-instance> at a designated position. If a position is not designated, the position of the inserted nodes within the designated parent is implementation-dependent. An insert expression is an updating expression <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-updating-expression> . Examples: * Insert a year element after the publisher of the first book. do insert <year>2005</year> into fn:doc("bib.xml")/books/book[1]/publisher after "publisher" * Navigating by means of several bound variables, insert a new police report into the list of police reports for a particular accident. do insert $new-police-report as last into fn:doc("insurance.xml")/policies /policy[id = $pid] /driver[license = $license] /accident[date = $accdate] /police-reports as last The semantics of an insert expression are as follows: 1. SourceExpr <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#doc-xquery-SourceExpr> must not be an updating expression <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-updating-expression> ; otherwise a static error is raised [err:XUST0101 <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#ERRXUST0101> ]. SourceExpr <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#doc-xquery-SourceExpr> is evaluated as though it were an enclosed expression in an element constructor (see Rule 1e in Section 3.7.1.3 of [XQuery 1.0] <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#xquery> ). The result of this step is either an error or a sequence of nodes to be inserted, called the insertion sequence. If the insertion sequence contains a document node, the document node is replaced in the insertion sequence by its children. If the insertion sequence contains an attribute node following a node that is not an attribute node, a type error is raised [err:TBD]. Let $alist be the sequence of attribute nodes in the insertion sequence. Let $clist be the remainder of the insertion sequence, in its original order. 2. The target expression must not be an updating expression <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-updating-expression> ; otherwise a static error is raised [err:XUST0101 <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#ERRXUST0101> ]. The target expression is evaluated. If into is specified, tThe result must be a single element node or a single document node; otherwise a type error is raised [err:TBD]. If before or after is specified, the result must be a single element node whose parent property is not empty; otherwise a dynamic error is raised [err:TBD]. Let $target be the node returned by the target expression. 3. SiblingExpr must not be an updating expression <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-updating-expression> ; otherwise a static error is raised [err:XUST0101 <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#ERRXUST0101> ]. SiblingExpr is evaluated as though it were the name expression of a computed element constructor (see Section 3.7.3.1 of [XQuery 1.0] <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#xquery> .) The result is either an error or an expanded QName. TargetExpr/$QName must evaluate to a single node; otherwise a dynamic error is raised [err:TBD]. Let $sibling be this node. 4. The result of the insert expression is a pending update list <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-pending-update-list> constructed as follows: 1. If as first is specified and $target has at least one child, let $child be the first child node of $target. The pending update list <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-pending-update-list> consists of the following update primitives <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-update-primitive> : 1. If $alist is not empty, upd:insertAttributes($target, $alist) 2. If $clist is not empty, upd:insertBefore($child, $clist) 2. If as last is specified, or as first is specified and $target has no children, the pending update list <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-pending-update-list> consists of the following update primitives <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-update-primitive> : 1. If $alist is not empty, upd:insertAttributes($target, $alist) 2. If $clist is not empty, upd:insertIntoAsLast($target, $clist) 3. If into is specified and neither as first nor as last nor after nor before is specified, the pending update list <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-pending-update-list> consists of the following update primitives <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-update-primitive> : 1. If $alist is not empty, upd:insertAttributes($target, $alist) 2. If $clist is not empty, upd:insertInto($target, $clist) 4. If before is specified, let $parent be the parent node of $target. Tthe pending update list <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-pending-update-list> consists of the following update primitives <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-update-primitive> : 1. If $alist is not empty, upd:insertAttributes($target, $alist) 2. If $clist is not empty, upd:insertBefore($sibling, $clist) 5. If after is specified, let $parent be the parent node of $target. TThe pending update list <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-pending-update-list> consists of the following update primitives <http://www.w3.org/TR/2006/WD-xqupdate-20060508/#dt-update-primitive> : 1. If $alist is not empty, upd:insertAttributes($target, $alist) 2. If $clist is not empty, upd:insertAfter($sibling, $clist)
Received on Tuesday, 12 September 2006 18:42:33 UTC