I think Alexander Lamb wrote:
> 
> (defrule component1Rule
>     (userSession
>         (currentTaskName "COMPLETER")
>         (somethingelse)
>         (andanotherpattern)
>         (OBJECT ?x))
>     =>
>     (call ?x setLeftComponentName "CompleterComponent")
> )
> [or]
> (defrule component1Rule
>     (userSession (currentTaskName "COMPLETER") (OBJECT ?x))
>     (userSession (something) (OBJECT ?x))
>     (userSession (somethingelse) (OBJECT ?x))
>     (another match)
>     =>
>     (call ?x setLeftComponentName "CompleterComponent")
> )
> 
> What is the most efficient?

The former is a lot more efficient; the latter would match three
different facts that all had ?x in the OBJECT slot, if they
existed, while the former will only match a single fact. Jess doesn't
realize that the multiple fact scenario wouldn't be possible
here. Knowing that all the matches will hit one fact means there will
be only one join in the Rete network for the first rule; for the
second, there will be one for each separate pattern. "Unifying" the
patterns (making sure ?x is the same for each occurrence) would
represent a lot of redundant work; in general, more joins == more
work, besides.

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