Conclusions

In this chapter we illustrated the benefits of static typing for a small but nontrivial XQuery application and then explained how XQuery infers the type for each expression during static analysis. Along the way, we learned about the many common errors that can be detected by static typing, including misspelled names in path expressions and constructors, and the use of an expression whose type is not compatible with the type required by the context in which the expression is used. We also showed how to compensate for the limitations of static typing, such as refining the cardinality of a type.

We expect that the benefits of static typing will increase with the size of XQuery applications. Like other modern languages, XQuery supports modules, which aid in the development of reusable libraries. XQuery modules most often will be designed for XML data conforming to some XML schema (e.g., SOAP, RDF, BizTalk, etc.). Hundreds of domain-specific DTDs and XML Schemas already exist, and we expect the number and complexity of these schemas to increase as XML data proliferates. Consequently, more XQuery applications will use imported modules and their associated schemas. Static typing can help make these applications more robust by guaranteeing that an application's uses of a module's data and functions are type-safe.

Although specific aspects of static typing, such as error messages, may differ across XQuery implementations , the examples in this chapter should help the users of any XQuery implementation get started with static typing. XQuery implementers, however, need to understand the details of the type system's inference rules. Those rules, and the rules for dynamic evaluation, are the subject of Chapter 5.



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