Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ontology languages and OWL

4,185 views

Published on

An introduction to the OWL ontology language and ontology editing with Protégé. Slides for the PhD Course on Semantic Web (http://elite.polito.it/).

Published in: Education

Ontology languages and OWL

  1. 1. Ontology languages
  2. 2. RDF / RDF Schema F. Corno, L. Farinetti - Politecnico di Torino 2
  3. 3. RDF Schema example F. Corno, L. Farinetti - Politecnico di Torino 3
  4. 4. RDFS problems bl RDFS is too “weak” to describe resources with a suitable level of details range and domain cannot be localized (e.g. the range of hasChild is a person when applied to a person, elephant when applied to an elephant) no constraints on existence or cardinality (e.g. all instances of persons have one and only one mother which is a person, and have exactly two parents) F. Corno, L. Farinetti - Politecnico di Torino 4
  5. 5. RDFS problems it is not possible to define transitive, inverse or symmetrical statements (e.g. p of is a y ( g part transitive property, hasPart is the inverse of isPartOf, touches is symmetrical) , y ) Reasoning is not well supported Non t d d N standard semantics, no native reasoner ti ti exists F. Corno, L. Farinetti - Politecnico di Torino 5
  6. 6. Requirements for an ontology language g g Extend existing Web standards XML, RDF, RDFS, ... Easy t understand and t use E to d t d d to based on well known KR languages Formally specified Adequate expressive power Adeq ate e pressi e po er Automatic support for reasoning pp g F. Corno, L. Farinetti - Politecnico di Torino 6
  7. 7. Stack of Web languages W3C IST EU project OntoKnowledgeg OWL bioinformatics DARPA University of OIL DAML+OIL community Washington XOL SHOE OML RDF(S) University of y Maryland XML F. Corno, L. Farinetti - Politecnico di Torino 7
  8. 8. Ontology Web Language (OWL) O t l W bL 4th level on the semantic web cake le el eb Built on top of p XML RDF/S Three versions Lite DL (maps to Description Logic) Full (not fully tractable) Serializable S i li bl as XML F. Corno, L. Farinetti - Politecnico di Torino 8
  9. 9. Ontology Web Language (OWL) F. Corno, L. Farinetti - Politecnico di Torino 9
  10. 10. OWL-DL OWL DL Based on Description Logic Well defined formal semantics well defined rules to treat sentence meaning well defined assumptions on the world being p g modeled Well known reasoning/inferencing g g algorithms tractable, tractable conclusions can be derived in finite time Widely available reasoning systems F. Corno, L. Farinetti - Politecnico di Torino 10
  11. 11. Building blocks in OWL Ontology declaration (XML syntax) <rdf:RDF xmlns:owl =http://www.w3.org/2002/07/owl#" xmlns:rdf ="http://www.w3.org/1999/02/22-rdf-syntax-ns#" l df "h // 3 /1999/02/22 df #" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd ="http://www.w3.org/2001/XMLSchema#"> Ontology metadata (information about the ontology) <owl:Ontology rdf:about=""> <rdfs:comment>An example OWL ontology</rdfs:comment> <owl:priorVersion < l i V i rdf:resource="http://www.mydomain.org/uni-ns-old"/> <owl:imports rdf:resource="http://www.mydomain.org/persons"/> p y g p <rdfs:label>University Ontology</rdfs:label> </owl:Ontology> F. Corno, L. Farinetti - Politecnico di Torino 11
  12. 12. Classes Cl Every class i a d E l is descendant of d t f owl:Thing g Classes are defined using owl:Class <owl:Class rdf:ID="Vehicle"/> Equivalence owl:equivalentClass <owl:Class rdf:ID="Car"> <owl:equivalentClass rdf:resource="#Automobile"/> q </owl:Class> F. Corno, L. Farinetti - Politecnico di Torino 12
  13. 13. Subsumption Provided by owl:subClassOf <owl:Class rdf:ID="2-Wheel-Drive"> < l Cl df ID "2 Wh l D i "> <rdfs:subClassOf rdf:resource="#Car"/> </owl:Class> F. Corno, L. Farinetti - Politecnico di Torino 13
  14. 14. Partitions Disjoint partition owl:disjointWith <owl:Class rdf:about="#2-Wheel-Drive"> <owl:disjointWith rdf:resource="#4-Wheel-Drive"/> </owl:Class> F. Corno, L. Farinetti - Politecnico di Torino 14
  15. 15. Partitions Exhaustive partition owl:oneOf <owl:Class rdf:ID="Car"> <owl:oneOf rdf:parseType="Collection"> <owl:Thing rdf:about="#2-Wheel-Drive"/> g # / <owl:Thing rdf:about="#4-Wheel-Drive"/> </owl:oneOf> </owl:Class> F. Corno, L. Farinetti - Politecnico di Torino 15
  16. 16. Attributes A ib Known also as “properties” Datatype properties Attributes that specify a class features by means of data (XSD datatype) Phone, title, age Object properties Attributes that define relationships between classes (Relations) isTaughtBy(Class(course), Class(professor)) F. Corno, L. Farinetti - Politecnico di Torino 16
  17. 17. Datatype properties Allow to describe a specific aspect of a concept Based on XSD data types The range specifies the data type The domain specifies the class to which the property is referred <owl:DatatypeProperty rdf:ID="age"> <rdfs:domain rdf:resource="#Person"/> < df d i df "#P "/> <rdfs:range rdf:resource="http://www.w3.org/2001/ XMLSchema#nonNegativeInteger"/> </owl:DatatypeProperty> F. Corno, L. Farinetti - Politecnico di Torino 17
  18. 18. Relationships Directed From one concept to another, no viceversa Defined through object properties Domain: the class(es) from which the relation departs Range: the relation destination(s) Subsumption between relationships is possible F. Corno, L. Farinetti - Politecnico di Torino 18
  19. 19. Relationships Example <owl:ObjectProperty rdf:ID="isTaughtBy"> <rdfs:domain rdf:resource="#course"/> <rdfs:range rdf:resource="#academicStaffMember"/> <rdfs:subPropertyOf rdf:resource="#involves"/> </owl:ObjectProperty> F. Corno, L. Farinetti - Politecnico di Torino 19
  20. 20. Instances (individuals) I t (i di id l ) No i N unique name assumption i OWL ti in If two instances have a different name or ID this does not imply that they are different individuals E.g.: “Queen Elizabeth”, “The Queen” and “Elizabeth Windsor” might all refer to the g same individual It must be explicitly stated that individuals are the same as each other, or different to each other F. Corno, L. Farinetti - Politecnico di Torino 20
  21. 21. Instances (individuals) I t (i di id l ) Defined by D fi d b means of f rdf:Description + rdf:Type p yp <academicStaffMember rdf:ID="949352"> rdf:ID= 949352 > <uni:age rdf:datatype="&xsd;integer"> 39 </uni:age> </academicStaffMember> <rdf:Description rdf:ID="949353"> <rdf:type rdf:resource="#academicStaffMember"/> </rdf:Description> F. Corno, L. Farinetti - Politecnico di Torino 21
  22. 22. Advanced constructs Ad d t t OWL supports several advanced constructs to define classes and relationships Intensional definition of classes By defining constraints on attribute values ( y g (either object or datatype properties) <owl:Class rdf:about="#academicStaffMember"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#teaches"/> <owl:someValuesFrom < l V l F rdf:resource="#undergraduateCourse"/> </owl:Restriction> </rdfs:subClassOf> </owl:Class> F. Corno, L. Farinetti - Politecnico di Torino 22
  23. 23. Advanced constructs Ad d t t Cardinality Used to fix the number of instances that can be related E.g.: a department should have at least 10 members <owl:Class rdf:about="#department"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasMember"/> <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger"> 10 </owl:minCardinality> </owl:Restriction> </rdfs:subClassOf> </owl:Class> F. Corno, L. Farinetti - Politecnico di Torino 23
  24. 24. Special properties S i l ti owl:TransitiveProperty defines a transitive property, such as “has better grade than”, “is taller than”, or “is ancestor of” owl:SymmetricProperty defines a symmetric property, such as “has same grade as” or “is sibling of” owl:FunctionalProperty defines a property that has at most one value for each object, such as “age”, “height”, or “directSupervisor” F. Corno, L. Farinetti - Politecnico di Torino 24
  25. 25. Special properties owl:InverseFunctionalProperty defines a property for which two different objects cannot have the same value j E.g.: the property “isTheSocialSecurityNumberFor”: a social isTheSocialSecurityNumberFor : security number is assigned to one person only F. Corno, L. Farinetti - Politecnico di Torino 25
  26. 26. OWL class constructors F. Corno, L. Farinetti - Politecnico di Torino 26
  27. 27. OWL axioms F. Corno, L. Farinetti - Politecnico di Torino 27
  28. 28. OWL: h t f ? OWL what for? To build an ontology define classes and provide information on them p define properties and provide information on them To express facts about a domain provide information on instances (individuals) To reason about ontologies and facts discover consequences of what is expressly stated F. Corno, L. Farinetti - Politecnico di Torino 28
  29. 29. Example of ontology p gy building in OWL with P té é ith Protégé
  30. 30. Protégé Open source ontology editor Developed by Stanford Center for Biomedical Informatics Research at the Stanford University School of Medicine http://protege.stanford.edu/ htt // t t f d d / F. Corno, L. Farinetti - Politecnico di Torino 30
  31. 31. F. Corno, L. Farinetti - Politecnico di Torino 31
  32. 32. Project steps 0. Conceptual design of the ontology 1. Classes definition 2. 2 Properties definition 3. Individuals definition 4. Restrictions definition F. Corno, L. Farinetti - Politecnico di Torino 32
  33. 33. Step 0 Conceptual design of the ontology F. Corno, L. Farinetti - Politecnico di Torino 33
  34. 34. Bed&Breakfast OneStarRating hasRating Accommodation Rating Accommodation TwoStarRating Camping Budget ThreeStarRating Accommodation Hotel int hasZipCode hasAccommodation Luxury Hotel string Backpacker Contact Hiking Destination hasStreet Surfing hasEMail Sheraton hasContact C string Sports isOffered Destination Yoga Beach Activity Caprera hasCity Relaxation hasActivity Quiet string Destination Family Destination Gallipoli Sunbathing Adventure Sightseeing Bardonecchia Rimini Safari BunjeeJumping Museums F. Corno, L. Farinetti - Politecnico di Torino 34
  35. 35. Step 1a Define classes and subclasses Is-a relationship, or subsumption F. Corno, L. Farinetti - Politecnico di Torino 35
  36. 36. Bed&Breakfast Accommodation Rating Accommodation Camping Budget Accommodation Hotel Luxury Hotel Backpacker Contact Hiking Destination Surfing Sports Destination Yoga Beach Activity Relaxation Quiet Destination Family Destination Sunbathing Adventure Sightseeing Safari BunjeeJumping Museums F. Corno, L. Farinetti - Politecnico di Torino 36
  37. 37. OWL code <owl:Class rdf:ID="Camping"> <rdfs:subClassOf> <owl:Class rdf:ID="Accommodation"/> rdf:ID Accommodation /> </rdfs:subClassOf> </owl:Class> <owl:Class rdf:ID="BudgetAccommodation"> <rdfs:subClassOf rdf:resource #Accommodation /> rdf:resource="#Accommodation"/> </owl:Class> <owl:Class rdf:ID="BedAndBreakfast"> <rdfs:subClassOf rdf:resource="#Accommodation"/> </owl:Class> <owl:Class rdf:ID="LuxuryHotel"> <rdfs:subClassOf> <owl:Class rdf:ID="Hotel"/> </rdfs:subClassOf> </owl:Class> <owl:Class rdf:about="#Hotel"> <rdfs:subClassOf rdf:resource="#Accommodation"/> </owl:Class> F. Corno, L. Farinetti - Politecnico di Torino 37
  38. 38. Step 1b Disjoint Define disjoint Bed&Breakfast classes Accommodation Camping Budget Accommodation Hotel <owl:Class rdf:about="#Hotel"> <owl:disjointWith rdf:resource="#Camping"/> <owl:disjointWith> <owl:Class rdf:about="#BedAndBreakfast"/> </owl:disjointWith> <rdfs:subClassOf rdf:resource="#Accommodation"/> </owl:Class> F. Corno, L. Farinetti - Politecnico di Torino 38
  39. 39. Step 1c Activity Adventure Sightseeing Define multiple Safari inheritance BunjeeJumping Museums F. Corno, L. Farinetti - Politecnico di Torino 39
  40. 40. Step 2a Accommodation Range Define object properties hasAccommodation relationships Domain Destination <owl:ObjectProperty rdf:ID="hasAccommodation"> <rdfs:domain rdf:resource="#Destination"/> <rdfs:range rdf:resource="#Accommodation"/> </owl:ObjectProperty> F. Corno, L. Farinetti - Politecnico di Torino 40
  41. 41. Step 2b Define object properties characteristics E.g: E g: define an inverse object property isOffered Destination Activity hasActivity <owl:ObjectProperty rdf:about #isOffered > rdf:about="#isOffered"> <rdfs:range rdf:resource="#Destination"/> <owl:inverseOf rdf:resource="#hasActivity"/> <rdfs:domain rdf:resource="#Activity"/> </owl:ObjectProperty> F. Corno, L. Farinetti - Politecnico di Torino 41
  42. 42. int Step 2c hasZipCode string Contact hasStreet hasEMail string Define datatype properties The range specifies the data type yp <owl:DatatypeProperty rdf:ID="hasEMail"> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> <rdfs:domain rdf:resource="#Contact"/> /owl:DatatypeProperty </owl:DatatypeProperty> <owl:DatatypeProperty rdf:ID="hasZipCode"> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/> <rdfs:domain rdf:resource="#Contact"/> </owl:DatatypeProperty> F. Corno, L. Farinetti - Politecnico di Torino 42
  43. 43. Step 3 Accommodation OneStarRating Rating g TwoStarRating Define individuals ThreeStarRating instances Family Destination Bardonecchia Rimini <AccommodationRating rdf:ID="OneStarRating"/> <AccommodationRating rdf:ID="ThreeStarRating"/> <AccommodationRating rdf:ID="TwoStarRating"/> <FamilyDestination rdf:ID="Bardonecchia"/> <F il D ti ti df ID "B d hi "/> <FamilyDestination rdf:ID="Rimini"/> F. Corno, L. Farinetti - Politecnico di Torino 43
  44. 44. Step 4 Define restrictions To restrict the individuals that belong to a class Quantifier restrictions (existential, universal quantifiers) Cardinality restrictions hasValue h V l restrictions t i ti F. Corno, L. Farinetti - Politecnico di Torino 44
  45. 45. Step 4 – example 1 Accommodation hasAccommodation >= 1 Activity FamilyDestination is a Destination Destination ith t least one D ti ti with at l t hasActivity >= 2 accommodation and at least Family 2 activities Destination Necessary and sufficient condition Cardinality restriction F. Corno, L. Farinetti - Politecnico di Torino 45
  46. 46. FamilyDestination is a Step St 4 – example 1 l Destination with at least one accommodation and <owl:Class rdf:ID= FamilyDestination > rdf:ID="FamilyDestination"> at least 2 activities <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <owl:Restriction> <owl:onProperty> <owl:ObjectProperty rdf:ID="hasAccommodation"/> </owl:onProperty> <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#int" >1</owl:minCardinality> / i i i </owl:Restriction> <owl:Restriction> <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#int" >2</owl:minCardinality> <owl:onProperty> <owl:ObjectProperty rdf:ID="hasActivity"/> </owl:onProperty> </owl:Restriction> <owl:Class rdf:about="#Destination"/> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> </owl:Class> / F. Corno, L. Farinetti - Politecnico di Torino 46
  47. 47. Step 4 – example 2 QuietDestination is a Destination Destination that is t h th t i not chosen b noisy by i families Quiet Destination Family Destination Complement restriction F. Corno, L. Farinetti - Politecnico di Torino 47
  48. 48. Step St 4 – example 2 l QuietDestination is a Destination that is not chosen by noisy families <owl:Class rdf:ID="QuietDestination"> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class> <owl:complementOf rdf:resource="#FamilyDestination"/> </owl:Class> <owl:Class rdf:about="#Destination"/> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> </owl:Class> F. Corno, L. Farinetti - Politecnico di Torino 48
  49. 49. OneStarRating Step St 4 – example 3 l Accommodation Rating TwoStarRating Bed&Breakfast ThreeStarRating Budget hasRating Accommodation Camping Accommodation BudgetAccommodation is Luxury Hotel an Accommodation that has Hotel either one or two star rating g Sheraton Existential restriction F. Corno, L. Farinetti - Politecnico di Torino 49
  50. 50. Step St 4 – example 3 l BudgetAccommodation is an Accommodation that has either one or <owl:Class rdf:ID "BudgetAccommodation"> rdf:ID="BudgetAccommodation"> two star rating t t ti <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <owl:Restriction> <owl:onProperty> <owl:ObjectProperty rdf:ID="hasRating"/> </owl:onProperty> <owl:someValuesFrom> <owl:Class> <owl:oneOf rdf:parseType="Collection"> <AccommodationRating rdf:ID="OneStarRating"/> <AccommodationRating rdf:ID= TwoStarRating /> rdf:ID="TwoStarRating"/> </owl:oneOf> </owl:Class> </owl:someValuesFrom> </owl:Restriction> <owl:Class rdf:about="#Accommodation"/> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> </owl:Class> F. Corno, L. Farinetti - Politecnico di Torino 50
  51. 51. Bed&Breakfast B d&B kf t Hotel Step 4 – example 4 Camping Accommodation Budget BackpackerDestination Accommodation hasAccommodation is a Destination that Backpacker Sports Destination hasActivity provides budget accommodation and Relaxation Activity Destination offers sport or ff t Adventure adventure activities Sightseeing F. Corno, L. Farinetti - Politecnico di Torino 51
  52. 52. BackpackerDestination is p Step 4 – example 4 a Destination that provides budget accommodation <owl:Class rdf:ID="BackpackerDestination"> and offers sport or <owl:equivalentClass> adventure activities <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> <owl:Restriction> <owl:onProperty> <owl:ObjectProperty rdf:ID="hasAccommodation"/> </owl:onProperty> <owl:someValuesFrom rdf:resource="#BudgetAccommodation"/> </owl:Restriction> <owl:Class rdf:about="#Destination"/> < l Cl df b t "#D ti ti "/> <owl:Restriction> <owl:onProperty> <owl:ObjectProperty rdf:ID="hasActivity"/> </owl:onProperty> <owl:someValuesFrom> <owl:Class> <owl:unionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Sports"/> <owl:Class rdf:about #Adventure /> rdf:about="#Adventure"/> </owl:unionOf> </owl:Class> </owl:someValuesFrom> </owl:Restriction> </owl:intersectionOf> </owl:Class> </owl:equivalentClass> F. Corno, L. Farinetti - Politecnico di Torino </owl:Class> 52
  53. 53. License This work is licensed under the Creative Commons Attribution-Noncommercial- Share Alike 3.0 Unported License. To view a copy of this license visit license, http://creativecommons.org/licenses/by- nc-sa/3.0/ or send a letter to C /3 0/ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. F. Corno, L. Farinetti - Politecnico di Torino 53

×