Review: XQuery, The XML Query Language
 
Published: 19 Mar 2004
Unedited - Community Contributed
Abstract
XQuery is a W3C initiative, an emerging standard, targeted to be a universal query language for XML. XQuery is also designed to play a major role in .NET Framework v2's (Whidbey) XML data access architecture. In this article Teemu Keiski reviews "XQuery, The XML Query Language", a book written by Michael Brundage, published by Addison-Wesley.
by Teemu Keiski
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 28314/ 36

Overview

XQuery is a W3C initiative, emerging standard, at the time of writing in draft stage. XQuery is targeted to be a universal query language for XML, without making any distinction where the data has come from. XQuery should bring the features that have existed in relational data access for years to XML data access. We have had tools like XPath and XSLT but their capabilities haven't been adequate for all needs and therefore some tasks have required the use of intermediate tools. This is what XQuery tries to cover and the initiative can be shortened by saying that XQuery should be the same for XML as SQL is for relational databases. However, by no means is XQuery's purpose to make existing standards obsolete; rather it provides a better tool to suit certain needs.

XQuery is interesting also from the .NET developer standpoint as the upcoming release of .NET Framework v2.0 (codename Whidbey) will also provide a better tool arsenal. One main new feature is the renewed data access architecture, especially from the XML standpoint. In Whidbey, the initiative to provide XML as a first class feature to software development has continued where it was left off in the previous version of the Framework. For example, in Whidbey there's support for middle-tier XML data access, which means one has the ability to query various data sources exposed through an XML provider as well as to manipulate the data.

The main new feature regarding this article is that Whidbey provides an XQuery implementation, giving us the capability to access heterogeneous data sources with the XML API and XQuery as a query language as it has been possible with a relational API and SQL. The main innovation in Whidbey is the common query processing architecture that is created for XSLT, XQuery, and XPath, giving them the same treatment (compilation, optimization, and MSIL) as is given to other CLR languages. If you want to know more about these, be sure to read A First Look at ADO.NET and System.XML v. 2.0 from Addison-Wesley, which I have reviewed in one of my previous articles. From this perspective, it was very interesting when I first read that Addison-Wesley publishes a book about XQuery. Now I have the book and here is the review for you.

The Book

XQuery, The XML Query Language is intended to be both an introduction to XQuery for beginners as well as a reference for more advanced users. It is assumed that the reader is familiar with XML 1.0, but previous knowledge of XML Schema, XPath, or XSLT is not necessary, though certainly helps to have things in context.

The book covers XQuery from the beginning to the end. It discusses important aspects such as the data model, type system, path navigation, iteration, construction, text processing, functions, type operators as well as information beyond the standard, and it provides a look at the future of XQuery. It gives exact details as to how to apply XQuery in practice and how it can be useful. 

The book's format is practical, and it provides hundreds of examples the reader can try out. However, note that the book is implementation independant, which means it doesn't provide any information about specific XQuery implementations. At the book's web site there are references to XQuery implementations and a couple of words about their current status.

Organization

The book is separated into four parts.  It has 505 pages in 14 chapters and 5 appendices including the index and bibliography.

Part I: Foundations

1. A Tour of XQuery
2. Data Model and Type System
3. Navigation
4. Functions and Modules

Part II: Core Language Features

5. Basic Expressions
6. Iteration
7. Constructing XML
8. Text Processing
9. Type Operators

Part III: Application

10. Practical Examples
11. Surprises
12. XQuery Serialization
13. Query Optimization
14. Beyond the Standard

Part IV: Reference

A. Data Model and Type System Reference
B. Expression Reference
C. Function Reference
D. Regular Expressions
E. Grammar

Bibliography
Index

Resources

Book's website maintained by the author:
http://www.qbrundage.com/xquery

Addison-Wesley's web page:
http://www.awprofessional.com/isapi/product_id~{32F4CE04-2E8E-46AB-9F08-4C592AEA9640}/catalog/product.asp

Pros & Cons

Pros

From the very beginning I liked the style the author has written the book with.  The style is very compact but informative at the same time. Therefore the book keeps its promises by being easily readable for a beginner as well as an advanced user. Such a style can be hard to adopt, and with this book the result has been good. The book keeps its focus well through the chapters and therefore it is also suitable for self-studying and in-fact even for classroom usage, if one would have such a need.

I also liked the implementation independent style that the book has adopted. It gives more room for background discussion of things behind implementations, and therefore important general things aren't missed because a certain implementation does something differently than another. That also gives one common denominator more for different parties interested in XQuery and suites for promoting the interoperability between these parties.

Cons

One drawback with the book is that its visual appearance is bit dull. The structure and style described earlier indeed serve well, but the chapters consist mostly of sections separated by the subject and one section is usually purely text varying from couple of sentences to a few pages, the only separators being headings, examples, and few tables. There are not very many figures but the ones that do exist work well.

Examples in the sections do ease the readability so that chapters aren't purely plain text, but there is room for improvement. In Chapter 9 (Type Operators), a figure was used to describe how evaluation happens when types were converted across the type hierarchy, and I think it worked well, similar to the tables describing tuple spaces in Chapter 6 (Iteration). Using more of these to visualize the descriptions would have been perfect. Certainly a reader with even a bit of focus gets what he wants from this book, but it takes a bit more will power than usual.

Another thing I'd like to criticize is the chosen time of publishing this book (February 2004). At the time of writing XQuery is in draft stage ("XQuery 1.0 and XPath 2.0 Formal Semantics" specification in Last Call till April 15th) so there are chances for changes before the specs are closed. After all, it wouldn't have been too long to wait for this stage to end so that reader could have been more sure what the specs would look like in final form. Luckily, the changes are probably minor and are mostly covered at the book's web site, so it won't be a big problem.

Conclusion

My conclusion is that this book is definitely worth buying. It has so much to say and give that I believe you will be happy with it. If you are a .NET developer, you have a new and exciting tool in your arsenal to be used when Whidbey is released. It is at least worth studying what XQuery can give to you. If you are a Java developer or are using some other platform, there are a bunch of other implementations waiting for you.


User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-16 6:56:55 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search