Homework #7: Querying Shakespeare
Due: 12-02
Description
All the plays of Shakespeare were encoded in XML in 1999
by Elliotte Rusty Harold as an example XML data set. The markup is a bit old school
using uppercase names limited to eight characters.
Your task is to produce an website from this content using XQuery. You'll need to write two XQueries - one for the index of plays and one for the plays themselves. Otherwise, the HTML and styling via CSS is the same as it would be otherwise.
Assignment
The XML content for the plays and a configuration of an XQuery-based web application is available at on github
in the examples/xquery
directory.
The structure is as follows:
examples/xquery/shakespeare/
— contains the XML of the playsexamples/xquery/shakespeare/plays.xhtml
— The index of all the plays whose content is a ul element with a link to each playexamples/xquery/shakespeare/web/
— web applicationexamples/xquery/shakespeare/web/resources/
— where you can put CSS, etc. (e.g. served as/resources/example.css
)examples/xquery/shakespeare/web/index.xq
— the XQuery file for the play index.examples/xquery/shakespeare/web/play.xq
— the XQuery file for a play.
You must do the following:
- Write an XQuery (i.e.,
index.xq
) to display the list of plays and link to each play. This XQuery runs againstshakespeare/plays.xhtml
. - Write an XQuery (i.e.,
play.xq
) to display a play.
You can run the script examples/xquery/shakespeare/web/run.sh
to run the web server or:
java -jar xproclet/xproclet-server.jar web.xml
The server is structured so that:
/
is the play index./{play-name}/
is a particular play (e.g./all_well/
maps toshakesspeare/all_well.xml
)
You can test your XQuery by running it directly through oXygen or by running the Web server and loading (or reloading) the page.
I will test your application by copying in your XQuery and running the web server. It must work there!
Resources
Priscilla Walmsley's book about XQuery - if you setup the UCB Library Proxy, you can access the book on Safari. I recommend making a quick read of the first three chapters (they aren't long) and then you can use it for specific topics afterwards.
MarkLogic has nice documentation. Navigate to the
W3C-Standard Function
section for functions available in any processor.XQuery 1.0 and XPath 2.0 Functions and Operators (Second Edition)
What to Turn In
You must turn in both XQuery files:
index.xq
play.xq
If it is easier, you can create a branch with a copy of all the content and your modified version of the two XQuery files.
I will take your XQuery and run it in the web application. Again, it must work there.
Grading
- 2 points - syntactically correct XQuery
- 2 points - your query doesn't fail to run
- 4 points - all content is readable and able to be navigated (e.g. the index of plays has the title and you can click on a link to see the play).
- 2 points - overall quality of the application
Please do not fake
the index. You have the input document
(plays.xhtml
) that gives you a list of plays and you should be able to
change index.xq to output the play titles with links as a properly formatted XHTML
document.