0

I've just started doing work on ontologies with Protegé and I'm trying to understand how to use SWRL rules. I'm afraid I don't get the concept or how to correctly treat them, as I'm not able to produce any output. I'll explain a bit more a simple case I created to test this:

I've created three individuals, called A, B and C. Each one with a test property, that has a boolean range. On the property assertions tab of each one I've initialized their values, so they are test(A,true), test(B,true) and test(C,true). To test how rules work, I created a rule like this: test(A,true), test(B,true) -> test(C,false). The way I understand it is that, if A and B's test property is true, C's one would turn false. To do so, I start the reasoner (Pellet) but nothing happens. I mean, it says the reasoner is active and no "inconsistent ontology" messages appear, but C's test value doesn't change. I'm sure this must be a really simple confusion but I can't seem to find it anywhere nor check if the rule has been activated.

Thank you in advance.

jmnavarro
  • 147
  • 7

1 Answers1

1

The inference doesnt work like that, you cannot retract test(C, true) if you've asserted it. Your ontology probably includes both test(C, true) and test(C, false) which is completely legal unless you've specified otherwise; in which case then you'd see the inconsistency.

Michael
  • 4,858
  • 19
  • 32
  • Thank you for your answer. Then, what would be the correct procedure for initializing the value of a property and then changing it inside a rule? – jmnavarro Dec 13 '13 at 12:29
  • You cannot retract asserted information via a rule, it just does not work like that. For your example, you should leave the value for `test` on `C` unspecified, and construct the rule such that it will always infer a value for it. That way if you change the assertion for `A` or `B` the inferred value of `test` for `C` will change appropriately. – Michael Dec 13 '13 at 13:44
  • Okay, I guess data assertions work as I first thought... So, is there any way working with OWL and SWRL to "initialize" (understanding it as you would do in Java, for example) a property's value and change it to another value when a rule is activated? – jmnavarro Dec 16 '13 at 16:31
  • Yes, by having the rule do it. – Michael Dec 18 '13 at 11:50
  • Hey again! I'm working again on this problem. To test this initialization problem I've created a test class called Test, an individual of that class called Indiv and a property called Prop, with Test domain and int range. After that, I created a rule like this: "Test(Indiv)->Prop(Indiv,5)". If I understood your explanation correctly, now Indiv should have a 5 on its Prop property, but I can't see anything happening (Probably that's another question, how can I see on Protegé the change the rule does?) – jmnavarro Jan 27 '14 at 09:42
  • New questions should not be posted as comments. – Michael Jan 27 '14 at 12:21
  • Umm, OK, I guess, though it would be a little more helpful if, apart from correcting me you stated how to correctly ask this question, which is totally related to the problem at hand. – jmnavarro Jan 27 '14 at 22:40