46 
 
 
Exercise 25: Create and Use the hasSpiciness Property 
_____________________________________________________________________________________ 
1. Go to the Object properties tab. Create a new property called hasSpiciness. Define its domain to be 
PizzaTopping and its range to be Spiciness.  Run the reasoner so that it knows about the new property.  
2. Go back to the Classes tab and select the class  JalapenoPepperTopping.  Click on the Add icon (+) 
next to the SubClass Of field. Enter the DL axiom: hasSpiciness value Hot. Remember you can use 
<control><space> to auto-complete. Click on OK.  
3. Note that this is a different kind of restriction than before. Before we were defining abstract restrictions 
such as some. I.e., some value from a class but the specific individual was not specified, as long as it was 
an individual from that class the restriction was satisfied. Now we are defining a restriction that relates to 
a specific individual, hence we use the value keyword rather than the some or only keywords.  
4. Now we will use this property to define a new class of Pizza. Start by creating a new subclass of 
Pizza called SpicyPizza.  
5. Make sure that SpicyPizza is selected. Click on the Add icon (+) next to the SubClass Of field. Enter 
the DL axiom: hasTopping some (hasSpiciness value Hot). This says that a SpicyPizza must have a 
topping that hasSpiciness value of Hot.  
6. Convert SpicyPizza to a defined class by selecting it and using Edit>Convert to defined class. Run the 
reasoner.  
_____________________________________________________________________________________ 
Now go to the Class hierarchy (inferred) tab in the Classes tab (see figure 4.25). You should see that 
AmericanHotPizza is now classified as a subclass of SpicyPizza because it has a topping 
(JalapenoPepperTopping) that has a spiciness value of Hot.  
4.16 Cardinality Restrictions 
In OWL we can describe the class of individuals that have at least, at most, or exactly a specified number 
of relationships with other individuals or datatype values. The restrictions that describe these classes are 
known as Cardinality Restrictions. For a given property P, a Minimum Cardinality Restriction specifies 
the minimum number of P relationships that an individual must participate in. A Maximum Cardinality 
Restriction specifies the maximum number of P relationships that an individual can participate in. A 
Cardinality Restriction specifies the exact number of P relationships that an individual must participate in. 
Relationships (for example between two individuals) are only counted as separate relationships if it can 
be determined that the individuals that are the fillers for the relationships are different from each other.  
Let’s add a cardinality restriction to our Pizza Ontology. We will create a new subclass of Pizza called 
InterestingPizza which will be defied to have 3 or more toppings.