Protege Tutorial - Computer Science Department
Download
Report
Transcript Protege Tutorial - Computer Science Department
SEMANTIC WEB, OWL &
PROTÉGÉ
Matthew J Wood
CS 570 – Topics in Artificial Intelligence
Spring 2013
Today’s Web
Most of today’s Web content is suitable for human
consumption
Even Web content that is generated automatically from
databases is usually presented without the original structural
information found in databases
Typical Web uses today people’s
seeking and making use of information, searching for and getting
in touch with other people, reviewing catalogs of online stores
and ordering products by filling out forms
2
Keyword-Based Search
Engines
Current Web activities are not particularly
well supported by software tools
Except for keyword-based search engines (e.g.
Google, AltaVista, Yahoo)
The Web would not have been the huge
success it was, were it not for search engines
3
Problems of Keyword-Based
Search Engines
High recall, low precision.
Low or no recall
Results are highly sensitive to vocabulary
Results are single Web pages
Human involvement is necessary to interpret
and combine results
Results of Web searches are not readily
accessible by other software tools
4
The Key Problem of Today’s
Web
The meaning of Web content is not machineaccessible: lack of semantics
It is simply difficult to distinguish the meaning
between these two sentences:
I am a professor of computer science.
I am a professor of computer science,
you may think. Well, . . .
5
The Semantic Web Approach
Represent Web content in a form that is more
easily machine-processable.
Use intelligent techniques to take advantage
of these representations.
The Semantic Web will gradually evolve out
of the existing Web, it is not a competition to
the current WWW
6
What is Semantic Web?
Semantic web is a term used more specifically
to refer to format and technologies that enable
it.
It defines the collection, structuring and
recovery of linked data that are enabled by the
technologies that provide a formal description
of concepts, terms, and relationships within a
given knowledge domain.
What is Semantic Web?
Sematic Web is the extension of the World Wide
Web that enables people to share content beyond
the boundaries of applications and websites
Semantic web was term coined by Tim BernersLee, the inventor of World Wide Web and the
director of the World Wide Web Consortium.
He defines it as “a web of data that can be
processed directly and indirectly by machines .
Why Semantic Web?
Semantic Web is about common formats for
integration and combination of data from
diverse sources.
Secondly, it is about language for recording
the relationship data and the real world
objects.
Semantic Web Components
Resource Description Framework (RDF)
RDF Schema (RDFS)
Simple Knowledge Organization System
(SKOS)
SPARQL, an RDF query language
Notation3 (N3)
N-Triples
Turtle (Terse RDF Triple Language)
Web Ontology Language (OWL)
Explicit Metadata
This representation is far more easily
processable by machines
Metadata: data about data
Metadata capture part of the meaning of data
Semantic Web does not rely on text-based
manipulation, but rather on machineprocessable metadata
11
On HTML
Web content is currently formatted for human
readers rather than programs
HTML is the predominant language in which
Web pages are written (directly or using
tools)
Vocabulary describes presentation
12
An HTML Example
<h1>Agilitas Physiotherapy Centre</h1>
Welcome to the home page of the Agilitas Physiotherapy Centre. Do
you feel pain? Have you had an injury? Let our staff Lisa Davenport,
Kelly Townsend (our lovely secretary) and Steve Matthews take care
of your body and soul.
<h2>Consultation hours</h2>
Mon 11am - 7pm<br>
Tue 11am - 7pm<br>
Wed 3pm - 7pm<br>
Thu 11am - 7pm<br>
Fri 11am - 3pm<p>
But note that we do not offer consultation during the weeks of the
<a href=". . .">State Of Origin</a> games.
13
Problems with HTML
Humans have no problem with this
Machines (software agents) do:
How distinguish therapists from the secretary,
How determine exact consultation hours
They would have to follow the link to the State Of
Origin games to find when they take place.
14
XML (eXtended Markup
Language)
A better representation of data
XML is a flexible text format that is widely
used to structure, store, and transport data.
XML is different from HTML because it is not
about displaying data.
In XML (differently from HTML) you create
your own tags to annotate data.
XML is used to create other languages such
as: XHTML, RSS, RDF, OWL, etc.
15
An XML Example
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>
16
RDF (Resource Description
Framework)
RDF: a standard for describing resources on the Web
The meaning of data is encoded in sets of triples.
Triples are “subject, predicate, object” statements.
Each element of a triple is identified by a URI.
URIs represent both resources and relations.
RDF is written in XML
RDF is to Semantic Web what HTML was to the Web.
Harry Potter has as author J. K. Rowling.
17
An RDF Example
http://en.wikipedia.org/wiki/J._K._Rowling
dc:creator
http://en.wikipedia.org/wiki/ Harry_Potter
<rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#
xmlns:dc=http://purl.org/dc/elements/1.1/>
<rdf:Description
rdf:about=“http://en.wikipedia.org/wiki/Harry_Potter”>
<dc:creator=“http://en.wikipedia.org/wiki/J._K._Rowling”>
</rdf:Description>
</rdf:RDF>
18
Ontologies and OWL
An ontology is an explicit description of things
and their relations.
OWL serves to write ontologies for the Web.
OWL is written in XML and built on top of RDF.
You can think of OWL as an object-oriented
language that defines classes, hierarchy of
classes, attributes, relations, etc.
OWL is designed to support inference
(subsumption and classification)
OWL is more expressive than RDF.
19
Typical Components of
Ontologies
Terms denote important concepts (classes of objects) of
the domain
e.g. professors, staff, students, courses, departments
Relationships between these terms: typically class
hierarchies
a class C to be a subclass of another class C' if every object in C
is also included in C'
e.g. all professors are staff members
20
Further Components of
Ontologies
Properties:
Value restrictions
e.g. only faculty members can teach courses
Disjointness statements
e.g. X teaches Y
e.g. faculty and general staff are disjoint
Logical relationships between objects
e.g. every department must include at least 10 faculty
21
Example of a Class Hierarchy
22
The Role of Ontologies on the
Web
Ontologies provide a shared understanding of
a domain: semantic interoperability
overcome differences in terminology
mappings between ontologies
Ontologies are useful for the organization and
navigation of Web sites
23
The Role of Ontologies in Web Search
Ontologies are useful for improving the accuracy of Web
searches
search engines can look for pages that refer to a precise concept
in an ontology
Web searches can exploit generalization/ specialization
information
If a query fails to find any relevant documents, the search engine
may suggest to the user a more general query.
If too many answers are retrieved, the search engine may
suggest to the user some specializations.
24
Web Ontology Languages (2)
OWL
A richer ontology language
relations between classes
cardinality
e.g., disjointness
e.g. “exactly one”
richer typing of properties
characteristics of properties (e.g., symmetry)
25
Software Agents
Software agents work autonomously and proactively
They evolved out of object oriented and compontent-based
programming
A personal agent on the Semantic Web will:
receive some tasks and preferences from the person
seek information from Web sources, communicate with other
agents
compare information about user requirements and preferences,
make certain choices
give answers to the user
26
Intelligent Personal Agents
A Semantic Web Primer
27
Semantic Web Agent Technologies
Metadata
Ontologies
Identify and extract information from Web sources
Web searches, interpret retrieved information
Communicate with other agents
Logic
Process retrieved information, draw conclusions
28
Drawbacks of XML
XML is a universal metalanguage for defining markup
It provides a uniform framework for interchange of data
and metadata between applications
However, XML does not provide any means of talking
about the semantics (meaning) of data
E.g., there is no intended meaning associated with the
nesting of tags
It is up to each application to interpret the nesting.
29
Requirements for Ontology
Languages
Ontology languages allow users to write
explicit, formal conceptualizations of domain
models
The main requirements are:
a well-defined syntax
efficient reasoning support
a formal semantics
sufficient expressive power
convenience of expression
30
Tradeoff between Expressive Power
and Efficient Reasoning Support
The richer the language is, the more
inefficient the reasoning support becomes
Sometimes it crosses the border of
noncomputability
We need a compromise:
A language supported by reasonably efficient
reasoners
A language that can express large classes of
ontologies and knowledge.
31
Reasoning About Knowledge in
Ontology Languages
Class membership
If x is an instance of a class C, and C is a
subclass of D, then we can infer that x is an
instance of D
Equivalence of classes
If class A is equivalent to class B, and class B is
equivalent to class C, then A is equivalent to C,
too
32
Reasoning About Knowledge in
Ontology Languages (2)
Consistency
X instance of classes A and B, but A and B are
disjoint
This is an indication of an error in the ontology
Classification
Certain property-value pairs are a sufficient
condition for membership in a class A; if an
individual x satisfies such conditions, we can
conclude that x must be an instance of A
33
Uses for Reasoning
Reasoning support is important for
checking the consistency of the ontology and the knowledge
checking for unintended relationships between classes
automatically classifying instances in classes
Checks like the preceding ones are valuable for
designing large ontologies, where multiple authors are involved
integrating and sharing ontologies from various sources
34
Reasoning Support for OWL
Semantics is a prerequisite for reasoning support
Formal semantics and reasoning support are usually
provided by
mapping an ontology language to a known logical formalism
using automated reasoners that already exist for those
formalisms
OWL is (partially) mapped on a description logic, and
makes use of reasoners such as FaCT and RACER
Description logics are a subset of predicate logic for
which efficient reasoning support is possible
35
Three Species of OWL
W3C’sWeb Ontology Working Group defined
OWL as three different sublanguages:
OWL Full
OWL DL
OWL Lite
Each sublanguage geared toward fulfilling
different aspects of requirements
36
OWL DL
OWL DL is so named due to its
correspondence with description logic.
Description logic (DL) is a family of formal
knowledge representation languages. It is
more expressive than propositional logic
It models concepts, roles and individuals, and
their relationships
It is used in AI for formal reasoning on the
concept of application domain known as
Terminological knowledge
Protege Tutorial
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
What can you do with
Protégé?
Create a new ontology from scratch
Download and extend an existing ontology
Export ontologies in a variety of formats
OWL
RDF
XML Schema
How it works
Objects in the domain are expressed through a
series of interrelated classes
Class hierarchy is similar to that used by objectoriented languages such as Java
Superclasses
Subclasses
Sibling Classes
Ancestor Classes, etc.
Heavy reliance on inheritance
Unlike Java, Protégé supports multiple inheritance
Individuals and Properties
Individual domain objects are expressed as
class members
Class members have object properties that
relate them to members of the same class or
other classes
Also have data properties
Expressed by data type – integer, String, etc.
If particular data property does not fit a predefined
data type it can be entered as text
Ex. Members of the class Soccer_Players have ‘has
fanpage’ data property that is expressed as a URL
Annotations
Provide definitions and comments on the
ontology and its contents
Can provide annotations for the entire
ontology, a specific class, a member of a
class, etc.
How It Works (cont.)
Using Protégé in conjunction with GraphViz
software allows users to view the ontology as
a semantic network
Protégé relies on semantic reasoners to
implement description logic
Semantic Reasoners
Inference engine for description logics
Inference process is carried out via forward
and backward chaining
Protégé supports various reasoners such as
FaCT++ and HermiT
FaCT++
Semantic reasoner used for OWL DL
ontologies
Implemented in C++ and supported by
Protege
Converts the KB into an internal
representation using various optimization
techniques
Uses dependency directed backtracking to
check satisfiability of the KB
Install Protege
Go to http://protege.stanford.edu/doc/owl/gettingstarted.html 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:
http://protege.stanford.edu/doc/owl/gettingstarted.html
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 (http://www.pizza.com/ontologies/pizza.owl) –
OWL DL – Properties View
A new empty Protege-OWL project has been
created.
Save it in your local file as pizza.owl
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,
Select the class MeatTopping,
Create subclaesses as MeatTopping, VegetableTopping,
CheeseTopping and SeafoodTopping. Make sure that
these classes are disjoint to each other.
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
Select CheeseTopping
Add disjoint subclasses: RedPepperTopping,
GreenPepperTopping, JalapenoPepperTopping
Add disjoint subclasses: MozzarellaTopping,
ParmezanTopping
Select SeafoodTopping
Add disjoint subclasses: TunaTopping,
AnchovyTopping and PrawnTopping
OWL Properties
OWL Properties represent relationships
between two objects.
There are two main properties:
Object properties: link object to object
datatype properties: link object to XML Schema
datatype or rdf:literal
OWL has another property – Annotation
properties, to be used to add annotation
information to classes, individuals, and
properties
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
Select hasBase
Press “Set inverse property” button,
Select “hasIngredient”
Then the inverse relation has been set up.
Create the isBaseOf as the inverse property of hasBase
isBaseOf is the subproperty of isIngredientOf
Select hasTopping
create isToppingOf as the inverse property.
isToppingOf is the subproperty
of isIngredientOf
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
Functional
Property
For a given
domain
Range is
unique
InverseFunctional
Property
Domain is
unique
For a given
range
example
hasFather: A hasFather
B, A hasFather C B=C
hasID: A hasID B, C
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.
By performing such tests on all of the classes, it is possible for a
reasoner to compute the inferred ontology class hierarchy.
Another reasoning service is consistency checking – to check
whether or not it is possible for the class to have any instances.
A class is deemed to be inconsistent if it cannot possibly have
any instances.
Using Racer
In order to reason over the ontology in
Protege-OWL, a DIG compliant reasoner
should be installed and started.
In this example, we use Racer,
Download at: http://www.racersystems.com/products/download/index.phtml
Double click RacerPro to start Racer.
Invoking the reasoner
Having started Racer, 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
By making CheeseTopping and
VegetableTopping disjoint from each other.
SPORTS ONTOLOGICAL EXTENSION
IN PROTÉGÉ
Project #1
Used Protégé to extend a general sports
ontology (sptcsem.owl)
Focused on adding classes, individuals, and
properties related to the game of soccer
Used Fact++ for DL queries