ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xml-dev
xml-dev
Re: [xml-dev] Yet another plea for XUpdate (was New XSLT, XPath, and XQuery drafts - but still no update?)
by Joe English other posts by this author
May 3 2002 8:57PM messages near this date
Re: [xml-dev] Yet another plea for XUpdate (was New XSLT, XPath, and XQuery drafts - but still no update?) | RE: [xml-dev] Out of topic or out of interest?
Dare Obasanjo wrote:
>  Patrick Lehti <Patrick.Lehti@[...].de> wrote:
> > Just think of an XML document of some GBs of size and you
> > want to change a greater amount of nodes in that document
> > with your update query. Do you really prefer a post-update
> > validation of the complete document against a static type
> > check of the update query?  Don't forget: if the validation
> > fails, you have to do a very expensive rollback on your
> > database! And what about developing the update query, do
> > you want to do these post-update validation and rollback
> > steps until you completely debugged the query and it is
> > working as you expected?
> 
>  Actually, I don't expect something that expensive.
>  What I would like is for post-update validation to be
>  the the most that is required by a DML specification
>  giving implementations leeway to do more aggresive
>  validation if they can which I am sure many will (in a
>  way that would probably mimic much of the XQuery type
>  system without some of the more onerous obligations).
>  A post-update validation would be the minimum
>  requirements as opposed to the XQuery expensive static
>  & dynamic type checking as the minimal requirements
>  approach.


Depending on the schema, update validation can be fairly cheap.

In tree-local grammars (e.g., DTDs, or a restricted subset
of RELAX-NG), it's possible to verify INSERTed and UPDATEd
nodes by first (1) validating the new subtree on its own
(which is O(n) in the size of the new subtree) and (2)
making sure that the new node is valid in the new context
(which is O(n) in the number of sibling nodes).  Further, if
all content models are string-local -- which is usually the
case for data-oriented XML vocabularies -- you can do step
(2) just by looking at the new node's immediate predecessor
and immediate successor, an O(1) operation.

This can be done *before* the update is even performed,
so there's no need to roll back a transaction.
If I'm not mistaken, a similar approach will work for
tree-regular grammars too (e.g., RELAX-NG), using
bottom-up tree automata.

Although I'm a big fan of strong static typing in general,
I tend to agree that the benefits for XML work are overstated.


--Joe English

  jenglish@[...].com

-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org> , an
initiative of OASIS <http://www.oasis-open.org> 

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl> 
Thread:
Dare Obasanjo
Jonathan Borden
Joe English

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved