Editing OWL Ontologies with Protégé - NTNU OWL modeling... · 2008-05-01 · Editing OWL...

40
1 Jon Atle Gulla OWL Modeling Editing OWL Ontologies with Protégé Jon Atle Gulla Jon Atle Gulla OWL Modeling Overview The Semantic Web and OWL Revisited Basic OWL Protege: Classes, Properties Advanced OWL Protege: Class Descriptions

Transcript of Editing OWL Ontologies with Protégé - NTNU OWL modeling... · 2008-05-01 · Editing OWL...

1

Jon Atle Gulla OWL Modeling

Editing OWL Ontologieswith Protégé

Jon Atle Gulla

Jon Atle Gulla OWL Modeling

Overview

The Semantic Web and OWL Revisited

Basic OWL

Protege: Classes, Properties

Advanced OWL

Protege: Class Descriptions

2

Jon Atle Gulla OWL Modeling

The Semantic WebShared ontologies help to exchange data and meaning between

web-based services

(Image by Jim Hendler)

Jon Atle Gulla OWL Modeling

Wine Example ScenarioTell me what wines I

should buy to serve with each course of the

following menu.

Wine Agent

Grocery Agent

Books Agent

I recommend Chardonney or

DryRiesling

3

Jon Atle Gulla OWL Modeling

Ontologies in the Semantic Web

Provide shared data structures to exchange information between agentsCan be explicitly used as annotations in web sitesCan be used for knowledge-based services using other web resourcesCan help to structure knowledge to build domain models (for other purposes)

Jon Atle Gulla OWL Modeling

OWL

Web Ontology LanguageOfficial W3C Standard since Feb 2004Based on predecessors (DAML+OIL)

A Web Language: Based on RDF(S)An Ontology Language: Based on logic

4

Jon Atle Gulla OWL Modeling

OWL OntologiesWhat’s inside an OWL ontology

Classes + class-hierarchyProperties (Slots) / valuesRelations between classes(inheritance, disjoints, equivalents)Restrictions on properties (type, cardinality)Characteristics of properties (transitive, …)AnnotationsIndividuals

Reasoning tasks: classification,consistency checking

Jon Atle Gulla OWL Modeling

OWL Use Cases

At least two different user groupsOWL used as data exchange language(define interfaces of services and agents)OWL used for terminologies or knowledge models

OWL DL is the subset of OWL (Full) that is optimized for reasoning and knowledge modeling

5

Jon Atle Gulla OWL Modeling

Protégé OWL Plugin

Extension of Protégé for handling OWL ontologiesProject started in April 2003Features

Loading and saving OWL files & databasesGraphical editors for class expressionsAccess to description logics reasonersPowerful platform for hooking in custom-tailored components

Jon Atle Gulla OWL Modeling

OWL Plugin Architecture

Protégé API(Classes, properties,

individuals, etc.)

Protégé GUI(Tabs, Widgets, Menus)

DBStorage P

roté

géC

ore

Sys

tem

Protégé OWL API(Logical class definitions,

restrictions, etc.)

Protégé OWL GUI(Expression Editor,

Conditions Widget, etc.)

OWL FileStorage

Jena API(Parsing, Reasoning)

OW

L P

lugi

n

OWL Extension APIs(SWRL, OWL-S, etc.)

OWL GUI Plugins(SWRL Editors, ezOWL,OWLViz, Wizards, etc.)

6

Jon Atle Gulla OWL Modeling

Tutorial Scenario

Semantic Web for Tourism/TravelingGoal: Find matching holiday destinations for a customer

I am looking for a comfortable destination

with beach access

Tourism Web

Jon Atle Gulla OWL Modeling

Scenario Architecture

A search problem: Match customer’s expectations with potential destinationsRequired: Web Service that exploits formal information about the available destinations

Accomodation (Hotels, B&B, Camping, ...)Activities (Sightseeing, Sports, ...)

7

Jon Atle Gulla OWL Modeling

Tourism Semantic Web

Open World:New hotels are being addedNew activities are offered

Providers publish their services dynamicallyStandard format / grounding is needed→ Tourism Ontology

Jon Atle Gulla OWL Modeling

Tourism Semantic Web

OWLMetadata

(Individuals)

OWLMetadata

(Individuals)

OWLMetadata

(Individuals)

OWLMetadata

(Individuals)

Tourism Ontology

Web Services

Destination

AccomodationActivity

8

Jon Atle Gulla OWL Modeling

OWL (in Protégé)

Individuals (e.g., “FourSeasons”)Properties

ObjectProperties (references)DatatypeProperties (simple values)

Classes (e.g., “Hotel”)

Jon Atle Gulla OWL Modeling

Individuals

Represent objects in the domainSpecific thingsTwo names could represent the same “real-world”individual

SydneysOlympicBeachBondiBeach

Sydney

9

Jon Atle Gulla OWL Modeling

ObjectProperties

Link two individuals togetherRelationships (0..n, n..m)

Sydney

BondiBeachhasPart

FourSeasonshasAccomodation

Jon Atle Gulla OWL Modeling

Inverse Properties

Represent bidirectional relationshipsAdding a value to one property also adds a value to the inverse property

Sydney

BondiBeachhasPart

isPartOf

10

Jon Atle Gulla OWL Modeling

Transitive Properties

If A is related to B and B is related to C then A is also related to COften used for part-of relationships

Sydney

BondiBeach

hasPart

NewSouthWales

hasPart

hasPart (derived)

Jon Atle Gulla OWL Modeling

DatatypeProperties

Link individuals to primitive values(integers, floats, strings, booleans etc)Often: AnnotationProperties without formal “meaning”

Sydney

hasSize = 4,500,000isCapital = truerdfs:comment = “Don’t miss the opera house”

11

Jon Atle Gulla OWL Modeling

ClassesSets of individuals with common characteristicsIndividuals are instances of at least one class

City

Sydney

Beach

Cairns

BondiBeach

CurrawongBeach

Jon Atle Gulla OWL Modeling

Range and DomainProperty characteristics

Domain: “left side of relation” (Destination)Range: “right side” (Accomodation)

Sydney

BestWestern

FourSeasonshasAccomodation

DestinationAccomodation

hasAccomodation

12

Jon Atle Gulla OWL Modeling

Domains

Individuals can only take values of properties that have matching domain

“Only Destinations can have Accomodations”Domain can contain multiple classesDomain can be undefined:Property can be used everywhere

Jon Atle Gulla OWL Modeling

Superclass RelationshipsClasses can be organized in a hierarchyDirect instances of subclass are also (indirect) instances of superclasses

Cairns

SydneyCanberra

Coonabarabran

13

Jon Atle Gulla OWL Modeling

Class Relationships

Classes can overlap arbitrarily

City

Sydney

CairnsBondiBeach

RetireeDestination

Jon Atle Gulla OWL Modeling

Class DisjointnessAll classes could potentially overlapIn many cases we want to make sure they don’t share instances

Sydney

UrbanArea RuralArea

SydneyWoomera

CapeYork

disjointWith

City Destination

14

Jon Atle Gulla OWL Modeling

(Create a new OWL project)

Jon Atle Gulla OWL Modeling

(Create simple classes)

15

Jon Atle Gulla OWL Modeling

(Create class hierarchy and set disjoints)

Jon Atle Gulla OWL Modeling

(Create Contact class with datatype properties)

16

Jon Atle Gulla OWL Modeling

(Edit details of datatype properties)

Jon Atle Gulla OWL Modeling

(Create an object property hasContact)

17

Jon Atle Gulla OWL Modeling

(Create an object property with inverse)

Jon Atle Gulla OWL Modeling

(Create the remaining classes and properties)

18

Jon Atle Gulla OWL Modeling

Class DescriptionsClasses can be described by their logical characteristicsDescriptions are “anonymous classes”

Things with three star accomodation

Things with sightseeing opportunities

RetireeDestination

SydneySanJose

BlueMountains

Jon Atle Gulla OWL Modeling

Class Descriptions

Define the “meaning” of classesAnonymous class expressions are used

“All national parks have campgrounds.”“A backpackers destination is a destination that has budget accomodation and offers sports or adventure activities.”

Expressions mostly restrict property values (OWL Restrictions)

19

Jon Atle Gulla OWL Modeling

Class Descriptions: Why?

Based on OWL’s Description Logic supportFormalize intentions and modeling decisions (comparable to test cases)Make sure that individuals fulfill conditionsTool-supported reasoning

Jon Atle Gulla OWL Modeling

Reasoning with Classes

Tool support for three types of reasoning exists:Consistency checking:Can a class have any instances?Classification:Is A a subclass of B?Instance classification:Which classes does an individual belong to?

For Protégé we recommend Pellet(but other tools with DIG support work too)

20

Jon Atle Gulla OWL Modeling

Restrictions (Overview)

Define a condition for property valuesallValuesFromsomeValuesFromhasValueminCardinalitymaxCardinalitycardinality

An anonymous class consisting of all individuals that fulfill the condition

Jon Atle Gulla OWL Modeling

Cardinality RestrictionsMeaning: The property must have at least/at most/exactly x values

is the shortcut for andExample: A FamilyDestination is a Destination that has at least one Accomodation and at least 2 Activities

21

Jon Atle Gulla OWL Modeling

allValuesFrom RestrictionsMeaning: All values of the property must be of a certain typeWarning: Also individuals with no values fulfill this condition (trivial satisfaction)Example: Hiking is a Sport that is only possible in NationalParks

Jon Atle Gulla OWL Modeling

someValuesFrom RestrictionsMeaning: At least one value of the property must be of a certain typeOthers may exist as wellExample: A NationalPark is a RuralArea that has at least one Campground and offers at least one Hiking opportunity

22

Jon Atle Gulla OWL Modeling

hasValue RestrictionsMeaning: At least one of the values of the property is a certain valueSimilar to someValuesFrom but with Individuals and primitive valuesExample: A PartOfSydney is a Destination where one of the values of the isPartOf property is Sydney

Jon Atle Gulla OWL Modeling

Enumerated ClassesConsist of exactly the listed individuals

OneStarRating

TwoStarRatingThreeStarRating

BudgetAccomodation

23

Jon Atle Gulla OWL Modeling

Logical Class Definitions

Define classes out of other classesunionOf (or)intersectionOf (and)complementOf (not)

Allow arbitrary nesting of class descriptions (A and (B or C) and not D)

Jon Atle Gulla OWL Modeling

unionOfThe class of individuals that belong to class A orclass B (or both)Example: Adventure or Sports activities

Adventure Sports

24

Jon Atle Gulla OWL Modeling

intersectionOfThe class of individuals that belong to both class A andclass BExample: A BudgetHotelDestination is a destination with accomodation that is a budget accomodation and a hotel

BudgetAccomodationHotel

Jon Atle Gulla OWL Modeling

Implicit intersectionOfWhen a class is defined by more than one class description, then it consists of the intersection of the descriptionsExample: A luxury hotel is a hotel that is also an accomodation with 3 stars

AccomodationWith3StarsHotel

LuxuryHotel

25

Jon Atle Gulla OWL Modeling

complementOfThe class of all individuals that do not belong to a certain classExample: A quiet destination is a destination that is not a family destination

DestinationFamilyDestination

QuietDestination (grayed)

Jon Atle Gulla OWL Modeling

Class Conditions

Necessary Conditions:(Primitive / partial classes)“If we know that something is a X,then it must fulfill the conditions...”

Necessary & Sufficient Conditions:(Defined / complete classes)“If something fulfills the conditions...,then it is an X.”

26

Jon Atle Gulla OWL Modeling

Class Conditions (2)

QuietDestination

NationalPark

(not everything that fulfills theseconditions is a NationalPark)

(everything that fulfills theseconditions is a QuietDestination)

Jon Atle Gulla OWL Modeling

ClassificationNationalPark

BackpackersDestination

A RuralArea is a DestinationA Campground is BudgetAccomodationHiking is a SportTherefore:Every NationalPark is a Backpackers-Destiantion

(Other BackpackerDestinations)

27

Jon Atle Gulla OWL Modeling

Classification (2)Input: Asserted class definitionsOutput: Inferred subclass relationships

Jon Atle Gulla OWL Modeling

The Manchester OWL Syntax

An abstract readable syntax for OWL ontologies

Horridge, et al.: ”The Manchester OWL Syntax”. Manchester.

28

Jon Atle Gulla OWL Modeling

Standard DL Syntax in OWLDefinition of VegetarianPizza in Pizza ontology (Protege tutorial)

Issues:Difficult to read for non-ontology expertsNon-standard symbols

Jon Atle Gulla OWL Modeling

Manchester OWL Syntax

Logical symbols translated to EnglishInfix notation

29

Jon Atle Gulla OWL Modeling

Manchester Syntax ExamplesClass of people who have at least one child that has some children that are only men (i.e. Grandparents that only have grandsons)

Jon Atle Gulla OWL Modeling

Improved Readability of Ontologies

VegetarianPizza in Protege in Manchester Syntax

Important macros:ONLYSOMEExclusive OR

30

Jon Atle Gulla OWL Modeling

Conclusions

OWL for modeling ontologiesClasses, properties and individualsRestrictionsCharacteristics of propertiesReasoning

Manchester OWL Syntax

Jon Atle Gulla OWL Modeling

Additional Slides

The following slides explain in some more detail how Protege is used to construct advanced ontological descriptions

31

Jon Atle Gulla OWL Modeling

(Create an enumerated class out of individuals)

Jon Atle Gulla OWL Modeling

(Create a hasValue restriction)

32

Jon Atle Gulla OWL Modeling

(Create a hasValue restriction)

Jon Atle Gulla OWL Modeling

(Create a defined class)

33

Jon Atle Gulla OWL Modeling

(Classify Campground)

Jon Atle Gulla OWL Modeling

(Add restrictions to City and Capital)

34

Jon Atle Gulla OWL Modeling

(Create defined class BackpackersDestination)

Jon Atle Gulla OWL Modeling

(Create defined class FamilyDestination)

35

Jon Atle Gulla OWL Modeling

(Create defined class QuietDestination)

Jon Atle Gulla OWL Modeling

(Create defined class RetireeDestination)

36

Jon Atle Gulla OWL Modeling

(Classification)

Jon Atle Gulla OWL Modeling

(Consistency Checking)

37

Jon Atle Gulla OWL Modeling

Putting it All Together

Ontology has been developedPublished on a dedicated web addressOntology provides standard terminologyOther ontologies can extend itUsers can instantiate the ontology to provide instances

specific hotelsspecific activities

Jon Atle Gulla OWL Modeling

Ontology Import

Adds all classes, properties and individuals from an external OWL ontology into your projectAllows to create individuals, subclasses, or to further restrict imported classesCan be used to instantiate an ontology for the Semantic Web

38

Jon Atle Gulla OWL Modeling

Tourism Semantic Web (2)

OWLMetadata

(Individuals)Tourism Ontology

Web Services

Destination

AccomodationActivity

Jon Atle Gulla OWL Modeling

Ontology Import with Protégé

On the Metadata tab:Add namespace, define prefixCheck “Imported” and reload your project

39

Jon Atle Gulla OWL Modeling

Individuals

Jon Atle Gulla OWL Modeling

Individuals

40

Jon Atle Gulla OWL Modeling

OWL File<?xml version="1.0"?>\<rdf:RDF

xmlns="http://protege.stanford.edu/plugins/owl/owl-library/heli-bunjee.owl#"xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"xmlns:owl="http://www.w3.org/2002/07/owl#"xmlns:dc="http://purl.org/dc/elements/1.1/"xmlns:travel="http://protege.stanford.edu/plugins/owl/owl-library/travel.owl#"

xml:base="http://protege.stanford.edu/plugins/owl/owl-library/heli-bunjee.owl">

<owl:Ontology rdf:about=""><owl:imports rdf:resource="http://protege.stanford.edu/plugins/owl/owl-library/travel.owl"/>

</owl:Ontology>

<owl:Class rdf:ID="HeliBunjeeJumping"><rdfs:subClassOf rdf:resource="http://protege.stanford.edu/plugins/owl/owl-library/travel.owl#BunjeeJumping"/>

</owl:Class>

<HeliBunjeeJumping rdf:ID="ManicSuperBunjee"><travel:isPossibleIn>

<rdf:Description rdf:about="http://protege.stanford.edu/plugins/owl/owl-library/travel.owl#Sydney"><travel:hasActivity rdf:resource="#ManicSuperBunjee"/>

</rdf:Description></travel:isPossibleIn><travel:hasContact>

<travel:Contact rdf:ID="MSBInc"><travel:hasEmail rdf:datatype="http://www.w3.org/2001/XMLSchema#string">[email protected]</travel:hasEmail><travel:hasCity rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Sydney</travel:hasCity><travel:hasStreet rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Queen Victoria St</travel:hasStreet><travel:hasZipCode rdf:datatype="http://www.w3.org/2001/XMLSchema#int">1240</travel:hasZipCode>

</travel:Contact></travel:hasContact><rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Manic super bunjee now offers nerve

wrecking jumps from 300 feet right out of a helicopter. Satisfaction guaranteed.</rdfs:comment></HeliBunjeeJumping>

</rdf:RDF>