What Is XQuery?

XQuery is a standardized language that can be used to query XML documents much as SQL is used to query relational database tables. Essentially, XQuery consists of a data model and a set of query operators that operate on that data model.

XQuery is implemented in industry. However, it is not yet completely finalized by the W3C.

Like SQL, XQuery is a declarative rather than a procedural programming language. A procedural programming language uses a step-by-step process to solve problems, where different lines of code (or groups of lines of code) can pass values back and forth between each other. A declarative programming language simply defines a set of things such as boundaries, conditions, and constraints. The computer is then left to figure out an answer that meets those specified restrictions. A declarative language is much higher level (less detailed) than a procedural language in that it is used to describe a problem, as opposed to problem solving.

So, XQuery scans through an XML document (or a portion thereof), applies restrictions to the query (such as filtering predicates), and returns whichever data matches the boundaries, conditions, and constraints set by a specific query. The result is a subset copy of the originally scanned XML document in XML form.

The current version of XQuery cannot be used to change XML data. However, this is coming in the future.

Technically, XQuery can be used anywhere that XML is used. Thats the idea at least. The intention of XML is to make for a universally understood platform-independent source of data. Thus, XQuery follows in the same mold by attempting to provide a universally usable XML document query tool.

Shared Components

XPath 2.0 and XQuery 1.0 support all of the same functions and operators, and they share the same data model. In fact, XQuery queries of XML data are built using XPath expressions. Documentation states that approximately 75 percent of the functionality of XQuery 1.0 is provided by XPath 2.0 a large part of which would be the XPath functions and operators as presented in the previous chapter.



Beginning XML Databases
Beginning XML Databases (Wrox Beginning Guides)
ISBN: 0471791202
EAN: 2147483647
Year: 2006
Pages: 183
Authors: Gavin Powell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net