As increasing amounts of data are stored, processed and exchanged using XML, the ability to access that data in an efficient, organized, and streamlined manner becomes ever so necessary. In the traditional data world, the standard is by using a SQL query, and as of January 2007 in the XML world, we officially have XQuery.
Written by Priscilla Walmsley, XQuery is for query writers who are familiar with XML basics, but perhaps not skilled in other XML-related technologies. It is both a tutorial as well as a reference book. It covers namespaces, schemas, built-in types and regular expressions. It also covers XQuery’s support for filtering, sorting, and grouping data as well as how to use FLWOR expressions, XPath and XQuery tools for extracting and combining information.
While the book breaks out into 25 chapters and three appendixes, I will break it down in to its six functional areas. The book is approximately two-thirds’s tutorial and one-third reference. It uses a running example that reflects many XML structures.
Chapters 1-2 are a high level overview of XQuery. In these chapters the author goes through what XQuery is, what it can do and lays out the example structures that will be used thought the book. She explains the design of the language as well as the data model.
Chapters 3-9 explore how to write fairly sophisticated queries with out using namespaces and schemas. Here she gets in to the building blocks that will be used to create your queries; that is, things like keywords, whitespace, function calls, and variables. You will learn to navigate input documents using paths, adding elements and attributes to results, selecting and joining using FLWOR’s expressions, sorting and grouping, as well as advance queries.
Chapters 10-15 provide advanced concepts for those who want to take advantage of modularity. You will also look at XML namespaces, types, nodes and atomic values as well as learning about queries, prologs, and modules. You will get into schemas, static typing and the overall principles of query design.
Chapters 16-23 introduce advanced concepts for those who want to work with specific types of data, like numbers, strings, dates, URI’s and processing instructions. There is discussion on working with other XML components such as documents, text nodes and CDATA as well as implementation –specific features such as serialization parameters.
Chapters 24-25 describe XQuery’s relationship to SQL and XSLT by comparing SQL syntax with XQuery syntax and showing how to combine the two when it would be advantageous. The author also goes into XPath and XSLT and how they compare to XQuery.
There are three Appendixes; A which contains a built-in function reference, B covers the built-in types, and C provides a listing of error messages.
There is a lot of information contained in XQuery and it is obvious that Priscilla Walmsley both knows her topic, and is quite clear, concise and well versed on presenting the information in a logical style. While the book is aimed at the XQuery novice, it’s usefulness as a desk reference makes it one of those books that you get to learn the topic, but keep forever.