The following is an interview with Cliff Anderson, the director of the XQuery Summer Institute, which will be hosted at Vanderbilt University in Nashville, Tennessee from June 9, 2014 - June 20, 2014. The deadline to apply is February 14th, so get those applications in by following the directions outlined on the XQuery Institute website.
ODH: What is XQuery?
CA: Simply put, XQuery is a programming language designed from the ground up to work with XML. While XQuery excels at querying, manipulating, and remixing XML documents, it can also be used like a general purpose scripting language.
ODH: What is an example of how I might use XQuery?
CA: In my own work, I’ve developed several digital libraries using XQuery. XQuery is a perfect language for creating interactive websites out of XML documents. For instance, the Digital Library of Abraham Kuyper (http://kuyper.ptsem.edu), which provides access to the published works and unpublished papers of Dutch Prime Minister and theologian Abraham Kuyper (1837-1920), is built primarily in XQuery.
Two instructors for the summer institute, David Michelson and Winona Salesky, are doing something similar with XQuery as they collaborate on Syriaca.org: The Syriac Reference Portal (http://syriaca.org/), an NEH-funded project documenting the history and literature of the Syriac language. Salesky is programming the public interface for the project in XQuery, including the functionality to render maps, footnote-style citations, and multilingual content.
Michelson, a medieval historian, is exploring using XQuery for his own scholarly purposes to detect latent information in the project’s substantial dataset. He is learning to write queries to discern patterns, for example, among the production and transmission of manuscripts. Whereas previously he would have had to conduct those analyses painstakingly over time, XQuery makes it possible to rearrange his primary sources easily and instantaneously.
ODH: How did you get started with XQuery?
CA: I started learning XQuery in 2006 while the language was still being standardized. My colleagues and I were working on digital representations of several nineteenth century journals. We had generated metadata for the journals and we wanted to make that metadata searchable. We ended up porting everything to a native XML database and implementing our search application using XQuery.
ODH: Is XQuery difficult to learn?
CA: XQuery is a straightforward language to learn, especially for those new to programming. XQuery is a functional programming language, which distinguishes it from imperative and object-oriented programming languages like PHP, Python, or Ruby. If you don’t have programming experience prior to learning XQuery, you won’t have to unlearn any habits from those languages. Functional programming languages also tend to be terser than other languages because they dispense with much “boilerplate” code. You can write significant programs in five to ten lines of XQuery. Of course, you can also write whole DH projects in XQuery.
ODH: What can I do with XQuery?
CA: The great thing about XQuery is that there are essentially no limitations to its use. Of course, XQuery is designed to manipulate XML. If you’re working with XML of any sort, learning XQuery will greatly improve your productivity. If you’re storing your XML documents in an open source XML database like eXist or BaseX, for example, you can easily query them using very specific criteria and update them as necessary. XQuery is not just for querying XML, however. You can also use it to build interactive websites or to “mash up” sources of information across the internet. We’ll be teaching people who attend our summer institute how to build an online search application for TEI documents. Really, what you can achieve with XQuery is limited only by what you can imagine building.
ODH: What about XSLT? How do XQuery and XSLT relate?
CA: XSLT is another programming language for XML. A main difference between XSLT and XQuery is that XSLT uses the syntax of XML whereas XQuery does not. In practice, this means XQuery tends to be more concise than XSLT. XQuery is also designed to be used in conjunction with an XML database. As its name implies, XQuery excels at querying many XML documents simultaneously for discrete bits of information.
But XSLT and XQuery are not really competitors. They share the same data model (the so-called “XDM”) and are frequently used together. For example, you might search a collection of XML documents using XQuery and then transform your results into HTML using XSLT.
Bottom line: If you learn XQuery, you’ll improve your understanding of XSLT (and vice versa).
ODH: How does XQuery fit into the “big tent” of the Digital Humanities?
CA: As you know, the question whether digital humanists should learn to program is frequently debated and a bit vexed. I guess my answer is that it depends. If you are already working with documents encoded in XML, learning to manipulate those documents with XQuery will open up new avenues of research and discovery.
Perhaps the divide between programmers and non-programmers has been overstated. Learning a few simple XQuery expressions can be very useful just in itself. There’s no strict line between programmers and non-programmers in my view. Our institute will provide the foundations for programming in XQuery and, if it turns out to be useful for your purposes, we hope that writing XQuery expressions becomes part of your basic toolkit for the digital humanities.