XQuery, the Query Language of the Future
XQuery will likely become the dominant language for querying data from most data sources.Although designed for querying XML data, you can use XQuery to tie together data from multiple data sources. In that respect it is much more powerful than SQL, which will slowly but surely be replaced as the main query language.
You may think I'm making a pretty bold statement here considering the current dominance of SQL with its many dialects, and the fact that XQuery has yet to become a W3 Consortium (W3C) Recommendation. However, there are already several implementations based on working drafts, including one by Microsoft included in the .NET Framework. These implementations show the enormous power of XQuery. But what is XQuery exactly?
XML Query, XQuery for short, is a new query language currently under development by the W3C. It is designed to query XML documents using a SQL-like syntax. XQuery's capabilities go far beyond SQL however, because XML (and thus XQuery) isn't bound to the rigid structure of tables and relations. XML can represent a large number of data models. Furthermore an XQuery query can return data from multiple documents in different locations. XSLT has similar capabilities, but many IT people will find XQuery much easier to understand, particularly database administrators familiar with SQL.
You can use XQuery to extract an XML document from a physical or virtual representation of XML data. An example of the latter is SQLXML (provided in Microsoft SQL Server 2000), which enables you to extract data from a SQL Server database formatted as XML using the HTTP protocol. Any system that exposes XML over HTTP is a potential source of data for XQuery. XQuery's designers hope that XQuery can act as a unified query language for any data store, including XML files, XML databases, and non-XML data stores. With the proliferation of loosely coupled systems and data coming from half way across the globe, performance of multi-document queries is going to be an issue, particularly if you only need a small amount of data from a large document. Future versions of XQuery may alleviate this problem by distributing a query over the queried systems.
The designers of XQuery want you to use it as a unified query language for any data store, including XML files, XML databases, and non-XML data stores. Keep in mind that most implementations are experimental and in the technology preview stage.
Although XQuery is still a working draft it already has broad support. There are several applications providing the ability to query using XQuery. Microsoft has already hinted that the next release of SQL Server (codename Yukon) will provide support for XQuery as well, and both IBM and Oracle will likely offer some kind of XQuery support once XQuery attains W3C Recommendation status.
By: Michiel Van Otegem
Michiel van Otegem is Senior Software Architect at Sogeti Netherlands. He started programming at age 10, and has nearly 20 years of professional experience as a developer and architect. As a pioneer in ASP and ASP.NET, Michiel still has a strong focus on the Microsoft platform, but he combines that with extensive knowledge of integration and security.
Michiel is the author of several books in Dutch and English, starting with Teach Yourself XSLT in 21 Days (SAMS) back in 2002, and most recently contributing to Programming Microsoft’s Clouds: Windows Azure and Office 365 (Wrox).
Michiel enjoys sharing his knowledge through books, articles, and speaking at conferences and user group events. He also loves to learn, especially life lessons from his two children.
XQuery 1.0 still has to reach W3C Recommendation status, but the available implementations and technology previews show that it is a very potent query language.