Digital humanities


Maintained by: David J. Birnbaum (djbpitt@gmail.com) [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2016-11-28T14:45:24+0000


XQuery assignment #3

The texts

We have uploaded to the eXist database on Obdurodon (http://obdurodon.org:8080) some of the XML files that you have been developing for your projects, as well as some from previous semesters. There is at least one file for each project (except where prohibited by copyright), as follows:

To see the content of the document, you need to append something to the path. For example, doc('/db/course/decameron/engDecameron.xml') will find the Decameron document but it won’t render it, while doc('/db/course/decameron/engDecameron.xml')/* (note the /* at the end) will retrieve the root element (and all its contents), and doc('/db/course/decameron/engDecameron.xml')//tei:p will retrieve all of the <p> elements inside it (assuming you’ve mapped the tei: prefix to the TEI namespace).

The /* isn’t strictly required for all files in all projects, but it is for some, and it works for all of them, so we recommending including it as a matter of course.

The assignment

Select one of these texts and spend a few minutes looking at it to familiarize yourself with its overall structure. You may use your own project text or someone else’s. Then use eXide to develop a query or set of queries to explore the text you’ve chosen, that is, to extract and format something interesting about the text. Your XQuery should be more interesting and more sophisticated than just a simple XPath to retrieve the value of a single element, but what you find interesting in the text is for you to discover. We would suggest beginning by formulating a question and retrieving the information you need to answer it. Once you’re getting the data you want, try to incorporate your query into a structure that lets you embed the information you’re retrieving inside valid HTML output. Bear in mind:

Because the XML texts that we are using here are under development, they may be inconsistently or incompletely marked up. They are all well formed, however, which means that they can be explored with XML tools, including XQuery. Remember that some may be in namespaces, in which case your queries need to refer to elements in the correct namespace.