XQuery/Background

History of XQueryEdit

XQuery and Functional ProgrammingEdit

XQuery is an example of a functional programming language. Like other functional languages, XQuery variables are immutable, meaning that you can set them once but never change them after that. XQuery functions do not have "side effects" meaning that they do not change data that is not specifically passed to them.

Functional programming has recently gained popularity with the rise of the MapReduce algorithms recently popularized by Google. Google's ability to leverage tens of thousands of CPUs in its data center has shown that functional languages are in many ways superior to procedural languages. But many of the benefits of functional programming go back to mathematical formalisms of the 1930s, including the lambda calculus and the μ-recursive functions.

Although the XQuery 1.0 W3C specification does not allow a function to be passed as an argument to a function, most implementations such as eXist support this, so technically the eXist implementation of XQuery is a true functional language but the W3C standard is not. However, XQuery 1.1 is to allow function items as data[1] while

A history of functional programming is available at Functional Programming. This article has an excellent historical background on functional programming and why functional programs are ideal for a server environment where reliability is critical.

XQuery as a w3c StandardEdit

In 1998 Jonathan Robie and Joe Lapp (then the principal architect of WebMethods) created a new query language designed specifically to query XML files called XQL

In 1998, two query languages, XQL and XML-QL got a lot of interest within the W3C and a working group for XML-based querying languages was formed.

In 1998 the World Wide Web consortium hosted a conference on query languages[2]. This conference gathered XML and query language experts from around the world and from many fields. 66 "Position Papers" were presented. The result was a very large knowledge base of use cases and proposals that began as a basis for a future standardized query language.

The working group selected around 90 use cases and compared the ability of seven advanced query languages to execute them. None of the seven were perfect. Each had some defects. The working group took the best part of each of the seven languages and created the XQuery standard.

The XSLT language reached recommendation status in 1999. But there were many people who felt that XSLT was too difficult to learn, and because of the XML syntax, it was very unfamiliar for many software developers. People with an SQL background had a difficult time understanding how to learn XSLT.

XQuery and SQLEdit

Studies have shown that people familiar with SQL can quickly learn XQuery. Once developers understand the structure of the FLWOR statement, many SQL concepts such as sorting and selecting distinct values are easily learned.

XQuery and XSLTEdit

Many developers once considered XSLT template-style transforms ideal for transforming documents and XQuery ideal for querying more structured XML data such as a collection of book metadata. Recent work with typeswitch-style transforms have shown that XQuery modules and functions can be used to create document-style transforms that rival most XSLT functions. And because many XQuery systems leverage document indexes they can be considerably faster than XSLT transforms that were never designed to use indexed XML structures.

ReferencesEdit

W3C Papers from 1998 on XML Query Languages

Last modified on 15 August 2011, at 14:53