This compiler efficiently translates XQuery code into Haskell, occupying minimal memory and executing quickly.
One of its primary features is its ability to capitalize on Haskell's lazy evaluation, which enables the user to keep in memory only those parts of XML data that are relevant at each point of evaluation. Consequently, HXQ employs stream-based evaluation for forward queries, which does not incorporate any backward steps. This implementation results in a fast and space-saving execution, similar to any stream-based implementation based on SAX filters or finite-state machines.
Additionally, the HXQ code is more straightforward, versatile and extensible as it is based on XML trees, rather than SAX events. Because of its utilization of lazy evaluation, HXQ produces non-blocking query outcomes instantly, while non-streaming XQuery processors must first parse the entire input file and construct the whole XML tree in memory before producing any output.
Finally, HXQ is capable of saving XML files to a relational database, presently MySQL or SQLite, through shredding XML into relational tuples, and by translating XQueries over the shredded documents into optimized SQL queries. To achieve this, HXQ uses hybrid inlining to inline attributes and non-repeating elements into a single table, resulting in a concise relational schema.
Furthermore, for every mapping, HXQ creates an XQuery synthesizing the original XML document from the shredded data. This query is then fused with the user queries via partial evaluation techniques, and the outcome is all the relevant predicates promoted to SQL through code folding rules. As a result, most of the evaluation is transferred to the database query engine, resulting in fast execution over enormous datasets.
Note that HXQ is licensed and distributed under BSD License terms.
Version 0.17.0: N/A