Chapter 4. Static Typing in XQuery

Mary Fern ndez, J r me Sim on, and Philip Wadler

XQuery is a strongly typed language, meaning that the types of values and expressions must be compatible with the context in which the value or expression is used. All implementations of XQuery must support dynamic typing, which checks during dynamic evaluation that the type of a value is compatible with the context in which it is used and raises a type error if an incompatibility is detected . XQuery implementations may optionally support static typing, which checks during static analysis that the type of an expression is compatible with the context in which it is used. Static Typing can shorten the development cycle by detecting common type errors before a query is evaluated.

This chapter explains how to use the XQuery type system to write type-safe queries, how to understand and resolve type errors, and how to work around the type system when necessary. Although focused on the XQuery static type system, this chapter is appropriate for all XQuery users, because it explains the relationships between dynamic typing, static typing, and validation.

Before reading this chapter, you should read Chapter 1, "XQuery: A Guided Tour," and you should read this chapter before reading Chapter 5, "Introduction to the Formal Semantics." Most of the typing concepts described by example in this chapter are described formally and completely in Chapter 5. Although informal examples help us learn how to use the XQuery type system, the formal definition of XQuery is necessary to build correct and complete implementations.

All typing concepts are introduced in the context of a realistic programming scenario, in which a programmer is given an input schema and an output schema, and he must write a query that transforms data conforming to the input schema into data conforming to the output schema.



XQuery from the Experts(c) A Guide to the W3C XML Query Language
Beginning ASP.NET Databases Using VB.NET
ISBN: N/A
EAN: 2147483647
Year: 2005
Pages: 102

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