axiothOntology Hub

Learn what an ontology is / Part 4. Design and quality · Lesson 20 of 24

Tools and workflow: editing, reasoning, versions and publishing

Build with an editor and a reasoner, manage the file like code, and release with versions so it lasts.

So far the Turtle has been written by hand. Once there are hundreds of terms and several people changing them, tools and a routine are needed. The cycle matters more than any one product, so that comes first.

One turn of the cycle

StageWhat happensCommonly used
EditWrite classes, properties and definitionsProtégé, a text editor, templates filled in as tables
ReasonCheck for contradictions and empty classes, compute the hierarchyReasoners such as HermiT and ELK
CheckLook for common mistakes and run competency questionsROBOT, SPARQL, SHACL
Convert and mergeChange formats and combine imported ontologiesROBOT, Apache Jena, RDFLib
PublishRelease with a version and produce readable documentationPersistent IRIs, documentation generators

Protégé is a free editor from Stanford University. It lets you edit the class hierarchy as a tree and run a reasoner inside it. What the editor saves is, in the end, the same kind of RDF file seen throughout this course.

Manage the file like code

A definition file is text, so keep its history in a version control tool such as Git and have the checks run automatically on every change. The example below runs the three checks from the previous lesson on the command line with ROBOT.

# run a reasoner and check for inconsistency and empty classes
robot reason --reasoner ELK --input pets.ttl --output pets-reasoned.ttl

# check for common mistakes and write a report
robot report --input pets.ttl --output report.tsv

# run queries that look for things that must not exist; any result is a failure
robot verify --input pets.ttl --queries no-label.rq

One thing to watch. A tool that saves the same graph with its lines in a different order makes the change look large. Settle on one format and one ordering, and only the lines that really changed will show.

Do not import a large ontology whole

owl:imports includes the entire other ontology. When only a few terms are needed, borrow just the IRIs, or build a module cut down to the terms needed and their ancestors and import that. Importing an ontology of several hundred thousand classes whole slows both reasoning and editing.

Add versions

PropertyMeaning
Ontology IRIThe address that always points at the latest release
owl:versionIRIThe address of this release only, carrying a date or a number
owl:versionInfoThe release number people read
owl:priorVersionThe release just before
owl:deprecatedMarks a term as retired without deleting it

The IRI of a published term is never deleted, and its meaning is never changed, because data already written with that IRI exists in the world. If the meaning has to change, mint a new IRI, and mark the old term as deprecated with a pointer to its replacement.

ex:Kitten owl:deprecated true ;                  # not deleted, only marked
  dcterms:isReplacedBy ex:YoungCat ;
  rdfs:comment "Deprecated in 1.2.0. Use ex:YoungCat."@en .

Publish

  • Put the real file behind a persistent identifier such as w3id.org. The IRI survives a move to another server.
  • From one address, serve a readable document to people and Turtle to programs (content negotiation).
  • State the licence in the header. Without one, nobody knows whether reuse is allowed.
  • Register it in registries such as Linked Open Vocabularies or the OBO Foundry. These are where this site collects ontologies from.

Common misunderstandings

An ontology can only be made with a dedicated editor.
An ontology is a text file. Small vocabularies are often written directly in Turtle with no editor at all.
A term made by mistake can simply be deleted.
Delete it and the data that used its IRI loses its meaning. Mark it deprecated and say what to use instead.
A new release changes the term IRIs to the new version number.
Only the version IRI changes. Term IRIs must stay the same across releases so existing data keeps working.

Tie editing, reasoning, checking and publishing into one cycle, and never delete a published IRI or change what it means.

See it in a real ontology

  • Gene Ontology
    An example released regularly with dated version IRIs.
  • OBO Metadata Ontology
    The OBO metadata ontology, collecting annotation properties for deprecation and replacement.
  • DCMI Metadata Terms
    Properties such as `dcterms:isReplacedBy` for versions and replacements.

Read more in the specifications