OWL指南 推薦標準-5

TransWiki - W3CHINA.ORG开放翻译计划(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)]

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.
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

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.

5.1.1. Intersection [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.


<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.)


<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.


<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.

5.1.2. Union [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:


<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.


<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.

5.1.3. Complement [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:


  <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:


<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.

5.2. Enumerated Classes 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.
The following defines a class WineColor whose members are the individuals White, Rose, and 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.
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:


<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:


<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).

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: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.


<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.
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)
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.



个人工具
其它语言
 
 Page execution time: 310.51 ms.
网上报警 苏ICP备05002329号