4.3.1. Different types of schemas
An ontology has to use a standardised technical notation so that different computer systems can read it. This is generally referred to as a schema. Schemas are able to use the grammar of triples in order to describe the components of an ontology.
Importantly, a schema describes the ontology. We can think of it as a dictionary and a rule book which codifies the ontology in terms that a computer can understand. It does not describe actual data, such as primary and secondary sources. Instead, once we have established a schema, we can apply it to data — we can use it to structure our significant entities within our datasets in line with the ontology.
There are broadly two types of schemas: database schemas and XML schemas. Database schemas use the internal language of a particular database system, such as MySQL. XML schemas use a data standard called XML Schema (often abbreviated to XSD) and they are designed to be used by the XML markup language.
So to recap:
- Database schemas can be used to describe ontologies. This means that data can be stored in a database in line with the ontology.
- XML Schema can be used to describe ontologies. This means that data can be tagged using the XML markup language in line with the ontology.
The choice between one or the other or both depends on the format of our data and what we want our computer system to do with the data. For example, XML favours full-text transcriptions where we also want to preserve the transcription itself. This will be covered in the next section.
XML schemas proliferate into a bewildering range of further data standards and notation formats, such as RDF and RDFS, Turtle, JSON, and OWL XML. For a discussion of OWL XML, see page 5.
When we are designing an XML schema in order to codify an ontology, we are creating something similar to the Text Encoding Initiative (TEI), which might be familiar to some of you in the arts and humanities. However, TEI is a data model that is focussed on capturing the structures (physical, logical, semantic) of texts. This is a fundamentally different conceptualisation to an ontology which is focussed on capturing the structures of knowledge.
4.3.2. My hand-written notation
If we look again at my handwritten ontology and its application to some data concerning a shop called Waterstones:
The ontology:
shop → hasType → type
shop → hasName → name
shop → hasStock → book
book → hasTitle → title
book → hasAuthor → name
Some data described using the ontology:
shop → hasType → books
shop → hasName → Waterstones
shop → hasStock → book
book → hasTitle → War and Peace
book → hasAuthor → Leo Tolstoy
4.3.3. XML Schema
This same ontology could be presented using XML, as follows:
The ontology written in XML Schema (XSD):
<?xml version=”1.0” encoding=”UTF-8” ?>
<xs:schema xmlns:xs=”http://www.w3.org/2001/XMLSchema”>
<xs:element name=”shop”>
<xs:complexType>
<xs:sequence>
<xs:element name=”hasType” type=”xs:string”/>
<xs:element name=”hasName” type=”xs:string”/>
<xs:element name=”hasStock”>
<xs:complexType>
<xs:element name=”book” minOccurs=”0” maxOccurs=”unbounded”>
<xs:complexType>
<xs:sequence>
<xs:element name=”hasTitle” type=”xs:string”/>
<xs:element name=”hasAuthor” type=”xs:string”/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Some data described using my XML schema:
<shop>
<hasType>books</hasType>
<hasName>Waterstones<hasName>
<hasStock>
<book >
<hasTitle>War and Peace</hasTitle>
<hasAuthor>Leo Tolstoy</hasAuthor>
</book>
</hasStock>
</shop>
By modifying the schema, we can also make the XML tags shorter if we wish:
<book>
<title>War and Peace</title>
<author>Leo Tolstoy</author>
</book>
And shorter still:
<book author=”Leo Tolstoy” title=”War and Peace”>War and Peace</book>
which is useful if we are coding a sentence in which the book is not explicitly named:
<book author=”Leo Tolstoy” title=”War and Peace”>A famous Russian novel</book>
Developing a full XML schema requires the specialist knowledge of a research software engineer or data scientist who will make choices based on an understanding of your handwritten ontology and requirements.
4.3.4. Database schemas
Finally, we could express our schema as database tables if it is our intention to store the data in a relational database. This is what our database might look like, using the same data:

Markup languages such as XML are ideal for storing and using data in a flat file format: i.e. the data is stored in a flat computer file such as a TXT file. However, relational and non-relational databases are frequently used to store ontologically structured data because they are faster and more efficient for computer systems to process than flat files.
Remember, a relational database stores data using the rules of a data model. The data model might be a relational data model, but it could also be an ontology or another type of model. Databases that use ontologies as their data models are occasionally referred to as ontology databases.
URL for this page
https://www.dhi.ac.uk/books/ontology-guide/describing-an-ontology-using-a-schema