问题
I am a newbie coding with the Manchester syntax for OWL. I need to understand the role of exactly
. Which of these restrictions is correct:
(hasChild (A or B)) and (hasChild exactly 1 Thing)
(hasChild (A or B)) and (hasChild exactly 2 Thing)
(hasChild (A and B)) and (hasChild exactly 1 Thing)
(hasChild (A and B)) and (hasChild exactly 2 Thing)
Can you explain it when A
and B
are equivalent, and when they are disjoint?
回答1:
The meaning of class expressions is defined in section 2.2.3 Class Expressions of the OWL 2 Web Ontology Language Direct Semantics W3C recommendation.
The four class expressions given in the question aren't quite well formed, as I understand the Manchester OWL syntax, as hasChild (A or/and B)
really needs to be hasChild some/only (A or/and B)
. That said, we can still discuss the meaning of the various combinations.
Exact Cardinality Restrictions
The restrictions hasChild exactly 1 Thing
and hasChild exactly 2 Thing
denote the classes of individuals which are related to exactly one or two other individuals by the hasChild
property, respectively. Since the class expression in the restriction is Thing
, it is probably more common to see the versions without a class: hasChild exactly 1
and hasChild exactly 2
.
Universal or AllValuesFrom Restrictions
The expression hasChild only X
denotes the class of individuals which are such that if they are related to any other individual by the hasChild
property, then the other individual is an instance of X
. It does not impose any constraint that there are such individuals, but only that if there are any, then they must be X
s.
Existential or SomeValuesFrom Restrictions
The expression hasChild some X
denotes the class of individuals which are related to at least one other individual that is an X
by the hasChild
property. It does not impose any constraint that every other individual related by the hasChild
is an X
, just that at least one is.
The meaning of the expressions
The class expressions in the problem aren't well formed at the moment, and should either be hasChild some (A or/and B)
or hasChild only (A or/and B)
. This means that there are a number of cases to consider, but fortunately some of them condense down.
If A and B are equivalent
If A
and B
are equivalent, then both (A or B)
and (A and B)
are equivalent to A
and to B
. This means that the expressions in the question can be simplified into two cases, depending on whether the restriction on the left hand side should be some
or only
.
(hasChild some A) and (hasChild exactly 1 Thing)
This class expression denotes the class of individuals which are related by thehasChild
property to at least one individual of typeA
, and that are related to exactly one other individual by thehasChild
property (and by the left side, that one individual must be that individual of typeA
).(hasChild some A) and (hasChild exactly 2 Thing)
This class expression denotes the class of individuals which are related by thehasChild
property to at least one individual of typeA
, and that are related to exactly two individuals by thehasChild
property (and by the left side, one of these individuals must that individual of typeA
).(hasChild only A) and (hasChild exactly 1 Thing)
This class expression denotes the class of individuals which are related by thehasChild
property only to individuals of typeA
, and that are related to exactly one other individual by thehasChild
property (and by the left side, that one individual must be of typeA
).(hasChild only A) and (hasChild exactly 2 Thing)
This class expression denotes the class of individuals which are related by thehasChild
property to some individual of typeA
, and that are related to exactly two individuals by thehasChild
property (and by the left side, both of these individuals must that individual of typeA
).
If A and B are disjoint
If A
and B
are disjoint, then the class expression A and B
denotes the empty class, since nothing can be both an A
and a B
. That means that that four of the cases are unsatisfiable.
The cases that involve hasChild some (A and B)
are unsatisfiable, because there are no A and B
s for anything to be related to. There are two such cases:
(hasChild some (A and B)) and (hasChild exactly 1 Thing)
(hasChild some (A and B)) and (hasChild exactly 2 Thing)
The combination of only (A and B)
and exactly n
is unsatisfiable, since (as long as n
is not 0), it says that an individual must be related to exactly n
things, and that each of those n
things must be an A and B
(of which there can be none. There are two such cases:
(hasChild only (A and B)) and (hasChild exactly 1 Thing)
(hasChild only (A and B)) and (hasChild exactly 2 Thing)
The remaining cases are all fairly straightforward, given the meaning of some
and only
. Though there are four class expressions, there are only two distinct classes.
(hasChild only (A or B)) and (hasChild exactly 1 Thing)
(hasChild some (A or B)) and (hasChild exactly 1 Thing)
This is the class of things that have exactly one child, which must be an A
or a B
.
(hasChild only (A or B)) and (hasChild exactly 2 Thing)
(hasChild some (A or B)) and (hasChild exactly 2 Thing)
This is the class of things that have exactly two children, each of which must be an A
or a B
.
来源:https://stackoverflow.com/questions/17137781/meaning-of-owl-exact-cardinality-restrictions