OWL指南 推荐标准-5
TransWiki - an Open Translation Project(OTP)
摘要_文档状态_目录 第1节 第2节 第3节 第4节 第5节 第6节 第7节 鸣谢_词汇表_术语索引_参考文献 附录
5. Complex Classes [OWL DL (http://www.w3.org/TR/2004/REC-owl-guide-20040210/#OWL_DL_tag)]
5. 复杂类 [OWL DL (http://www.w3.org/TR/2004/REC-owl-guide-20040210/#OWL_DL_tag)]
OWL provides additional constructors with which to form classes. These constructors can be used to create so-called class expressions. OWL supports the basic set operations, namely union, intersection and complement. These are named owl:unionOf, owl:intersectionOf, and owl:complementOf, respectively. Additionally, classes can be enumerated. Class extensions can be stated explicitly by means of the oneOf constructor. And it is possible to assert that class extensions must be disjoint.
OWL另外还提供了一些用于构建类的构造子。这些构造子被用于创建所谓的类表达式。OWL支持基本的集合操作,即并,交和补运算。它们分别被命名为owl:unionOf,owl:intersectionOf,和owl:complementOf.此外,类还可以是枚举的。类的外延可以使用oneOf构造子来显示的声明。同时,我们也可以声明类的外延必须是互不相交的。
Note that Class expressions can be nested without requiring the creation of names for every intermediate class. This allows the use of set operations to build up complex classes from anonymous classes or classes with value restrictions.
注意类表达式是可以嵌套的,它并不要求要为每一个中间类都提供一个名字。这样就允许我们通过使用集合操作来从匿名类或具有值约束的类来创建复合类。
5.1. Set Operators intersectionOf, unionOf, complementOf
5.1 集合运算符 intersectionOf,unionOf,complementOf
Remember that OWL class extensions are sets consisting of the individuals that are members of the class. OWL provides the means to manipulate class extensions using basic set operators.
记住:OWL类外延是由个体组成的集合,而这些个体都是类的成员。OWL使用基本的集合操作算子来处理类的外延。
5.1.1. Intersection [some uses of OWL DL (http://www.w3.org/TR/2004/REC-owl-guide-20040210/#OWL_DL_tag)]
5.1.1.交运算 [some uses of OWL DL (http://www.w3.org/TR/2004/REC-owl-guide-20040210/#OWL_DL_tag)]
The following examples demonstrate the use of the intersectionOf construct.
下面的例子展示了intersectionOf构造子的使用
<owl:Class rdf:ID="WhiteWine">
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#Wine" />
<owl:Restriction>
<owl:onProperty rdf:resource="#hasColor" />
<owl:hasValue rdf:resource="#White" />
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
Classes constructed using the set operations are more like definitions than anything we have seen to date. The members of the class are completely specified by the set operation. The construction above states that WhiteWine is exactly the intersection of the class Wine and the set of things that are white in color. This means that if something is white and a wine, then it is an instance of WhiteWine. Without such a definition we can know that white wines are wines and white, but not vice-versa. This is an important tool for categorizing individuals. (Note that 'rdf:parseType="Collection"' is a required syntactic element.)
使用集合操作构造的类与我们目前所看到的所有语法中的定义类似。类的成员完全是通过集合操作来说明的。上面的语句说明WhiteWine恰好是类Wine与所有颜色是白色的事物的集合的交集。这就意味着如果某一事物是白色的并且是葡萄酒,那么它就是WhiteWine的实例。如果没有这样的定义我们只能知道白葡萄酒是葡萄酒酒并且是白色的,但是反过来就不是这样了。这是对个体进行分类的强有力工具。(请注意:'rdf:parseType="Collection"'是必需的语法元素。)
<owl:Class rdf:about="#Burgundy">
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#Wine" />
<owl:Restriction>
<owl:onProperty rdf:resource="#locatedIn" />
<owl:hasValue rdf:resource="#BourgogneRegion" />
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
Here we define Burgundy to include exactly those wines that have at least one locatedIn relation to the Bourgogne Region. We could have declared a new class ThingsFromBourgogneRegion and used it as a class in the owl:intersectionOf construct. Since we do not have any other use for ThingsFromBourgogneRegion, the declaration above is shorter, clearer and doesn't require the creation of a contrived name.
在这里我们定义了Burgundy类。这个类恰好包含了那些至少有一个locatedIn关系,而同时这一关系又要联系到Bourgogne地区的葡萄酒。当然我们也可以声明一个新的类ThingsFromBourgogneRegion,并且将该类作为owl:intersectionOf结构中的类使用。但既然ThingsFromBourgogneRegion不再有其他用处,上面的声明就显得更加简短、清晰,并且这一声明不需要我们努力想一个新的名字出来。
<owl:Class rdf:ID="WhiteBurgundy">
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#Burgundy" />
<owl:Class rdf:about="#WhiteWine" />
</owl:intersectionOf>
</owl:Class>
Finally, the class WhiteBurgundy is exactly the intersection of white wines and Burgundies. Burgundies in turn are grown in the French region of Bourgogne and are dry wines. Accordingly all individual wines that meet these criteria are part of the class extension of WhiteBurgundy.
最后,WhiteBurgundy类恰好是白葡萄酒和Burgundies的交集。依次,Burgundies生产在法国一个叫做Bourgogne的地方并且它是干葡萄酒(dry wine)。因此,所有满足这些标准的葡萄酒个体都是WhiteBurgundy类的外延的一部分。
5.1.2. Union [OWL DL (http://www.w3.org/TR/2004/REC-owl-guide-20040210/#OWL_DL_tag)]
5.1.2. 并运算 [OWL DL (http://www.w3.org/TR/2004/REC-owl-guide-20040210/#OWL_DL_tag)]
The following example demonstrates the use of the unionOf construct. It is used exactly like the intersectionOf construct:
下面的例子展示了unionOf结构的使用。它的使用方法和intersectionOf极其类似:
<owl:Class rdf:ID="Fruit">
<owl:unionOf rdf:parseType="Collection">
<owl:Class rdf:about="#SweetFruit" />
<owl:Class rdf:about="#NonSweetFruit" />
</owl:unionOf>
</owl:Class>
The class Fruit includes both the extension of SweetFruit and the extension of NonSweetFruit.
Note how completely different this union type construct is from the following.
Fruit类既包含了SweetFruit类的外延也包含了NonSweetFruit的外延。
请仔细观察这种并集类型的结构与下面的一个结构是多么的不同。
<owl:Class rdf:ID="Fruit">
<rdfs:subClassOf rdf:resource="#SweetFruit" />
<rdfs:subClassOf rdf:resource="#NonSweetFruit" />
</owl:Class> ?
This says that the instances of Fruit are a subset of the intersection of sweet and non-sweet fruit, which we would expect to be the empty set.
上面的例子说明Fruit的实例是SweetFruit和NonSweetFruit的交集的子集,这里我们将预计得到一个空集。
5.1.3. Complement [OWL DL (http://www.w3.org/TR/2004/REC-owl-guide-20040210/#OWL_DL_tag)]
5.1.3. 补运算 [OWL DL (http://www.w3.org/TR/2004/REC-owl-guide-20040210/#OWL_DL_tag)]
The complementOf construct selects all individuals from the domain of discourse that do not belong to a certain class. Usually this refers to a very large set of individuals:
complementOf结构从某个论域(domain of discourse)选出不属于某个类的所有个体。通常它将指向一个非常大的个体集合:
<owl:Class rdf:ID="ConsumableThing" />
<owl:Class rdf:ID="NonConsumableThing">
<owl:complementOf rdf:resource="#ConsumableThing" />
</owl:Class>
The class of NonConsumableThing includes as its members all individuals that do not belong to the extension of ConsumableThing. This set includes all Wines, Regions, etc. It is literally the set difference between owl:Thing and ConsumableThing. Therefore, a typical usage pattern for complementOf is in combination with other set operators:
类NonConsumableThing包含了所有不属于ConsumableThing的外延的个体。NonConsumableThing集合包含了所有的Wines,Regions等。它实际上就是owl:Thing与ConsumableThing的这两个集合的集合差。因此,complementOf典型的用法是与其它集合运算符联合使用:
<owl:Class rdf:ID="NonFrenchWine">
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#Wine"/>
<owl:Class>
<owl:complementOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#locatedIn" />
<owl:hasValue rdf:resource="#FrenchRegion" />
</owl:Restriction>
</owl:complementOf>
</owl:Class>
</owl:intersectionOf>
</owl:Class> ?
This defines the class NonFrenchWine to be the intersection of Wine with the set of all things not located in France.
上面的例子定义了一个NonFrenchWine类,它是Wine类与所有不位于法国的事物的集合的交集。
5.2. Enumerated Classes oneOf [OWL DL (http://www.w3.org/TR/2004/REC-owl-guide-20040210/#OWL_DL_tag)]
5.2. 枚举类oneOf [OWL DL (http://www.w3.org/TR/2004/REC-owl-guide-20040210/#OWL_DL_tag)]
OWL provides the means to specify a class via a direct enumeration of its members. This is done using the oneOf construct. Notably, this definition completely specifies the class extension, so that no other individuals can be declared to belong to the class.
OWL提供了一种通过直接枚举类的成员的方法来描述类。这是通过使用oneOf结构来完成。特别地,这个定义完整地描述了类的外延,因此任何其他个体都不能被声明为属于这个类。
The following defines a class WineColor whose members are the individuals White, Rose, and Red.
下面的例子定义了WineColor类,它的成员是White,Rose和Red这三个个体.
<owl:Class rdf:ID="WineColor">
<rdfs:subClassOf rdf:resource="#WineDescriptor"/>
<owl:oneOf rdf:parseType="Collection">
<owl:Thing rdf:about="#White"/>
<owl:Thing rdf:about="#Rose"/>
<owl:Thing rdf:about="#Red"/>
</owl:oneOf>
</owl:Class>
The first thing to understand here is that no other individuals can be a valid WineColor since the class has been defined by enumeration.
看到上面的定义,第一件想到的事情就是由于这个类是通过枚举定义的,因此其他任何个体都不可能是一个有效的WineColor。
Each element of the oneOf construct must be a validly declared individual. An individual has to belong to some class. In the above example, each individual was referenced by name. We used owl:Thing as a simple cliché to introduce the reference. Alternatively, we could have referenced the elements of the set according to their specific type, WineColor, by:
oneOf结构的每一个元素都必须是一个有效声明的个体。一个个体必须属于某个类。在上面的例子中,每一个个体都是通过名字来引用的。我们使用owl:Thing简单地进行引用,尽管这有点多余(因为每个个体都属于owl:Thing)。另外,我们也可以根据具体类型WineColor来引用集合中的元素:
<owl:Class rdf:ID="WineColor">
<rdfs:subClassOf rdf:resource="#WineDescriptor"/>
<owl:oneOf rdf:parseType="Collection">
<WineColor rdf:about="#White" />
<WineColor rdf:about="#Rose" />
<WineColor rdf:about="#Red" />
</owl:oneOf>
</owl:Class>
Other, more complex descriptions of individuals are also valid elements of the oneOf construct, for example:
另外,较复杂的个体描述同样也可以是oneOf结构的有效元素,例如:
<WineColor rdf:about="#White">
<rdfs:label>White</rdfs:label>
</WineColor> ?
For additional examples of the use of oneOf, see the Reference (http://www.w3.org/TR/2004/REC-owl-ref-20040210/#EnumeratedDatatype).
其它关于oneOf使用的例子,请参见 Reference (http://www.w3.org/TR/2004/REC-owl-ref-20040210/#EnumeratedDatatype).
5.3. Disjoint Classes disjointWith [OWL DL (http://www.w3.org/TR/2004/REC-owl-guide-20040210/#OWL_DL_tag)]
The disjointness of a set of classes can be expressed using the owl:disjointWith constructor. It guarantees that an individual that is a member of one class cannot simultaneously be an instance of a specified other class.
使用owl:disjointWith构造子可以表达一组类是不相交的。它保证了属于某一个类的个体不能同时又是另一个指定类的实例。
<owl:Class rdf:ID="Pasta">
<rdfs:subClassOf rdf:resource="#EdibleThing"/>
<owl:disjointWith rdf:resource="#Meat"/>
<owl:disjointWith rdf:resource="#Fowl"/>
<owl:disjointWith rdf:resource="#Seafood"/>
<owl:disjointWith rdf:resource="#Dessert"/>
<owl:disjointWith rdf:resource="#Fruit"/>
</owl:Class>
The Pasta example demonstrates multiple disjoint classes. Note that this only asserts that Pasta is disjoint from all of these other classes. It does not assert, for example, that Meat and Fruit are disjoint. In order to assert that a set of classes is mutually disjoint, there must be an owl:disjointWith assertion for every pair.
A common requirement is to define a class as the union of a set of mutually disjoint subclasses.
Pasta例子声明了多个不相交类。注意它只声明了Pasta与其它所有类是不相交的。例如,它并没有保证Meat和Fruit是不相交的。为了声明一组类是互不相交的,我们必须对每两个类都使用owl:disjointWith来声明。
<owl:Class rdf:ID="SweetFruit">
<rdfs:subClassOf rdf:resource="#EdibleThing" />
</owl:Class>
<owl:Class rdf:ID="NonSweetFruit">
<rdfs:subClassOf rdf:resource="#EdibleThing" />
<owl:disjointWith rdf:resource="#SweetFruit" />
</owl:Class>
<owl:Class rdf:ID="Fruit">
<owl:unionOf rdf:parseType="Collection">
<owl:Class rdf:about="#SweetFruit" />
<owl:Class rdf:about="#NonSweetFruit" />
</owl:unionOf>
</owl:Class>
Here we define Fruit to be exactly the union of SweetFruit and NonSweetFruit. And we know that these subclasses exactly partition Fruit into two distinct subclasses because they are disjoint. As the number of mutually disjoint classes grows, the number of disjointness assertions grows proportionally to n2. However, in the use cases we have seen, n is typically small.
在上面个例子中,我们定义了Fruit是SweetFruit和NonSweetFruit的并集。而且我们知道这些子类恰好将Fruit划分成了连个截然不同的子类,因为它们是互不相交的。随着互不相交的类的增加,不相交的声明的数目也会相应的增加到n2.然而,在我们已知的用例中,n通常比较小。
When n is large, alternate approaches can be used to avoid quadratic growth in the number of assertions. One such method is illustrated in the OWL test suite (http://www.w3.org/TR/2004/REC-owl-test-20040210/byIssue#I5.21-002)
当n很大时,我们可以使用另一些方法以避免声明的数目按二次方增长。其中一个方法在OWL test suite (http://www.w3.org/TR/2004/REC-owl-test-20040210/byIssue#I5.21-002)有详细说明。
The illustrated method works as follows. We describe a parent class whose elements have a property with cardinality equal to one. That is, each instance must have one and only one value for this property. Then, for every subclass of the parent we require that its instances must have a particular unique value for the property. In which case none of the distinct subclasses can have members in common.
这一方法的工作原理如下。我们描述一个父类,它的元素有一个基数等于一的属性。接着,对于这个父类的每一个子类,我们都要求这个子类的实例的这一属性必须具有一个唯一的值。在这种情况下,各个不同子类就不可能有共同的成员了。


