Q. Why do rdfs:domain and rdfs:range seem to work back-to-front when it comes to thinking about the class hierarchy?
A. Because RDFS is a logic-based system. The way rdfs range and domain declarations work is alien to anyone who thinks of RDFS and OWL as being a bit like a type system for a programming language, especially an object oriented language.
To expand on the problem. Suppose we have three classes:
eg:Animal eg:Human eg:Man
And suppose they are linked into the simple class hierarchy:
eg:Man rdfs:subClassOf eg:Human .
eg:Human rdfs:subClassOf eg:Animal .
Now suppose we have property eg:personalName with:
eg:personalName rdfs:domain eg:Human .
The question to ask is this: "can we deduce:
eg:personalName rdfs:domain eg:Man ?"
The answer is "no" the correct such deduction is:
eg:personalName rdfs:domain eg:Animal .
This is completely obvious to anyone who thinks about RDFS as a logic system, however it can be surprising if you are thinking in terms of objects.
A common line of thought is this: "surely [P rdfs:domain C] means roughly that P 'can be applied to' objects of type C, just like a type constraint in a programming language. Now all instances of eg:Man are also eg:Human so we can always apply eg:personalName to eg:Man things, doesn't that mean eg:Man is in the domain of eg:personalName?"
There are two flaws in this line of thought. First, rdfs:domain isn't really a constraint and doesn't mean 'can be applied to'. It means more or less the opposite, it enables an inference not imposes a constraint. [P rdfs:domain C] means that if you see a triple [X P foo] then you are licensed to deduce that X must be of type C. So we can see that if we make the illegal deduction [eg:personalName rdfs:domain eg:Man] then everything we applied eg:personalName to would become a eg:Man and we could no longer have things of type eg:Human which aren't of type eg:Man. Whereas the correct deduction [eg:personalName rdfs:domain eg:Animal] is safe because every eg:Human is an eg:Animal so the domain deductions don't tell us anything that wasn't already true, so to speak!
The second flaw is in the phrasing "is in the domain of". It is true that eg:Man is, in some sense, "in the domain of" eg:personalName but the correct translation of this loose phase is that "eg:Man is a subclass of the domain of eg:personalName" which is quite different from saying ":eg:Man *is* the domain of eg:personalName."
It is very confusing! I tend to think of it in terms of what you're going to find in the box, with a pair of boxes like this (please work, ASCII art!) :
Domain Range
_______ _______
| | | |
| | --[property]--> | |
|______| |______|
(I suppose that's harking back to frames/slots a bit)
When it comes to subclassing, the OO ideas really do get in the way, and 'generalises' and 'specialises' are prob'ly less confusing (human) terms.
Posted by: Danny on January 27, 2004 11:42 PM
heheh - optimism.
Tell you what, picture an empty box on the left labelled 'domain' and an empty box on the right labelled 'range'. Between them is a:
--[property]-->
Posted by: Danny on January 28, 2004 12:16 AM