Protege Tutorial
Based on ProtegeOWLTutorial at
protege website
What is protege?
●Protege is a free, open-source platform to construct
domain models and knowledge-based applications
with ontologies.
●Ontologies range from taxonomies, classifications,
database schemas to fully axiomatized theories.
●Ontologies are now central to many applications
such as scientific knowledge portals, information
management and integration systems, electronic
commerce and web services
Install Protege
●Go to
[Link]
ml
to download protege (version 3.x)
●Protege OWL editor is built with the full installation of
protege platform. During the install process, choose
the “Basic+OWL” option.
●For more details:
[Link]
[Link]
Protege
● There are two main ways of modelling ontologies:
● Frame-based
● OWL
● Each has its own user interface
● Protege Frames editor: enables users to build and populate ontologies that
are frame-based, in accordance with OKBC (Open Knowledge Base
Connectivity Protocol).
● Classes
● Slots for properties and relationships
● Instances for class
● Protege OWL editor: enables users to build ontology for the Semantic Web,
in particular to OWL
● Classes
● Properties
● Instances
● reasoning
Building an OWL Ontology
●E2: Create a new OWL project
● Start protege
● File – New Project – OWL/RDF files – Ontology
URI ([Link] –
OWL DL – Properties View
● A new empty Protege-OWL project has been
created.
● Save it in your local file as [Link]
Building an OWL Ontology
●Reaproveitamento de Vocabulários.
●Foaf (Friend of a Friend)( [Link]
[Link]/): especifica um vocabulário que
permite definir as ligações entre pessoas na
Web.
● [Link]
Building an OWL Ontology
● SKOS (Simple Knowledge Organization System):
vocabulário especificado para suportar o uso do
conhecimento na forma de tesauros, taxonomias e
esquemas no contexto da Web semântica.
● SIOC(Semantically-Interlinked Online
Communities): ontologia que especifica conceitos e
propriedades requeridas para descrever
informações de comunidades online (ex., message
boards, wikis, weblogs, etc.) na Web Semantica.
[Link]
CamelNotation
● Notação utilizada para uniformizar as ontologias
Chama-se CamelNotation
● Letra maiúscula para classes – Ingrediente,
Animal
● Letra minúscula para propriedades – temPatas,
temCobertura
● Use a convenção que quiser mas…
SEJA CONSISTENTE!
Named Classes
● Go to OWL Classes tab
● The empty class tree contains one class called owl:Thing,
which is superclass of everything.
● E3: Create subclasses Pizza, PizzaTopping and
PizzaBase. They are subclasses of owl:Thing.
● Naming convention
● no special naming convention
● consistency
Disjoint classes
●E4: How to say that Pizza, PizzaTopping and
PizzaBase classes are disjoint.
1. Select the class Pizza
2. Press “add siblings” button
on the disjoint classes
widget
3. Add PizzaBase and
PizzaTopping
4. Select the class
PizzaTopping,
5. Add Pizza and PizzaBase
to the disjoint class
E5: Create group of classes
●Create ThinAndCrisyBase and
DeepPanBase as the subclasses of
PizzaBase, and each of them are disjointed.
●Select PizzaBase, right click the mouse,
select “create subclasses”
●Follow the wizard to create these two disjoint
classes.
●It will save lots of time when there is need to
create lots of disjoint classes.
E6: Create some subclasses of
PizzaTopping
●Select PizzaTopping,
● Create subclaesses as MeatTopping, VegetableTopping,
CheeseTopping and SeafoodTopping. Make sure that these
classes are disjoint to each other.
●Select the class MeatTopping,
● Add disjoint subclasses: SpicyBeefTopping,
PepperoniTopping, SalamiTopping and HamTopping
●Select VegetableTopping:
● Add disjoint subclasses: TomatoTopping, OliveTopping,
MushroomTopping, PepperTopping, OnionTopping,
CaperTopping
E6: Creating disjoint
subclasses
●Select PepperTopping
● Add disjoint subclasses: RedPepperTopping,
GreenPepperTopping, JalapenoPepperTopping
●Select CheeseTopping
● Add disjoint subclasses: MozzarellaTopping,
ParmezanTopping
●Select SeafoodTopping
● Add disjoint subclasses: TunaTopping,
AnchovyTopping and PrawnTopping
Propriedades OWL
●Propriedades no OWL são definidas para
representar relações entre dois objetos.
●Há dois principais tipos de propriedades:
● Propriedade Object: são propriedades que
relacionam um individuo com o outro.
● Propriedade datatype: relacionam individuos com
um XML Schema datatype ou rdf:literal
●A propriedade – Annotation, é para ser
utilizada para adicionar informações para as
classes, individuos e propriedade.
E7: Create an object property
●Switch to the “Properties” tab,
●Use “Create Object Property” button to
create a new object property.
●Rename it to hasIngredient
E8: Creating sub-properties
●Select hasIngredient property
● Add hasTopping and hasBase as the
subproperties
Inverse Properties
●Each object property may have a
corresponding inverse property.
●If some property links individual a to
individual b, then its inverse property will link
individual b to individual a.
E9: Create inverse properties
● Create a new object property called isIngredientOf
● Press “Set inverse property” button,
● Select “hasIngredient”
● Then the inverse relation has been set up.
● Select hasBase
● Create the isBaseOf as the inverse property of hasBase
● isBaseOf is the subproperty of isIngredientOf, why?
● Select hasTopping
● create isToppingOf as the inverse property.
● isToppingOf is the subproperty
of isIngredientOf, why?
Functional Properties
●If a property is functional, for a given individual,
there can only be at most one individual to be
related via this property.
● For a given domain, range must be unique
●Functional properties are also known as single
valued properties.
Inverse Functional Properties
●If a property is inverse functional, then its
inverse property is functional.
● For a given range, domain must be unique.
Functional vs. inverse
functional properties
●FunctionalProperty vs InverseFunctionalProperty
domain range example
Functional For a given Range is hasFather: A hasFather
Property domain unique
B, A hasFather C 🡪B=C
InverseFunctional Domain is For a given hasID: A hasID B, C
Property unique range
hasID B 🡪A=C
Transitive Properties
● If a property is transitive, and the property related individual a
to individual b, and also individual b to individual c, then we
can infer that individual a is related to individual c via property
P.
Symmetric Properties
●If a property P is symmetric, and the property
relates individual a to individual b, then
individual b is also related to individual a via
property P.
E10: Make the hasIngredient
property transitive
●Select the hasIngredient property
●Tick the transitive tick box
●Select the isIngredientOf property, make sure
that the transitive tick box is ticked.
E11: Make the hasBase
property functional
●Select the hasBase property
●Tick the “functional” tick box
●OWL-DL does not allow datatype properties
to be transitive, symmetric or have inverse
properties.
Property domains and ranges
●Properties link individuals from the domain to
individuals from the range.
●OWL uses domain and range as axioms in
reasoning.
E12: Specify the range of
hasTopping
●Select hasTopping
● Press range button
● Select PizzaTopping
● Press OK button
● PizzaTopping should be displayed in the range
list.
●When multiple classes are added to the
range, they represent the union of all classes.
E13: Specify Pizza as the domain
of the hasTopping property
●Select hasTopping property
● Press add domain button
● Select Pizza
● Press OK
● Pizza is displayed in the domain list.
●When multiple classes are added as domain,
they represent as the union of these classes.
E14: Specify the domain and range for
the isToppingOf property
●Select the isToppingOf property
●Set the domain of the isToppingOf property to
PizzaTopping
●Set the range of the isToppingOf property to
Pizza.
E15: Specify the domain and range for the hasBase
property and its inverse property isBaseOf
●Select the hasBase property
● Specify the domain as Pizza
● Specify the range as PizzaBase
●Select the isBaseOf property
● Specify the domain as PizzaBase
● Specify the range as Pizza
Property restrictions
●In OWL, properties are used to create restrictions.
●Restrictions are used to restrict the individuals that
belong to a class
●Three restrictions:
● Quantifier restrictions
● Existential quantifier ( )
● Universal quantifier ( )
● Cardinality restrictions
● hasValue restrictions
E16: Add a restriction to Pizza
●Add a restriction to Pizza that specifies a
Pizza must have a PizzaBase
● Select Pizza
● Select Necessary header to create a necessary
condition
● Select create a restriction wizard
●Select hasBase as restricted property
●Select someValueFrom as restriction
●Put PizzaBase into the filler
Add a restriction to Pizza
E18: Creating different kinds of
Pizzas
●Create a subclass of Pizza called
NamedPizza, and a subclass of NamedPizza
called MargheritaPizza.
●Add comment to MargheritaPizza: A pizza
that only has Mozarella and Tomato toppings
E19: Adding restrictions to
MargheritaPizza
●To specify that MargheritaPizza has at least one
MozzarellaTopping.
● Select MargheritaPizza
● Go to “Asserted Conditions”, create new restriction.
● Select someValueFrom
● Select hasTopping as the property to be restricted.
● Enter MozzarellaTopping as the filler
● Press OK button
E20: Adding restrictions to
MargheritaPizza
●To specify that MargheritaPizza has at least one
TomatoTopping.
● Select MargheritaPizza
● Go to “Asserted Conditions”, create new restriction.
● Select someValueFrom
● Select hasTopping as the property to be restricted.
● Enter TomatoTopping as the filler
● Press OK button
E21: Create AmericanPizza
●Create AmericanPizza with toppings of
pepperoni, mozzarella and tomato.
●Through cloning and modifying the
description of MargheritaPizza.
● Select MargheritaPizza
● Select create clone
● Add additional restriction to AmericanaPizza
●Adding PepperoniTopping
● Press OK.
E22: Create an AmericanHotPizza
and a SohoPizza
●An AmericanHotPizza is almost the same as an
AmericanaPizza, but has JalapenoPepperTopping
on it.
●A SohoPizza is almost the same as a
MargheritaPizza, but has additional OliveTopping
and ParmezanTopping
E23: Make subclasses of NamedPizza
disjoint from each other
●Select MargheritaPizza
●Press “add all siblings” button on the
“Disjoints widget” to make the pizzas disjoint
from each other.
Using a reasoner
● Ontology described in OWL-DL can be processed by a
reasoner.
● Go to owl—preference, to make sure that OWL-DL is
selected.
● The main services offered by a reasoner is to test
whether or not one class is a subclass of another class.
● Serviços padrão oferecidos por Mecanismos de
inferência são:
● Checar consistência
● Checar Generalização
● Checar relacionamentos de equivalência
● Checar instanciação
Using Racer
●Mecanismos de inferência podem ser utilizados
durante runtime como mecanismos de busca.
●Nós vamos utilizá-los durante o desenvolvimento da
ontologia como um compilador. Uma ontologia bem
projetada pode ser compilada de modo a averiguar
se o seu significado é o pretendido.
Invoking the reasoner
● Having started a reasoner, the ontology can be sent to the
reasoner to automatically compute the classification hierarchy,
and also check the logical consistency of the ontology.
● In Protege, the manually constructed class hierarchy is called the
asserted hierarchy. The automatically computed by the
reasoner is called the inferred hierarchy.
● Go to OWL – classify taxonomy – to invoke the reasoner
● If a class has been reclassified, then the class name will appear
in a blue color in the inferred hierarchy.
● Go to OWL – Check consistency – to invoke the reasoner
● If a class has been found to be inconsistent, it’s icon will be
circled in red color.
● Computing the inferred class hierarchy is also known as
classifying the ontology.
Invoke the reasoner
E24: Inconsistent classes
● In order to demonstrate the use of the reasoner to detect
inconsistencies in the ontology, we will create a class
ProbeInconsistentTopping,
● Which is the subclass of CheeseTopping
● Select ProbeInconsistentTopping, go to asserted condition to add
named classes, select VegetableTopping and then press OK.
● Go to OWL – check consistency
E25: Classify the ontology again
●To see ProbeInconsistentTopping is
inconsistent.
E26: Remove the disjoint statement
●Between CheeseTopping and
VegetableTopping to see what happens
● Select CheeseTopping
● Go to Disjoint part
● Select VegetableTopping, right click and “Delete
the selected row”.
● Classify taxonomy
● The inconsistency no longer exists.
E27: Fix the ontology
1. Select the class CheeseTopping using the class hierarchy.
2. The ‘Disjoint classes’ section of the ‘Class Description’ view should
contain MeatTopping and SeafoodTopping.
3. Press the ‘Add’ icon (+) on the ‘Disjoint With’ to display a dialog in
which classes may be picked from. Select the class VegetableTopping
and press the ‘OK’ button. CheeseTopping should once again be
disjoint from VegetableTopping.
4. Test that the disjoint axiom has been added correctly — Press
‘Classify...’ on the Reasoner drop down menu to send the ontology to
the reasoner. After a few seconds the ontology should have been
classified, and ProbeInconsistentTopping should be highlighted in red
indicating that it is once again inconsistent.
Classes Primitivas e Definidas
- Todas as classes criadas até agora foram definidas as
condições necessárias para descrevê-las.
- Classes que não tem alguma das condições necessárias
(somente tendo condições necessárias) são conhecidas
como classes primitivas.
- Classes que tem ao menos um conjunto necessário e
suficiente condições são conhecidas como classe defined,
e algum indivíduo que satisfaz a definição deve pertencer a
classe.
- No Protege classes defined são caracterizada com linhas
horizontais.
E28: Create a subclass of Pizza called
CheesyPizza and specify that it has at least
one topping that is a kind of CheeseTopping
Os indivíduos da classe CheesyPizza
necessitam ser membro da classe Pizza e
necessitam ter ao menos um recheio (topping)
que é membro da classe CheeseTopping
E29: Convert the necessary conditions for
CheesyPizza into necessary & sufficient
conditions
CheesyPizza em necessary & sufficient
condições: se um indivíduo é membro da classe
Pizza e tem ao menos um recheio (topping) que é
membro da classe CheeseTopping então essas
condições são suficientes para determinar que o
indivíduo deve ser membro da classe
CheesyPizza.
E30: Use the reasoner to automatically
compute the subclasses of CheesyPizza
E31: Create a class to describe a
VegetarianPizza
Create a class to describe a
VegetarianPizza
E32: Convert the necessary conditions for
VegetarianPizza into necessary & sufficient
conditions
E33: Uso do reasoner para classificar
a ontologia
Open world assumption
● Mundo fechado
Qualquer coisa que não for declarada pode
ser assumida como falsa, ou seja, assume-se
que a informação é completa e conhecida.
● Mundo aberto
Se algo não é declarado explicitamente, não
implica que é falso, implica somente em falta
de conhecimento.
Open world assumption
● Raciocínio em OWL (Description Logics) é baseados
no princípio conhecido como “open world
assumption” (OWA).
● Frequentemente referenciado como “open world
reasoning” (OWR).
● Então significa que não podemos assumir que algo
não exista até ser explicitada como não existente.
Em outras palavras, caso algo não tenha sido
declarado verdadeiro ela não pode ser assumida
falso. Portanto é assumido que ‘the knowledge just
hasn’t been added to the knowledge base’.
Open world assumption
MargheritaPizza has toppings that are kinds of
MozzarellaTopping and also kinds of TomatoTopping.
Because of the open world assumption, until we
explicitly say that a MargheritaPizza only has these
kinds of toppings, it is assumed (by the reasoner) that a
MargheritaPizza could have other toppings.
To specify explicitly that a MargheritaPizza has toppings
that are kinds of MozzarellaTopping or kinds of
TomatoTopping and only kinds of MozzarellaTopping
or TomatoTopping, we must add what is known as a
closure axiom on the hasTopping property.
Closure Axiom
A closure axiom on a property consists of a universal
restriction that acts along the property to say that it
can only be filled by the specified fillers. The
restriction has a filler that is the union of the fillers that
occur in the existential restrictions for the property.
For example, the closure axiom on the hasTopping
property for MargheritaPizza is a universal restriction
that acts along the hasTopping property, with a filler
that is the union of MozzarellaTopping and also
TomatoTopping.
E34: Add a closure axiom on the
hasTopping property for
MargheritaPizza
Add a closure axiom on the hasTopping
property for MargheritaPizza
E35: Add a closure axiom on the
hasTopping property for SohoPizza
E36: Automatically create a closure
axiom on the hasTopping property for
AmericanPizza
E37: Automatically create a closure
axiom on the hasTopping property for
AmericanPizza
E37: Classes geradas de
VegetarianPizza e CheesyPizza após os
axiomas e a execução da inferência.
E39: Create a ValuePartition to
represent the spiciness of
pizza toppings
E40: Specify hasSpiciness
restrictions on PizzaToppings
E40: Specify hasSpiciness
restrictions on PizzaToppings
E41: Create a SpicyPizza as a
subclass of Pizza
E41: Create a SpicyPizza as a
subclass of Pizza
E42: Use the reasoner to
classify the ontology
E43:Create an InterestingPizza
that has at least three toppings
E43:Create an InterestingPizza
that has at least three toppings
E44: Use the reasoner to
classify the ontology
E45: Create a Four Cheese
Pizza that has exactly four
cheese toppings
E46: Create a datatype
property called
hasCalorificContentValue
E47: Create example pizza
individuals
E47: Create example pizza
individuals
E48: Create a datatype
restriction to state that all
Pizzas have a calorific value
E48: Create a datatype
restriction to state that all
Pizzas have a calorific value
E49: Create a HighCaloriePizza
that has a calorific value
higher than or equal to 400
E49: Create a HighCaloriePizza
that has a calorific value
higher than or equal to 400
E50: Classify pizza individuals
based on their
hasCalorificContentValue
E50: Classify pizza individuals
based on their
hasCalorificContentValue
E51: Making the
hasCalorificContentValue
datatype property functional
E52: Create NonVegetarianPizza
as a subclass of Pizza and make
it disjoint to Vegetarian-
Pizza
E53: Make VegetarianPizza the
complement of
NonVegetarianPizza
E53: Make VegetarianPizza the
complement of
NonVegetarianPizza
E54: Add Pizza to the necessary
and sufficient conditions for
NonVegetarianPizza
E54: Add Pizza to the necessary
and sufficient conditions for
NonVegetarianPizza
E55:Use the reasoner to
classify the ontology
E56: Create a subclass of
NamedPizza with a topping of
Mozzarella
E57: Use the reasoner to
classify the ontology
E58: Create a class called
Country and populate it with
some individuals
E59: Create a hasValue
restriction to specify that
MozzarellaTopping has Italy as
its country of origin.
E59: Create a hasValue
restriction to specify that
MozzarellaTopping has Italy as
its country of origin.
E60: Convert the class Country
into an enumerated class
E60: Convert the class Country
into an enumerated class
Resources
●Protege Ontology Libraries
● [Link]
Protege_Ontology_Library
●Protege tutorial
● [Link]
●Protege Website
● [Link]
● [Link]
Resources
●Protege Ontology Libraries
● [Link]
Protege_Ontology_Library
●Protege tutorial
● [Link]
●Protege Website
● [Link]
● [Link]