网络本体语言OWL

网络本体语言OWL由W3C开发,用于构建知识图谱的语义描述。OWL 1.0包括OWL Lite、OWL DL和OWL Full,提供不同级别的表达力,如OWL restrictions、类和属性类型。OWL 2引入更多语法糖和构造,如Self Restriction、Qualified Cardinality和Datatype Restrictions,增强了表达能力。

1. 简介

网络本体语言(Web Ontology Language, OWL)是W3C开发的一种网络本体语言,用于对本体进行语义描述。

对于许多人来说,RDF Schema是一种具有足够表现力的本体语言。然而,有些用例需要更有表现力的形式,如实例分类、一致性检查、归纳推理等。OWL是一种将DL公理编码为RDF三元组的方式,其语义与RDF(S)广泛兼容。

OWL有两个版本:OWL 1.0OWL2。 相较于 OWL 1.0OWL 2 具有更强的表达能力。

2. OWL 1.0

OWL功能的不同子集产生了以下子语言(OWL 1.0 Species),其中在表征语言的表现力和对使用该语言建立的表征进行推理的难度之间存在着权衡。:

  • OWL Lite

  • OWL DL

  • OWL Full

2.1 Ontology header

<> rdf:type owl:Ontology ;
   owl:versionInfo “1.4” ;
   rdfs:comment “An example ontology” ;
   owl:imports <http://example.org/base/> .

2.2 OWL class types

  • owl:Class: 区别于rdfs:Class - 需要OWL Lite/DL

  • owl:Thing (⊤): 全集

  • owl:Nothing (⊥): 空集

2.3 OWL property types

  • owl:ObjectProperty: 资源价值的属性类

  • owl:DatatypeProperty: 字面价值的属性类

  • owl:AnnotationProperty: 用于对注解类和属性的属性进行类型化,OWL推理器会忽略其谓词被标记为注释属性的任何三联体。

2.4 OWL restrictions

2.4.1 Local cardinality constraints

根据一个属性所取的值的数量来定义一个类。

  • owl:minCardinality (≥ n R)

  • owl:maxCardinality (≤ n R)

  • owl:cardinality (= n R)

Example: “Single malt whiskies are whiskies which are distilled by one and only one thing”

SingleMaltWhisky≡Whisky⊓=1.distilledBySingleMaltWhisky ≡Whisky ⊓ =1.distilledBySingleMaltWhiskyWhisky=1.distilledBy

ont:SingleMaltWhisky rdf:type owl:Class ;
  owl:equivalentClass [ rdf:type owl:Class ;
                        owl:intersectionOf 
                          ( ont:Whisky
                            [ rdf:type owl:Restriction ;
                              owl:onProperty ont:distilledBy ;
                              owl:cardinality 1 ] ) ] .

2.4.2 Local range constraints

根据属性值的类型来定义一个类别,区别于RDF模式中的全局范围约束(rdfs:range)。

  • owl:someValuesFrom (∃R.C)

  • owl:allValuesFrom (∀R.C)

Example: “Carnivores are things which eat some things which are animals”

Carnivore≡∃eats.AnimalCarnivore ≡∃eats.AnimalCarnivoreeats.Animal

ont:Carnivore rdf:type owl:Class ;
              owl:equivalentClass [ rdf:type owl:Restriction ;
                                    owl:onProperty ont:eats ;
                                    owl:someValuesFrom ont:Animal ] .

Example: “Vegetarians are things which eat only things which are plants”

Vegetarian≡∀eats.PlantVegetarian≡∀eats.PlantVegetarianeats.Plant

ont:Vegetarian rdf:type owl:Class ;
               owl:equivalentClass [ rdf:type owl:Restriction ;
                                     owl:onProperty ont:eats ;
                                     owl:allValuesFrom ont:Plant ] .

2.4.3 Local value constraints

根据一个特定属性值的存在来定义一个类别。无法在OWL Lite中使用。

  • owl:hasValue (∃R.{x})

Example: “Green things are things which are coloured green”

GreenThing≡∃hasColour.greenGreenThing≡∃hasColour.{green}GreenThinghasColour.green

ont:GreenThing rdf:type owl:Class ;
               owl:equivalentClass [ rdf:type owl:Restriction ;
                                     owl:onProperty ont:hasColour ;
                                     owl:hasValue ont:green ] .

2.5 Set constructors

  • owl:intersectionOf (C⊓D)

  • owl:unionOf (C⊔D)

  • owl:complementOf (¬C)

GreenApple≡Apple⊓∃hasColour.greenGreenApple≡Apple⊓∃hasColour.{green}GreenAppleApplehasColour.green

ont:GreenApple rdf:type owl:Class ;
  owl:equivalentClass [ rdf:type owl:Class ;
                        owl:intersectionOf 
                          ( ont:Apple
                            [ rdf:type owl:Restriction ;
                              owl:onProperty ont:hasColour ;
                              owl:hasValue ont:green ] ) ] .

2.6 Equivalence and identity relations

  • owl:sameAs (MorningStar=EveningStar)

  • owl:equivalentClass (C≡D)

  • owl:equivalentProperty (R≡S)

ont:morningStar rdf:type owl:Thing ;
                owl:sameAs ont:eveningStar .

2.7 Non-equivalence relations

  • owl:differentFrom:可用于指定一个有限的唯一的名称假设
Ont:HarryCorbett rdf:type owl:Thing ;
                 owl:differentFrom ont:HarryHCorbett .
  • owl:AllDifferent and owl:distinctMembers:用于指定一组相互不同的个体
[ rdf:type owl:AllDifferent ;
  owl:distinctMembers ( ont:John ont:Paul ont:George ont:Ringo ) ] .

2.8 Necessary/Sufficient Class Definitions

  • Primitive / partial classes (⊑):Necessary

    • 如果我们知道某物是X,那么它就必须满足条件…

    • 使用 rdfs:subClassOf 定义

Person⊑∃hasBirthdate.⊤Person⊑∃hasBirthdate.⊤PersonhasBirthdate.

ont:Person rdf:type owl:Class ;
           rdfs:subClassOf [ rdf:type owl:Restriction ;
                             owl:onProperty ont:hasBirthdate ;
                             owl:SomeValuesFrom owl:Thing ] .
  • Describes a subset of the class (⊒):Sufficient

    • 如果我们知道某个东西有这个属性,那么它就属于这个类别…

    • 使用 rdfs:subClassOf 定义(in the other direction)

  • Defined / complete classes (≡):Necessary and Sufficient

    • 如果某物满足了…的条件,那么它就是一个X

    • 使用 owl:equivalentClass 定义

2.9 Property types

  • Inverse
    • 将一个属性定义为另一个属性的相反(R≡R−R≡R^-RR

    • owl:inverseOf

ont:hasAuthor rdf:type owl:ObjectProperty ;
            owl:inverseOf ont:wrote .
  • Symmetric

    • 如果∀x∀y⟨x,y⟩∈RI⟺⟨y,x⟩∈RI∀x∀y ⟨x,y⟩∈R^I⟺⟨y,x⟩∈R^Ixyx,yRIy,xRI成立,则称属性R是对称的

    • owl:SymmetricProperty

    • 在DL中:𝑅≡𝑅−𝑅≡𝑅^-RR(对称属性是它们自己的反证)

  • Transitive

    • 如果∀x∀y∀z⟨x,y⟩∈RI∧⟨y,z⟩∈RI⇒⟨x,z⟩∈RI∀x∀y∀z ⟨x,y⟩∈R^I∧⟨y,z⟩∈R^I⇒⟨x,z⟩∈R^Ixyzx,yRIy,zRIx,zRI成立,则称属性R是传递的

    • owl:TransitiveProperty

    • 在DL中:R⊑R+R⊑R^+RR+

  • Functional

    • 如果∀x∀y∀z⟨x,y⟩∈RI∧⟨x,z⟩∈RI⇒y=z∀x∀y∀z ⟨x,y⟩∈R^I∧⟨x,z⟩∈R^I⇒y=zxyzx,yRIx,zRIy=z成立,则称属性R是Functional的

    • owl:FunctionalProperty

  • Inverse Functional

    • 如果∀x∀y∀z⟨y,x⟩∈RI∧⟨z,x⟩∈RI⇒y=z∀x∀y∀z ⟨y,x⟩∈R^I∧⟨z,x⟩∈R^I⇒y=zxyzy,xRIz,xRIy=z成立,则称属性R是Inverse Functional的

    • owl:InverseFunctionalProperty

2.10 Disjoint classes

  • owl:disjointWith:一个类的成员不能同时是另一个特定类的成员

Duck⊓Goose≡⊥Duck⊓Goose≡ ⊥DuckGoose

ont:Duck rdf:type owl:Class ;
         owl:disjointWith ont:Goose .

2.11 Enumerated classes

  • owl:oneOf (C ≡ {a,b,c}):将一个类定义为其成员的直接枚举
ont:Beatles rdf:type owl:Class ;
            owl:oneOf ( ont:John ont:Paul ont:George ont:Ringo ) .

2.12 Ontology modularisation

通过 owl:imports 机制可以包含其他本体。也可以使用其他本体的术语而不明确地导入它们。导入需要一定的连带关系(entailments),而简单使用则不需要(但也不妨碍)这些连带关系。

如本体1包含 BBB rdfs:subClassOf AAA . ,本体2包含 ont2 owl:imports ont1 .CCC rdfs:subClassOf BBB .,则本体2必须包含 CCC rdfs:subClassOf AAA

如本体1包含 BBB rdfs:subClassOf AAA . ,本体3包含 CCC rdfs:subClassOf BBB .,则本体3不是一定要包含 CCC rdfs:subClassOf AAA

3. OWL 2

OWL 2主要有以下几点变化:

  1. 语法糖(Syntactic sugar)

  2. 提高表达能力的结构(Constructs for increased expressivity)

  3. 数据类型支持(Datatype support)

  4. 元模式(Metamodelling)

  5. 注释(Annotation)

3.1 语法糖

3.1.1 Disjoint Classes

在OWL 1.0中我们可以说明两个类是不相交的(owl:disjointWith)。OWL 2可以让我们说明一组类是成对不相交的。

[ rdf:type owl:AllDisjointClasses ;
  owl:members ( ont:Duck ont:Goose ont:Swan ) ] .

3.1.2 Disjoint Union

允许我们将一个类定义为一些其他类的联合,所有这些类都是成对不相交的。

C≡C1⊔C2⊔…⊔Cn C≡C_1⊔C_2⊔…⊔C_n CC1C2CnC1⊓C2≡⊥ C_1⊓C_2≡ ⊥ C1C2C1⊓C3≡⊥ C_1⊓C_3≡ ⊥ C1C3… … C(n−1)⊓Cn≡⊥ C_(n-1)⊓C_n≡ ⊥ C(n1)Cn

Monotreme≡Platypus⊔EchidnaMonotreme≡Platypus⊔EchidnaMonotremePlatypusEchidna

Platypus⊓Echidna≡⊥Platypus⊓Echidna≡ ⊥PlatypusEchidna

ont:Monotreme owl:disjointUnionOf ( ont:Platypus ont:Echidna ) .

3.1.3 Negative Property Assertions

OWL 1中可以断言一个个体的属性值,OWL 2可以让我们断言一个个体没有某个特定的属性值。

[ rdf:type owl:NegativePropertyAssertion ;
  owl:sourceIndividual ont:John ;
  owl:assertionProperty ont:hasChild ;
  owl:targetIndividual ont:Susan ] .

3.2 New Constructs

3.2.1 Self Restriction

定义了一类个体,这些个体通过一个给定的属性与自己相关。

∃R.Self∃R.SelfR.Self

[ rdf:type owl:Restriction ;
  owl:onProperty property ;
  owl:hasSelf “true”^^xsd:boolean ] .

Narcissist≡Person⊓∃loves.SelfNarcissist≡Person⊓∃loves.SelfNarcissistPersonloves.Self

ont:Narcissist rdf:type owl:Class ;
  owl:equivalentClass 
    [ rdf:type owl:Class ;
      owl:intersectionOf ( ont:Person 
                           [ rdf:type owl:Restriction ;
                             owl:onProperty ont:loves ;
                             owl:hasSelf “true”^^xsd:boolean ] ) ] .

3.2.2 Qualified Cardinality

OWL 1让我们指定一个属性的局部范围,或者指定该属性的取值数量。OWL 2中我们可以同时指定两者。

∃(=4)hasPart.Wheelor=4hasPart.Wheel∃_(=4)hasPart.Wheel or =4 hasPart.Wheel(=4)hasPart.Wheelor=4hasPart.Wheel

[ rdf:type owl:Restriction ;
  owl:onProperty ont:hasPart ;
  owl:onClass ont:Wheel ;
  owl:cardinality 4 ] .

3.2.3 Reflexive/Irreflexive Properties

  • owl:ReflexiveProperty:允许我们断言,一个属性将每个对象与它自己联系起来。如果属性R具有∀x⟨x,x⟩∈RI∀x ⟨x,x⟩∈R^Ixx,xRI,则可以称它是反射的。
ont:sameAgeAs rdf:type owl:ReflexiveProperty .
  • owl:IrreflexiveProperty:允许我们断言一个属性不涉及任何对象与自身的关系。如果属性R具有∀x⟨x,x⟩∉RI∀x ⟨x,x⟩∉R^Ixx,x/RI,则可以称它是不反射的。
ont:strictlyTallerThan rdf:type owl:IrreflexiveProperty .
ont:marriedTo rdf:type owl:IrreflexiveProperty .

3.2.4 Asymmetric Properties

  • owl:AsymmetricProperty:如果属性R具有∀x∀y⟨x,y⟩∈RI⇒⟨y,x⟩∉RI∀x∀y ⟨x,y⟩∈R^I⇒⟨y,x⟩∉R^Ixyx,yRIy,x/RI,则可以称它是不对称的。
ont:strictlyTallerThan rdf:type owl:AsymmetricProperty .

ont:marriedTo rdf:type owl:SymmetricProperty .

3.2.5 Disjoint Properties

我们可以说明,两个个体不能通过两个不同的属性相互关联,而这些属性被宣布为不相干的。如果RI∩SI=∅R^I∩ S^I=∅RISI=成立,两个属性R和S是不相交的。

ont:separatedFrom rdf:type owl:ObjectProperty ;
                  owl:propertyDisjointWith ont:contiguousWith .

3.2.6 Property Chain Inclusion

OWL 1不允许我们将一个属性定义为其他属性的组合,例如hasUncle≡hasParent∘hasBrotherhasUncle ≡ hasParent∘hasBrotherhasUnclehasParenthasBrother ,但OWL 2让我们定义这种属性组合。

ont:hasUncle rdf:type owl:ObjectProperty ;
             owl:propertyChainAxiom ( ont:hasParent ont:hasBrother ) .

3.2.7 Keys

OWL 1让我们定义一个属性是功能性的,因此个人可以通过该属性的值来唯一地识别。OWL 2让我们定义唯一的识别键,包括几个属性。

ont:Person rdf:type owl:Class ;
           owl:hasKey ( ont:hasSSN ont:hasBirthDate ) .

3.2.8 Datatype Restrictions

允许我们定义数据类型的子集,限制数据类型所允许的数值范围。例如,大于或等于5的整数的数据类型可以定义为:

ont:IntGEFive rdf:type owl:Datatype ;
  owl:withRestrictions ( [ rdf:type xsd:minInclusive “5”^^xsd:integer ] ) .

3.3 Metamodelling

3.3.1 Punning

OWL 1要求用于识别类、属性、个体和数据类型的名称必须是不相干的。OWL 2放宽了这一点,同一个名字(URI)可以用于一个类和一个个体。

但是,一个名字不能同时用于一个类和一个数据类型;一个名字不能用于一个以上的属性类型(DataProperty vs ObjectProperty)。

ont:Eagle rdf:type owl:Class .
ont:Harry rdf:type ont:Eagle .
ont:Eagle rdf:type ont:EndangeredSpecies .
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值