HXQ-0.2: Main2.hs
{--------------------------------------------------------------
-
- The main program of the XQuery processor
- Programmer: Leonidas Fegaras (fegaras@cse.uta.edu)
- Date: 03/19/2008
-
---------------------------------------------------------------}
{-# OPTIONS_GHC -fth #-}
module Main where
import XQuery
f(x,y) = $(xe "<a>{$x,', ',$y}</a>")
main = do a <- $(xq ("<result>{ "
++" for $x in doc('/home/fegaras/data/dblp.xml')//inproceedings at $i "
++" where $x/author = 'Leonidas Fegaras' "
++" orderby $x/year descending "
++" return <paper>{ $i, ') ', $x/booktitle/text(), "
++" ': ', $x/title/text() "
++" }</paper> "
++" }</result> "))
putStrLn (show a)
b <- $(xq "f($a/paper[10],$a/paper[8])")
putStrLn (show b)