Docs GODI Archive
Projects Blog Link DB

Search GODI:


More options
File doc/godi-galax/readme.html GODI Package godi-galax
 
   readme.html    Sources  
Previous Up Next

Chapter 1  Getting Started

1.1  What is XQuery 1.0?

XQuery 1.0 is a query language for XML, defined by the World-Wide Web Consortium (W3C), under the XML activity. XQuery is a powerful language, which supports XPath 2.0 as a subset and includes expressions to construct new XML documents, SQL-like expressions to perform selection, joins, and sorting over collections of XML values, operations on namespaces, and expressions over XML Schema types. XQuery is a functional language, which comes with an extensive library of built-in functions, and allows user to define their own functions. More information about XQuery can be found of the XML Query Working Group Web page1.

1.2  What is Galax?

Galax is an implementation of XQuery 1.0 designed with the following goals in mind: completeness, conformance, performance, and extensibility. Galax is open-source, and has been used on a large variety of real-life XML applications. Galax relies on a formally specified and open architecture which is particularly well suited for users interested in teaching XQuery, or in experimenting with extensions of the language or optimizations.

Here is a list of the main Galax features.

  • Galax implements the January 2007 (W3C Recommendation) set of specifications for XQuery.
  • Galax supports Minimal Conformance, as well as the following optional features: Static Typing, Full Axis, Module, and Serialization. The following table lists Galax 1.0 results with respect to the XQuery Tests Suite version 1.0.2:
     PassFailTotalPercent
    Minimal Conformance145537114637(99.4%)
    Optional Features    
     Static Typing Feature46046(100%)
     Full Axis Feature1300130(100%)
     Module Feature32032(100%)
  • Galax supports Unicode, with native support for the UTF-8 and ISO-8859-1 character encodings.
  • Galax is portable and runs on most modern platforms.
  • Galax includes a command-line interface, APIs for OCaml, C, and Java, and a simple Web-based interface.
  • Galax includes partial support for the Schema Import and Schema Validation optional features. Unimplemented features of XML Schema include simple types facets and derivation by extension and restriction on complex types.
  • Galax supports the XQuery 1.0 Update Facility2.
  • Galax supports the XQueryP scripting extension for XQuery3.
Alpha features:

The following features are experimental.

  • Galax inludes support for SOAP and WSDL-based Web Services invocation;
  • Galax inludes support for Distributed XQuery development;
  • Galax’s compiler includes an optimizer that supports state of the art database and programming language optimization, including:
    • type-based optimizations, notably eliminating unnecessary type matching or casting operations and turning dynamic dispatch into static dispatch for comparison and arithmetic operators;
    • tail-recursion optimization;
    • join and query unnesting optimizations, including physical support for XQuery-specific hash and sort join algorithms;
    • tree-pattern detection in query plans and physical support for the TwigJoin and StaircaseJoin algorithms;
    • generation of hybrid streamed/materialized query plans.
  • Galax has an extensible data model interface. This allows users to provide their own implementation of the XML data model. This can be used to support e.g., XML queries over legacy data.
Limitations:

See Chapter 4 for details on Galax’s alignment with the XQuery and XPath working drafts.

1.2.1  Changes since the last version

The following lists the main changes included with this version (1.0).

  • Galax 1.0 supports the latest OCaml 3.10 compiler and GODI 3.10.
  • Support for the XQuery Update Facility 1.0, August 2007 Working Draft. Support for the XQuery 1.0 Update Facility Static Typing Feature.
  • Improved implementation of XQueryP.
    • Re-implementation of while loops.
    • Fixed issues with scoping.
  • Improved support for modules.
    • Properly implemented nested imports.
    • Added support for module interfaces.
  • Support for XQueryX trivial embedding.
  • Bug fixes:
    • Fixed problems with support for in-scope namespaces.
    • Fixed problems with checking of cyclic variable declarations.
    • Fixed several problems with the parser, using wrong lexical states inside constructors.
    • Small bug fixes in support for the prolog.

Changes from older versions can be found in Chapter 8.

1.3  Downloading and installing Galax

The official distribution can be downloaded from the main Galax Web site4. Detailed installation instructions are provided in Chapter 2.

1.4  How to use Galax

The Galax processor offers the following user interfaces:

  • Command-line.
  • Application-programming interfaces (APIs) for OCaml, C, or Java.
  • Web interface.

1.4.1  Using Galax from the command line

A number of stand-alone command-line tools are provided with the Galax distribution. Assuming the Galax distribution is intalled in $GALAXHOME, and that Galax executables are reachable from your $PATH environment variable, The following examples show how to use the main command-line tools.

galax-run
The main XQuery interpreter (galax-run) is the simplest way to use Galax. For instance, the following commands:
% echo "<two>{ 1+1 }</two>" > test.xq
% galax-run test.xq
<two>2</two>
evaluates the query <two>{ 1+1 }</two> and prints the XML result <two>2</two>.
galax-parse
The Galax XML parser and XML Schema validator can be called as a standalone tool. For instance, the following command validates the document in hispo.xml against the schema in hispo.xsd:
% galax-parse -validate -xmlschema $GALAXHOME/examples/docs/hispo.xsd \
                                   $GALAXHOME/examples/docs/hispo.xml 
galax-mapschema
A stand-alone tool that maps XML Schema documents into the XQuery type system. This tools is useful for checking whether Galax recognizes all the constructs in your XML Schema. It also eliminates a lot of the “noise” in XML Schema’s XML syntax.

For instance, this command will print out the XQuery type representation of the schema in hispo.xsd:

% galax-mapschema $GALAXHOME/examples/docs/hispo.xsd 

Chapter 5 describes the command-line tools in detail.

1.4.2  Web interface

The Web interface is a simple and convenient way to get acquainted with Galax. It allows users to submit a query, and view the result of compilation and execution for that query.

An on-line version is available on-line at: http://www.galaxquery.org/demo/galax_demo.html

You can also re-compile the demo from the Galax source and install it on your own system. You will need an HTTP server (Apache is recommended), and follow the compilation instructions in Section 2.4.

1.4.3  Language API’s

Galax supports APIs for OCaml, C, and Java. See Chapter 6 for how to use the APIs.

If you have installed the binary distribution of Galax, all three APIs are available.

If you have intalled the source distribution of Galax, you will need to select the language(s) for which you need API support at configuration time. See Chapter 2 for details on compiling Galax from source.

Examples of how to use Galax’s APIs can be found in the following directories:
$GALAXHOME/examples/caml_api/
$GALAXHOME/examples/c_api/
$GALAXHOME/examples/java_api/.


1
http://www.w3c.org/XML/Query
2
http://www.w3.org/TR/xquery-update-10/
3
http://www.ximep-2006.org/papers/Paper-Chamberlin-Carey.pdf
4
http://www.galaxquery.org

Previous Up Next
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml