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.

Alpha features:

The following features are experimental.

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).

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:

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
2
3
4

Previous Up Next