|
Navigation: Introduction > Property Restrictions |
![]() ![]()
|
With subclass relations we can specify a class C to be subclass of another class C'; then every instance of C is also an instance of C'. Now suppose we wish to declare, instead, that the class C satisfies certain conditions, that is, all instances of C satisfy the conditions. One way of doing this is by specifying a restriction on some property associated with class C.
Typically, property restrictions are described as consisting of two groups, namely: value constraints and cardinality constraints.
Value constraints constitute restrictions on the kinds of values a property can take.
Let's consider an example in our library setting in which we are interested in retrieving books that can be loaned only to faculty members. This can be expressed as follows:
Book
loanedBy FacultyMember
We can identify Book and FaculyMember as classes in our ontology and loanedBy as a property linking the classes. The icon "
" signifies an AllValuesFrom restriction imposed on the property loanedBy.
This kind of restriction is used to specify the class of possible values that the property on which it is imposed can take - in other words: all values of the property must come from this class. In terms of logic this is called universal quantification. In our example, only faculty members are allowed as values of the property loanedBy.
In another example we can express that we want to retrieve books loaned by "John Billington" as follows:
Book
loanedBy "John Billington"
In this example we used a HasValue (
) restriction to state a specific value that the property must have in order for the resulting objects to satisfy the query criteria.
In our last example we want to retrieve books that have at least once been loaned by some member:
Book
loanedBy Member
Here the SomeValuesFrom (
) restriction ensures that only books for which there is some loan will be retrieved. In terms of logic this is called existential quantification.
The following table presents a summary of the different value constraints:
|
All Values From |
All values of the property on which the restriction is imposed must come from the class that follows the property in the restriction expression (the object concept in the corresponding triple).
|
||
|
Some Values From |
Some values of the property on which the restriction is imposed must come from the class that follows the property in the restriction expression (the object concept in the corresponding triple). |
||
|
Has Value |
The property on which the restriction is imposed must have the specified value that follows the property in the restriction expression. |
Cardinality constraints constitute restrictions on the overall number of values a property can take. In other words, cardinality defines how many values a property can have.
An example query using a cardinality constraint is the following: retrieve all books who have been loaned at least 5 times.
This can be expressed as follows:
Book
loanedBy 5
The following table presents a summary of the different cardinality constraints:
|
Cardinality |
A cardinality of X means that a property must have exactly X values. |
|
Minimum Cardinality |
Minimum cardinality of X means that a property can have at least X values. |
|
Maximum Cardinality |
Maximum cardinality of X means that a property can have at most X values. |
Combining constraints
Consider the following expression as an example of combining different value constraints:
Book
loanedBy (
hasPhone "2421074973")
This can be translated as: retrieve the books that have been loaned by someone who has the specified phone number.
Here we can also clearly see the distinction between a SomeValuesFrom and a AllValuesFrom restriction. Consider the following expression:
Book
loanedBy (
hasPhone "2421074973")
This is the same as in the previous example changing only the restriction from SomeValuesFrom to AllValuesFrom. The query can now be translated to: retrieve the books that have been loaned only by someone who has the specified phone number.
The difference is that the books retrieved in the second case are books that are known to have been loaned by a specific person (the one with the specified phone number) and no other. This restriction is not present in the first case: others might also have borrowed those same books.
As a last example we consider the following query expression:
Book
ownedBy (
employs 10 )
In this example we combine a value constraint and a cardinality constraint. The query can be translated as follows: retrieve all books owned by some library department which employs at least 10 staff members.
What may be confusing in all these query expressions is the fact that some concepts are missing from the query and have to be guessed. In this last query expression, for instance, we deduced that the missing concept refers to a library department. What we specifically know from the expression is that the concept refers to something that owns books and employs a multitude of people or things. As humans we need to make such deductions to better understand the query, even though this is not actually necessary. To simplify the query formulation the Semantic Search Engine always displays omitted concepts from query expressions.
It should be clear after all the examples presented here how to refine a query expression. As a general rule, a concept in a restriction that represents the object in the corresponding triple (see the section Triples in the topic Introduction to Ontologies) can always be substituted by an appropriate restriction, either a value restriction or a cardinality restriction.
See also: