In Problem Set 2, you will construct XPath and XQuery queries for an XML version of our movie database.
To allow you to check your work, we’ll make use of a freely available XML DBMS called BaseX.
You should begin by downloading the following files into your folder for this assignment:
Make sure to put the files in your ps2
folder. If your browser
doesn’t allow you to specify where a file should be saved, try
right-clicking on each link above and choosing Save as... or Save
link as..., which should produce a dialog box that allows you to
choose the correct folder for the file.
Once you have completed the steps outlined above, you can perform queries by taking the following steps:
Start up the BaseX GUI by double-clicking on the JAR file that you downloaded above.
Select the Database->New menu option, click the Browse button,
and use the resulting dialog box to find the imdb.xml
file that you downloaded above.
Click Open to select the file, and click OK to create the database.
To execute a query, enter it in the Editor pane in BaseX, and click the green play button to execute it. (You can also use Ctrl+Enter or Ctrl+Return for this purpose.)
The results (if any) will be displayed in the Result pane.
If you have trouble getting BaseX to work on your machine, here are some possible options:
On newer Macbooks, try downloading a newer version of the BaseX
JAR file: Base114.jar
On MacOS, try running the program from the Terminal.
First, use cd
to navigate to the appropriate folder – the one that
contains the downloaded JAR file.
Then, entering the following from the command line:
java -jar BaseX114.jar
Or, if you have the original JAR file:
java -jar BaseX851.jar
If you are able to launch BaseX but you can’t open the database file, you may need to give Java permission to access the disk. One set of instructions for doing so on Macs can be found here.
If all else fails, you can run BaseX on the virtual desktop. Once you are in the virtual desktop, you can:
imdb.xml
file.Last updated on October 7, 2024.