Hi, I got more fundamental question on the rule firing.
For example,
(reset)
(deffunction change-baby () (printout t "Baby is now dry" crlf))
 
(defrule do-change-baby
      (baby-is-wet)
      =>
      (change-baby))
 
(assert (baby-is-wet))
  
At this moments, I have two facts and one rule.
 
Jess> (facts)
f-0   (MAIN::initial-fact)
 
f-1   (MAIN::baby-is-wet)
 
For a total of 2 facts.
 
Jess> (rules)
MAIN::do-change-baby
 
For a total of 1 rules.
 
Then, if I call "(run)", the do-change-baby rule is fired as I expected.
 
At this time, I still have two facts and one rule.
Jess> (facts)
f-0   (MAIN::initial-fact)
 
f-1   (MAIN::baby-is-wet)
 
For a total of 2 facts.
 
Jess> (rules)
MAIN::do-change-baby
 
For a total of 1 rules.
 
But even though I called "(run)" again, do-change-baby is not fired. It looks like the RHS of do-change-baby seems to be extracted from the knowledge base. Is this correct interpretation?
Is there any way to look at the LHS and RHS of the rules in the knowledge base?
 
These behavior is not what I expected. I think the rule should be untouched and the fact caused firing the rule should be removed from the knowledge base. In other words, we should have a rule to change baby's diaper and the fact of "baby-is-wet" should be removed because we changed it. But Jess behaves in the opposite way.
Is there any reason for this behavior or am I misunderstanding something a lot?
 
What should I do, if I want the do-change-baby is always fired when there is the fact, baby-is-wet is in the knowledge base?
 
Is there any way to see how many functions are in the knowledge base? I can see the rules and facts with (rules) and (facts) function call, but there is no (functions) in Jess.
 
Thanks in advance. Any comments would be of great help.
 
Young-Jin

Reply via email to