I just start to learn Semantic Web and have a question about restriction class. I dug a while but haven't found any answer yet.. Any help would be much appreciated!
From text book, I see examples of define restriction class, they are all about to define a anonymous owl:Restriction
class bnode
and link this bnode
with property owl:equivalentClass
.
example:
example:restrictionClass owl:equivalentClass [
rdf:type owl:Restriction;
owl:onProperty example:resProp;
owl:someValuesFrom example:resValue.
]
My question is can we define a restriction class directly? Like:
example:restrictionClass rdf:type owl:Restriction;
owl:onProperty example:resProp;
owl:someValuesFrom example:resValue.
What's the advantage to define anonymous owl:Restriction
?
No, you can't. The RDF you're seeing is the encoding of the OWL axiom like: EquivalentClasses(C ObjectSomeValuesFrom(p D)). It gets encoded as:
Now, suppose you also had the axiom EquivalentClasses(C ObjectSomeValuesFrom(r E)). That gets encoded as:
Now, if you could apply the abbreviation that you want, you'd get:
Now there's ambiguity. Which of the following would C be equal to?
From the RDF alone, you don't have a way to tell. You actually need to encode the EquivalentClasses axioms.
Addendum
To address questions from the comments: I used C, p, and D to make the text shorter. Your original RDF snippet is the RDF encoding of the axiom
That's what
encodes. example:restrictionClass is the same IRI in both places. The entire blank node is the class expression ObjectSomeValuesFrom(example:resProp example:resValue). Then owl:equivalentClass just relates the two. Note that expressions aren't the same; the classes that they denote are the same. The mapping from OWL ontologies to RDF is given in OWL 2 Web Ontology Language: Mapping to RDF Graphs (Second Edition). Specifically, have a look at Table 1 in 2.1 Translation of Axioms without Annotations where you'll find the rules:
and
When you go in the reverse direction, you can read in the RDF and reconstruct your axiom. But support that the mapping let you do the abbreviation that you're talking about, and you had two equivalent class axioms. You'd end up with ambiguous RDF, since you'd have two owl:onProperty triples, and two owl:someValuesFrom triples.
Maybe an example from arithmetic would help. We know that 4, 2+2, and 1+3 are all expressions that denote the same number. So we can have the axioms:
Now suppose that we encode that in RDF with something like:
That's nice, and we can reconstruct 4 = 2+2 and 4 = 1+3 from it. Now suppose we tried to move those properties to :four, rather than a blank node related by :equals. We'd end up with:
But what axioms is this supposed to represent? You have have four ways of picking a left and right from :four. Which of the following is it supposed to encode?