问题
Let's have an OWL-DL ontology considering only the TBox (no individuals) and Let's consider
Chinesefamily hasChilren max 1
SterileChinesefamily subClassOf Chinesefamily
SterileChinesefamily hasChilren exactly 0
The expression
hasChilren max 1
will return Chinesefamily
and SterileChinesefamily
as sub classes
Well, how to specify classes that may have 0 or 1 children (Chinesefamily
) but must not have exactly 0 children (SterileChinesefamily
)
I tried
hasChilren max 1 and not hasChilren exactly 0
It returns Nothing!
============= UPDATE =============
Please note
hasChilren exactly 1
is not what I intend. Instead, what I mean is classes that are subclasses of:
- The classes that their individuals are allowed to have either 1 or 0 children (
Chinesefamily
). AND
NOT
The classes that their individuals must have exactly zero children (SterileChinesefamily
).
(Actually, I consider only the TBox (no individuals), but this update is just for clarification).
回答1:
The syntax you use at the beginning of your question is non standard:
Chinesefamily hasChilren max 1
It looks like Manchester syntax because hasChildren max 1
is a class expression in that syntax, but if you stick a name before, it's no longer Manchester. From what follows, it seems that your intention is to mean:
Class: Chinesefamily
EquivalentClass: hasChildren max 1
(As a side note, it is strange to say that all Chinese families have only zero or one child. It is well known that there are Chinese families that have more children... just saying)
A family with exactly 1 children can be defined as follows:
Class: FamilyWithOneChildren
SubClassOf: hasChildren exactly 1
Easy.
回答2:
Well, how to specify classes that may have 0 or 1 children (Chinesefamily) but must not have exactly 0 children (SterileChinesefamily)
You are right that hasChildren exactly 0 is a subclass of hasChildren max 1, because a family with 0 children certainly has at most one child. If you're asking for families with exactly one child, simply ask for the individuals of type
hasChildren exactly 1
what I mean is classes that are subclasses of:
- The classes that their individuals are allowed to have either 1 or 0 children (Chinesefamily) AND
- NOT The classes that their individuals must have exactly zero children (SterileChinesefamily).
A class expression like hasChildren max 1 doesn't have anything to do with permission, or being "allowed" to have values. It is simply the class of individuals that have either 0 or 1 values for the hasChildren property. What you're asking for is classes that are subclasses of both:
- hasChildren max 1
- the complement of hasChildren max 0
The complement of hasChildren max 0 is the class of individuals that have at least one child. That is, it's the class hasChildren min 1. So you're asking for classes that are subclasses of both:
- hasChildren max 1
- hasChildren min 1
That means you're asking for subclasses of
- (hasChildren max 1) and (hasChildren min 1)
Now, that intersection is equivalent to
- hasChildren exactly 1
This makes sense. The things that can have 0 or 1 children, but don't have 0 children, are the things that have 1 child.
来源:https://stackoverflow.com/questions/29497675/dl-returning-classes-with-max-1-and-not-exactly-0