Save 40% on books and eBooks + 70% on videos now through May 31*—use code PROGRAM. Shop now.
"The individual perspectives on the concepts behind the XQuery language offered by XQuery from the Experts will be of great value to those who are seeking to understand the implications, opportunities, and challenges of XQuery as they design future information systems based on XML."
—Michael Champion, Advisory Research and Development Specialist, Software AG
XQuery answers the growing need for a functional XML search and transformation standard. Backed by the full weight of the World Wide Web Consortium (W3C), XQuery is being extremely well received by the IT community worldwide. The first major XML language that takes advantage of the benefits of strong typing provided by XML Schema, XQuery has the versatility to manipulate both XML and non-XML data and provides a valuable connection between the world of XML and relational databases.
In XQuery from the Experts, select members of the W3C's XML Query working group come together to discuss every facet of XQuery. From Jonathan Robie's introductory "XQuery: A Guided Tour" to Mary Mary Fernández, Jérôme Siméon, and Philip Wadler's "Introduction to the Formal Semantics," XQuery is revealed in a way that both novice programmers and industry experts can appreciate.
Edited by long-time XML expert and programmer Howard Katz, coverage ranges from strictly technical chapters to comparative essays such as Michael Kay's "XQuery, XPath, and XSLT," which explores the common ancestry of all three languages, and Don Chamberlin's "Influences on the Design of XQuery," which details the process behind XQuery's design.
Key coverage includes:
For IT managers, professionals, programmers, or anyone involved with XML, XQuery from the Experts is an invaluable resource.
Download the Sample Chapter related to this title.
I. BASICS.1. XQuery: A Guided Tour.
Sample Data: A Bibliography.
Literals and Comments.
Locating Nodes: Path Expressions.
Creating Nodes: Element, Attribute, and Document Constructors.
Combining and Restructuring Nodes.
External Functions and Variables.
Types in XQuery.
Introduction to XQuery Types.
Schemas and Types.
Working with Types.
II. BACKGROUND.2. Influences on the Design of XQuery.
The Need for an XML Query Language.
The Query Data Model.
Related Languages and Standards.
XML and Namespaces.
Other Query Languages.
Issue 1: Handling of Untyped Data.
Issue 2: Unknown and Inapplicable Data.
Issue 3: What Is a Type?
Issue 4: Element Constructors.
Issue 5: Static Typing.
Issue 6: Function Resolution.
Issue 7: Error Handling.
Issue 8: Ordering Operators.
Conclusion.3. XQuery, XPath, and XSLT.
XSLT: A Quick Introduction.
Why Was a New Query Language Needed?
Convergence: XPath 2.0.
XSLT and XQuery Compared.
Semantics of Element Construction.
Functions and Named Templates.
Where Does the Time Go?
Internal Coding Efficiency.
Pipelining and Lazy Evaluation.
Using Type Information.
III. FORMAL UNDERPINNINGS.4. Static Typing in XQuery.
The Benefits of Static Typing.
An XQuery Programming Scenario.
Getting Started with Types.
XML Schema and XQuery Types.
Relating Values and Types.
Literals and Operators.
A Final Example: Grouping.
Conclusions.5. Introduction to the Formal Semantics.
The Benefits of a Formal Semantics.
Getting Started with the Formal Semantics.
Matching Values and Types.
Finishing Getting Started.
Learning More about XQuery.
Values and Types.
Matching and Subtyping.
Implicit Coercions and Function Calls.
Node Identity and Element Constructors.
The Forest through the Trees.
IV. DATABASES.6. Mapping between XML and Relational Data.
Framing the Problem.
Sources of XML Data.
LOB or Compose?
Composition Techniques: Common Concepts.
Generation of XML Structure through Hierarchical Joins.
Generation of XML Structure through Hierarchical Grouping.
Composition Techniques: Examples.
Annotated XML Template.
Additional Mapping Languages.
Creation of the Database.
Adding Extra Information to the Composition.
Inlining and Consolidation.
Support of Full XML.
Emitting XML Documents.
Querying and Updating XML Documents.
Conclusion.7. Integrating XQuery and Relational Database Systems.
Relational Storage of XML: The XML Type.
Logical Models for the XML Datatype.
Physical Models for the XML Datatype.
Encodings and Collations.
Typing an XML Datatype.
Other Aspects of the XML Datatype.
Integrating XQuery and SQL: Querying XML Datatypes.
XQuery Functionality in SQL.
Augmenting the XQuery Static Context.
Providing Access to SQL Data inside XQuery.
Adding XQuery Function Libraries.
A Note on the XQuery Data Modification Language.
Physical Mappings of XQuery.
Issues of Combining SQL, XML Datatype, and XQuery.
XML Document (Fragment) Collections.
XML Views over Relational Data.
Conclusion and Issues.8. A Native XML DBMS.
What Is XML Data?
XML as Text.
XML Data Model.
Interfaces to a Native XML Database.
Database Configuration Interfaces.
A Database Command Language.
Collections and Storage.
XQuery Client APIs.
Full-Text Search in a Native XML Database.
A Content Management Application.
XML is everywhere. In an astonishingly short period of time, XML has worked itself into the nooks and crannies of corporate IT departments, academic research institutions, and small-shop programming operations everywhere. As one of the authors of this book points out, XML now encodes a bewildering array of data types scattered across a large number of diverse application domains.
Where there's information, there are people who are going to need to query that information. Happily, XQuery has come along to provide a powerful and standardized way of searching through all that glorious XML-encapsulated data. Going even one better than Google, XQuery provides a flexible and easy-to-use mechanism for querying not only content, but structure as well. Taking a leaf from XSLT, XQuery doesn't content itself with simply providing a query capability; it does transformations too. I think we'll increasingly see it replacing XSLT (my own personal prediction) in a number of application areas (though XSLT aficionados needn't fear—there are plenty of things to do for both technologies). Most interestingly, some of the data that XQuery will manipulate won't even have started life as XML: a goodly portion of the data that XQuery deals and will deal with will have started life in the form of rows and columns in corporate relational databases.
Most technical books are either tutorials or reference works. You turn to the former if you're looking for a gentle introduction to a new subject; you look to the latter if you already know something about the subject at hand and want a minimum of hand holding while you seek out the information you need. This book is unusual in that it shares some of the characteristics of each. It's a series of technical essays and perspectives, some of them tutorial-like, on various facets of XQuery from members of the World Wide Web Consortium's (W3C) Query working group, the standards body that's been hard at work creating and crafting the formal definition of the language since the Fall of 1999. Their intimate knowledge of the matter at hand sheds a lot of light on a technical topic that some find daunting, given the weight and density of the formal spec.
Members of the working group would probably be embarrassed to hear themselves referred to here as "experts," as the title implies, but that's really what they are. Nobody knows the material better than this group--after all, they're the ones who created it in the first place! This is definitely a case where you could say (pun intended) that they wrote the book. And not just the one you're holding in your hand: they also wrote most of the specification itself, since nearly every one of the authors is also a hard-working editor of one or more of the numerous documents that comprise the formal specification.
The names of many of these "experts" are no doubt already known to some of you. Let me name just a few of them (to either the chagrin or the great relief of the rest of them): Don Chamberlin, a researcher at IBM's prestigious Almaden Labs, brings to bear the weighty authority he's garnered as a co-founder of SQL, a language that's played such an important role in modern technical commerce; Jonathan Robie proselytizes fiercely for XQuery and fights the good fight on the XML-DEV mailing list for the use of strong typing in XML; Michael Kay is the author of Saxon and is arguably one of the world's foremost experts on XSLT; Phil Wadler is a noted language theoretician, the principal designer of Haskell and the editor-in-chief of the "Journal of Functional Programming"; Mary Fernandez is a seasoned researcher at AT&T Labs and is well-known for her work on query languages for XML, among other research topics. Take a look at the "Contributors" section of the book to see the impressive bona fides of all our experts crew.
This book provides an opportunity for these members of the working group to write individually about those XQuery topics they know best and about which they feel the most passion. It gives them an opportunity to write with a personal voice and perspective in a way that's not possible within the carefully and consensually crafted framework of a formal standards specification.
You should read this book if you're interested in XQuery. That may not be that helpful a statement, since it describes a very large number of technophiles these days. There are two programming disciplines in particular, however, whose members will find particular value in this volume. This book will likely interest you if you're an XSLT developer. As noted above, XQuery shares a number of capabilities with XSLT and is likely to replace it in some areas. Of particular interest, Michael Kay's chapter on "XQuery, XPath, and XSLT" examines the commonalities and differences between the two languages in some detail.
This book will likely also interest you if you're corporately or otherwise involved with SQL and relational databases. XQuery has often been called SQL for XML, and that's no accident, given that a number of the members of the working group come from a relational database background, and the fact that XQuery was designed from the ground up to work with relational data. Two of the chapters in the "Database" section of the book look at the connections between XQuery and relational data.
Whatever your specific background, to get good value from this book you should be comfortable and familiar with XML basics. You'll probably do best if you have some prior exposure to XQuery, although it doesn't have to be extensive. At a minimum, the book assumes that you're conversant with the fundamentals of XPath and know what a location path is. Jonathan Robie's introductory guided tour provides a good overview of XQuery for those who aren't already familiar with the technology.
As mentioned above, readers of this book are likely to come from different backgrounds, and how you approach the material will depend on your specific experience and interests. Here's a quick roadmap to the main sections of the book and a look at the individual chapters to help you figure out where to dive in first. There are four sections in all:
Jonathan Robie's "XQuery: A Guided Tour" provides a good starting point if you're new or relatively new to XQuery. Its easy, tutorial-like style means you can sit down and read it straight through if you're so inclined. As a compact and convenient reference to most of XQuery's key features, it's also a good place to periodically return to, for newcomers and experts alike, for a quick refresher of the basics as you weave in and out of the detail in the other chapters. Jonathan's coverage is extensive; most of the Glossary entries in the back of the book (a useful resource when you're stumbling across new terminology) originated in this chapter.
The two chapters in the "Background" section provide historical context and a detailed rationale for many of the complex technical decisions the Query working group has had to make as the language has evolved. The second chapter in this section will be of particular interest to XSLT developers, since it provides a valuable comparison and contrast between XQuery and XSLT, the two official W3C-mandated languages that are quite similar in a number of ways.
As Don Chamberlin describes in "Influences on the design of XQuery," the process of designing XQuery has been one of resolving the tensions between conflicting goals, and this chapter provides a historical and technical description of that dialectic in action. This chapter also places XQuery in the context of the other related languages and standards it coexists with. The second half of the chapter deals in cogent detail with the intricacies of what Don calls "watershed issues": eight complex and often controversial issues that have had a major impact on the design of the language. Don goes a long way to teasing apart the complexities
As Mike Kay notes in his chapter on "XQuery and XSLT," the fact that both these languages share a common data model, as well as a common sublanguage in XPath, is a major achievement of the W3C. His chapter explores that commonality and the overlap in functionality between the two languages, as well as their differences. This chapter describes where each language might be employed to best advantage. Mike addresses some of the same issues discussed by Don in the previous chapter but from the particular perspectives of XPath and XSLT.
Both chapters in this section were jointly co-written by Mary Fernandez, Phil Wadler, and Jerome Simeon.
The chapter "Static Typing in XQuery" is a gentle tutorial that explores the ramifications of static typing in a language dealing with XML data. Despite the term "formal" in the title of this section --this chapter fits very naturally here because it provides such a great lead-in to the chapter on the formal semantics--the topic isn't difficult or particularly heavy. Static typing is important to XQuery developers because it can help guarantee program correctness. It can also significantly help speed up the development cycle, as this chapter attests. It's important that users understand the concept of static typing so they can better understand the meaning of the error messages returned by the query system they're working with.
"Introduction to the Formal Semantics" is a tutorial-like introduction to the formal semantics, the formal mathematical system on which XQuery is built. This is likely the single most challenging technical component of XQuery. This chapter should appeal to implementors, language theoreticians, and those just terminally curious about this aspect of the language. They should find this chapter a much less daunting approach to the formal semantics than that provided by the specification.
Most major relational database vendors already have or will shortly provide support for XQuery as a front end for relational data, and interest in XQuery from this market sector was one of the driving forces behind its development. The first two chapters in this section deal with the topic of XQuery and relational data and were jointly developed by their two authors. The last chapter in this section describes the features of what its author refers to as an XML database mangagement system.
XQuery was designed to query XML, and using it to query and pull data out of relational databases that store information in tabular format poses a number of interesting challenges. Denise Draper explores these issues in "Mapping between XML and Relational Data."
Michael Rys' chapter, "Integrating XQuery and Relational Database Systems," builds on the foundation laid in the prior chapter. This chapter shows two methods of accessing XML stored in a relational database. One approach uses the XML datatype to store XML into the database as an LOB (large object) and accesses that data using a combination of both XQuery and SQL. Michael also describes a so-called "top-level XQuery" approach that obviates the need to use SQL altogether.
Jim Tivy's concluding chapter, "A Native XML DBMS," rounds out the offerings in this section. Jim describes the key features of what he calls an XML database management system and explores what that means. He looks at the use of the XQuery data model in that context and explores other XML DBMS features such as command languages and APIs, drawing on his experience with XStreamDB (his own native XML database product), Tamino, and the xmldb initiative.
Download the Index
file related to this title.