I'm trying to use the HermiT reasoner to compute inferences for an ontology which contains a set of OWL axioms and a SWRL rule:
Ontology(
ClassAssertion( :Student :Bob )
ClassAssertion( :Professor :DrBoffin )
ClassAssertion( :University :UF )
ObjectPropertyAssertion( :supervises :DrBoffin :Bob )
ObjectPropertyAssertion( :worksAt :DrBoffin :UF )
EquivalentClasses( :Student ObjectHasSelf( :r1 ))
EquivalentClasses(
ObjectHasSelf( :r2 )
ObjectSomeValuesFrom( :worksAt :University ))
SubObjectPropertyOf(
ObjectPropertyChain( :r2 :supervises :r1 ) :professorOf )
DLSafeRule(Body(ObjectPropertyAtom( :professorOf Variable( ?x ) Variable( ?y )))
Head(ObjectPropertyAtom( :instructorOf Variable( ?x ) Variable( ?y ))))
)
Basically, the OWL part is trying to express such a rule:
worksAt(x, y), University(y), supervises(x, z), Student(z) -> professorOf(x, z)
using property chain and rolification techniques:
The SWRL part is:
professorOf(x, y) -> instructorOf(x, y)
The expected output should contain both ObjectPropertyAssertion( :professorOf :DrBoffin :Bob )
and ObjectPropertyAssertion( :instructorOf :DrBoffin :Bob )
. However, the actual output is (showing only object properties)
ObjectPropertyAssertion( :r1 :Bob :Bob )
ObjectPropertyAssertion( :professorOf :DrBoffin :Bob )
ObjectPropertyAssertion( :r2 :DrBoffin :DrBoffin )
ObjectPropertyAssertion( :supervises :DrBoffin :Bob )
ObjectPropertyAssertion( :worksAt :DrBoffin :UF)
Why isn't the expected SWRL result showing up? Any suggestions?
After re-reading your question, I realized that the rule you are trying to represent is
but that you are trying to represent it, essentially by
which is actually a valid SWRL rule, even though it has a complex class expression. (See Can OWL Class Expressions be used in SWRL Rules? for more information. Even though they're valid, the Protégé editor didn't accept that input, though it would display rules correctly if they are already in the ontology.)
Although it can be expressed in SWRL, that will only cover cases where the individuals are named, so the rolification based solution will cover more cases. So, the idea is to create a role
rWorksAtSomeUniversity
(the rolification ofworksAt some University
) and a rolerStudent
(the rolification ofStudent
, and then to assert thatThen, to relate
professorOf
andinstructorOf
, you can either use a SWRL ruleor a subproperty axiom
As with rolification-based rule, the non-SWRL rule will cover more cases, and does not require that the reasoner have SWRL support.
Here's an ontology that contains these classes and axioms, in the OWL functional syntax. It's not wonderfully human readable, but it's complete; you should be able to download it and test it out with your reasoner.
Both Pellet and HermiT 1.3.7 can produce the inferences: