27 March 2003
Examples of OWL document fragments are shown in this appendix. In particular, the examples correspond to the ones in the Guide document [OWL Guide] are listed.
Since the XML presentation syntax in itself does not rely on the syntax of RDF, namespace declaration of the XML syntax dose not have to include RDF-related namespace such as 'xmlns:rdf' and 'xmlns:rdfs' in contrast to the declaration for the RDF/XML syntax.
<!DOCTYPE Ontology [ <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > <!ENTITY vin "http://www.example.org/wine#" > <!ENTITY food "http://www.example.org/food#" > ]> <owls:Ontology owls:name="http://www.example.org/wine" xmlns:owls="http://www.w3.org/2003/OWL-XMLSchema"> <!-- OWL statements --> </owls:Ontology>
<!DOCTYPE owl [ <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > <!ENTITY vin "http://www.example.org/wine#" > <!ENTITY food "http://www.example.org/food#" > ]> <rdf:RDF xmlns ="http://www.example.org/wine#" xmlns:vin ="http://www.example.org/wine#" xmlns:food="http://www.example.org/food#" xmlns:owl ="http://www.w3.org/2002/07/owl#" xmlns:rdf ="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > <!-- OWL statements --> </rdf:RDF>
In the XML presentation syntax, there is no header element, in contrast to the RDF/XML syntax in which owl:Ontology is provided as a construct for the header component.
<owls:Annotation> <owls:Documentation>An example OWL ontology</owls:Documentation> </owls:Annotation> <owls:PriorVersion owls:ontology="http://www.example.org/wine-112102.owl" /> <owls:Imports owls:ontology="http://www.example.org/food.owl"/> <owls:Annotation> <owls:Label>Wine Ontology</owls:Label> </owls:Annotation>
<owl:Ontology rdf:about="http://www.example.org/wine"> <rdfs:comment>An example OWL ontology</rdfs:comment> <owl:priorVersion rdf:resource="http://www.example.org/wine-112102.owl"/> <owl:imports rdf:resource="http://www.example.org/food.owl"/> <rdfs:label>Wine Ontology</rdfs:label> </owl:Ontology>
As simple (and incomplete) definitions (i.e., axioms), the examples below only indicate the existence of three classes: Winery, Region, and ConsumableThing, each of which is given with a name.
<owls:Class owls:name="Winery" owls:complete="false" /> <owls:Class owls:name="Region" owls:complete="false" /> <owls:Class owls:name="ConsumableThing" owls:complete="false" />
<owl:Class rdf:ID="Winery"/> <owl:Class rdf:ID="Region"/> <owl:Class rdf:ID="ConsumableThing"/>
The next example defines a simple (and incomplete) definition for the class PotableLiquid that is a sub-class of ConsumableThing.
<owls:Class owls:name="PotableLiquid" owls:complete="false"> <owls:Class owls:name="#ConsumableThing" /> </owls:Class>
<owl:Class rdf:ID="PotableLiquid"> <rdfs:subClassOf rdf:resource="#ConsumableThing" /> </owl:Class>
The owls:Label element in XML presentation syntax (rdfs:label entry in RDF/XML syntax) provides an optional human readable name for this class. A label is like a comment and contributes nothing to the logical interpretation of an ontology.
<owls:Class owls:name="Wine" owls:complete="false"> <owls:Annotation> <owls:Label xml:lang="en">wine</owls:Label> <owls:Label xml:lang="fr">vin</owls:Label> </owls:Annotation> <owls:Class owls:name="&food;PotableLiquid" /> </owls:Class>
<owl:Class rdf:ID="Wine"> <rdfs:subClassOf rdf:resource="&food;PotableLiquid"/> <rdfs:label xml:lang="en">wine</rdfs:label> <rdfs:label xml:lang="fr">vin</rdfs:label> </owl:Class>
An individual is minimally introduced by declaring to be a member of a class.
<owls:Individual owls:name="CentralCoastRegion"> <owls:type owls:name="Region" /> </owls:Individual>
<Region rdf:ID="CentralCoastRegion" />
The following example is identical in meaning to the definition above.
<owls:Individual owls:name="CentralCoastRegion" /> <owls:Individual owls:name="#CentralCoastRegion"> <owls:type owls:name="Region" /> </owls:Individual>
<owl:Thing rdf:ID="CentralCoastRegion" /> <owl:Thing rdf:about="#CentralCoastRegion"> <rdf:type rdf:resource="#Region"/> </owl:Thing>
Properties allow to assert general facts about the members of classes and specific facts about individuals. OWL distinguishes two types of properties: object properties and datatype properties.
<owls:ObjectProperty owls:name="madeFromGrape"> <owls:domain owls:class="Wine" /> <owls:range owls:class="WineGrape" /> </owls:ObjectProperty>
<owl:ObjectProperty rdf:ID="madeFromGrape"> <rdfs:domain rdf:resource="#Wine"/> <rdfs:range rdf:resource="#WineGrape"/> </owl:ObjectProperty>
Given with definitions of the property above as well as the following individual, it is possible to infer that LindemansBin65Chardonnay is a wine, because the domain of madeFromGrape is Wine.
<owls:Individual owls:name="LindemansBin65Chardonnay"> <owls:ObjectPropertyValue owls:property="madeFromGrape"> <owls:Individual owls:name="#ChardonnayGrape" /> </owls:ObjectPropertyValue> </owls:Individual>
<owl:Thing rdf:ID="LindemansBin65Chardonnay"> <madeFromGrape rdf:resource="#ChardonnayGrape" /> </owl:Thing>
Properties, like classes, can be arranged in a hierarchy. Properties of WineDescriptor relate wines to their color and components of their taste. hasColor is a subproperty of the hasWineDescriptor property, with its range further restricted to WineColor.
<owls:Class owls:name="WineDescriptor" owls:complete="false" /> <owls:Class owls:name="WineColor" owls:complete="false"> <owls:Class owls:name="#WineDescriptor" /> </owls:Class> <owls:ObjectProperty owls:name="hasWineDescriptor"> <owls:domain owls:class="Wine" /> <owls:range owls:class="WineDescriptor" /> </owls:ObjectProperty> <owls:ObjectProperty owls:name="hasColor"> <owls:range owls:class="WineColor" /> </owls:ObjectProperty> <owls:SubPropertyOf owls:sub="hasColor"> <owls:ObjectProperty owls:name="hasWineDescriptor" /> </owls:SubPropertyOf>
<owl:Class rdf:ID="WineDescriptor" /> <owl:Class rdf:ID="WineColor"> <rdfs:subClassOf rdf:resource="#WineDescriptor" /> </owl:Class> <owl:ObjectProperty rdf:ID="hasWineDescriptor"> <rdfs:domain rdf:resource="#Wine" /> <rdfs:range rdf:resource="#WineDescriptor" /> </owl:ObjectProperty> <owl:ObjectProperty rdf:ID="hasColor"> <rdfs:subPropertyOf rdf:resource="#hasWineDescriptor" /> <rdfs:range rdf:resource="#WineColor" /> </owl:ObjectProperty>
In the next example, the locatedIn property that relates things to the regions where the things are located.
<owls:ObjectProperty owls:name="locatedIn"> <owls:domain owls:class="http://www.w3.org/2002/07/owl#Thing" /> <owls:range owls:class="#Region" /> </owls:ObjectProperty>
<owl:ObjectProperty rdf:ID="locatedIn"> <rdfs:domain rdf:resource="http://www.w3.org/2002/07/owl#Thing" /> <rdfs:range rdf:resource="#Region" /> </owl:ObjectProperty>
The definition of Wine class is then expanded to include the notion of regions, and that a wine is made from at least one WineGrape. As with property definitions, class definitions have multiple subparts that are implicitly conjoined.
<owls:Class owls:name="Wine" owls:complete="false"> <owls:Class owls:name="&food;PotableLiquid" /> <owls:ObjectRestriction owls:property="#madeFromGrape"> <owls:minCardinality owls:value="1" /> </owls:ObjectRestriction> <owls:ObjectRestriction owls:property="#locatedIn"> <owls:minCardinality owls:value="1" /> <owls:ObjectRestriction> </owls:Class>
<owl:Class rdf:ID="Wine"> <rdfs:subClassOf rdf:resource="&food;PotableLiquid"/> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#madeFromGrape"/> <owl:minCardinality rdf:datatype="&xsd;NonNegativeInteger">1</owl:minCardinality> </owl:Restriction> </rdfs:subClassOf> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#locatedIn"/> <owl:minCardinality rdf:datatype="&xsd;NonNegativeInteger">1</owl:minCardinality> </owl:Restriction> </rdfs:subClassOf> </owl:Class>
Although the wines produced in specific years are considered vintages, it is problematic, for example, to consider the year 2000 as a vintage. The vintage is not a new variety of wine, but a special subset of the wine produced in the year 2000. However, a vintage can be defined as a separate class, whose instances have a relationship to the Wine they are a vintage of.
<owls:Class owls:name="Vintage" owls:complete="false"> <owls:ObjectRestriction owls:property="#vintageOf"> <owls:minCardinality owls:value="1" /> </owls:ObjectRestriction> </owls:Class> <owls:ObjectProperty owls:name="vintageOf"> <owls:domain owls:class="#Vintage" /> <owls:range owls:class="#Wine" /> </owls:ObjectProperty>
<owl:Class rdf:ID="Vintage"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#vintageOf"/> <owl:minCardinality rdf:datatype="&xsd;NonNegativeInteger">1</owl:minCardinality> </owl:Restriction> </rdfs:subClassOf> </owl:Class> <owl:ObjectProperty rdf:ID="vintageOf"> <rdfs:domain rdf:resource="#Vintage" /> <rdfs:range rdf:resource="#Wine" /> </owl:ObjectProperty>
OWL distinguishes properties if they relate individuals to individuals (object properties) or individuals to datatypes (datatype properties). Datatype properties may range over strings or they may make use of simple types defined according to XML Schema datatypes [XMLSchema-2].
<owls:Class owls:name="VintageYear" owls:complete="false" /> <owls:DatatypeProperty owls:name="yearValue"> <owls:domain owls:class="#VintageYear" /> <owls:range owls:datatype="&xsd;positiveInteger" /> </owls:DatatypeProperty>
<owl:Class rdf:ID="VintageYear" /> <owl:DatatypeProperty rdf:ID="yearValue"> <rdfs:domain rdf:resource="#VintageYear" /> <rdfs:range rdf:resource="&xsd;positiveInteger"/> </owl:DatatypeProperty>
In the following example, an idividual of Cabernet Sauvignon wine is defined with reference to Region and Winery individuals.
<owls:Individual owls:name="SantaCruzMountainsRegion"> <owls:type owls:name="Region" /> <owls:ObjectPropertyValue owls:property="locatedIn"> <owls:Individual owls:name="#CaliforniaRegion" /> </owls:ObjectPropertyValue> </owls:Individual> <owls:Individual owls:name="SantaCruzMountainVineyard"> <owls:type owls:name="Winery" /> </owls:Individual> <owls:Individual owls:name="SantaCruzMountainVineyardCabernetSauvignon"> <owls:type owls:name="CabernetSauvignon" /> <owls:ObjectPropertyValue owls:property="locatedIn"> <owls:Individual owls:name="#SantaCruzMountainsRegion" /> </owls:ObjectPropertyValue> <owls:ObjectPropertyValue owls:property="hasMaker"> <owls:Individual owls:name="#SantaCruzMountainVineyard" /> </owls:ObjectPropertyValue> </owls:Individual>
<Region rdf:ID="SantaCruzMountainsRegion"> <locatedIn rdf:resource="#CaliforniaRegion" /> </Region> <Winery rdf:ID="SantaCruzMountainVineyard" /> <CabernetSauvignon rdf:ID="SantaCruzMountainVineyardCabernetSauvignon" > <locatedIn rdf:resource="#SantaCruzMountainsRegion"/> <hasMaker rdf:resource="#SantaCruzMountainVineyard" /> </CabernetSauvignon>
Datatype properties can be added to individuals. An instance of VintageYear is created below, and a specific value of type &xsd;positiveInteger (i.e., http://www.w3.org/2001/XMLSchema#positiveInteger) is associated.
<owls:Individual owls:name="Year1998"> <owls:type owls:name="VintageYear" /> <owls:DataPropertyValue owls:property="yearValue"> <owls:DataValue owls:datatype="&xsd;positiveInteger">1998</owls:DataValue> </owls:DataPropertyValue> </owls:Individual>
<VintageYear rdf:ID="Year1998"> <yearValue rdf:datatype="&xsd;positiveInteger">1998</yearValue> </VintageYear>
<owls:ObjectProperty owls:name="locatedIn" owls:transitive="true"> <owls:domain owls:class="&owl;Thing" /> <owls:range owls:class="#Region" /> </owls:ObjectProperty> <owls:Individual owls:name="SantaCruzMountainsRegion"> <owls:type owls:name="Region" /> <owls:ObjectPropertyValue owls:property="locatedIn"> <owls:Individual owls:name="#CaliforniaRegion" /> </owls:ObjectPropertyValue> </owls:Individual> <owls:Individual owls:name="CaliforniaRegion"> <owls:type owls:name="Region" /> <owls:ObjectPropertyValue owls:property="locatedIn"> <owls:Individual owls:name="#USRegion" /> </owls:ObjectPropertyValue> </owls:Individual>
<owl:ObjectProperty rdf:ID="locatedIn"> <rdf:type rdf:resource="&owl;TransitiveProperty" /> <rdfs:domain rdf:resource="&owl;Thing" /> <rdfs:range rdf:resource="#Region" /> </owl:ObjectProperty> <Region rdf:ID="SantaCruzMountainsRegion"> <locatedIn rdf:resource="#CaliforniaRegion" /> </Region> <Region rdf:ID="CaliforniaRegion"> <locatedIn rdf:resource="#USRegion" /> </Region>
<owls:ObjectProperty owls:name="adjacentRegion" owls:symmetric="true"> <owls:domain owls:class="#Region" /> <owls:range owls:class="#Region" /> </owls:ObjectProperty> <owls:Individual owls:name="MendocinoRegion"> <owls:type owls:name="Region" /> <owls:ObjectPropertyValue owls:property="locatedIn"> <owls:Individual owls:name="#CaliforniaRegion" /> </owls:ObjectPropertyValue> <owls:ObjectPropertyValue owls:property="adjacentRegion"> <owls:Individual owls:name="#SonomaRegion" /> </owls:ObjectPropertyValue> </owls:Individual>
<owl:ObjectProperty rdf:ID="adjacentRegion"> <rdf:type rdf:resource="&owl;SymmetricProperty" /> <rdfs:domain rdf:resource="#Region" /> <rdfs:range rdf:resource="#Region" /> </owl:ObjectProperty> <Region rdf:ID="MendocinoRegion"> <locatedIn rdf:resource="#CaliforniaRegion" /> <adjacentRegion rdf:resource="#SonomaRegion" /> </Region>
<owls:Class owls:name="VintageYear" owls:complete="false" /> <owls:ObjectProperty owls:name="hasVintageYear" owls:functional="true"> <owls:domain owls:class="#Vintage" /> <owls:range owls:class="#VintageYear" /> </owls:ObjectProperty>
<owl:Class rdf:ID="VintageYear" /> <owl:ObjectProperty rdf:ID="hasVintageYear"> <rdf:type rdf:resource="&owl;FunctionalProperty" /> <rdfs:domain rdf:resource="#Vintage" /> <rdfs:range rdf:resource="#VintageYear" /> </owl:ObjectProperty>
<owls:ObjectProperty owls:name="hasMaker" owls:functional="true" /> <owls:ObjectProperty owls:name="producesWine" owls:inverseOf="#hasMaker" />
<owl:ObjectProperty rdf:ID="hasMaker"> <rdf:type rdf:resource="&owl;FunctionalProperty" /> </owl:ObjectProperty> <owl:ObjectProperty rdf:ID="producesWine"> <owl:inverseOf rdf:resource="#hasMaker" /> </owl:ObjectProperty>
<owls:ObjectProperty owls:name="hasMaker" /> <owls:ObjectProperty owls:name="producesWine" owls:inverseFunctional="true" owls:inverseOf="#hasMaker" />
<owl:ObjectProperty rdf:ID="hasMaker" /> <owl:ObjectProperty rdf:ID="producesWine"> <rdf:type rdf:resource="&owl;InverseFunctionalProperty" /> <owl:inverseOf rdf:resource="#hasMaker" /> </owl:ObjectProperty>
<owls:Class owls:name="Wine" owls:complete="false"> <owls:Class owls:name="&food;PotableLiquid" /> <owls:ObjectRestriction owls:property="#hasMaker"> <owls:allValuesFrom owls:class="#Winery" /> </owls:ObjectRestriction> </owls:Class>
<owl:Class rdf:ID="Wine"> <rdfs:subClassOf rdf:resource="&food;PotableLiquid" /> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasMaker" /> <owl:allValuesFrom rdf:resource="#Winery" /> </owl:Restriction> </rdfs:subClassOf> </owl:Class>
<owls:Class owls:name="Wine2" owls:complete="false"> <owls:Class owls:name="&food;PotableLiquid" /> <owls:ObjectRestriction owls:property="#hasMaker"> <owls:someValuesFrom owls:class="#Winery" /> </owls:ObjectRestriction> </owls:Class>
<owl:Class rdf:ID="Wine2"> <rdfs:subClassOf rdf:resource="&food;PotableLiquid" /> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasMaker" /> <owl:someValuesFrom rdf:resource="#Winery" /> </owl:Restriction> </rdfs:subClassOf> </owl:Class>
<owls:Class owls:name="Vintage" owls:complete="false"> <owls:ObjectRestriction owls:property="#hasVintageYear"> <owls:cardinality owls:value="1" /> <owls:ObjectRestriction> </owls:Class>
<owl:Class rdf:ID="Vintage"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasVintageYear"/> <owl:cardinality rdf:datatype="&xsd;NonNegativeInteger">1</owl:cardinality> </owl:Restriction> </rdfs:subClassOf> </owl:Class>
<owls:Class owls:name="Burgundy" owls:complete="false"> <owls:ObjectRestriction owls:property="#hasSugar"> <owls:hasValue owls:name="#Dry" /> </owls:ObjectRestriction> </owls:Class>
<owl:Class rdf:ID="Burgundy"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasSugar" /> <owl:hasValue rdf:resource="#Dry" /> </owl:Restriction> </rdfs:subClassOf> </owl:Class>
<owls:Class owls:name="Wine" owls:complete="true"> <owls:Class owls:name="&vin;Wine" /> </owls:Class>
<owl:Class rdf:ID="Wine"> <owl:equivalentClass rdf:resource="&vin;Wine"/> </owl:Class>
<owls:Class owls:name="TexasThings" owls:complete="true"> <owls:ObjectRestriction owls:property="#locatedIn"> <owls:allValuesFrom owls:class="#TexasRegion" /> </owls:ObjectRestriction> </owls:Class>
<owl:Class rdf:ID="TexasThings"> <owl:equivalentClass> <owl:Restriction> <owl:onProperty rdf:resource="#locatedIn" /> <owl:allValuesFrom rdf:resource="#TexasRegion" /> </owl:Restriction> </owl:equivalentClass> </owl:Class>
<owls:Individual owls:name="#MikesFavoriteWine"> <owls:type owls:name="Wine" /> </owls:Individual> <owls:SameIndividual> <owls:Individual owls:name="#MikesFavoriteWine" owls:type="Wine" /> <owls:Individual owls:name="#StGenevieveTexasWhite" /> </owls:SameIndividual>
<Wine rdf:ID="MikesFavoriteWine"> <owl:sameIndividualAs rdf:resource="#StGenevieveTexasWhite" /> </Wine>
<owls:Individual owls:name="Dry"> <owls:type owls:name="WineSugar" /> </owls:Individual> <owls:Individual owls:name="Sweet"> <owls:type owls:name="WineSugar" /> </owls:Individual> <owls:DifferentIndividuals> <owls:Individual owls:name="#Sweet" /> <owls:Individual owls:name="#Dry" /> </owls:DifferentIndividuals>
<WineSugar rdf:ID="Dry" /> <WineSugar rdf:ID="Sweet"> <owl:differentFrom rdf:resource="#Dry"/> </WineSugar>
<owls:Individual owls:name="OffDry"> <owls:type owls:name="WineSugar" /> </owls:Individual> <owls:DifferentIndividuals> <owls:Individual owls:name="#OffDry" /> <owls:Individual owls:name="#Dry" /> <owls:Individual owls:name="#Sweet" /> </owls:DifferentIndividuals>
<WineSugar rdf:ID="OffDry"> <owl:differentFrom rdf:resource="#Dry"/> <owl:differentFrom rdf:resource="#Sweet"/> </WineSugar>
<owls:DifferentIndividuals> <owls:Individual owls:name="Red" owls:type="&vin;WineColor" /> <owls:Individual owls:name="White" owls:type="&vin;WineColor" /> <owls:Individual owls:name="Rose" owls:type="&vin;WineColor" /> </owls:DifferentIndividuals>
<owl:AllDifferent> <owl:distinctMembers rdf:parseType="Collection"> <vin:WineColor rdf:about="#Red" /> <vin:WineColor rdf:about="#White" /> <vin:WineColor rdf:about="#Rose" /> </owl:distinctMembers> </owl:AllDifferent>
Classes constructed using the set operations are definitions (or axioms), and the members of the class are completely specified by the set operation. In the XML presentation syntax, the modality attribute owls:complete of owls:Class[axiom] must be set to true for class definitions using set operators.
The class definition below 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 it is possible to know that white wines are wines and white, but not vice-versa. This is an important tool for categorizing individuals.
<owls:Class owls:name="WhiteWine" owls:complete="true"> <owls:IntersectionOf> <owls:Class owls:name="#Wine" /> <owls:ObjectRestriction owls:property="#hasColor"> <owls:hasValue owls:name="#White" /> </owls:ObjectRestriction> </owls:IntersectionOf> </owls:Class>
<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>
The following example defines Burgundy that includes exactly those wines that have at least one locatedIn relation to the Bourgogne Region.
<owls:Class owls:name="#Burgundy" owls:complete="true"> <owls:Class owls:name="#Wine" /> <owls:ObjectRestriction owls:property="#locatedIn"> <owls:hasValue owls:name="#BourgogneRegion" /> </owls:ObjectRestriction> </owls:Class>
<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>
The next example says that the class WhiteBurgundy is exactly the intersection of white wines and Burgundies.
<owls:Class owls:name="WhiteBurgundy" owls:complete="true"> <owls:Class owls:name="#Burgundy" /> <owls:Class owls:name="#WhiteWine" /> </owls:Class>
<owl:Class rdf:ID="WhiteBurgundy"> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Burgundy" /> <owl:Class rdf:about="#WhiteWine" /> </owl:intersectionOf> </owl:Class>
The class Fruit given below includes both the extension of SweetFruit and the extension of NonSweetFruit.
<owls:Class owls:name="Fruit" owls:complete="true"> <owls:UnionOf> <owls:Class owls:name="#SweetFruit" /> <owls:Class owls:name="#NonSweetFruit" /> </owls:UnionOf> </owls: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>
The next example says that the instances of Fruit are a subset of the intersection of sweet and non-sweet fruit, which is expected to be the empty set.
<owls:Class owls:name="Fruit2" owls:complete="false"> <owls:Class owls:name="#SweetFruit" /> <owls:Class owls:name="#NonSweetFruit" /> </owls:Class>
<owl:Class rdf:ID="Fruit"> <rdfs:subClassOf rdf:resource="#SweetFruit" /> <rdfs:subClassOf rdf:resource="#NonSweetFruit" /> </owl:Class>
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:
<owls:Class owls:name="NonConsumableThing" owls:complete="true"> <owls:ComplementOf> <owls:Class owls:name="#ConsumableThing" /> </owls:ComplementOf> </owls:Class>
<owl:Class rdf:ID="ConsumableThing" /> <owl:Class rdf:ID="NonConsumableThing"> <owl:complementOf rdf:resource="#ConsumableThing" /> </owl:Class>
The class of NonConsumableThing above includes as its members all individuals that do not belong to the extension of ConsumableThing. This set includes all Wine(s), Region(s), etc. It is literally the set difference between owls:Individual (i.e., owl:Thing in the RDF/XML syntax) and ConsumableThing. A typical usage pattern for the complement operator is thus in combination with other set operators:
The next example defines the class NonFrenchWine to be the intersection of Wine with the set of all things not located in France.
<owls:Class owls:name="NonFrenchWine" owls:complete="true"> <owls:Class owls:name="#Wine" /> <owls:ComplementOf> <owls:ObjectRestriction owls:property="#locatedIn"> <owls:hasValue owls:name="#FrenchRegion" /> </owls:ObjectRestriction> </owls:ComplementOf> </owls:Class>
<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>
An OWL class can be defined via a direct enumeration of its members by using owls:OneOf construct. 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.
<owls:Class owls:name="WineColor" owls:complete="false"> <owls:Class owls:name="#WineDescriptor" /> <owls:OneOf> <owls:Individual owls:name="#White" /> <owls:Individual owls:name="#Rose" /> <owls:Individual owls:name="#Red" /> </owls:OneOf> </owls:Class>
<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>
In the XML presentation syntax, owls:EnumeratedClass can also be used for the enumerative class definition as shown below.
<owls:Class owls:name="WineColor" owls:complete="false"> <owls:Class owls:name="#WineDescriptor" /> </owls:Class> <owls:EnumeratedClass owls:name="WineColor"> <owls:Individual owls:name="#White" owls:type="WineColor" /> <owls:Individual owls:name="#Rose" owls:type="WineColor" /> <owls:Individual owls:name="#Red" owls:type="WineColor" /> </owls:EnumeratedClass>
<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>
The disjointness of a set of classes guarantees that an individual that is a member of one class cannot simultaneously be an instance of a specified other class.
<owls:Class owls:name="Pasta" owls:complete="false"> <owls:Class owls:name="#EdibleThing" /> </owls:Class> <owls:DisjointClasses> <owls:Class owls:name="#Pasta" /> <owls:Class owls:name="#Meat" /> </owls:DisjointClasses> <owls:DisjointClasses> <owls:Class owls:name="#Pasta" /> <owls:Class owls:name="#Fowl" /> </owls:DisjointClasses> <owls:DisjointClasses> <owls:Class owls:name="#Pasta" /> <owls:Class owls:name="#Seafood" /> </owls:DisjointClasses> <owls:DisjointClasses> <owls:Class owls:name="#Pasta" /> <owls:Class owls:name="#Dessert" /> </owls:DisjointClasses> <owls:DisjointClasses> <owls:Class owls:name="#Pasta" /> <owls:Class owls:name="#Fruit" /> </owls:DisjointClasses>
<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 above 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. A owls:DisjointClasses in the XML presentation syntax allows to assert that a set of classes is mutually disjoint. On the other hand, there must be an owl:disjointWith assertion for every pair in the RDF/XML syntax.
A common requirement is to define a class as the union of a set of mutually disjoint subclasses. In the following example, Fruit is defined to be exactly the union of SweetFruit and NonSweetFruit. It must be noted here that these subclasses exactly partition Fruit into two distinct subclasses because they are disjoint.
<owls:Class owls:name="SweetFruit" owls:complete="false"> <owls:Class owls:name="#EdibleThing" /> </owls:Class> <owls:Class owls:name="NonSweetFruit" owls:complete="false"> <owls:Class owls:name="#EdibleThing" /> </owls:Class> <owls:DisjointClasses> <owls:Class owls:name="#SweetFruit" /> <owls:Class owls:name="#NonSweetFruit" /> </owls:DisjointClasses>
<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>
<owls:PriorVersion owls:ontology="http://www.example.org/wine-112102.owl" />
<owl:Ontology rdf:about="http://www.example.org/wine"> <owl:priorVersion rdf:resource="http://www.example.org/wine-112102.owl"/> </owl:Ontology>
<owls:Class owls:name="&vin;JugWine" owls:complete="false" owls:deprecated="true" /> <owls:ObjectProperty owls:name="&vin;hasSeeds" owls:deprecated="true" />
<owl:DeprecatedClass rdf:ID="&vin;JugWine" /> <owl:DeprecatedProperty rdf:ID="&vin;hasSeeds" />