1. 简介
网络本体语言(Web Ontology Language, OWL)是W3C开发的一种网络本体语言,用于对本体进行语义描述。
对于许多人来说,RDF Schema是一种具有足够表现力的本体语言。然而,有些用例需要更有表现力的形式,如实例分类、一致性检查、归纳推理等。OWL是一种将DL公理编码为RDF三元组的方式,其语义与RDF(S)广泛兼容。
OWL有两个版本:OWL 1.0
和 OWL2
。 相较于 OWL 1.0
,OWL 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”
S i n g l e M a l t W h i s k y ≡ W h i s k y ⊓ = 1. d i s t i l l e d B y SingleMaltWhisky ≡Whisky ⊓ =1.distilledBy SingleMaltWhisky≡Whisky⊓=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”
C a r n i v o r e ≡ ∃ e a t s . A n i m a l Carnivore ≡∃eats.Animal Carnivore≡∃eats.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”
V e g e t a r i a n ≡ ∀ e a t s . P l a n t Vegetarian≡∀eats.Plant Vegetarian≡∀eats.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”
G r e e n T h i n g ≡ ∃ h a s C o l o u r . g r e e n GreenThing≡∃hasColour.{green} GreenThing≡∃hasColour.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)
G r e e n A p p l e ≡ A p p l e ⊓ ∃ h a s C o l o u r . g r e e n GreenApple≡Apple⊓∃hasColour.{green} GreenApple≡Apple⊓∃hasColour.