<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>2796</bug_id>
          
          <creation_ts>2006-02-02 15:27:56 +0000</creation_ts>
          <short_desc>[ScriptReq] updating nodes, then returning values computed from them</short_desc>
          <delta_ts>2007-06-29 08:32:14 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Scripting Extensions 3.0</component>
          <version>Working drafts</version>
          <rep_platform>Macintosh</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Daniela Florescu">dflorescu</reporter>
          <assigned_to name="Andrew Eisenberg">andrew.eisenberg</assigned_to>
          <cc>martin</cc>
    
    <cc>tony.santangelo</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>8106</commentid>
    <comment_count>0</comment_count>
    <who name="Daniela Florescu">dflorescu</who>
    <bug_when>2006-02-02 15:27:56 +0000</bug_when>
    <thetext>It is unclear if the current XQuery update specification satisfies the use cases that need 
to update some nodes and then return the updated nodes or something computed 
from them. Example: increase the salaries of all employees whose pay is less than their 
bonus, and return these employee nodes. Note that it is not sufficient to perform the 
update and then search for the updated nodes, because the original predicate will no 
longer yield the  same results.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9024</commentid>
    <comment_count>1</comment_count>
    <who name="Mary Holstege">holstege</who>
    <bug_when>2006-04-04 15:23:37 +0000</bug_when>
    <thetext>This is related to 2794, I believe. The current rules are overly draconian.
They forbid so many use cases as to border on the unusable:
* create a function that, if some condition is met, performs an update and
returns true or false depending on whether the update was performed
* perform a series of insertions and return a count of how many were performed
* implement a simple queue: insert appends a child element, remove removes
  the first element and returns it
* delete an item in an invoice and return an XHTML rendering of the new invoice... etc. etc.

In short, any real application that wants to communicate results to the user
is forbidden by the rule that update expressions must be pure update expressions.  The only legitimate means of reporting an error is to crash
the entire application with fn:error. 

There is no reason for this restriction. Pending update lists are side effects;
so make the do expression have a value of empty sequence. The spec would
be much simplified as a result, and more usable besides.  All the special
rules for typeswitch, if-then-else, etc. go away.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>10653</commentid>
    <comment_count>2</comment_count>
    <who name="Tony Santangelo">tony.santangelo</who>
    <bug_when>2006-07-23 23:19:09 +0000</bug_when>
    <thetext>I&apos;m distressed to find that the Working Draft of 11 July 2006 still does not address this issue. The current spec seems to make it impossible, for example, to express web application logic in XQuery. If even top-level queries must either return a value OR perform an update, but never both, then *something* (other than XQuery) is going to have to co-ordinate the response to requests that involve updates. And the revolution is once again deferred.

The update model currently used in eXist, a native XML DBMS,  (http://exist.sourceforge.net) has the characteristic described in Comment #1: update expressions evaluate to the empty sequence. This tool drastically reduces the pain of web development.

Please allow XQuery (with Update) to be a programming language, not just a query language.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11266</commentid>
    <comment_count>3</comment_count>
    <who name="Daniela Florescu">dflorescu</who>
    <bug_when>2006-08-24 21:57:21 +0000</bug_when>
    <thetext>Tony,

Personally I am also convinced that the real utility of XQuery will be attained only after
we add enough functionakity to make it a  full (and easy to use) programming language
-- targeted at XML processing of course, not a general purpose programming language.

Some of us we have been working in this direction. We proposed an extension called 
XQueryP (www.ximep-2006.org/papers/Paper-Chamberlin-Carey.pdf) by adding
a small number of extensions like variable assignement, sequential/deterministic
evaluation order in case of side-effects and such.

Everything being said, your comment unfortunatelly does not give us enough 
details in terms of what kind of features would you like to see in XQuery in the
future. A &quot;programming language&quot; is too general for us to understand your intent.

In order to help the process it would be really good if you could give us a detailed
description of the features you would like to see, together with some use cases that
you consider important. For example, would something like XQueryP be a good
solution for you ?

Thanks, best regards
Dana





(In reply to comment #2)
&gt; I&apos;m distressed to find that the Working Draft of 11 July 2006 still does not
&gt; address this issue. The current spec seems to make it impossible, for example,
&gt; to express web application logic in XQuery. If even top-level queries must
&gt; either return a value OR perform an update, but never both, then *something*
&gt; (other than XQuery) is going to have to co-ordinate the response to requests
&gt; that involve updates. And the revolution is once again deferred.
&gt; 
&gt; The update model currently used in eXist, a native XML DBMS, 
&gt; (http://exist.sourceforge.net) has the characteristic described in Comment #1:
&gt; update expressions evaluate to the empty sequence. This tool drastically
&gt; reduces the pain of web development.
&gt; 
&gt; Please allow XQuery (with Update) to be a programming language, not just a
&gt; query language.
&gt; </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15725</commentid>
    <comment_count>4</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2007-06-29 08:29:45 +0000</bug_when>
    <thetext>This requirement has been accepted for the Scripting Extensions, but not for the Update Facility itself. </thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>