[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

XQuery and Item Orientation

Hans-Juergen Rennau hrennau at yahoo.de
Tue Jan 20 07:46:48 PST 2009


  XQuery and Item Orientation
Hello People,

I would like to learn about your thoughts about a perspective of introducing "item orientation" - an echo of object orientation - into XQuery.

Starting point: in my opinion, software development has undergone two revolutions: object orientation, and XML/XPath/XQuery, both acting as reducers of complexity. Suddenly it appears strange to me that XQuery makes no attempt to incorporate object oriented features. More concretely, I think of binding functionality to a) type and b) instance. Imagine a second kind of function were introduced into the language, call it itemFunction, which is invoked like an object's member function, where the "object" is an item:
   $triangle->rotate()
or
   $triangles/.->rotate()

Within the function body, the item is available as the context item expression (its top level uses, of course). So much for the binding to an instance. Now the binding to a type. This amounts to some sort of test used to select the appropriate function definition for a given item. An obvious possibility were to bind function declarations to an item type which must be matched by the item on which the function is invoked, for example thus:
   declare itemFunction element(tringle) local:rotate() {...}
   declare itemFunction element(square, squareType) local:rotate() {...}

More flexibility is gained by the additional possibility to specify an item test in the form of an XPath expression:
   declare itemFunction element(), itemTest="@geometrical eq true()" 
               element(tringle, triangleType) local:rotate() {...}

To demonstrate the simplicity to be gained, imagine the task to edit a sequence of reports for rendering purposes. You might write
   $reports/.->render()

and start with a default implementation of the itemFunction 'render'. Later, you refine the rendering by simply *adding* special versions, and you can even do so by just importing additional modules.

My questions to you:
- would such extensions of XQuery be desirable (from the user's point of view)
- would such extensions introduce drawbacks or problems (from the implementor's point of view)

Thank you for any comments!
Hans-Juergen Rennau


      



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.