- From: <bugzilla@jessica.w3.org>
- Date: Sat, 26 Oct 2013 13:54:24 +0000
- To: public-qt-comments@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=23643
Bug ID: 23643
Summary: Convenient operator for transform expressions
Product: XPath / XQuery / XSLT
Version: Working drafts
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P2
Component: Update 3.0
Assignee: john.snelson@marklogic.com
Reporter: christian.gruen@gmail.com
QA Contact: public-qt-comments@w3.org
The XQUF transform expression has turned out to be an essential operation when
it comes to updating XML documents in main-memory. From our perspective,
however, it has the following shortcomings:
* Its verbose syntax makes updatable expressions inconvenient to read. The
copy/modify/return construct is particularly bulky when being embedded in
another FLWOR expression.
* Our users frequently mix up the components of FLWOR and transform
expressions. For many, it is hard to grasp why "copy" cannot be used in row
with "for" or "let".
* Most transform expressions we have encountered so far contain a single copy
variable and return the modified value without further modifications.
This is why I would like to propose a "modify" operator for XQUF 3.0, which
would require only few modifications in the grammar:
AndExpr ::= ModifyExpr ( "and" ModifyExpr )*
ModifyExpr ::= ComparisonExpr ( "!!" ComparisonExpr )?
ComparisonExpr ::= ...
The modify operator works similar to the XQuery 3.0 map operator (and the "!!"
token has been chosen for that reason): the value of the first expression is
bound as context item, and the second expression performs updates on this item.
The updated item is returned as result.
>From the implementation point of view, this extension is straightforward:
* It can completely be derived from the transform expression.
* Error codes are the same, too (XUST0002, XUTY0013).
This is a little example how an expression may look like before and after:
* Using the transform expression:
for $e in //item[@status ne 'up-to-date']
let $c :=
copy $c := $e
modify insert node <sub/> into $c
return $c
return element updated { $c }
* Using the modify operator:
for $e in //item[@status ne 'up-to-date']
let $c := $e !! insert node <sub/> into .
return element updated { $c }
I’m looking forward to the discussion.
--
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Saturday, 26 October 2013 13:54:25 UTC