1 / 36

ARIN – KR Lecture 4

OWL. ARIN – KR Lecture 4. Suresh Manandhar . Outline. Limitations of RDFS OWL Introduction OWL examples Using Protégé (demo). What is OWL?. OWL stands for Web Ontology Language OWL provides a richer KR language compared to RDFS RDFS = straightfoward hierarchies +

blythe
Download Presentation

ARIN – KR Lecture 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. OWL ARIN – KR Lecture 4 Suresh Manandhar

  2. Outline • Limitations of RDFS • OWL Introduction • OWL examples • Using Protégé (demo)

  3. What is OWL? • OWL stands for Web Ontology Language • OWL provides a richer KR language compared to RDFS • RDFS = straightfoward hierarchies + straightforward relations/properties • OWL = RDFS + rich language for complex KR

  4. Some peculiarities • OWL/RDF is backwards compatible with RDFS • Every RDFS description is an OWL description • Just like every RDF description is an RDFS description • But RDF, RDFS, OWL have separate namespaces • Thus there are some things to bear in mind due to this.

  5. Some peculiarities owl:Thing rdf:Resource rdfs:Class owl:Class

  6. Back to Camera shop example • RDFS Domain/Range specification cannot say that: • A camera can have only one Lens and only one Maker • What if we do want to impose such a constraint Domain Range lens Camera Lens Maker Camera Maker

  7. Our previous RDFS example @prefix : <http://www.shop.com/camera#> . @prefix dbpedia: <http://www.dbpedia.org/resource/> . @prefix Maker: <http://dbpedia.org/resource/Public_company> . :lens a rdf:Property; rdfs:domain :Camera; rdfs:range :Lens. Maker: a rdf:Property; rdfs:domain :Camera; rdfs:range Maker: .

  8. RDFS spec. permits • Thus this: • both acceptable/consistent. • But what if we do not want this. :Nikon_D300 :lens :Nikon_F30Lens. :Nikon_D300 :lens :Nikon_F50Lens. and :Nikon_D300 Maker: dbpedia:Nikon. • :Nikon_D300 Maker: dbpedia:Samsung.

  9. Similarly : • Cannot prevent the same camera to be bought by 2 different people. :Nikon_D300_sn8321686 :bought_by :Cust1242. :Nikon_D300_sn8321686 :bought_by :Cust4321.

  10. OWL provides functional relations • Functional constraint on relations: owl:FunctionalProperty • @prefix owl: <http://www.w3.org/2002/07/owl#> . • :Camera a owl:Class. • :Customer a owl:Class. bought_by:a owl:FunctionalProperty; rdfs:domain :Camera; rdfs:range:Customer.

  11. What is a functional relation? • If R is a functional relation then: • R(x,y) and R(x,z) implies y=z • Since bought_byis functional: Possible interpretations: • C1242 and C4321 both bought Nikon_D300_s2334 (distributive interpretation) • C1242 and C4321 are the same (functional interpretation) Customer Camera C1242 C4321 Nikon_D500 Bought_by Nikon_D300_s2334 implies C1242 = C4321

  12. Functional relation - entailment • Thus now: • would imply :Nikon_D300_sn8321686 :bought_by :Cust1242. :Nikon_D300_sn8321686 :bought_by :Cust4321. :Cust1242 = :Cust4321 How do we state that the two customers are different?

  13. OWL solution : distinctMembers • One solution will be to say: • But that would require too much typing…. At the instance level • The OWL solution: • States that the two instances are different. • Results in an inconsistent KB. :Cust1242≠ :Cust4321 [] rdf:typeowl:AllDifferent; owl:distinctMembers ( :Cust1242 :Cust4321).

  14. owl:AllDisjointClasses [] rdf:typeowl:AllDisjointClasses; owl:members (:Nikon_F50Lens :Nikon_F30Lens). Lens Lens Nikon_F30Lens Nikon_F50Lens Nikon_F30Lens Nikon_F50Lens Incorrect Correct

  15. Functional relation - entailment • Thus now: • would imply -- KB is inconsistent :Nikon_D300_s2334 :lens :Nikon_F30Lens_s432. :Nikon_D300_s2334 :lens :Nikon_F50Lens_s123. :Nikon_D300_s2334 rdf:type :Nikon_D300. :Nikon_F30Lens_s432 rdf:type :Nikon_F30Lens. :Nikon_F50Lens_s123 rdf:type :Nikon_F50Lens. and • [] rdf:typeowl:AllDisjointClasses; • owl:members (:Nikon_F50Lens :Nikon_F30Lens). • :lens a owl:FunctionalProperty; • rdfs:domain :Camera; • rdfs:range :Lens.

  16. Aside – owl:ObjectProperty • The OWL equivalent for a (vanilla) relation between two classes • with no additional constraints :lens a rdf:Property; rdfs:domain :Camera; rdfs:range :Lens. :lens a owl:ObjectProperty; rdfs:domain :Camera; rdfs:range :Lens.

  17. Functional relation - correctly • Actually the correct syntax to specify functional properties is: :lens a owl:ObjectProperty; a owl:FunctionalProperty; rdfs:domain :Camera; rdfs:range :Lens. and

  18. Aside – owl:DatatypeProperty • For cases, when the range is a Datatype, OWL has a special DatatypeProperty keyword. :model a rdf:Property; rdfs:domain :Camera; rdfs:rangexsd:string. • :model a owl:DatatypeProperty; • a owl:FunctionalProperty; • rdfs:domain :Camera; • rdfs:rangexsd:string.

  19. Lens instances • Currently, we still need to say, at the instance level • But we really don’t care about Lens instances • After all, nobody looks at the serial no. of lens  • So, just want to say that Nikon_D300 camera comes with exactly one lens • And adding lens serial no. is optional :Nikon_D300_s2334 :lens :Nikon_F30Lens_s432. :Nikon_D300_s2334 rdf:type :Nikon_D300. :Nikon_F30Lens_s432 rdf:type :Nikon_F30Lens. :Nikon_F50Lens_s123 rdf:type :Nikon_F50Lens.

  20. So we want to be able to: :Nikon_D300_s2334 :lens :Nikon_F30Lens_s432. (delete) :Nikon_D300_s2334 rdf:type :Nikon_D300. (keep) :Nikon_F30Lens_s432 rdf:type :Nikon_F30Lens. (delete) :Nikon_F50Lens_s123 rdf:type :Nikon_F50Lens. (delete)

  21. OWL cardinality constraints • Cardinality constraints allows stating things like: • A camera comes with at least one lens • A camera comes with at most three lens

  22. OWL cardinality constraints :Camera rdfs:subClassOf [ rdf:typeowl:Restriction; owl:minCardinality 1; owl:onProperty :lens ]. :Camera rdfs:subClassOf [ rdf:typeowl:Restriction; owl:maxCardinality 3; owl:onProperty :lens ].

  23. OWL cardinality constraints :Nikon_D500 rdfs:subClassOf :Camera. :Nikon_D500 rdfs:subClassOf [ rdf:typeowl:Restriction; owl:cardinality 1; owl:onProperty :lens ]. • Similar to FunctionalProperty constraint but not identical. • Spot the difference?

  24. Quantifiers in OWL • Closely related to cardinality constraints • owl:someValuesFrom (existential quantifier) • owl:allValuesFrom (universal quantifier) • So we can state: “All reviews of a camera is by a PhotoJournalist” • Would enforce the constraint: “0 or more reviewers for each Camera” “All reviewers must be PhotoJournalist”

  25. Owl:allValuesFrom :Camera rdfs:subClassOf [ rdf:typeowl:Restriction; owl:allValuesFrom :PhotoJournalist; owl:onProperty :Reviewer ].

  26. Owl:someValuesFrom :Camera rdfs:subClassOf [ rdf:typeowl:Restriction; owl:someValuesFrom :PhotoJournalist; owl:onProperty :Reviewer ]. • States that every camera has at least one reviewer. • KB still consistent even if a reviewer does not (yet) exist.

  27. Open world semantics • OWL is based on Description Logics (DL) • DLs come with an open-world semantics • In plain English – this means: “My KB is only a partial picture of the real world” “There is lot more stuff I should have said but have not got around to saying it – or I don’t know it” “So do not make any extra assumptions beyond what is being stated” “Keep an open mind”

  28. Open world semantics - implications • Instances can belong to multiple classes • The same class may have multiple names – the user does not yet know • A Class may inherit from multiple super classes in complicated ways • no constraint on the inheritance structure • All of the above applies to relations/properties • Formal semantics in the next lecture

  29. Lets build a family ontology S1: Each person is either Male or Female S2: You cannot be both Male and Female :Male a owl:Class. :Female a owl:Class. • [] rdf:typeowl:AllDisjointClasses; • owl:members (:Male :Female). :Person a owl:Class; owl:unionOf (:Male :Female). • UnionOfimposes stronger constraint compared to using subClassOf

  30. S3: Parent is Person with a Child :Parent owl:equivalentClass • [rdf:typeowl:Restriction; • owl:onProperty :hasChild; owl:someValuesFrom Person ] • equivalentClassimposes a stronger constraint compared to using subClassOf • Also harder to implement

  31. But this does not impose the constraint that Parent is a Person. • The following adds this additional constraint. :Parent owl:equivalentClass • [rdf:typeowl:Class; • owl:intersectionOf • ( :Person • [rdf:typeowl:Restriction; • owl:onProperty :hasChild; • owl:someValuesFrom :Person • ] • )].

  32. S4: Mother is Parent and Female. Father is Parent and Male. :Mother owl:equivalentClass • [rdf:typeowl:Class; • owl:intersectionOf (:Parent :Female)]. • :Father owl:equivalentClass • [rdf:typeowl:Class; • owl:intersectionOf (:Parent :Male)].

  33. S5: A person is either Dead or Alive. S6: You cannot be Dead and Alive at the same time. • :Dead a owl:Class. • :Alive a owl:Class. • [] rdf:typeowl:AllDisjointClasses; • owl:members (:Dead :Alive). • :Person a owl:Class; • owl:unionOf (:Dead :Alive).

  34. S7: hasParent and hasChild are inverses of each other. • :hasParentowl:inverseOf:hasChild. • Remember from MFCS: • (x,y) ∈ R implies (y,x) ∈ R-1 • Thus: • (x,y) ∈ hasParentimplies (y,x) ∈ hasChild

  35. S8: Orphan is Person whole Parents are all Dead. :Orphan owl:equivalentClass • [rdf:typeowl:Restriction; • owl:onProperty :hasParent; owl:allValuesFrom :Dead ].

  36. S9: My Parents are my Ancestors and my Parent’s Ancestors are my Ancestors too. equivalently S9: Ancestor is a transitive relation over Parent. • :hasParent • rdfs:subPropertyOf :hasAncestor. • :hasAncestor • rdf:typeowl:TransitiveProperty. • The first statement states: “Every parent is an ancestor”

More Related