Introduction to XQuery

Source: Internet
Author: User
Tags documentation serialization xpath xslt xquery

Note: This article was revised in December 2005 to incorporate the latest changes in the XQuery specification: eight of these work drafts have entered the "candidate recommendation for the World wide Business" status, and the overall specification distance is a step closer to the "Recommended standard". The main Full-text document was originally published in 2004 and has recently been modified. The "Draft requirements work (Requirements Working Draft)" On the renewal facility and the draft Xpath/xquery Lexical Analyzer (Tokenizer) were first published in 2005. The number of XQuery features continues to grow, as is the list of XQuery implementations and the growing resources of developers on the Web.

After a long six years on the road to being the recommended standard for the consortium, the XQuery specification is a mysterious and enduring Hollywood blockbuster, like the "Star Wars" and "Lord of the Rings" series. XQuery originated in the 1998 Forum of Query languages sponsored by the World's consortium, where representatives from industry, academia and research groups gathered in Boston to propose features and requirements that they considered important in the XML query language.

Two different camps

Those who are interested in history can get these 66 speeches online (see resources), they come mainly from two different camps: the people who use XML primarily as a document (which largely reflects the fact that XML originated in SGML) and the people who use XML as data--the latter largely reflects XML in the field of middleware, front-end traditional relational database in the field of the growing situation.

In particular, David Maier of Oregon State Graduate School, "Database desiderata for XML Query Language", is very concise and very helpful to understand Query Language Working Group ( The idea of the query Language team, which was chartered shortly after the Boston seminar.

Although the membership has increased in time, the Working Group is very large according to the standards of the consortium (it is said that only Protocol Working Group (the Working Group) has more members). It consists of more than 30 member companies, reflecting the respective views of the two camps, data and documentation. The final form that is now merged (after a long time) is an XML query language standard that can represent the needs and perspectives of these two groups.

For XML users, the most familiar XQuery-critical component is XPath, which is itself a world-code-for-all specification. The individual XPath location path itself ("//book/editor" means "find all book editors in the current DataSet") is an entirely effective XQuery. In terms of data, XQuery has the appearance and ability to resemble SQL, which is popular and familiar to users from the world of relational databases.

Humble origins.

XQuery is originally called Quilt. Quilt, originally a test tool for user-level syntax, was founded by three diligent and far-sighted members of the workgroup: Jonathan Robie, Don Chamberlin, and Daniela Florescu. In defining requirements, use cases, and underlying data models and algebra, Quilt is based on the collaborative efforts of the entire team.

Robie, Chamberlin, and Florescu point out the impact of some languages on Quilt design, including XQL, XML-QL, and SQL. If you are interested in the evolution of the language of the computer, read XML Query language:experiences and exemplars (see Resources), this significant paper compares the first two languages and the other two languages Yatl and Lorel well 。 Author Mary Fernandez, Jerome Simeon and Phil Wadler are themselves members of the group.

Since data and document groups hold such a different view and the reliability of the foundation that the team builds, it is not surprising that this vast norm takes so long to make public. The internal progress of the Working Group on the Task Force is strictly confidential, and most of the work of the query Language Working group was carried out secretly by mid-February 2001.

The Requirements document and Data Model work was published very early on, but it was not until February 2001 that the team's release came to a climax when a large number of documents began to appear. Since then, two important updates were made in 2001, with three or four updates each year, with only 2004 years of exception, and only one update was released by the Working Group.

This year's new requirements document for the update mechanism, coupled with a brief description of the creation of the lexical analyzer for the XQuery language implementation, totals 16 documents (including XSLT specifications placed on the XML Query Web site for some reason I don't know), It doesn't take a long time to make up a complete set of documents. It is certain that an update language document will appear at some point.

Release Kingdom of the newborn

Documents that are fully used to describe and define XQuery currently include:

XML Query Requirements The team's primary planning documentation. List of XQuery requirements. XML Query use Cases some actual scenarios and XQuery fragments that solve specific problems. XQuery 1.0:an XML Query Language Core documentation that describes the language itself, as well as an overview of most other content. XQuery 1.0 and XPath 2.0 the extension of the data Model XML information set. Describes the basis of data items and formal semantics that a query implementation must understand. The XQuery 1.0 and XPath 2.0 formal semantics from the formal definition of the underlying algebra of the language. XML Syntax for XQuery 1.0 (XQueryX) provides another syntax for people who prefer to use XML (primarily computers). XQuery 1.0 and XPath 2.0 functions and Operators Version 1.0 approximately 225 functions and operators of XML Schema data types, XML nodes, and their sequences. XML Path Language (XPath) 2.0 isolated XPath documents. XPath Requirements Version 2.0 XPath's requirements document. The XSLT 2.0 and XQuery 1.0 serialization examines the XML issues associated with serializing angle brackets from the XQuery 1.0 and XPath 2.0 Data Model output. Serialization is not, in essence, part of the Master language specification. The XML Query and XPath full-text Requirements describes the functional requirements that Full-text recommendation needs to achieve. XML Query and XPath full-text use Cases Full-text The actual scenario that the specification should be able to handle. The XQuery 1.0 and XPath 2.0 full-text the main full-text document, detailing the full text extension language of XQuery in strict sense. XQuery Update Facility Requirements XQuery requires the ability to write new data to existing documents and to query the document. Building a tokenizer for XPath or XQueryWork draft annotation file, and select some syntax data from the main XQuery 1.0 document for explanation. is meaningful only to the language's implementation.

These documents (see Resources) represent a great deal of work. "XQuery 1.0:an XML Query Language" is the key, but other documents contribute to the language that XQuery has become a good specification and fully supported. As far as I know, this is the most complex set of specifications that come out of the consortium (although XML schemas may be comparable, but that's another matter).

If you're surprised by so many documents and don't know where to start, I can recommend two ways. You can start with the core XQuery 1.0 documentation. It has a good introductory overview detailing many of the features of the language. Another approach is to start by selecting a use Cases work draft. This document lists some of the actual scenarios where XQuery works. Each use case is for a specific application area and lists some XQuery code for the sample data for that domain. These snippets are valuable if you want to see concrete examples of the actual syntax. The third approach is to study many of the built-in functions listed in the functions and Operators work draft, but it is best to have a basic understanding of the language.

Babelfish, where are you?

XQuery is actually a combination of three languages:

Surface grammar is one of the easiest languages to see, and is the most likely to be accessible to users. In many ways, this language version is XQuery. (See Sidebar syntax: A simple example of surface-layer syntax.) )

An alternative syntax based on XML replaces the surface language with another language that is more easily machine-processed. (see XQueryX later in this article.) )

The formal algebra language describes in detail the internal working mechanism of an XQuery handler.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.