Neil
Neil

Reputation: 3281

OWL/Protege: Combining Object Properties with Conjunction

Say I have a class "Adult" and a class "Child" and two object properties "isFatherOf " and "playsMonopolyWith". Suppose I want all fathers who play monopoly with their children. Now I could do a subclass like:

Adult
isFatherOf some Child
playsMonopolyWith some Child

But this isn't quite right since a father who plays monopoly only with other people's children would be included here. What a really want is:

Adult
(isFatherOf and PlaysMonopolyWith) some child

The child that the father plays monopoly with must be the same child that he is the father of.

This gives syntax error. So I'm guessing the description logic doesn't allow this sort of construct? Is there a work around?

Upvotes: 1

Views: 319

Answers (1)

Richard-Degenne
Richard-Degenne

Reputation: 2949

In order to describe business logic, it is often preferable to use inference rules instead of OWL logic.

From your example, if you want a class NiceFather for Fathers who playsMonopolyWith their own Child, here is what to do.

Go to "Window" > "Tabs", and check "SWRLTab", then go to the newly created "SWRLTab". Click on the "New" button.

SWRL rules view

Write the rule you described in your question. The syntax is pretty straightforward.

isFatherOf(?father, ?child) ^ playsMonopolyWith(?father, ?child) -> NiceFather(?father)

Click "Ok" to create the rule, and run the reasoner.


Here is a Gist that you can download and open in Protégé. As you can see Albert is a nice father because he plays Monopoly with his son Albert Jr. Bob, on the other hand, is not a nice father because he plays Monopoly with Albert Jr. instead of his own son Bob Jr. :)

albert is a nice father bob is not a nice father

Upvotes: 1

Related Questions