Galax is installed in the following two directories: o:\cse\courses\cse444\06wi\Galax-0.5.0-MinGW\bin --- the Windows version O:\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 Windows only. For Linux, go back in the browser and click on the other link 1. Type: o: cd \cse\courses\cse444\06wi 2. Type 'dir'. You should get something like that: 02/02/2006 08:05 PM . 01/04/2006 11:15 AM .. 02/02/2006 08:04 PM Galax-0.5.0-Linux 02/02/2006 08:04 PM Galax-0.5.0-MinGW 02/01/2006 11:13 AM 23,465,935 Galax-0.5.0-Linux.tar.gz 02/01/2006 11:13 AM 17,540,508 Galax-0.5.0-MinGW.zip 02/01/2006 11:13 AM 1,784,705 mondial-3.0.xml 02/01/2006 11:13 AM 124 q1.xq 02/01/2006 11:13 AM 183 q2.xq 12/14/2005 03:45 PM 4,416 mondial-3.0.dtd 6 File(s) 42,795,871 bytes 4 Dir(s) 0 bytes free 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-MinGW\bin\galax-run.exe 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-MinGW\bin\galax-run.exe q2.xq You are getting the names of all provinces in Peru with at least two cities. 6. Finally, try: Galax-0.5.0-MinGW\bin\galax-run.exe q2.xq > C:\myfile.xml This creates myfile.xml in C: directory with your result.