packages feed

HXQ-0.19.0: tests/TestDBLP.hs

{--------------------------------------------------------------
-
- Creating the DBLP database
- Download dblp.xml.gz from http://dblp.uni-trier.de/xml/
-   and uncompress it in the data directory.
- Programmer: Leonidas Fegaras (fegaras@cse.uta.edu)
- Date: 02/01/2009
-
---------------------------------------------------------------}

{-# LANGUAGE TemplateHaskell #-}

module Main where

import Text.XML.HXQ.XQuery
import System.IO


main = do db <- connect "hxq"
          exists <- isSchema db "d"
          ans <- if exists
                 then do putStr $ "The DBLP database already exists. Do you want to rebuild it? [y/n] "
                         hFlush stdout
                         line <- getLine
                         return $ line == "y"
                 else return True
          if ans
             then do putStrLn "Generating the relational schema for the DBPL database using hybrid inlining."
                     -- ignore the HTML tags <i>, <sub>, <sup>, and <tt>
                     genSchema db "data/dblp.xml" "d" ["i","sub","sup","tt"]
                     putStrLn "Populating the DBPL database (will insert about 5M tuples)."
                     shred db "data/dblp.xml" "d"
                     putStrLn "Creating an index on author name."
                     createIndex db "d" "author"
             else return ()