Home > Store

XQuery from the Experts: A Guide to the W3C XML Query Language

Register your product to gain access to bonus material or receive a coupon.

XQuery from the Experts: A Guide to the W3C XML Query Language

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2004
  • Dimensions: 7" x 9-1/4"
  • Pages: 512
  • Edition: 1st
  • Book
  • ISBN-10: 0-321-18060-7
  • ISBN-13: 978-0-321-18060-5

"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:

  • Denise Draper on "Mapping Between XML and Relational Data"
  • Michael Rys exploring "Integrating XQuery and Relational Database Systems"
  • Jim Tivy's analysis of "A Native XML DBMS"
  • Mary Mary Fernández, Jérôme Siméon, and Philip Wadler, presenting "Static Typing in XQuery"
  • Information presented in both a tutorial and a reference framework for use by XML professionals of any level
  • For IT managers, professionals, programmers, or anyone involved with XML, XQuery from the Experts is an invaluable resource.



    0321180607B07212003

    Sample Content

    Online Sample Chapters

    Influences on the Design of XQuery

    Mapping between XML and Relational Data

    Downloadable Sample Chapter

    Download the Sample Chapter related to this title.

    Table of Contents



    Preface.


    Contributors.


    Acknowledgments.

    I. BASICS.

    1. XQuery: A Guided Tour.

    Sample Data: A Bibliography.

    Data Model.

    Literals and Comments.

    Input Functions.

    Locating Nodes: Path Expressions.

    Creating Nodes: Element, Attribute, and Document Constructors.

    Combining and Restructuring Nodes.

    FLWOR Expressions.

    Quantifiers.

    Conditional Expressions.

    Operators.

    Arithmetic Operators.

    Comparison Operators.

    Sequence Operators.

    Built-in Functions.

    User-Defined Functions.

    Variable Definitions.

    Library Modules.

    External Functions and Variables.

    Types in XQuery.

    Introduction to XQuery Types.

    Schemas and Types.

    Sequence Types.

    Working with Types.

    Summary.

    II. BACKGROUND.

    2. Influences on the Design of XQuery.

    The Need for an XML Query Language.

    Basic Principles.

    The Query Data Model.

    Related Languages and Standards.

    XML and Namespaces.

    XML Schema.

    XPath.

    Other Query Languages.

    Watershed Issues.

    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.

    XPath 1.0.

    Why Was a New Query Language Needed?

    Differing Requirements.

    Differing Cultures.

    Convergence: XPath 2.0.

    XSLT and XQuery Compared.

    XML-Based Syntax.

    Semantics of Element Construction.

    Functions and Named Templates.

    FLWOR Expressions.

    Template Rules.

    Axes.

    Type Strictness.

    Optimization Techniques.

    Where Does the Time Go?

    Internal Coding Efficiency.

    Pipelining and Lazy Evaluation.

    Expression Rewriting.

    Using Type Information.

    Conclusion.

    III. FORMAL UNDERPINNINGS.

    4. Static Typing in XQuery.

    The Benefits of Static Typing.

    An XQuery Programming Scenario.

    Debugging.

    Validation.

    Static Typing.

    Getting Started with Types.

    XML Schema and XQuery Types.

    Values.

    Sequence Types.

    Schema Import.

    Relating Values and Types.

    Literals and Operators.

    Variables.

    Functions.

    Conditionals.

    Path Expressions.

    Predicates.

    FLWOR Expressions.

    Element Construction.

    Validation Context.

    Validation Mode.

    A Final Example: Grouping.

    Conclusions.

    5. Introduction to the Formal Semantics.

    The Benefits of a Formal Semantics.

    Getting Started with the Formal Semantics.

    Dynamic Semantics.

    Environments.

    Matching Values and Types.

    Errors.

    Static Semantics.

    Type Soundness.

    Evaluation Order.

    Normalization.

    Finishing Getting Started.

    Learning More about XQuery.

    Values and Types.

    Matching and Subtyping.

    FLWOR Expressions.

    Path Expressions.

    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.

    Processing Models.

    Application Types.

    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.

    Default Mapping.

    Extended SQL.

    Annotated XML Template.

    Additional Mapping Languages.

    Shredding.

    Creation of the Database.

    Adding Extra Information to the Composition.

    Inlining and Consolidation.

    Support of Full XML.

    Schema-Independent Representation.

    Implementation Concepts.

    Emitting XML Documents.

    Querying and Updating XML Documents.

    Conclusion.

    7. Integrating XQuery and Relational Database Systems.

    Getting Started.

    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.

    Top-Level 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.

    Interoperability.

    Data-Definition Interfaces.

    Update Interfaces.

    Database Configuration Interfaces.

    A Database Command Language.

    Collections and Storage.

    XQuery Client APIs.

    Full-Text Search in a Native XML Database.

    Sample Applications.

    Invoice Archive.

    A Content Management Application.

    Conclusion.

    References.
    Glossary.
    Index.

    Preface

    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.

    This Book

    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.

    Who Should Read This Book?

    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.

    Organization and Roadmap

    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:

  • "Basics"
  • "Background"
  • "Formal Underpinnings," and
  • "Databases"
  • Basics

    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.

    Background

    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.

    Formal Underpinnings

    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.

    Databases

    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.



    0321180607P05222003

    Index

    Download the Index file related to this title.

    Updates

    Submit Errata

    More Information

    InformIT Promotional Mailings & Special Offers

    I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

    Overview


    Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

    This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

    Collection and Use of Information


    To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

    Questions and Inquiries

    For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

    Online Store

    For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

    Surveys

    Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

    Contests and Drawings

    Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

    Newsletters

    If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

    Service Announcements

    On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

    Customer Service

    We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

    Other Collection and Use of Information


    Application and System Logs

    Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

    Web Analytics

    Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

    Cookies and Related Technologies

    This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

    Do Not Track

    This site currently does not respond to Do Not Track signals.

    Security


    Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

    Children


    This site is not directed to children under the age of 13.

    Marketing


    Pearson may send or direct marketing communications to users, provided that

    • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
    • Such marketing is consistent with applicable law and Pearson's legal obligations.
    • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
    • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

    Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

    Correcting/Updating Personal Information


    If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

    Choice/Opt-out


    Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

    Sale of Personal Information


    Pearson does not rent or sell personal information in exchange for any payment of money.

    While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

    Supplemental Privacy Statement for California Residents


    California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

    Sharing and Disclosure


    Pearson may disclose personal information, as follows:

    • As required by law.
    • With the consent of the individual (or their parent, if the individual is a minor)
    • In response to a subpoena, court order or legal process, to the extent permitted or required by law
    • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
    • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
    • To investigate or address actual or suspected fraud or other illegal activities
    • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
    • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
    • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

    Links


    This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

    Requests and Contact


    Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

    Changes to this Privacy Notice


    We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

    Last Update: November 17, 2020