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
| Stage | What happens | Commonly used |
|---|---|---|
| Edit | Write classes, properties and definitions | Protégé, a text editor, templates filled in as tables |
| Reason | Check for contradictions and empty classes, compute the hierarchy | Reasoners such as HermiT and ELK |
| Check | Look for common mistakes and run competency questions | ROBOT, SPARQL, SHACL |
| Convert and merge | Change formats and combine imported ontologies | ROBOT, Apache Jena, RDFLib |
| Publish | Release with a version and produce readable documentation | Persistent 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.rqOne 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
| Property | Meaning |
|---|---|
| Ontology IRI | The address that always points at the latest release |
owl:versionIRI | The address of this release only, carrying a date or a number |
owl:versionInfo | The release number people read |
owl:priorVersion | The release just before |
owl:deprecated | Marks 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
- OBO Metadata Ontology
The OBO metadata ontology, collecting annotation properties for deprecation and replacement.