Galax is installed in the following two directories: /cse/courses/cse444/06wi/Galax-0.5.0-MinGW/bin --- the Windows version /cse/courses/cse444/06wi/Galax-0.5.0-Linux/bin --- the Linux version Technically, that's all you need to know to do the homework problems on XQuery. For a more gentle introduction on how to use Galax, read on. This small tutorial is for Linux only. For Windows, go back in the browser and click on the other link. 1. Type: cd /cse/courses/cse444/06wi 2. Type 'ls -al'. You should get something like that: total 41816 drwxrwsr-x 4 root cse444 4096 Feb 2 20:05 . drwxrwsr-x 17 root cse444 4096 Jan 4 11:15 .. drwxr-sr-x 8 wufei cse444 141 Feb 2 20:04 Galax-0.5.0-Linux -rw-r--r-- 1 wufei cse444 23465935 Feb 1 11:13 Galax-0.5.0-Linux.tar.gz drwxr-sr-x 8 wufei cse444 141 Feb 2 20:04 Galax-0.5.0-MinGW -rw-r--r-- 1 wufei cse444 17540508 Feb 1 11:13 Galax-0.5.0-MinGW.zip -rw-rw-r-- 1 wufei cse444 4416 Dec 14 15:45 mondial-3.0.dtd -rw-r--r-- 1 wufei cse444 1784705 Feb 1 11:13 mondial-3.0.xml -rw-r--r-- 1 wufei cse444 124 Feb 1 11:13 q1.xq -rw-r--r-- 1 wufei cse444 183 Feb 1 11:13 q2.xq mondial-3.0.xml is a copy of the XML document you will use for the homework. 3. Look at the files q1.xq and q2.xq. For q1.xq you should see: { for $x in document("mondial-3.0.xml")/mondial/country//city/name/text() return { $x } } For q2.xq you should see: { for $x in document("mondial-3.0.xml")/mondial/country[@name="Peru"]/province[count(city)>1]/@name return { fn:string($x) } } !!! Note: Using "fn:string" is because $x is an attribute. This is one way to return the value of an attribute. 4. Type: Galax-0.5.0-Linux/bin/galax-run q1.xq In a few seconds galax will print the result for you. In this case it's the list of all city names in the database. Notice that cities occur either under country, or under province. In order to get both we used country//city. 5. Now try Galax-0.5.0-Linux/bin/galax-run q2.xq You are getting the names of all provinces in Peru with at least two cities. 6. Finally, try: Galax-0.5.0-Linux/bin/galax-run q2.xq > ~/myfile.xml This creates myfile.xml in HOME directory with your result.