0

I am using Protege 4.3 to make some SWRL rules.

I have one class called "Person" with one property called "name".

I created individuals from the class with different names, and some names are the same.

I want to write a rule that creates instances of Property called "sameName" to bind people who have the same name. So I wrote the following rule :

Person(?p1), Person(?p2), name(?p1, ?n1), name(?p2, ?n2), equal(?n1, ?n2) -> sameName(?p1, ?p2)

The rule gave the right result but includes every person with himself, means compares also every person with himself, so I added notEqual(?p1,?p2) to force the reasoner to not compare a person with himself like this:

Person(?p1), Person(?p2), name(?p1, ?n1), name(?p2, ?n2), equal(?n1, ?n2), notEqual(?p1, ?p2) -> sameName(?p1, ?p2)

The result was empty. Did I miss something?

riad
  • 361
  • 1
  • 9
  • 19
  • 2
    Unless you assert that two individuals are `owl:differentFrom`, or there's some other way to _prove_ that they're distinct, notEqual(?p1, ?p2) won't match. Do you have any such assertions? – Joshua Taylor Mar 24 '14 at 14:53
  • Sorry for the late answer @Joshua, I had a problem with my account :). Thank you for the information. – riad May 06 '15 at 09:27

1 Answers1

1

I guess you should set all the individuals be different. If you did not do that, the reasoner could not judge whether two individuals are same or not, so the SWRL rules you wrote did not work at all.