I think Samson Tu wrote:
> 
> My problem is I don't see how to write the RHS of a (need-object) rule
> to get the behavior I want when I have two different ways of concluding
> A, as in
> 
> (B -> A) or (C -> A)
> 
> Basically, I want  need-B XOR need-C, not both if either will conclude
> A.
> 

I can't really add anything to what the other poster suggested. The
rules that generate B and C would need to explicitly mention either A
or the other (B or C) prevent each other from firing. Jess's backward
chaining is just a simulation on top of forward chaining, and it
certainly has limitations -- this is one of them.

> 
> I don't need to check that (in the following example) the Assertion
> chronic_steroids object is already there? Jess asserts "need-object" but
> not "object" patterns, right?
> 
> > > (defrule R14b " "
> > >   (need-object (is-a Assertion)(concept "chronic_steroids"))
> > >   (not (object (is-a Assertion)(concept "chronic_steroids")))
> > > =>...
> 

When Jess compiles a (need-object) pattern in a rule, it inserts a
corresponding (not (object)) pattern, as you can see in the session
below. 

Jess> (do-backward-chaining foo)
TRUE
Jess> (defrule need-foo (need-foo A B C) => (assert (foo A B C)))
TRUE
Jess> (ppdefrule need-foo)
"(defrule MAIN::need-foo
   ?__factidx0 <- (MAIN::need-foo A B C)
   ?__factidx1 <- (not (MAIN::foo A B C))
   =>
   (assert (foo A B C)))"
Jess>



---------------------------------------------------------
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