You are on page 1of 16

Table of Figures

Figure 1 Metrics of the Ontology....................................................................................................3


Figure 2: The Class Hierarchy of the ontology...............................................................................4
Figure 3: The main class and sub class hierarchy............................................................................4
Figure 4 : Disjoint Classes...............................................................................................................5
Figure 5 : An example of an individual representing as a doctor....................................................5
Figure 6: Object Properties in the Ontology....................................................................................6
Figure 7 :Object Property Assertion................................................................................................7
Ontology Design
The Protégé is an open-source free editor and a knowledge management system which is
developed by Stanford Center for Biomedical Informatics Research. There are many versions
released after the initial release on 11 th November 1999. For the development of the ontology
based on covid 19 pandemic, the protégé 5.5.0 version is used. The designed covid 19 ontology
contains 334 axioms,40 individuals,16 classes,13 object properties,20 data properties in total.
There are around 16 classes including the sub classes, disjoint classes as well.
Figure 1 Metrics of the Ontology
Every individual is hand crafted and individuals represent classes of the picture shown below.
Some individuals represent doctors, patients, hospitals where they are included in the relevant
classes as shown in below figure 2.0. In the case of areas, the individuals are included separated
in subclasses as of diseased areas and non-diseased areas. This is also same as Persons. The
persons can be of different types hence they are categorized into doctors, infected persons,
recovered persons and dead persons. The doctors can be included in patients’ class as well.

The classes of Area, Person, Precautions and Symptoms can be considered as Named Classes. In
addition, the Area can be of two sub classes such as DeseasedArea and NonDeseasedArea. The
person is the super class, and we can have sub classes for person such as CoronaPatient and
NonCoronaPatient (Refer figure 3.0). Further, we can have classes to classify the CoronaPatient
as a DeadPerson, InfectedPerson or RecoveredPerson. The below graph shows the classes and
the sub classes hierarchy. When we consider the above classes, the recovered person cannot be
included in the dead person class. Hence, the classes DeadPerson and RecoveredPerson are
disjoint classes (Refer figure 4.0).
Figure 2: The Class Hierarchy of the ontology

Figure 3: The main class and sub class hierarchy

Figure 4 : Disjoint Classes


The below is an example of the individual representing as a doctor (Figure 5.0).

Figure 5 : An example of an individual representing as a doctor.

The class hierarchy is comprised of 5 main classes and including 11 sub classes and totally
making 16 classes. The parent class can include firstName, LastName, age, marietalStatus,
address, contactNo in which this is utilized in the declaration of metadata where it is easier to
identify and specify an individual in the system. Most of these classes uses rdfs:label annotation
to declare them in a standard way. rfds:comment is used to describe the class and the
representing items. In addition, the other class names are self-explanatory in the ontology
system.
In an ontology, the hierarchy of classes could be more extended with more relationships which
are called as object and data properties. The Object properties connect two individuals with a
predicate and a data property connects a single subject with some form of attribute data. This
ontology contains 13 object properties and 20 data properties. The below figure 6 shows the
object properties that are included in the ontology.

Figure 6: Object Properties in the Ontology.


The object property can be more explained with the types such as functional, inverse functional,
transitive, symmetric, asymmetric, reflexive etc. In addition, we can define the domain and the
range of the object property. For an example, the object property works has the domain of Doctor
and the range of Hospital which implies that the doctor works at the hospital. As another
example when we consider the above object properties, as an example the Person has Symptoms.
Here, has is the object property has the Domain of Person and the Range of Symptoms. This is
the inverse property of the occuredIn (Figure 7). The data properties connect individuals to
literal data such as strings, datetime, numbers, Boolean etc. The below are the data properties
used as shown. For each data property there is a domain to which it belongs and the data type. As
an example, the firstname and lastname belongs to the Person Class and they have the data types
of String.

Figure 7 :Object Property Assertion


For the example of data properties, the person class have subclasses as well. But the individuals
in the person can have more explanatory items where they are called as data properties. For an
example the doctor can have data properties such as first name, last name , age, marital status,
the hospital works etc.

Figure 8 Data Property Assertions.


The below is also an example of the individual. Each class is having the individuals with their
data properties as well has the relations.
In addition, the data properties can have the data types as well. The names can have string values
and a data property such as integer ca have integer values.
The corona patients are treated by Doctors and in the same time some doctors can be included in
the group of corona patients since some can be influenced by the corona virus.

SPARQL Query Examples


Query 1
The below query is designed to return the individuals in a defined class. Since the user has ability
to filter the relevant individuals. In the below example, all the individuals in the Doctor class
have been filters and the list of individuals is sorted by the name.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>


PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ont: <http://www.semanticweb.org/davidogolo/ontologies/2022/5/untitled-ontology-
6#>
SELECT ?subject ?name
WHERE
{
?subject ?r ont:Doctor.
?subject ont:firstname ?name
}
Order by ASC(?name)
The below is the results obtained.
Query 2
The second query is little more related of obtaining the subclasses of a defined class. Since there
are many levels of subclasses, in the first step the SPARQL gets only the first level of subclasses
and if we want to get the sub-sub classes also, we need to declare the ‘*’ after the
rdfs:subClassOf , then the SPARQL will retrieve all the classes from the upper level to lower
level. The below two figures shows the difference as described above.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ont: <http://www.semanticweb.org/davidogolo/ontologies/2022/5/untitled-ontology-
6#>

SELECT distinct ?subject


WHERE
{
?subject rdfs:subClassOf* ont:Person.
}
Query 3
Query all individuals
In this query we can filter all the individuals of not only from one class but with many classes.
For this purpose, it is convenient to UNION keyword and we can filter the results with the first
name in ascending order.
For an example of we want to get all the individuals of the persons who becomes dead and
infected due to corona, then we can use UNION key word and get only the required individuals.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ont: <http://www.semanticweb.org/davidogolo/ontologies/2022/5/untitled-ontology-
6#>
SELECT ?subject ?name
WHERE
{
{
?subject ?r ont:DeadPerson.
?subject ont:firstname ?name
}
union
{
?subject ?r ont:InfectedPerson.
?subject ont:firstname ?name
}
}
Order by ASC(?name)
Query 4 – Query Individuals with integer filtrations
As an example, if we want to get the persons who are suffered from covid 19 and if we want to
get only the persons who are less than 50 in their age, we can use the below query.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>


PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ont: <http://www.semanticweb.org/davidogolo/ontologies/2022/5/untitled-ontology-
6#>
SELECT ?subject ?name ?age
WHERE
{
{
?subject ?r ont:DeadPerson.
?subject ont:firstname ?name.
?subject ont:age ?age.
}
union
{
?subject ?r ont:InfectedPerson.
?subject ont:firstname ?name.
?subject ont:age ?age.
}
Filter (?age > 40)
}
Order by ASC(?name)

Query 5
Query individuals with text filter
In this query for an example if we need to filter all the individuals having the name Amali the
below query can be used.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ont: <http://www.semanticweb.org/davidogolo/ontologies/2022/5/untitled-ontology-
6#>
SELECT ?subject ?name
WHERE
{
{
?subject ?r ont:DeadPerson.
?subject ont:firstname ?name.
}
union
{
?subject ?r ont:InfectedPerson.
?subject ont:firstname ?name
}
union
{
?subject ?r ont:RecoveredPerson.
?subject ont:firstname ?name
}
union
{
?subject ?r ont:Doctor.
?subject ont:firstname ?name
}
FILTER (?name = "David").
}
Order by ASC(?name)
Query 6
In this, lets say if we want to get the list of doctors who are working in private hospitals and
treating the covid patients and the names of the doctors and patients, we can use the below query.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ont: <http://www.semanticweb.org/davidogolo/ontologies/2022/5/untitled-ontology-
6#>

SELECT distinct ?subject ?name ?hos_name


WHERE
{
?subject ?r ont:Doctor.
?subject ont:firstname ?name.
?subject ont:Works ?hos_name.
optional{?hos_name ?t ont:PrivateHospital.}
optional{?subject ont:treats ont:InfectedPerson}
}
QS: Filter all the doctors whose name does not contain 'David'

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>


PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ont: <http://www.semanticweb.org/davidogolo/ontologies/2022/5/untitled-ontology-
6#>
SELECT ?subject ?name
WHERE
{
?subject ?r ont:Person.
?subject ont:firstname ?name.
FILTER NOT EXISTS { filter( regex(str(?name), "David") )}
}
Order by ASC(?name)

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>


PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ont: <http://www.semanticweb.org/davidogolo/ontologies/2022/5/untitled-ontology-
6#>
SELECT ?subject ?name
WHERE
{
?subject ?r ont:Vaccine.
?subject ont:VaccineName ?name
}
Order by ASC(?name)

You might also like