Galax Manual: XQuery 1.0 Conformance

# Chapter 4 XQuery 1.0 Conformance

This chapter documents the relationship of Galax to the target W3C working drafts. Galax 1.0 is a prototype implementation, and therefore it is not (yet) completely aligned with the relevant W3C working drafts (WDs). This chapter also document the non-standard features in Galax 1.0 and the known bugs and limitations.

Galax 1.0 implements the January, 2007 XQuery 1.0 and XPath 2.0 Candidate Recommendations, the XML 1.0 Recommendation, the Namespaces in XML Recommendation, and XML Schema Recommendation (Parts 1 and 2).

Galax 1.0 implements the XQuery 1.0 Recommendations:

- XQuery 1.0 and XPath 2.0 Data Model. W3C Recommendation January, 2007. (`http://www.w3.org/TR/xpath-datamodel/`).
- XQuery 1.0 : An XML Query Language. W3C Recommendation January, 2007. (`http://www.w3.org/TR/xquery/`).
- XQuery 1.0 and XPath 2.0 Formal Semantics. W3C Recommendation January, 2007. (`http://www.w3.org/TR/xquery-semantics/`).
- XQuery 1.0 and XPath 2.0 Functions and Operators. W3C Recommendation January, 2007. (`http://www.w3.org/TR/xpath-functions/`).
- XML Query Use Cases. W3C Working Draft 23 March 2007. (`http://www.w3.org/TR/2007/NOTE-xquery-use-cases-20070323/`).
- XML Schema Part 1: Structures and Part 2: Datatypes. W3C Recommendation 2 May 2001. `http://www.w3.org/TR/xmlschema-1/`, `http://www.w3.org/TR/xmlschema-2/`.

## 4.1 Data Model

Galax 1.0 fully supports the XQuery 1.0 and XPath 2.0 Data Model.

Galax 1.0 implements an xsd:float value as an xsd:double value.

## 4.2 XQuery

The alignment issues in this section follow the outline of the "Expressions" section in `http://www.w3c.org/TR/xquery`. If a subsection is not listed here, it means that Galax 1.0 implements the semantics described in that section.

### XQuery Section 2.1.1 Static Context

Galax 1.0 does not support:

- XPath 1.0 compatibility modes.
- Collations.
- The construction mode. Type annotations on copied elements are always erased/eliminated.
- The ordering mode. Input order is always preserved.

### XQuery Section 2.1.2 Dynamic Context

The implicit timezone is set to the local timezone.

### XQuery Section 2.2 Processing Model

Galax’s processing model is similar to XQuery’s abstract processing model. See Section 7 for more information on Galax’s internal processing model.

### XQuery Section 2.2.4 Serialization

### XQuery Section 2.3.3 Effective Boolean Value

Galax 1.0 does not check that a numeric value is equal to NaN when computing an effective boolean value.

### XQuery Section 2.3.4 Input Sources

Galax 1.0 does not support the `fn:collection()` function.

The context item and values for external variables can be specified on the command line or in the API. See Sections 5.1.1 and 6.2.

### XQuery Section 2.4.4 SequenceType Matching

Galax requires that all actual types, that is, those types that annotate input documents be in the in-scope schema definitions. Galax will raise a dynamic error if it encounters a type in a document that is not imported into the query by an import schema prolog statement.

### XQuery Section 2.6 Optional Features

Galax supports the Schema Import, Static Typing, and Full Axis features.

### XQuery Section 2.6.4 Module Feature

Galax 1.0 supports the Module feature.

### XQuery Section 2.6.5 Pragmas

Galax 1.0 does not support the Pragmas feature.

### XQuery Section 2.6.6 Must-Understand Extensions

Galax 1.0 does not support must-understand extensions.

### XQuery Section 2.6.7 Static Typing Extensions

Galax 1.0 does not support static typing extensions.

### XQuery Section 3.1.1 Literals

Galax 1.0 implements an xsd:float value as an xsd:double value.

### XQuery Section 3.2.1.1 Axes

Galax 1.0 supports all axes with the exception of the preceding and following axes.

### XQuery Section 3.7 Constructors

When constructing a new element, Galax 1.0always erases/eliminates type annotations on copied elements.

When constructing a new element, Galax 1.0requires that the new element’s attributes precede its other content.

### XQuery Section 3.7.4 In-scope Namespaces of a Constructed Element

Namespace declarations in input and output documents and in input queries are not handled consistently. We are working on this.

### XQuery Section 3.9 Ordered and Unordered Expressions

Galax 1.0 will accept queries that contain the `ordered` or `unordered` expressions, but they have no effect on query evaluation (i.e., they are no-ops).

### XQuery Section 4.2 Module Declaration

### XQuery Section 4.2 Module Import

Galax 1.0 supports the Module feature.

### XQuery Section 4.4 Default Collation Declaration

Galax 1.0 does not support collations.

### XQuery Section 4.6 Construction Declaration

Galax 1.0 does not support the construction declaration.

### XQuery Section 4.8 Default Ordering Declaration

Galax 1.0 does not support the default ordering declaration.

### XQuery Section 4.9 Schema Import

Schema components in an imported schema are mapped into XQuery types according to the mapping rules specified in the XQuery 1.0 Formal Semantics (see below).

## 4.3 XQuery 1.0 Formal Semantics

The XQuery 1.0 formal semantics defines the mapping of every XQuery expression into an expression in the XQuery core, and it defines the static and dynamic semantics of each core expression. The formal semantics also defines how imported schemas are mapped into internal XQuery types.

Galax 1.0 implements the static and dynamic semantics of core expressions defined in the XQuery 1.0 Formal Semantics.

## 4.4 Functions and Operators

Galax 1.0 supports most of the functions in the XQuery 1.0 and XPath 2.0 Functions and Operators document. The signatures of supported functions are listed in `$``GALAXLIB``/pervasive.xq`.

Galax 1.0 does not support the following functions:

      fn:id
      fn:idref
      fn:collection

### Functions and Operators Section 4 The Trace Function

The `fn:trace` function emits its input sequence and message are to standard output.

### Functions and Operators Section 5.2 Constructor Functions for User-Defined Types

Galax 1.0does not support constructor functions for user-defined types.

### Functions and Operators Section 12 Functions and Operators on base64Binary and hexBinary

Galax 1.0 does not support any functions on binary data.

## 4.5 Use Cases

See `$``GALAXHOME``/usecases/STATUS`

## 4.6 Galax 1.0 extensions

### 4.6.1 Defining XQuery Types in the Query Prolog

Type values are available in a query by either importing a predefined XML schema using the `import schema` declaration in the query prolog or by defining XQuery types explicitly in the query prolog.

Galax 1.0 supports the definition of XQuery types in the query prolog using the internal type syntax defined in the XQuery 1.0 Formal Semantics. The grammar is provided here for reference:

        TypeDeclaration ::=    ("define" "element" QName "{" TypeDefn? "}")
                            |  ("define" "attribute" QName "{" TypeDefn? "}")
                            |  ("define" "type" QName "{" TypeDefn? "}")

        TypeDefn        ::=    TypeUnion
                            |  TypeBoth
                            |  TypeSequence
                            |  TypeSimpleType
                            |  TypeAttributeRef
                            |  TypeElementRef
                            |  TypeTypeRef
                            |  TypeParenthesized
                            |  TypeNone

        TypeUnion        ::= TypeDefn  "|"  TypeDefn
        TypeBoth         ::= TypeDefn  "&"  TypeDefn
        TypeSequence     ::= TypeDefn  ","  TypeDefn
        TypeSimpleType   ::= QName OccurrenceIndicator
        TypeAttributeRef ::= "attribute" NameTest ("{" TypeDefn? "}")? OccurrenceIndicator
        TypeElementRef   ::= "element" NameTest ("{" TypeDefn? "}")? OccurrenceIndicator
        TypeTypeRef      ::= "type" NameTest OccurrenceIndicator
        TypeParenthesized::= "(" TypeDefn? ")" OccurrenceIndicator
        TypeNone         ::= "none"

### 4.6.2 Galax specific functions

Galax-only functions are put in the Galax namespace (http://www.galaxquery.org), which is bound by default to the glx: prefix.

See `$GALAXHOME/lib/pervasive.xq` for a complete list of functions in the Galax namespace.