Galax is installed in the following two directories:
o:\cse\courses\cse444\04au\Galax035Win32\bin --- the Windows version
o:\cse\courses\cse444\03au\Galax040Linux\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, follow similar steps.
1. Type:
o:
cd \cse\courses\cse444\04au
2. Type 'dir'. You should get something like that:
10/26/2004 08:57 PM
.
09/17/2004 11:48 AM ..
10/24/2003 04:35 PM 192 q2.xq
10/26/2004 08:41 PM Galax035Win32
10/26/2004 08:13 PM 4,416 mondial-3.0.dtd
10/26/2004 08:13 PM 1,784,825 mondial-3.0.xml
02/12/2004 05:08 PM 128 q1.xq
08/06/2004 10:02 AM Galax-0.4.0Linux
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) }
}
4. Type:
Galax035Win32\bin\galax.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
Galax035Win32\bin\galax.exe q2.xq
You are getting the names of all provinces in Peru with at least
two cities.
6. Finally, try:
Galax035Win32\bin\galax.exe q2.xq > myfile.xml
This creates myfile.xml with your result.