These materials are under construction and incomplete.
Participants will need to have access to the following resources and tools prior to the training:
- GitHub account - register for a free GitHub account here
- Protege - Install Protege 5.5, download it here
- Install ELK 0.5
- Install GitHub Desktop Please make sure you have some kind of git client installed on your machine. If you are new to Git, please install GitHub Desktop
- Review tutorial on Ontology Term Use
- Review tutorial on Contributing to OBO Ontologies
- Clone Mondo repo: Follow these instructions to clone the Mondo repo
What is delivered as part of this course¶
Description: This course will cover reasoning with OWL.
At the end of this lesson, you should know how to do:
- Add existential restrictions
- Add defined classes
- Add disjoint axioms
- Debug unsatisfiable classes
OpenHPI Course Content
- Ontologies and Logic Videos 3.0-3.10 | Duration: ~3.5 hrs
- OWL, Rules, and Reasoning Videos 4.0-4.8 | Duration: ~2.7 hrs
Additional Materials and Resources¶
- Monkeying around with OWL: Musings on building and using ontologies, posts by Chris Mungall
- Documentation on Cell Ontology relations
- Guidelines for writing definitions in Ontologies (paper)
- How to deal with unintentional equivalent classes: Cool post by Chris Mungall on how to deal with an important reasoning issue.
Semantic Engineer Toolbox¶
- Content was adapted from Ontology 101 Tutorial
OWL class restrictions¶
In OWL, we use object properties to describe binary relationships between two individuals (or instances). We can also use the properties to describe new classes (or sets of individuals) using restrictions. A restriction describes a class of individuals based on the relationships that members of the class participate in. In other words, a restriction is a kind of class, in the same way that a named class is a kind of class.
For example, we can use a named class to capture all the individuals that are idiopathic diseases. But we could also describe the class of idiopathic disease as all the instances that are 'has modifier' idiopathic disease.
In OWL, there are three main types of restrictions that can be placed on classes. These are quantifier restriction, cardinality restrictions, and hasValue restriction. In this tutorial, we will initially focus on quantifier restrictions.
Quantifier restrictions are further categorized into two types, the existential and the universal restriction.
- Existential restrictions describe classes of individuals that participate in at least one relationship along a specified property to individuals that are members of a specified class. For example, the class of individuals that have at least one ( some ) 'has modifier' relationship to members of the
idiopathic diseaseclass. In Protege, the keyword 'some' is used to denote existential restrictions.
- Universal restrictions describe classes of individuals that for a given property only have relationships along this property to individuals that are members of a specified class. For example, we can say a cellular component is capable of many functions using the existential quantifier, however, OWL semantics assume that there could be more. We can use the universal quantifier to add closure to the existential. That is, we can assert that a cellular component is capable of these functions, and is only capable of those functions and no other. Another example is that the process of hair growth is found only in instances of the class Mammalia. In Protege the keyword 'only' is used.
In this tutorial, we will deal exclusively with the existential (some) quantifier.
Strictly speaking in OWL, you don't make relationships between classes, however, using OWL restrictions we essentially achieve the same thing.
We wanted to capture the knowledge that the named class 'idiopathic achalasia' is an idiopathic disease. In OWL speak, we want to say that every instance of an ' idiopathic achalasia' is also an instance of the class of things that have at least one 'has modifier' relationship to an idiopathic disease. In OWL, we do this by creating an existential restriction on the idiopathic achalasia class.
- In the Entities tab, select 'idiopathic achalasia' in the class hierarchy and look at its current class description in the bottom right box.
- Note that there are two superclasses (as denoted by the SubClass Of list). ''gastroesophageal disease'' and 'has modifier' some idiopathic.
- Run the reasoner.
- You should see that this class is now inferred to be an idiopathic disease because of this SubClassOf (superclass) restriction.
Equivalence Axioms and Automatic classification¶
This example introduces equivalence axioms or defined classes (also called logical definitions) and automatic classification.
The example involves classification of Mendelian diseases that have a monogenic (single gene) varation. These equivalence axioms are based off the Mondo Design Pattern disease_series_by_gene.
- and (intersection)
- equivalence (logical definitions)
- existential restrictions (e.g. 'disease has basis in dysfunction of')
Add an equivalence axiom to an existing Mondo term¶
- Create a new branch and open (or re-open) mondo-edit.obo
- Navigate to the class
'cardioacrofacial dysplasia 1'
- According to OMIM, this disease is caused by a variation in the gene PRKACA.
- We want to add an equivalence axiom that says every instance of this class is a type of
'cardioacrofacial dysplasia'that has dysfunction in the PRKACA gene.
- To do this, click the + next to Equivalent To in the lower right Description box.
- Add the following equivalence axiom:
'cardioacrofacial dysplasia' and ('disease has basis in dysfunction of' some PRKACA)
- Run the reasoner.
- You shouldn't see any change, but try deleting the superclass assertion to 'cardioacrofacial dysplasia' and re-running the reasoner.
- You should see that 'cardioacrofacial dysplasia' is an inferred superclass.
- Undo the last change, save your work, commmit, and create a pull request.
Adding classes and automatically classifying them¶
For teaching purposes, let's say we need a new class that is 'fungal allergy'.
- Create a new branch and re-open mondo-edit.obo
- Add a new term under owl:Thing named 'fungal allergy'.
- Following the design pattern allergy.yaml, add the text definition, synonym and equivalentTo axiom, using the substance ECTO_0000524 'exposure to mycotoxin'.
- Run the reasoner and note where the class is automatically classified.
- Create a pull request and note in the PR what the parent class is.
Debugging automatic classifications¶
- On the same branch, add a new term under owl:Thing named 'oral cavity neoplasm'.
- Following the design pattern neoplasm_by_origin, add the term label and the equivalence axiom.
- Run the reasoner and note where the term in automatically classified. You should see it is under owl:Nothing.
- Click the ? next to owl:Nothing in the Description box to see the explanation.
- Can you determine why this is an unsatisfiable class?
- Create a pull request and add a comment explaining why this is unsatisfiable.
By default, OWL assumes that these classes can overlap, i.e. there are individuals who can be instances of more than one of these classes. We want to create a restriction on our ontology that states these classes are different and that no individual can be a member of more than one of these classes. We can say this in OWL by creating a disjoint classes axiom.
- Create a branch in the Mondo repo (name it: disjoint-[your initials]. For example: disjoint-nv)
- Open the mondo-edit.obo file
- Per this ticket, we want to assert that infectious disease and syndromic disease are disjoint.
- To do this first search for and select the infectious disease class.
- In the class 'Description' view, scroll down and select the (+) button next to Disjoint With. You are presented with the now familiar window allowing you to select, or type, to choose a class. In the Expression editor, add 'syndromic disease' as disjoint with 'infectious disease'.
- Run the ELK reasoner.
- Scroll to the top of your hierarchy and note that owl:Nothing has turned red. This is because there are unsatisfiable classes.
Review and fix one unsatisfiable class¶
Below we'll review an example of one class and how to fix it. Next you should review and fix another one on your own and create a pull request for Nicole or Nico to review. Note, fixing these may require a bit of review and subjective decision making and the fix described below may not necessarily apply to each case.
Bickerstaff brainstem encephalitis: To understand why this class appeared under owl:Nothing, first click the ? next to owl:Nothing in the Description box. (Note, this can take a few minutes).
- The explanation is displayed above - it is because this class is a descedent of
Guillain-Barre syndrome, which is a child of
- Next, we have to ask if
Bickerstaff brainstem encephalitisis an appropriate child of
regional variant of Guillain-Barre syndrome. Note, Mondo integrates several disease terminologies and ontologies, and brought in all the subclass hierarchies from these source ontologies. To see the source of this superclass assertion, click the @ next to the assertion.
- This source came from Orphanet, see below.
- Based on the text definition, there does not seem to be any suggestion that this disease is a type of Guillain-Barre syndrome.
- Assuming that this disease is not a type of Guillain-Barre syndrome, we should exclude the superclass
regional variant of Guillain-Barre syndrome(see this paper and this paper. It seems a bit unclear what the relationship of BBE is to Guillain-Barre syndrome. This also brings into the question if a disease can be syndromic and an infectious disease - maybe this disjoint axiom is wrong, but let's not worry about this for the teaching purposes.)
- To exclude a superclass, follow the instructions here.