[Haskell-cafe] ANN: HXQ: An XQuery Compiler/Interpreter for Haskell

Fegaras, Leonidas fegaras at uta.edu
Sun Apr 20 17:42:42 EDT 2008

Dear Haskell cafe members,
I would like to announce the release of an XQuery compiler/interpreter
for Haskell, called HXQ. You can get more info and download it at:


HXQ is a fast and space-efficient translator from XQuery (the standard
query language for XML) to embedded Haskell code. The translation is
based on Haskell templates. HXQ takes full advantage of Haskell's lazy
evaluation to keep in memory only those parts of XML data needed at
each point of evaluation, thus performing stream-based evaluation for
forward queries (queries that do not contain backward steps). This
results to an implementation that is as fast and space-efficient as
any stream-based implementation based on SAX filters or finite state
machines. Furthermore, the coding is far simpler and extensible since
its based on XML trees, rather than SAX events.

For example, a complex XQuery against the DBLP bibliography (420MB XML)
runs in 39 seconds on my laptop (using 18MB of max heap space in ghc).
To contrast this, Qexo, which compiles XQueries to Java bytecode, took
1 minute 17 seconds (using no less than 1400MB of heap space).
Also XQilla, which is written in C++, took 1 minute and 10 secs
(using 1150MB heap).

Current Status: HXQ supports most essential XQuery features, although
some system functions are missing (but are easy to add). HXQ has
little support for backward step axes, such as /.. (parent). Some, but
not all, parent axis steps are removed using optimization rules; all
others cause a compilation error. Finally, HXQ does not comply to the
XQuery semantics that requires duplicate elimination and sorting by
document order for every XPath step, which is very expensive and
unnecessary in most cases.

Please email me any suggestions for improvements or extensions you'd
like to see. My plan is to use it as a base for various XQuery
projects, such as adding SQL connectivity, as well as native storage
and indexing.
Leonidas Fegaras
U. of Texas at Arlington
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080420/1a9ec556/attachment.htm

More information about the Haskell-Cafe mailing list