amp-sidebar 5
hasTopping property
1. Navigate to the Object properties tab. Select the hasTopping property.
2. Click on the Add icon (+) next to Domains (intersection) in the Description view for hasTopping
.
You will be presented with a window that shows several tabs.
There are multiple ways to define domain and range. For now we will use the simplest method (and the one most often used). Select the ClassHierarchy tab. Then select Pizza from the class hierarchy. Your UI should look like figure 4.14.
Click on OK. You should now see Pizza underneath the Domains in the Description view.
3. Repeat step 2 but this time start by using the (+) icon next to the Ranges (intersection) in the Description for hasTopping
.
This time select the class PizzaTopping as the range.
4. Synchronize the reasoner.
Now select isToppingOf.
You should see that the Domain and Range for isToppingOf
have been filled in by the reasoner (see figure 4.15).
Since the two properties are inverses the reasoner knows that the domain for one is the range for the other and vice versa. This is another example of why frequently running the reasoner can save time and help maintain a valid model.
Note that these values are highlighted in yellow. Any information supplied by the reasoner rather than by the user is highlighted in this way.
Figure 4.14: Defining the Domain for hasTopping |
It is possible to specify more than one class as the domain or range of a property.
One of the most common mistakes of new users is to do this and expect that the resulting domain/range is the union of the two classes.
However, note that next to the Domain and Range in the Description view it says (intersection).
This is because the semantics of having 2 or more classes as the domain or range is the intersection of those classes not the union.
For example, if one defined the domain for a property to be Pizza
and then added another domain PizzaBase
that would mean that for something to be in the domain of that property it would have to be an instance of both Pizza
and IceCream
not (as people often expect) the union of those two sets which would be either the class Pizza
or the class IceCream
.
Also, note that the domain and range are for inferencing, they are not data integrity constraints.This distinction will be explained in more detail below in the section on SHACL.
-
Written by @mdebellis
with contributions from @gigster99 and @ldodds -
Translated by @jaygray0919