[Galax]

Tech. Center
 Publications
 Static Typing
 Compiler

About Static Typing

The purpose of this page is to help you get acquainted with XQuery's type system, and static typing.

Static typing in XQuery is one of the most innovative feature of XQuery. Static typing can be used to check at compile time that your query will never raise any type errors. This allows to detect a large number of errors during early phases of the development of your application. Static typing has proved itself an invaluable tool in other programming languages in the past, for instance in Java or ML. This benefit has a cost though, since the developer must first understand the type system, and how to work effectively with it. In the context of XQuery, the type system is based on XML Schema.

Galax and Static Typing. Galax supports XQuery's static typing option.


XML Schema and the XQuery Type System

The first step in understanding static typing is to understand XML Schema which is XQuery's type system. An introduction to the semantics of XML Schema and the corresponding type system can be found in the following paper:

  • The Essence of XML, Philip Wadler, and Jérôme Siméon. ACM Conference on Principles of Programming Languages (POPL'2003). January 2003.

The complete specification for XQuery's type system and many more examples can be found in the XQuery 1.0 and XPath 2.0 Formal Semantics.


Static Typing in XQuery

The way static typing functions can be somewhat complex. Understanding how static typing works is not necessary for a user of the language, but is necessary for an XQuery implementor. The following papers and presentations explain the basics of static typing in XQuery.


Subtyping

Dealing subtyping on XML Schema types is one of the main technical difficulty when implementing XQuery's type system. The following paper presents a way to deal with subtyping in XQuery. Galax subtyping algorithm is based on this paper.

  • Subsumption for XML Types. Gabriel M. Kuper and Jérôme Siméon, in International Conference on Database Theory (ICDT'2001), January 2001, London, UK.