hi, all
I borrow this topic to ask another question. Thanks in advance!

Requirement:
===========
We have two rules. The values are hold by facts. We want to pass values from 
the first rule to the second rules.

Details of requirement:
=======================
We have a fact to hold values initially. This fact matches the first rule. 
RHS action of the first rule wants to add more values and hold new values 
and old values together in a fact. This fact with new values will match the 
second rule.

Issue:
=========
How to implement this in RHS action of the first rule?

Solution 1:
===========
In RHS action of the first rule, modify the initial fact and update values. 
Basically, we reuse the fact, just modify it and use it to match the second 
rule.

Solution 2:
===========
In RHS action of the first rule, retract the initial fact and create a new 
fact with old values and new values. Then, we use the new fact to match the 
second rule.


Eventually, my question:
========================
Which solution is preferred?

thanks for your help

gang


>From: "Gang Liu" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Re: JESS: Threads.
>Date: Wed, 04 Sep 2002 04:11:38 +0000
>
>thanks,  Ernest
>
>
>>From: [EMAIL PROTECTED]
>>Reply-To: [EMAIL PROTECTED]
>>To: [EMAIL PROTECTED]
>>Subject: Re: JESS: Threads.
>>Date: Tue, 3 Sep 2002 16:31:46 -0700 (PDT)
>>
>>
>>A Rete object has basically three synchronization mutexes:
>>
>>1) One is on the Rete network, (actually the ReteCompiler object) so
>>that only one fact may be asserted or removed at a time. Calls to
>>assert() or retract() will block while another assert() or retract()
>>is executing.
>>
>>2) Another is on the Agenda, and this one is used such that only one
>>thread can call run() at a time. The agenda can be modified during a
>>run; this is controlled by yet another lock, on the HeapPriorityQueue
>>object inside the Agenda.
>>
>>3) One is on executeCommand(), so that only one thread can be in an
>>executeCommand() call at one time.
>>
>>So your assumption that no facts can be asserted during a run is
>>false, if you're assuming that Jess will enforce this behavior. Jess
>>allows facts to be asserted while an engine is running. Your second
>>thread could call runUntilHalt() so that the engine ran continuously.
>>
>>If you wanted Jess to behave this way, you could certainly do your own
>>synchronization between your two threads using your own lock.
>>
>>Does this answer your question?
>>
>>
>>I think Gang Liu wrote:
>> > hi, all
>> > Thanks for your help in advance.
>> >
>> > Scenario:
>> > =======
>> > We have one thread to assert facts constantly to Jess and this thread
>> > doesn't start Jess engine to run. We have another thread to run Jess 
>>engine
>> > by (run) once a while. We have a rule whose RHS has a time-consuming
>> > operation. Those facts will trigger the rule.
>> >
>> > Our Assumption:
>> > ============
>> > In one round of running jess engine, we assume no new facts can be 
>>asserted.
>> > When Jess starts, it will only process all facts available at the time 
>>of
>> > starting point.
>> >
>> > Observation:
>> > =========
>> > During that time-consuming operation, new facts are added. And, in the 
>>same
>> > round of jess run, those new facts are processed also.
>> >
>> >
>> > More questions:
>> > ===========
>> > Can you tell us how those threads are coordinated by Jess engine?
>> >
>> > thanks
>> > gang
>>
>>
>>
>>---------------------------------------------------------
>>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]
>>--------------------------------------------------------------------
>>
>
>
>
>
>_________________________________________________________________
>Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>--------------------------------------------------------------------
>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]
>--------------------------------------------------------------------




_________________________________________________________________
Join the worlds largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

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