Digital humanities


Maintained by: David J. Birnbaum (djbpitt@gmail.com) [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2021-12-27T22:03:57+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. There is at least one file for each project (except where prohibited by copyright), as follows:

To see the content of the document, you may need to append something to the path. For example, if doc('/db/course/norse/alltales.xml') doesn’t render the document, try doc('/db/course/norse/alltales.xml')/*. This second expression asks for all of the child elements of the document node, and a document node should always have a single child element, which is the root node of the document.

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 the type of question someone might really want to ask about the data and then 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. You can remind yourself of how to declare and use a namespace in XQuery at xquery-abcs.xhtml.