I think Waldek Jaronski wrote:
> >
> > Now, I'm not sure what this rule is trying to do -- why are there five
> > separate personality_problems patterns? Are they all intended to match
> > separate facts, or the same one, or some combination?
> >
> 
> What I'm trying to simulate in my application is a system consisting of
> decision tables, which we translate to Jess. In this small example troubling
> and perceiving are conditions in a decision table and personality_problems
> is the action. The values of conditions are aquired during the interaction
> with the user, and irrelevant conditions shouldn't be asked of, of course.
> The sequence of questions is important, it has to be the same as designed in
> a decision table. And since an action in one table can be a condition in
> another one, I thought that this rule could be a good representation of a
> decision scenario.
> Answering your question, there is only one fact with the same head, and
> different patterns with the same head should always match the same fact.
> 

Jess doesn't work that way, though. If you write two patterns, they
can match two completely different facts, or the same fact twice. If
it's the same one twice, Jess still acts as if it's two separate ones.


> Do you have any suggestions how such a rule could look like then?

Maybe I'm missing some subtlety, but what's wrong with

(defrule PERSONALITY_PROBLEMS::r001
   (declare (auto-focus TRUE))
   ?f1 <- (or (personality_problems (troubling yes) (personality_problems nil))
              (personality_problems (perceiving yes) (personality_problems nil)))
   =>
   (modify ?f1 (personality_problems yes))) 


> Thank you in advance,
> Waldek
> 
> >
> >
> > I think Waldek Jaronski wrote:
> > > Hello everyone,
> > >
> > > Despite many hard attempts I still can't figure out why precisely a new
> > > need-xxx fact is asserted...
> > > Consider the following case:
> > >
> > > There is a template
> > > (deftemplate PERSONALITY_PROBLEMS::personality_problems
> > >  (slot troubling)
> > >  (slot perceiving)
> > >  (slot personality_problems)
> > > )
> > > which is backward chaining reactive. There is always only one
> > (def)fact with
> > > this template.
> > >
> > > Now, there is a number of rules which update the slot
> > personality_problems
> > > based on the values of two other slots, eg., if troubling is yes and
> > > perceiving is yes, then personality_problems should be yes
> > > (defrule PERSONALITY_PROBLEMS::r001
> > >   (declare (auto-focus TRUE))
> > >   (explicit (PERSONALITY_PROBLEMS::personality_problems
> > (troubling ?v1)))
> > >    (test (or (eq ?v1 yes)(eq ?v1 nil)))
> > >    (PERSONALITY_PROBLEMS::personality_problems (troubling yes))
> > >   (explicit (PERSONALITY_PROBLEMS::personality_problems
> > (perceiving ?v2)))
> > >    (test (or (eq ?v2 yes)(eq ?v2 nil)))
> > >    (PERSONALITY_PROBLEMS::personality_problems (perceiving yes))
> > >
> > >   ?factid <- (explicit (PERSONALITY_PROBLEMS::personality_problems
> > > (personality_problems nil)))
> > > =>
> > >   (modify ?factid (personality_problems yes))
> > > )
> > >
> > > At the beginning all slots are equal nil. The rule r001 contributes
> > > therefore at startup to assertion of fact
> > > (PERSONALITY_PROBLEMS::need-personality_problems (troubling
> > yes) (perceiving
> > > nil) (personality_problems nil))
> > >
> > > There is also a rule which should retract this need- fact when
> > the value of
> > > troubling is becomes known:
> > > (defrule PERSONALITY_PROBLEMS::need_1_troubling_answered
> > >   (declare (auto-focus TRUE))
> > >   (PERSONALITY_PROBLEMS::answered troubling)
> > >   ?fff <- (PERSONALITY_PROBLEMS::need-personality_problems
> > (troubling ~nil))
> > > =>
> > >   (retract ?fff))
> > >
> > > When the value of troubling is known, first I assert fact
> > > (PERSONALITY_PROBLEMS::answered troubling), which activates and executes
> > > this rule, so that ?fff is retracted. Then I modify slot
> > troubling in the
> > > fact (PERSONALITY_PROBLEMS::personality_problems) with (modify
> > ...) command
> > > to the value yes. This causes, following the rule r001, assertion of
> > > (PERSONALITY_PROBLEMS::need-personality_problems (troubling
> > nil) (perceiving
> > > yes) (personality_problems nil)) which I am very happy about, but also
> > > (PERSONALITY_PROBLEMS::need-personality_problems (troubling
> > yes) (perceiving
> > > nil) (personality_problems nil)) again.
> > >
> > > I do not understand why this latter fact is again asserted
> > while the pattern
> > > (PERSONALITY_PROBLEMS::personality_problems (troubling yes))
> > should already
> > > exist since I have just modified the slot troubling.
> > >
> > > Could someone please explain it to me ?
> > > Thanks in advance,
> > > Waldek
> > >
> >
> 
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to