Home   |   Products   |   Purchase   |   Support   |   XQuery Demo   |   About Us   |   Contact Us  
» XQuery Demo
» Use Cases
» Simple Queries
» Type Examples
» Full-Text Search
» About XQuantum
» Alignment


XQuantum® Alignment with XQuery 1.0

XQuantum fully supports the XQuery 1.0 standard and a subset of the May 1, 2006 Full-Text draft standard.  The optional XQuery features for Static Typing and Modules are also fully supported.

The XQuantum type system generalizes the sequence type syntax of the XQuery standard to include full regular expression types.  We refer to this extended type system as the regular type system.  The rationale for using regular types is discussed below under the heading Regular Type System.

Features in XQuantum 1.0

Static Type Checking
Document Order
Effective Boolean Value
SequenceType Syntax
SequenceType Matching
Variable References
Function Calls
Path Expressions
Sequence Expressions
Arithmetic Expressions
Value Comparisons
General Comparisons
Node Comparisons
Logical Expressions
Direct Constructors
Computed Constructors

FLWOR Expressions
Ordered and Unordered Expressions
Conditional Expressions
Quantified Expressions
Instance Of
Version Declaration
Module Declaration
Module Import
Variable Declaration
Function Declaration
Full-Text Operators
NaN, INF, -INF Values
ISO-8859-1 Encoding

Additional Features in XQuantum 1.50

Processing Instruction Nodes
Comment Nodes
Namespace Awareness
Extension Expressions
Boundary-space Declaration
Default Collation Declaration
General Type Constructors
Collation Sequences
Position Variables
Document Collections
Query Modules

Base URI Declaration
Construction Declaration
Ordering Mode Declaration
Empty Order Declaration
Copy-Namespaces Declaration
Option Declarations
Unicode Normalization
Unicode Character Encodings
XML Schema Datatypes
Dates, Times, and Durations
Built-in Functions and Operators

Language Extensions

Regular Expression Types
Regular Type Declarations
Regular Type Modules

Validation with Regular Types
Enclosed Expression Typing
Advanced Whitespace Options

Regular Type System
XQuantum generalizes the XQuery sequence type syntax by adding a choice type operator, | and a sequence type operator, comma.  With these extensions, you can specify types which allow arbitrary combinations of elements with different content models.  XQuantum also allows you to declare type definitions in the query prolog, and you can optionally type external XML files using regular type definitions stored in .rtd files. 

The goal of making these changes is to give XQuery a type system that is integrated into the language as is typically the case with other programming languages.  The XQuery standard provides a limited type system internal to the language and requires that you specify complex types externally using XML Schema, a different language. 

The following query example illustrates some of the features just described.  It declares a BOOK type and uses it to validate an untyped XML value, producing a typed value.

    declare type BOOK := element(book, (
        attribute(year, xs:integer),
        element(title, xs:string),
        element(author, xs:string)+)

    declare variable $book :=
    <book year="1999">
        <title>The XML Companion</title>
        <author>Neil Bradley</author>

    $book validate as BOOK
During validation against the BOOK type, the year attribute is converted into an xs:integer, and all the element values are converted into xs:strings.

Regular types differ semantically from sequence types, in that regular types use structural typing as opposed to named typing.  This means that regular types are compared based on their structure.  Two types with the same structure are the same, even if they have different names.

Regular Type Grammar
The grammar used for regular types is the same that is used for sequence types in the standard, except that a choice operator, '|', and a sequence operator, ',' have been added.  Parenthesis should be used around choice and sequence types whenever they are used in type declarations or passed as arguments to type constructors,







choice | sequence

sequence, repeat

repeat *
repeat +
repeat ?

document-node( )
element( )
element(name, repeat)
attribute( )
attribute(name, repeat)

The builtin grammar symbol represents one of the built-in types defined above, and the name symbol represents a user-defined type name.  The grammar gives the sequence operator higher precedence than the choice operator.

     Copyright © 2009 Cognetic Systems, Inc. ·  Legal Notices  ·  Privacy Statement  ·  Powered by XQuantum ®