The Village at the Keystone Resort
Colorado Software Summit
Java and XML Programming Conference
October 26 – 31, 2003
Keystone Conference Center


Jonathan Robie – DataDirect Technologies

Java, Databases, and XML Query Languages

Many Java applications exchange data as XML, but store and query data using a JDBC connection to a traditional relational database. Unfortunately, XML and SQL represent information in very different ways. Although XML databases are now generating mainstream interest, most developers are still using relational databases. When producing XML for exchange, programmers need a way to build a hierarchical XML structure using queries on a set of unordered two dimensional tables. Similarly, they need a way to update the contents of their two dimensional tables based on the contents of hierarchical XML.

Almost all major RDBMS vendors now supply tools or product enhancements to help bridge the gap between XML and relational data. The incompatible approaches they have taken are often ad hoc and inconvenient.

For most Java applications, the most convenient approach is to use a query language that can query relational data and build any desired XML structure. The XML can then be returned as JDOM, SAX, DOM or text. Two emerging query language standards now make this possible. SQL/XML is an extension to the ANSI/ISO SQL standard that allows XML to be generated as the result of a query and provides an XML datatype. W3C's XQuery is a query language that takes XML as its input and produces XML as its output. Some DBMS vendors will soon allow XQuery to operate on SQL/XML views of their databases. Using these standards greatly simplifies development, provides for more maintainable code, and provides portability across databases.

Querying XML with XQuery

Java is an object oriented language; XQuery is an XML oriented language. There are several Java-based implementations of XQuery, and it can be very convenient and efficient for Java applications to delegate complex XML processing to an XQuery library, receiving results as SAX, DOM, JDOM or text. XQuery is not only a query language, but a general processing language for XML, allowing very powerful transformations to be expressed economically

The basic data types used in XQuery are those found in XML documents: documents, elements, attributes, comments, processing instructions, and the built-in XML Schema types such as integer, float, double, date and string. An XML document can represent almost anything, and users of an XML query language expect it to be able to do useful queries on whatever they have stored in XML. XQuery is based on the structure of XML, and leverages this structure to provide query capabilities for the same range of data that XML represents.

This presentation provides a high-level introduction to the XQuery language by presenting a series of examples which each illustrate an important feature of the language and showing how it is used in practice. We cover most of the language features of XQuery, but also focus on teaching the idioms used to solve specific kinds of problems with Xquery.

Jonathan Robie is the XML Program Manager at DataDirect Technologies, responsible for our SQL/XML and Xquery implementations. With Don Chamberlin and Dana Florescu, he invented Quilt, an XML query language that was adopted as the basis of XQuery, the W3C XML Query language. He is now an editor of several of the specifications which define the XQuery language. He is also a co-inventor of XQL, an earlier XML query language which was a predecessor of XPath. Jonathan has been significantly involved in several other W3C Working Groups, acting as an editor for documents produced by the XML Schema and Document Object Model Working Groups, and has also participated in the W3C XML Information Set and XML Stylesheet Language (XSL) Working Groups. He is well known in the XML world, both as an innovator and as a speaker.

Prior to joining DataDirect, Jonathan worked as an XML Research Specialist at Software AG, where he helped design architectures for XML servers and represent Software AG on the XML Query and XML Schema Working Groups. He has been on the architecture team for three XML databases or repositories, at Software AG, Texcel Research, and POET Software. Since 1985 he has been working with advanced database systems and complex database applications, especially object oriented databases, multimedia databases, workgroup database applications, and XML/SGML databases.



* Return to Top *

© 1997 – 2003  Kovsky Conference Productions Inc.  All rights reserved.