I have a question in Jess Tab in Protege,I am building an ontology of 1 class Message and 3 instances :message 1 message2 message 3 , each each 3 datatype properties : category , interests , class .For each message I want to classify it as ham if the category and interests are equal , spam otherwise.The classification should be done using Jess Rules by which the class slot / property should change to ham or spam so I use modify-instance for that , as the interests of a message instance could change by time so it's not a static classification (or I would need to reclassify it)
Here is an example for message1 in protege :
So I mapped the instances as shown to Jess Engine using Jess Tab :
Here are screenshots with my rules the :
When I type (run) the Jess engine will classify only 1 instance correctly which is message3 the last instance , I mean I thus have to send only 1 instance at a time to the engine else it won't classify all messages correctly.
I tried to otherwise print the classification value and it works correctly( in my example the 3 messages should be classified as ham )
and when I added both rules the result was that the "ham/spam" printing enters a for loop . I've asked a question before and I got an answer that infinite loop happens because the rule keeps firing as the "if " in the action (RHS) is always correct :
Is this a feature of Jess that it considers the last received instance. And is there a way to force Jess engine to consider more than 1 message at a time ? and why is the infinite loop happening ?
I am really stuck in this part and in desperate need for speed to finalize it for my thesis . So you help is appreciated . (I have implemented these rules in swrl busing SWRL+Jess Tab in Protege and the rules worked fine the problem was the facts were asserted in the ontology and I want them to be modified not asserted so that's why I used Jess Rules , do you think I am on the write track or I should use Sweet Rules for example better ?)
I updated the rule as follows by making constraint on the fact's slot value but no change :
(defrule MAIN::test2
(object (is-a http://www.owl-ontologies.com/Ontology1496039955.owl#Message) (OBJECT ?o))
(object (OBJECT ?o) (http://www.owl-ontologies.com/Ontology1496039955.owl#interests $?i))
(object (OBJECT ?o) (http://www.owl-ontologies.com/Ontology1496039955.owl#category $?c&:(eq (intersection$ $?i $?c) )))
(object (OBJECT ?o) (http://www.owl-ontologies.com/Ontology1496039955.owl#class $?cl&:(neq $?cl "spam")))
=>
(modify-instance ?o (http://www.owl-ontologies.com/Ontology1496039955.owl#class spam)))