Download presentation
Presentation is loading. Please wait.
1
Chapter 4 Web Ontology Language: OWL2
Grigoris Antoniou Paul Groth Frank van Harmelen Rinke Hoekstra Chapter 4 A Semantic Web Primer
2
Lecture Outline Introduction Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS The OWL Language OWL2 Profiles Summary Chapter 4 A Semantic Web Primer
3
Introducation The variety of things we described using RDF and RDF Schema in previous chapters is deliberately very limited RDF is roughly limited to binary ground predicates (A ground predicate(闭谓词或已决谓词),is an atomic formula all of whose argument terms are ground terms(基项), that is, contain no variables) RDF Schema is roughly limited to a class hierarchy and a property hierarchy with domain and range restrictions on these properties Both were designed with flexibility in mind 3 Chapter 4 A Semantic Web Primer
4
Introducation In many cases, however, we need to express more advanced, more “expressive” knowledge e.g. that one person has exactly one birth date or, that no person can be in different cities at the same time The Web Ontology Working group and the OWL Working Group have identified a number of characteristic use cases(用例)for the Semantic Web that require much more language features than those that RDF and RDFS have to offer 4 Chapter 4 A Semantic Web Primer
5
Introducation The resulting language, OWL2, for the Web Ontology Language, is closely related to a fragment of a family of logics These logics are specially crafted for representing terminological(术语学的)knowledge They are Description Logic (DL,描述逻辑) which have a long history and their features are well understood by the community OWL2 is the second iteration of the OWL language 5 Chapter 4 A Semantic Web Primer
6
Lecture Outline Introduction Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS The OWL Language OWL2 Profiles Summary 6 Chapter 4 A Semantic Web Primer
7
Ontology and Ontology Languages
We have seen that RDF and RDFS allow us to describe “concepts” that exist in a domain and share these descriptions across the Web What is an ontology? An explicit formal specification of the concepts in a domain is called an ontology Languages that are used to express ontologies are therefore called ontology languages 7 Chapter 4 A Semantic Web Primer
8
Requirements for Ontology Languages
A well-defined(明确定义的)syntax(句法) A formal(形式化的)semantics Sufficient expressive power(表现力) Convenience of expression(表述的便捷) Efficient reasoning support(推理支持) 8 Chapter 4 A Semantic Web Primer
9
Syntax In the area of programming languages, a well-defined syntax is a necessary condition for machine to process information A well-defined syntax allows you to write down everything you would like to express in an unambiguous manner OWL2 builds upon RDF and RDFS and uses an extension of their syntax 9 Chapter 4 A Semantic Web Primer
10
Syntax A well-defined syntax does not have to be very user-friendly(用户友好的) e.g. the RDF/XML syntax is notoriously hard to people to read This drawback is not significant because most ontology engineers will make use of specialized ontology development tools 10 Chapter 4 A Semantic Web Primer
11
Formal Semantics A formal semantics describe the meaning of a language precisely(精确地) Precisely means that the semantics does not refer to any subjective(主观的)intuitions(直觉), nor is it open to different interpretations(解释) The combination of a formal semantics with a well-defined syntax allows us to interpret sentences expressed using the syntax: we now know what is meant by the sentence 11 Chapter 4 A Semantic Web Primer
12
Formal Semantics Formal semantics also allows us to reason about the knowledge expressed in the sentences For instance, the formal semantics of RDFS allows us to reason about class membership Given :x rdf:type :C. :C rdfs:subClassOf :D. :x is an instance of :D :p rdfs:range :D. :x :p :y. :y rdf:type :D. 12 Chapter 4 A Semantic Web Primer
13
Reasoning About Knowledge in Ontology Languages
The expressive power of RDF and RDFS is very limited : We often need to provide more precise definitions than what RDF and RDFS allow us to state Class Membership(类成员关系) We have seen RDFS offers some simple mechanisms for determining class membership of instances using subclass, domain, and range A more precise description of the conditions would allow for more fine-grained(细粒度的)reasoning 13 Chapter 4 A Semantic Web Primer
14
Reasoning About Knowledge in Ontology Languages
Class Membership For instance, if we declare that certain property-value pairs are a sufficient condition for membership in a class :A, then if an instance :x satisfies these conditions, we can conclude that :x must be an instance of :A Something is only a tennis match if it involves at least players, rackets, etc.(necessary condition or sufficient condition???) 14 Chapter 4 A Semantic Web Primer
15
Reasoning About Knowledge in Ontology Languages
Classification(分类) We would like to use the conditions on class membership to infer relations between classes For instance, the definition of a tennis match can be reused to define badminton matches 15 Chapter 4 A Semantic Web Primer
16
Reasoning About Knowledge in Ontology Languages
Equivalence(等价)and equality(相等) It can be useful to express equivalence between classes. For instance, the class :Tortoise(龟) and :Land_Turtle share all the members We would like to be able to state when two instances are the same: the :morning_star and the :evening_star are names for the same planet :venus It should also be possible to determine equivalence and equality by applying formal semantics to the description of the classes 16 Chapter 4 A Semantic Web Primer
17
Reasoning About Knowledge in Ontology Languages
Disjointness(不相交性)and Difference(不同) Sometimes we know that two classes do not share any instances or that two instances are decidedly not the same thing For instance, :Winner and :Loser are disjoint classes, and :roger_federer and :rafael_nadal are different individuals 17 Chapter 4 A Semantic Web Primer
18
Reasoning About Knowledge in Ontology Languages
Boolean Combinations(布尔组合)of Classes Sometimes classes need to be combined in ways that go beyond subclass relations For instance, we may want to define the class :Person to be the disjoint union of :Female and :Male Local Scope(局部作用域)of Properties rdfs:range states that the instances in the range of a property all belong to a certain class We can not declare range restrictions that differentiate(区分) between contexts 18 Chapter 4 A Semantic Web Primer
19
Reasoning About Knowledge in Ontology Languages
Local Scope of Properties For instance, we cannot say that tennis players play only tennis, while other people may play badminton Special Characteristics of Properties Transitive(传递)property, such as :greater_than Unique(唯一)property, such as: is_mother_of A property is the inverse(逆)of another property, like :eats and :is_eaten_by 19 Chapter 4 A Semantic Web Primer
20
Reasoning About Knowledge in Ontology Languages
Cardinality Restrictions(基数限制) Sometimes we need to place restrictions on how many distinct values a property may or must take For instance, each person has exactly two parents, or a course is taught by at least one lecturer 20 Chapter 4 A Semantic Web Primer
21
Reasoning About Knowledge in Ontology Languages
Consistency(一致性) Once we can determine the relations between classes, we may also want to determine conflicts(冲突)between their definitions Suppose we declared that :Fish and :Mammal are disjoint classes, then it is an error to assert that :dolphin is an instance of both A sufficiently expressive ontology language would allow us to detect all these types of inconsistencies(不一致性) An ontology language must make it as convenient as possible to build sentences that makes use of its expressiveness 21 Chapter 4 A Semantic Web Primer
22
Reasoning Support Formal semantics is a prerequisite(先决条件)for reasoning support Derivations(推导)such as the preceding ones can be done mechanically instead of by hand Automatic reasoning is important because it allows us to check the correctness of the ontology checking the consistency of the ontology checking for unintended relations between classes checking for unintended classifications of instances 22 Chapter 4 A Semantic Web Primer
23
Reasoning Support Checks like the preceding ones are extremely valuable for designing large ontologies, where multiple authors are involved integrating and sharing ontologies from various sources 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 23 Chapter 4 A Semantic Web Primer
24
Trade-off between Expressive Power and Efficient Reasoning Support
We need an ontology language richer than RDFS When designing such languages, one should bear it in mind the trade-off The richer the logical formalism, the less efficient the reasoning support becomes, sometimes crossing the border of decidability We need a compromise: A language can be supported by reasonably efficient reasoners while sufficiently expressive to represent a large variety of knowledge 24 Chapter 4 A Semantic Web Primer
25
Lecture Outline Introduction Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS The OWL Language OWL2 Profiles Summary 25 Chapter 4 A Semantic Web Primer
26
Compatibility of OWL2 with RDF/RDFS
Ideally, OWL2 would extend RDFS adopts the RDFS meanings of classes and properties and adds language primitives to offer required expressiveness consistent with the layered architecture of the Semantic Web But simply extending RDFS would work against obtaining expressive power and efficient reasoning Certain constructions are very expressive and would lead to uncontrollable computational properties if included in the logic underlying OWL2 26 Chapter 4 A Semantic Web Primer
27
Two Semantics of OWL2 The full set of requirements for an ontology language seems unobtainable A language as expressive as a combination of RDFS with a full logic cannot be supported by any efficient reasoning The W3C working groups split OWL2 into two different sublanguages each with a different underlying semantics geared toward fulfilling different aspects of the full set of requirements 27 Chapter 4 A Semantic Web Primer
28
OWL2 Full: RDF-based Semantics
The entire language is called OWL2 Full and uses all the OWL2 language primitives It also allows the combination of these primitives in arbitrary ways with RDF and RDFS For instance, we could impose a cardinality constraint on the class of all classes, limiting the number of classes that can be described in any ontology 28 Chapter 4 A Semantic Web Primer
29
OWL2 Full: RDF-based Semantics
Advantages of OWL2 Full It is mapped to an RDF-based semantics It is therefore both structurally and semantically fully upward-compatible with RDF Disadvantage of OWL2 Full is The language has become so powerful as to be undecidable, dashing any hope of complete reasoning support 29 Chapter 4 A Semantic Web Primer
30
OWL2 DL: Direct Semantics
To regain computational efficiency, OWL2 DL is mapped onto a description logic (DL) Description logics are a subset of predicate logic for which efficient reasoning support is possible OWL2 DL restricts the way in which the primitives of OWL2, RDF, and RDFS may be used 30 Chapter 4 A Semantic Web Primer
31
OWL2 DL: Restrictions OWL2 DL does not allow the application of OWL2’s primitives to each other OWL2 DL can only define classes of non-literal resources All OWL2 DL classes are instances of owl:Class rather than rdfs:Class 31 Chapter 4 A Semantic Web Primer
32
OWL2 DL: Restrictions OWL2 DL strictly separates properties for which the range includes non-literal resources from those that relate to literal values All OWL2 DL properties are instances of either owl:ObjectProperty or owl:DatatypeProperty In OWL2 DL a resource cannot be a class, property, or instance at the same time They may share the same name but are treated as distinct things by the underlying logic 32 Chapter 4 A Semantic Web Primer
33
Subclass relationships between OWL2 and RDF/RDFS
rdfs:Resource rdf:Property rdfs:Class owl:Class rdfs:Literal owl:ObjectProperty owl:DatatypeProperty disjoint
34
Advantages and Disadvantages of OWL2 DL
OWL2 DL permits efficient reasoning support and can make use of a wide range of existing reasoners Disadvantages We lose full compatibility with RDF: an RDF document will have to be extended or restricted before it becomes a legal OWL2 DL document Every legal OWL2 DL document is a legal RDF document
35
Lecture Outline Introduction Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS The OWL Language OWL2 Profiles Summary 35 Chapter 4 A Semantic Web Primer
36
The OWL Language In OWL2, the members of classes are commonly called individuals(个体)rather than instances(实例) When we state that some resource is of a certain type, we call this an assertion(断言) For instance, :roger-federer rdf:type :Person. is a class assertion relating the individual :roger_federer to its class 36 Chapter 4 A Semantic Web Primer
37
The OWL Language When we combine classes, properties, and instances, they form expressions(表达式) For instance, _:x rdf:type owl:Class; owl:unionOf (:Man :Woman). is a class expression that specifies the union of the classes :Man and :Woman. 37 Chapter 4 A Semantic Web Primer
38
The OWL Language If we relate the preceding definition to one of our classes, we create an axiom(公理) For instance, :Person owl:equivalentClass _:x. _:x rdf:type owl:Class; owl:unionOf (:Man :Woman). is an equivalent class axiom (sometimes called restrictions) that states that :Person is equivalent to the union we introduced 38 Chapter 4 A Semantic Web Primer
39
Syntax OWL2 builds upon RDF and RDFS and thus can be expressed using all valid RDF syntaxes Functional-Style Syntax: much more compact and readable than many of the other syntaxes Closely relates to the formal structure of ontologies For instance, the above class restrictions can be written as: EquivalentClasses(:Person ObjectUnionOf(:Man :Woman)) 39 Chapter 4 A Semantic Web Primer
40
Syntax OWL/XML: This is an XML syntax for OWL2 that does not follow the RDF conventions The main benefit is that it allows us to interact with ontologies using standard off-the-shelf(现成的)XML authoring tools For instance, the previous equivalent class restrictions can be written as: <EquivalentClasses> <Class abbreviatedIRI=“:Person”/> <ObjectUnionOf><Class IRI=“#Man”/><Class IRI=“#Woman”/> </ObjectUnionOf> </EquivalentClasses> 40 Chapter 4 A Semantic Web Primer
41
Syntax Manchester Syntax: Originally developed by the University of Manchester, this syntax is designed to be as human-readable(人类可读的)as possible It is the syntax used in the user interface of most ontology editors For instance, the previous equivalent class restrictions can be written as: Class: Person EquivalentTo: Man or Woman 41 Chapter 4 A Semantic Web Primer
42
Ontology Documents When using the Turtle syntax, OWL2 ontology documents, or simply ontologies, are just like any other RDF document An OWL2 ontology starts with a collection of assertions which introduce a base namespace the ontology itself its name possible comments version control, and inclusion of other ontologies 42 Chapter 4 A Semantic Web Primer
43
An Example of Ontologies
@prefix :< @prefix dbpedia-owl: < @prefix dbpedia: < @base < 43 Chapter 4 A Semantic Web Primer
44
An Example of Ontologies
< rdf: type owl:Ontology; rdfs:label “Apartments Ontology”^^xsd:string; rdfs:comment “An example OWL2 ontology”^^xsd:string; owl:versionIRI < owl:imports < owl:imports < 44 Chapter 4 A Semantic Web Primer
45
Imports What kind of problems would this incur? 45
Only one of the assertions that has some consequences for the logical meaning of the ontology: owl:imports owl:imports points to other ontologies and the axioms of the latter become part of the current ontology What kind of problems would this incur? In order to use some of the information in DBpedia, we have to import all 672 million triples described in it 45 Chapter 4 A Semantic Web Primer
46
Imports It only allows importing of an entire ontology, not parts of it Namespaces are used for disambiguation(消除模棱两可), while imported ontologies provide definitions for use Typically an ontology contains an import statement for every namespace it uses The owl:imports property is transitive 46 Chapter 4 A Semantic Web Primer
47
Property Types Object properties: relate individuals to other individuals :rents rdf:type owl:ObjectProperty; rdfs:domain :Person; rdfs:range :Apartment; rdfs:subPropertyOf :liveIn. Datatype Properties: relate individuals to literal(文字)values of a certain data type :age rdf:type owl:DatatypeProperty; rdfs:range xsd:nonNegativeInteger. 47 Chapter 4 A Semantic Web Primer
48
Annotation Properties
Annotation properties(注解属性)are properties that do not carry any meaning under the direct semantics of OWL2 DL That is, they are ignored by a DL reasoner and will be taken into account by RDFS and OWL2 Full reasoners Annotation properties are typically used for adding readable labels, comments, or explanations 48 Chapter 4 A Semantic Web Primer
49
An Example of Annotation Properties
:label rdf:type owl:AnnotationProperty; rdfs:range rdf:PlainLiteral; rdfs:subPropertyOf rdf:label. :Apartment :label In general case, annotation properties have literal values, but they may be used to relate non-literal resources as well 49 Chapter 4 A Semantic Web Primer
50
Top and Bottom Properties
All object properties in OWL2 are a subproperty of owl:topObjectProperty owl:topObjectProperty relates all individuals in the ontology Conversely, owl:bottomObjectProperty relates no individuals owl:topDataProperty relates all individuals to any possible literal value owl:bottomDataProperty relates no individual to any literal value 50 Chapter 4 A Semantic Web Primer
51
Transitive Properties
rdfs:subClassOf is a transitive property We can define a property as transitive as follows: :isPartOf rdf:type owl:ObjectProperty; rdf:type owl:TransitiveProperty. Transitive properties are so-called composite properties(复合属性): they can be said to be composed of multiple steps 51 Chapter 4 A Semantic Web Primer
52
An Example of Transitive Properties
For instance, :BaronWayApartment :isPartOf :BaronWayBuilding. :BaronWayKitchen :isPartOf :BaronWayApartment. A reasoner will infer: :BaronWayKitchen :isPartOf :BaronWayBuilding. The last :isPartOf relation is composed of the two preceding property assertions 52 Chapter 4 A Semantic Web Primer
53
Symmetric and Asymmetric Properties
Some properties, such as :isAdjacentTo, are symmetric(对称) Symmetric properties are equivalent to their inverse For other properties, it will never be the case. For instance, the :isCheaperThan relation is asymmetric(不对称) 53 Chapter 4 A Semantic Web Primer
54
Examples of Symmetric and Asymmetric Properties
:isAdjacentTo rdf:type owl:ObjectProperty; rdf:type owl:SymmetricProperty. :isCheapterThan rdf:type owl:ObjectProperty; rdf:type owl:AsymmetricProperty; rdf:type owl:TransitiveProperty. 54 Chapter 4 A Semantic Web Primer
55
Functional and Inverse-Functional Properties
For some properties, we know that every individual can always have at most one other individual related via that property A functional property(函数属性) is a property that is a function: it relates an individual to at most one value For instance, :age, :height, or :directSupervisor 55 Chapter 4 A Semantic Web Primer
56
Functional and Inverse-Functional Properties
An inverse-functional property is a property for which two different individuals cannot have the same value For instance, :isTheSocialSecurityNumberfor 56 Chapter 4 A Semantic Web Primer
57
Reflexive and Irreflexive Properties
Reflexivity(反身性)of a property means that every individual is related to itself via that property For instance, everything :isPartOf itself or, everything is rdfs:subClassOf itself 57 Chapter 4 A Semantic Web Primer
58
Reflexive and Irreflexive Properties
Irreflexivity(反自反性)means that no individual is related to itself via that property Most properties with disjoint domain and range are irreflexive For instance, :rents or, nobody can be related to himself via property :parentOf 58 Chapter 4 A Semantic Web Primer
59
Examples of Reflexive and Irreflexive Properties
:isPartOf rdf:type owl:ObjectProperty; rdf:type owl:ReflexiveProperty. :rents rdf:type owl:ObjectProperty; rdf:type owl:IrreflexiveProperty. 59 Chapter 4 A Semantic Web Primer
60
Property Axioms In addition to property types, we can specify additional characteristics of properties in terms of how they relate to classes and other properties Domain and range The way that OWL2 treats domain and range for properties is exactly the same as in RDFS Domains and ranges can only be used to determine class membership for individuals. For instance, :p rdfs:range :D :x :p :y. 60 Chapter 4 A Semantic Web Primer
61
Inverse Properties OWL2 allows us to define the inverse of properties For instance, :rents and :isRentedBy :isRentedBy rdf:type owl:ObjectProperty; owl:inverseOf :rents. This means that a reasoner will determine that two individual p and m have the relation m :isRentedBy p in addition to p :rents m 61 Chapter 4 A Semantic Web Primer
62
Equivalent Properties
Properties can also be defined as equivalent Equivalence is a convenient mechanism for mapping elements of different ontologies For instance, :isPartOf rdf:type owl:ObjectProperty; owl:equivalentProperty dbpedia:partOf. 62 Chapter 4 A Semantic Web Primer
63
Disjoint Properties For some properties we know that no two individuals related via one property can be related via the other For instance, :rents and :owns :rents rdf:type owl:ObjectProperty; rdfs:domain :Person; rdfs:range :Apartment; owl:disjointProperty :owns. 63 Chapter 4 A Semantic Web Primer
64
Property Chains A more complex feature of OWL2 is the ability to define chains of properties Sometimes it is useful to specify shortcuts along the graph of properties For instance, if we know that :Paul :rents :BaronWayApartment. :BaronWayApartment :isPartOf :BaronWayBuilding. :BaronWayBuilding dbpedia:location dbpedia:Amsterdam. 64 Chapter 4 A Semantic Web Primer
65
Property Chains 65 We will be able to know that
:Paul :liveIn :Amsterdam. In OWL2, we can specify this using a property chain axiom: :liveIn rdf:type owl:ObjectProperty; owl:propertyChainAxiom (:rents :isPartOf :location). The property chain axiom does not make the :liveIn property equivalent to the chains of properties; it is rather a subproperty of the chain(or superproperty ???) 65 Chapter 4 A Semantic Web Primer
66
Class Axioms Classes are defined by asserting a resource to be of type owl:Class Two pre-defined classes: owl:Thing and owl:Nothing owl:Thing is the most general class Every individual is an instance of this class Every instance of owl:Class is a subclass of owl:Thing 66 Chapter 4 A Semantic Web Primer
67
Class Axioms 67 owl:Nothing class is the empty class
owl:Nothing has no instances Every instance of owl:Class is a superclass of owl:Nothing Inconsistent classes cannot have any instances, thus equivalent to owl:Nothing 67 Chapter 4 A Semantic Web Primer
68
Subclass Relations 68 Subclass relations are defined as in RDFS
:LuxuryApartment rdf:type owl:Class; rdfs:subClassOf :Apartment. 68 Chapter 4 A Semantic Web Primer
69
Class Equivalence Equivalence(等价)of classes means that every instance of a class must be an instance of its equivalent class, and vice versa :Apartment owl:equivalentClass dbpedia:Apartment Asserting an equivalent relation between classes is equivalent to asserting subclass relations in both directions :Apartment rdfs:subClassOf dbpedia:Apartment. dbpedia:Apartment rdfs:subClassOf :Apartment. 69 Chapter 4 A Semantic Web Primer
70
Punning 70 Is dbpedia:Apartment a class? No, it is an individual
The classes in DBpedia ontology are not intended to classify individual entities but rather individual topics Treating individuals as classes is called meta-modeling(元建模技术), not allowed in the direct semantics of OWL2 @prefix dbpedia: < @prefix dbpedia-owl: < 70 Chapter 4 A Semantic Web Primer
71
Punning 71 OWL2 circumvents this limitation by punning(双关语):
Whenever URI dbpedia:Apartment appears in a class axiom, it is treated as a class Whenever it appears in individual assertions, it is treated as individual How about? dbpedia:Apartment rdfs:subClassOf :Apartment. 71 Chapter 4 A Semantic Web Primer
72
Enumerations The most straightforward way to define a class is by explicitly enumerating(列举、枚举)all individuals though inexpressive and computationally expensive For instance, :BaronWayRooms rdf:type owl:Class; owl:one of (:BaronWayKitchen :BaronWayBedroom1 :BaronWayBedroom 2 :BaronWayLivingroom :BaronWayBathroom …). 72 Chapter 4 A Semantic Web Primer
73
Disjoint Classes Disjointness of classes means that no member of one class can also be a member of the other class For instance, :LuxuryApartment owl:disjointWith :ColdWaterFlat. No :luxuryApartment can be a :ColdWaterFlat at the same time 73 Chapter 4 A Semantic Web Primer
74
Complement The complement C of a class A is the class of all things not belonging to A In other words, the union of A and C is equivalent to owl:Thing Complementarity(互补性)is a very poweful modeling construct :FurnishedApartment rdfs:subClassOf :Apartment. :UnfurnishedApartment rdfs:subClassOf :Apartment; owl:complementOf :FurnishedApartment. 74 Chapter 4 A Semantic Web Primer
75
Complement 75 If we state the following
:SemiDetached owl:disjointWith :Apartment. What would happen to :SemiDetached? :SemiDetached is empty, equivalent to owl:Nothing 75 Chapter 4 A Semantic Web Primer
76
Union and Disjoint Union
We often know that for some class it is equivalent to two or more other classes This can be specified using the owl:unionOf construct For example, :Apartment rdf:type owl:Class; owl:unionOf (:ColdWaterFlat :LuxuryApartment :PenthouseApartment :StudioApartment…). 76 Chapter 4 A Semantic Web Primer
77
Union and Disjoint Union
In many cases, the member classes of the union are mutually disjoint We can state this directly :Apartment rdf:type owl:Class; owl:disjointUnionOf (:FurnishedApartment :UnfurnishedApartment). 77 Chapter 4 A Semantic Web Primer
78
Intersection We can state that a class is exactly the intersection of two or more other classes For instance :LuxuryApartment rdf:type owl:Class; owl:intersectionOf (:GoodLocationApartment :LargeApartment :NiceViewApartment :LuxuryBathroomApartment). 78 Chapter 4 A Semantic Web Primer
79
Class Axioms on Properties
OWL2 allows for more fine-grained(细粒度的)control of class definitions We can specify additional class axioms that restrict the set of individuals that may be considered to be a member of a class by looking at their properties that allow us to automatically infer class membership Class restriction axioms are attached to an owl:Class by relating them to an anonymous class (an owl:Restriction) Chapter 4 A Semantic Web Primer
80
Universal Restrictions
A universal restriction(全称限制)on a class C and property p states that for every member of C all values of p belong to a certain class In other words, the universal restriction can be used to specify a range for a property (local to the restricted class) This type of restriction is built using the owl:allValuesFrom construct Chapter 4 A Semantic Web Primer
81
An Example of Universal Restrictions
:LuxuryBathroomApartment rdf:type owl:Class; rdfs:subClassOf [rdf:type owl:Restriction; owl:onProperty :hasBathroom; owl:allValuesFrom :LuxuryBathroom]. The :LuxuryBathroomApartment class is a subclass of the set of individuals that only have instances of :LuxuryBathroom as value for :hasBathroom property Chapter 4 A Semantic Web Primer
82
An Example of Universal Restrictions
:LuxuryBathroomApartment rdf:type owl:Class; rdfs:subClassOf [rdf:type owl:Restriction; owl:onProperty :hasBathroom; owl:allValuesFrom :LuxuryBathroom]. The owl:allValuesFrom restriction merely states that if a member of the restricted class (that is, the :LuxuryBathroomApartment class) has a value for the property, then that value must be a member of the specified :LuxuryBathroom class. Chapter 4 A Semantic Web Primer
83
An Example of Universal Restrictions
:LuxuryBathroomApartment rdf:type owl:Class; rdfs:subClassOf [rdf:type owl:Restriction; owl:onProperty :hasBathroom; owl:allValuesFrom :LuxuryBathroom]. However, the restriction does not require the property to have any value at all! In the above example, a luxury bathroom apartment does not have to have a bathroom at all! Chapter 4 A Semantic Web Primer
84
Existential Restrictions
An existential restriction(存在限制)on a Class C and property p states that for every member of C there exists at least some value for p that belongs to a certain class This type of restriction is specified using an owl:someValuesFrom keyword Chapter 4 A Semantic Web Primer
85
An Exmaple of Existential Restrictions
:LuxuryBathroomApartment rdf:type owl:Class; rdfs:subClassOf [rdf:type owl:Restriction; owl:onProperty :hasBathroom; owl:someValuesFrom :LuxuryBathroom]. The :LuxuryBathroomApartment class is a subclass of the set of individuals that have at least some instance of :LuxuryBathroom as value for :hasBathroom property Chapter 4 A Semantic Web Primer
86
Necessary versus Sufficient Conditions (preliminaries)
Definition: A necessary condition for some state of affairs S is a condition that must be satisfied in order for S to obtain. For example, a necessary condition for getting an A in C341 is that a student hand in a term paper. This means that if a student does not hand in a term paper, then a student will not get an A, or, equivalently, if a student gets an A, then a student hands in a term paper. ( Chapter 4 A Semantic Web Primer
87
Necessary versus Sufficient Conditions (preliminaries)
Definition: A sufficient condition for some state of affairs S is a condition that, if satisfied, guarantees that S obtains. For example, a sufficient condition for getting an A in C341 is getting an A on every piece of graded work in the course. This means that if a student gets an A on every piece of graded work in the course, then the student gets an A. ( Chapter 4 A Semantic Web Primer
88
Necessary versus Sufficient Conditions (Self-Test)
Being a mammal is a sufficient condition for being human. Being human is a sufficient condition for being a mammal. Being alive is a necessary condition for having a right to life. Being alive is a sufficient condition for having a right to life. If it is true that if P then Q, then P is a sufficient condition for Q. If it is true that if P then Q, then Q is a necessary condition for P. (F) (T) (T) (F) (T) (T) Chapter 4 A Semantic Web Primer
89
Necessary and Sufficient Conditions
The rdfs:subClassOf restriction states necessary conditions for class membership We could also have used owl:equivalentClass property to state that the restricted class is exactly the same described by the restriction The owl:equivalentClass restriction states necessary and sufficient conditions Chapter 4 A Semantic Web Primer
90
Necessary and Sufficient Conditions
A reasoner can only directly infer class membership for individuals based on both necessary and sufficient conditions For instance, the following does not make a reasoner conclude that every individual that has a :hasBathroom relation with an individual of type :LuxuryBathroom must be an instance of :LuxuryBathroomApartment :LuxuryBathroomApartment rdf:type owl:Class; rdfs:subClassOf [rdf:type owl:Restriction; owl:onProperty :hasBathroom; owl:someValuesFrom :LuxuryBathroom]. Chapter 4 A Semantic Web Primer
91
Necessary and Sufficient Conditions
The individual might only be an instance of a subclass of the restriction, for instance, LuxuryBathroomHouse :LuxuryBathroomApartment rdf:type owl:Class; rdfs:subClassOf [rdf:type owl:Restriction; owl:onProperty :hasBathroom; owl:someValuesFrom :LuxuryBathroom]. If we make the class equivalent to the class specified by the restriction, it is clear that any individual satisfies the restriction must be a member of the class Chapter 4 A Semantic Web Primer
92
Value Restrictions Value restrictions are helpful when
we want to define a class based on relations with known individuals, or specific values for datatype properties :AmsterdamApartment rdf:type owl:Class; owl:equivalentClass [rdf:type owl:Restriction; owl:onProperty dbpedia-owl:location; owl:hasValue dbpedia:Amsterdam]. Chapter 4 A Semantic Web Primer
93
Cardinality Restrictions
A cardinality restriction constraints the number of values a certain property may have for a class :StudioApartment rdf:type owl:Class; owl:subClassOf [rdf:type owl:Restriction; owl:onProperty :hasRoom; owl:cardinality “1”^^xsd:integer]. **studio apartment(一居室公寓) Chapter 4 A Semantic Web Primer
94
Cardinality Restrictions
If we additionally specify the class these values need to belong to, the restriction is said to be qualified(限定的) We can turn the previous example into a qualified cardinality restriction :StudioApartment rdf:type owl:Class; owl:subClassOf [rdf:type owl:Restriction; owl:onProperty :hasRoom; owl:qualifiedCardinality “1”^^xsd:integer]; owl:onClass [owl:unionOf(:LivingRoom :Kitchen :Bedroom)] ]. Chapter 4 A Semantic Web Primer
95
Data Range Restrictions and Datatypes
Universal and existential restrictions on datatype properties allow members of a class to have any value from the specified datatype as value for the property Sometimes, we need more precise definitions to define, for instance, the class of adults who can rent apartments, or the minimum size of apartments Chapter 4 A Semantic Web Primer
96
An Example of Data Range Restrictions
:Adult rdfs:subClassOf dbpedia:Person; rdfs:subClassOf [ rdf:type owl:Restriction; owl:onProperty :hasAge; owl:someValuesFrom [ rdf:type rdfs:Datatype; owl:onDatatype xsd:integer; owl:withRestrictions ( [xsd:minInclusive “18”^^xsd:integer] ) ] ]. Anonymous class Anonymous class Chapter 4 A Semantic Web Primer
97
An Example of Data Range Restrictions
We could also have introduced a new named datatype for reuse :AdultAge rdf:type rdfs:Datatype; owl:onDatatype xsd:integer; owl:withRestrictions ( [xsd:minInclusive “18”^^xsd:integer] ). :Adult rdfs:subClassOf dbpedia:Person; rdfs:subClassOf [ rdf:type owl:Restriction; owl:onProperty :hasAge; owl:someValuesFrom :AdultAge]. Chapter 4 A Semantic Web Primer
98
Self Restrictions Good apartments will sell themselves. You do not need to spend much time redecorating it for it to sell well In OWL2 we can express this using a self restriction ex:GoodApartment rdf:type owl:Class; rdfs:subClassOf [ rdf:type owl:Restriction; owl:onProperty ex:sells; owl:hasSelf “true”^^xsd:boolean ]. Not applicable to datatype properties in OWL2 DL Chapter 4 A Semantic Web Primer
99
Keys Databases typically use keys(键)to identify records
These keys are not necessarily URIs and it can be difficult to come up with an elegant conversion scheme OWL2 allows us to indicate that, for certain classes, the value of a specific datatype property should be considered as a unique identifier(唯一的标识符) Chapter 4 A Semantic Web Primer
100
An Example of Keys For instance, the combination of postcode and street address number will provide a unique identifier for any dwelling(住宅 )in Netherlands :postcode rdf:type owl:DatatypeProperty. :addressNumber rdf:type owl:DatatypeProperty. :Dwelling rdf:type owl:Class; owl:hasKey (:postcode :addressNumber). Any two individuals(i.e. Dwellings)share the same value for :postcode and :addressNumber must be considered to be the same (inverse functional property defined) Chapter 4 A Semantic Web Primer
101
Individual Facts We turn our attention to the individual entities governed by our data model In many cases, we only need class axioms to infer extra information Statements about individuals are called assertions Chapter 4 A Semantic Web Primer
102
Class and Property Assertions
Class membership and property assertions in OWL2 are stated in the same way as in RDFS :Apartment rdf:type owl:Class; :BaronWayApartment rdf:type :Apartment; :hasNumberOfRooms “4”^^xsd:integer; :isRentedBy :Paul. Chapter 4 A Semantic Web Primer
103
Open-World Assumption
The open-world assumption says that we cannot conclude some statement x to be false simply because we cannot show x to be true The opposite assumption (closed-world assumption) would allow deriving falsity from the inability to derive truth Chapter 4 A Semantic Web Primer
104
Open-World Assumption
Question: “Did it rain in Tokyo yesterday?” Answer: “I don’t know that it rained, but that’s not enough reason to conclude that it didn’t rain.” Open-world assumption is appropriate! Chapter 4 A Semantic Web Primer
105
Open-World Assumption
Question: “Was there a big earthquake disaster in Tokyo yesterday?” Answer: “I don’t know that there was, but if there had been such a disaster, I’d have heard about it. Therefore I conclude that there wasn’t such a disaster.” Close-world assumption is appropriate! Chapter 4 A Semantic Web Primer
106
Identity Assertions Because OWL2 has the open-world assumption, we can never assume that two individuals with different URIs must be different entities We might be dealing a single individual with multiple names It is often more convenient to state identity(身份)relations explicitly :BaronWayApartment owl:sameAs :PaulsApartment; owl:differentFrom :FranksApartment. Chapter 4 A Semantic Web Primer
107
Identity Assertions The list of different individuals can easily grow quite long We can state this a bit more elegantly using the owl:AllDifferent construct _:x rdf:type owl:AllDifferent; owl:members (:FranksApartment :PaulsApartment). Chapter 4 A Semantic Web Primer
108
Negative Assertions(否定断言)
Sometimes we know that something is not the case Ruling out(排除)possibilities allows us to infer new knowledge in an open world For instance, if :BaronWayApartment is not rented by :Frank, then we may be able to infer that it is not :FranksApartment Chapter 4 A Semantic Web Primer
109
An Example of Negative Assertions
_:x rdf:type owl:NegativePropertyAssertion; owl:sourceIndividual :BaronWayApartment; owl:assertionProperty :isRentedBy; owl:targetIndividual :Frank. If owl:assertionProperty points to a datatype property, we use owl:targetValue instead of owl:targetIndividual Chapter 4 A Semantic Web Primer
110
An Example of Negative Assertions
If we know that an individual is not a member of a certain class, we can state this by asserting it to be a member of that class’s complement :BaronWayApartment rdf:type [owl:complementOf :LuxuryApartment]. Chapter 4 A Semantic Web Primer
111
Lecture Outline Introduction Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS The OWL Language OWL2 Profiles Summary 111 Chapter 4 A Semantic Web Primer
112
OWL2 Profiles The OWL2 specification includes a number of so-called profiles(配置文件,概要) Some are subsets of OWL2 DL Others are more expressive without the full semantics of OWL2 Full Motivations: Many ontologies tend to use only a fraction of the language constructs in DL Reasoner performance can be increased by using a less expressive language Chapter 4 A Semantic Web Primer
113
OWL2 Profiles In particular, the profiles are
restricted by syntax: the semantics of a profile’s syntax is provided by OWL2 DL specifications defined by logics that can handle at least some interesting inference service in polynomial time with respect to either: The number of facts in the ontology, or The size of the ontology as a whole Chapter 4 A Semantic Web Primer
114
OWL2 EL The primary strength of OWL2 EL lies in the ability to reason in polynomial time(多项式时间)on ontologies with a large number of class axioms(类公 理) Designed to cover the expressive power of several existing large-scale ontologies in the health care(卫 生保健) and life sciences domain (e.g. SNOMED-CT, Gene Ontology, and GALEN) The most significant difference from OWL2 DL is it drops owl:allValuesFrom restriction but supports rdfs:range restriction Chapter 4 A Semantic Web Primer
115
OWL2 QL Reasoners developed for OWL2 DL and OWL2 EL are relatively inefficient when dealing with ontologies that have relatively uncomplicated class definitions and contain a large number of assertions The QL profile is designed to efficiently handle query answering on such ontologies It adopts technologies from relational database management Chapter 4 A Semantic Web Primer
116
OWL2 RL The RL profile of OWL2 is based on so-called Description Logic Programs(描述逻辑程序), enabling interactions between description logics and rules It is the largest syntactic fragment of OWL2 DL that is implementable using rules Rules can be run in parallel, thus allowing for scalable reasoning implementations Rule implementations of OWL2 RL can implement subsets of OWL2 Full―OWL2 RL provides a bridge between OWL2 DL and OWL2 Full Chapter 4 A Semantic Web Primer
117
OWL DLP和其他语言的关系
118
Lecture Outline Introduction Requirements for Ontology Languages
Compatibility of OWL2 with RDF/RDFS The OWL Language OWL2 Profiles Summary 118 Chapter 4 A Semantic Web Primer
119
Summary Formal semantics and reasoning support are provided by
OWL2 extends RDF and RDFS with a number of very expressive language features including cardinality constraints, class equivalence, intersection, and disjunction Formal semantics and reasoning support are provided by mapping an ontology language to a known logical formalism using automated reasoners that already exist for those formalisms Chapter 4 A Semantic Web Primer
120
Summary OWL2 has four standard syntaxes: RDF/XML, OWL/XML, the Functional-Style syntax, and Manchester syntax OWL2 comes in two flavors OWL2 DL imposes some restrictions on the combination of OWL2 and RDFS elements to retain decidability(可判定性) OWL2 Full is a fully compatible extension of RDFS with all OWL2 language features, but is known to be undecidable Chapter 4 A Semantic Web Primer
121
Summary The three profiles, OWL2 EL, OWL2 QL, and OWL2 RL, are syntactic subsets that have desirable computational properties OWL2 RL is implementable using rules and has become the de facto standard for expressive reasoning on the Semantic Web Chapter 4 A Semantic Web Primer
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.