Metamodels and how they relate – part 2: From QDA to XML/TEI

In the last post, I said something about the terms of Qualitative Data Analysis (QDA) in general, this post will be about projecting the method and terminology to TEI-XML. Annotating text has a long tradition in the Digital Humanities, so I don’t have to invent something from scratch. The TEI-XML data model can easily be used for QDA – but also brings some new terms with it, which I must combine with the QDA-terminology.

The basic part of XML are “elements”. An element has a start and an end “tag” and an “element content” in between those.  As I have defined our coding units in QDA with sentences and words, TEI-XML provides the corresponding tags <s> (sentence) and <w> (word). The element content can in turn consist of further elements, that are called “child elements”, which could store the information about subcodes. To apply a code to an element, I use the @anaattribute”. An attribute in general contain data related to a specific element; This way, I link a code with a text segment by assigning an attribute with the name “ana” to a tag with the name of a coding unit, and the value of the attribute bears the name of the code. Additionally, the @type attribute is used to identify the codes. As easy as pie, isn’t it? Apply this technique to the example  segment about the goldsmith would end in:

You may noticed, that the case information is missing.  I use the <div> tag  together with the @type attribute to allocate all contained elements (also called “descendants“) to the occupation profile “Goldsmith”. In this context the tag works as structuring unit and the attribute value define the case:

DivAs I mentioned in the previous post, I need a possibility to disambiguate the semantics of words with the same orthographical form. GermaNet provides a  lexical-semantic net, that assorts lexical units into semantical groups, which is exactly what I need (there is also a english version Wordnet). For the word “cast” there is one Lexical Unit ID pointing the orthographical form “cast” with the meaning of “form by pouring” and a Synset ID pointing to its semantics. That means every Lexical Unit ID points to only one word, but a Synset ID can point to several words with the same meaning, for example the Synset ID of the words “Gold” and “Aurum”:

OrthForm LexUnit Synset
Gold 68343 47790
Aurum 68342 47790

To enrich the data of the words with those lexical information I choose the @type attribute:

The text enriched with lexical unit ids from GermaNet

The GermaNet is implemented in PostgreSQL and XML, but the later implementation is fragmented into 59 XML-Files and they are difficult to handle, especially if you want to add new words.  And you may have already noticed that the annotated text is getting hard to read. So I will not import the lexical units from GermaNet to a XML register in a local file; at this point I will transfer my data (with a little help of XSLT – article will follow soon) to a tabular structure and connect them to the PostgreSQL implementation of GermaNet.

One important thing : The technique shown here is a simplified form to show the connections and divergences of the terms and is not used in production. A explanation of the sophisticated technique will follow in a separate post.

You also gotta keep in mind, that “tags” and “coding units” and “element content” and “coding” etc. are not exactly the same thing, but you can use those XML-features to represent them; there is also a wide range of possibilities for storing information in elements with attributes. So for example, I could use @lemmaRef instead of the @type attribute.

Cite this blog post
Robert Nasarek (2019, July 8). Metamodels and how they relate – part 2: From QDA to XML/TEI. OoO. Retrieved June 16, 2024, from

One thought on “Metamodels and how they relate – part 2: From QDA to XML/TEI”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.