W3C's XQuery Language Standard

The W3C's pending XQuery 1.0 standard brings XML processing deeper into relational database management systems. But XQuery is still both immature and limited. Here's what you need to know.

January 19, 2007

7 Min Read
NetworkComputing logo in a gray background | NetworkComputing

The W3C's Xquery 1.0 moved to Proposed Recommendation status in November, bringing the prospect of a SQL-like approach to XML data querying one step closer to official sanction.

As happens with evolving standards, support for XQuery is making its way into mainstream products. IBM's DB2 version 9, for example, implements XQuery as part of its hybrid server. And Oracle gives database developers a choice of embedding XML inside SQL queries or employing the XQuery standard. Such developments represent an important change in the potential value of XML data.

XQuery essentially enables relational vendors to bring XML processing deeper into their database engines. The relational DBMS can then build XML indexes for optimizers to use, so the system can perform queries against XML data with the same efficiency as SQL. XQuery is also important for tiered architectures; database and middleware vendors can employ XQuery to access XML or SQL data from multiple, heterogeneous sources.But XQuery is immature; it offers read-only access to XML data, though updating and other functions will be added later. And XQuery is not at all ready to support analytics and BI (business intelligence), unlike SQL.

PRACTICAL APPLICATIONS

Companies are starting to use XQuery when they need to create XML dynamically for SOAP (Simple Object Access Protocol) messages, dynamic Web sites, database publishing and report generation. DataDirect Technologies, for instance, says one of its customers is using DataDirect's XQuery driver to integrate customer data from Salesforce.com and an Oracle database to create proposals in Adobe's PDF format. Another customer is using the company's XQuery driver to query very large XML files.

IBM has been very visible in the XQuery market. IBM Fellow Don Chamberlin, who designed the original SQL language, was a co-designer (with DataDirect's Jonathan Robie and Oracle's Daniela Florescu) of "Quilt," the precursor to XQuery. IBM's XML support has evolved from a simple data-type extender to stored procedures and other functions for processing XML in message queues. And DB2 9's "pureXML" initiative brings XQuery functionality to IBM's DB2 Developer Workbench; for example, Visual XQuery Builder is a design tool that enables developers to create and execute XML queries using wizards.

Oracle has been on a path similar to IBM's. The company was the first major vendor to offer native XML data storage (in the 9i release in 2001); it has been developing XML DB technology (a feature within the current 10g release) since then. To access XML data stored in an Oracle database, developers have a choice of embedding XML inside SQL queries or employing the XQuery standard. Oracle supports "shredding" (or decomposing) XML data into a relational table structure, as well as a more document-centric paradigm in which the structure of the document (such as a contract) is preserved.Microsoft's SQL Server supports some forms of XML processing, and the company plans to increase XQuery support over the next two releases. Its XQuery support is not as advanced as IBM's or Oracle's, but Microsoft also has more work to do in terms of implementing XQuery and XML support throughout its Windows platform. In 2007, organizations should watch Office 2007's Open XML Formats as they evolve to support XQuery on the front end.

Smaller companies have come to the fore with XQuery support as well. Mark Logic, for example, is a leading pure-play XML database vendor. The company was quick to implement XQuery in its MarkLogic Server, which allows efficient querying of data.

Continue Reading This Story...

RELATED DEVELOPMENTS

XQuery is the big fish in a pond full of related standards, such as XSLT (Extensible Stylesheet Language Transformations), a W3C language designed by James Clark and the XSL Working Group. While there is some overlap between the XSLT and XQuery, XSLT was designed as a style-sheet language for performing transformations of documents into XML and other formats whereas XQuery's mission has been to replicate what SQL does, but for XML data.

Along with the W3C's standards efforts around XQuery, another important emerging standard is JSR (Java Specification Request) 225: XQuery API for Java, or XQJ. Sponsored by IBM and Oracle, JSR 225 will provide XQuery-standard methods for XML data access in much the same way that JDBC (Java Database Connectivity) did for accessing, querying and updating relational databases.SOA (service-oriented architecture) approaches are also dependent on XML. Thus, it comes as no surprise that the RDBMS vendors are working quickly to maintain their relevance in an XML-dominated world. The XQuery standard is crucial to all, so its evolution may be smoother than other industry standards, including SQL. Nonetheless, distinctions will always exist between data sources--database and middleware vendors will succeed if they can ease developers' current XML data-integration headache of having to learn and implement a series of APIs for each data source and writing lots of procedural code.

XQuery's primary drawback right now is simple--immaturity. It provides read-only access to XML data and lacks support for analytics and BI. However, updating and other functions will be added over time--the popularity of search engines will likely speed its build-out toward providing extensions that give finer control over full-text searches.

XQUERY AND SQL

A discussion about XQuery wouldn't be complete without touching upon SQL. SQL can access and manipulate data organized in relational tables: Normalization, primary key relationships and indexes determine the data that a SQL query will return efficiently.

TimelineClick to enlarge in another window

XML is all about exposing data so it can be reused. Hierarchies and sequential relationships between documents and parts of documents are also important, so XQuery functions must enable different operations than SQL. To accomplish this, XQuery and XSLT working groups will have to sort out functionality; competition between these efforts could hamper development.

XQuery will never replace SQL because most business data is perfectly happy being stored and accessed through the relational model. XQuery is focused on the burgeoning world of XML documents, and content and collaboration through interchange of these data sources; vendors know they will cease to be relevant if they can't provide technology for these purposes. Still, it remains an open question whether RDBMS vendors can deliver XQuery and XML functionality with SQL-like subsecond response times. If they stall in providing this performance, customers will address their XML data-management woes with pure-play, custom-built or middleware-oriented solutions.

David Stodder is editor in chief of Intelligent Enterprise, a sister CMP publication. Write to him at [email protected]. Ben Dupont is a systems engineer for Wps Resources in Green Bay, Wis. He specializes in software development. Write to him at [email protected].

SUBSCRIBE TO OUR NEWSLETTER
Stay informed! Sign up to get expert advice and insight delivered direct to your inbox

You May Also Like


More Insights