In OWL:
- There is a class X and the properties P1, P2, and P3, each of which has domain X.
I want to say:
- Every instance of X must at least participate in a relation with one of the properties P1 or P3.
- Every instance of X which participates in a relation with P2 must also participate in a relation with P1.
- But every instance of X may only participate in relations with P1 and P2 or in relations with P3.
Maybe it is easier to understand with some syntax and labels:
:Chronology a owl:Class ;
rdfs:label "X" ;
:hasBegin a owl:DatatypeProperty ;
rdfs:label "P1" ;
rdfs:domain :Chronology .
:hasEnd a owl:DatatypeProperty ;
rdfs:label "P2" ;
rdfs:domain :Chronology .
:hasNoBeginNoEnd a owl:DatatypeProperty ;
rdfs:label "P3" ;
rdfs:domain :Chronology .
I understand the concept of anonymous classes and restrictions but nothing really seems to fit.
You have a few different constraints here, but they can all be represented in OWL. Let us address the constraints one at a time.
This says that for every x, either there is a y such that P1(x,y), or there is a z such that P2(x,z). In OWL, this is expressed by
The class expression
P1 some Thing
represents the class of things that are related byP1
to some entity. Similarly forP2 some Thing
. The subClassOf axiom as a whole says that “if something is an X, then it is either aP1 some Thing
or aP2 some Thing
.” (You could also useP min 1
instead ofP some Thing
, if you wanted to. It is not a significant difference.)This says that for every x, if there is a y such that P2(x,y), then there is also a z such that P1(x,z). Another way of saying this is that “for every x, if x is an X and there is a y such that P2(x,y), then there is also a z such that P1(x,z).” This can be expressed by another subclass axiom:
(For the sake of generality, I used
X and (P2 some Thing)
on the left side of this subclass axiom. In this specific case, since X is the domain of P2, we can infer thatP2 some Thing
is a subclass of X, so we could also have used justP2 some Thing
on the left.)This says that if some x is an X and there is a y such that P3(x,y), then there is no z such that P1(x,z) or P2(x,y), and vice versa. You can represent this in a few ways. You could use two subclass axioms:
You could also use a single disjoint class axiom (notice that X appears on both sides)
(As I noted in the previous case, since the domain of the properties is X, the class
X and (P3 some Thing)
is equivalent toP3 some Thing
. The left side of these subclass axioms could also be simplyP3 some Thing
and(P1 some Thing) or (P2 some Thing)
, and the classes in the disjoint axioms could beP3 some Thing
and(P1 some Thing) or (P2 some Thing)
.)Here's what the classes and axioms in the ontology looks like (in the N3 format):
Commentary on Blank Node Usage
As pointed out in the comments, the ontology above uses class expressions represented by blank nodes as the subjects of the two "general class axioms", i.e., the subclass axioms that related two class expressions, neither of which is a simple class identifier. The original OWL Web Ontology Language Reference includes, in Appendix E: Rules of Thumb for OWL DL Ontologies:
At first glance, it would seem that the ontology provided above violates this, because the "general class axioms" (class axioms whose subject is not a class identifier) have class expressions as their subject. However, section 3.2 Class Axioms gives the syntax of, e.g.,
rdfs:subClassOf
axioms asThat section also includes the note:
This suggests that Appendix E is mistaken in omitting certain cases where "orphan blank nodes" are allowed. That suggestion isn't normative, of course; it opens with the introduction:
For confirmation, we need to look at section 8. OWL Full, OWL DL and OWL Lite, which describes the precise constructs that are allowed in OWL Full, OWL DL, and Owl Lite ontologies. That section reiterates that, in OWL Lite,
but puts no such restrictions on OWL DL ontologies. Section 8 does require, for OWL DL ontologies, that
This points out that
is not valid OWL DL, but that
is (provided that
:Foo
is anowl:Class
, of course). The non-normative Appendix E simply missed a case where "orphan blank nodes" can be used. General class axioms don't get used all that often, except when some particularly complicated sentences need to be represented, so it's not a hard mistake to make.For some more information about general class axioms, see Being complex on the left-hand-side: General Concept Inclusions.