packages feed

HXQ-0.7.2: Test2.hs

{--------------------------------------------------------------
-
- Testing the  XQuery compiler on a large file
- Download dblp.xml from http://dblp.uni-trier.de/xml/
- Programmer: Leonidas Fegaras (fegaras@cse.uta.edu)
- Date: 03/30/2008
-
---------------------------------------------------------------}

{-# OPTIONS_GHC -fth #-}

module Main where

import XQuery


f(x,y) = $(xe "<a>{$x,', ',$y}</a>")

main = do a <- $(xq ("<result>{                                                               "
                 ++"     for $x at $i in doc('data/dblp.xml')//inproceedings                  "
                 ++"     where $x/author = 'Leonidas Fegaras'                                 "
                 ++"     order by $x/year descending                                          "
                 ++"     return <paper>{ $i, ') ', $x/booktitle/text(),                       "
                 ++"                     ': ', $x/title/text()                                "
                 ++"            }</paper>                                                     "
                 ++"  }</result>                                                              "))
          putXSeq a
          b <- $(xq "f($a/paper[10],$a/paper[8])")
          putXSeq b