Wolfgang is correct, we have a single Rete instance.  He is also correct in
that we can always obtain a reference to the original object via the shadow
fact, or some other way.

The problem is that when an update happens to an object a new copy of the
updated object is passed.  So, we have two physical objects that represent
the same logical piece of data, say A1 that is already in Rete as a shadow
fact, and A2 the updated version of A1 that has just been passed to us.

My question was: what is the best, or simplest, way to update Rete with the
new object.

Thanks.
  
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Wolfgang Laun
Sent: Tuesday, December 11, 2007 4:48 AM
To: [email protected]
Subject: Re: JESS: Updating shadow facts from object copies

I have understood Will's problem to be within a single Rete object. 
Basically, the Rete.add() method returns a reference to the created 
jess.Fact. As a shadow fact in good standing it'll have a slot OBJECT 
containing a reference to the original Java object. "Therefore, the 
original object is always easily available." (The Jess Manual, 5.3.2)

Hal Hildebrand wrote:

> Wouldn't the fact id be (potentially) different in different 
> instances  of the rules engine?  I believe these are assigned in 
> declaration  order, so unless every instance is defining instances in 
> precisely the  same order, then you'd end up with the same logical 
> fact having  different ids in different VMs.
>
> FWIW, there's a good paper by someone who did something remarkably  
> similar: www.waset.org/pwaset/v4/v4-18.pdf
>
> Myself, I've taken another route, which is using shadow facts for  
> everything I want distributed.  The facts all have generated UUIDs, 
> so  there's no issues with locally generated ids in a distributed 
> system.   Then it's  a fairly simple matter to translate to the local 
> facts when  the shadow changes and vice versa.
>
> On Dec 10, 2007, at 1:07 PM, Will Edwards wrote:
>
>> We're attempting to integrate a JavaSpaces implementation with Jess.
>>
>> When an object changes in the JavaSpace we receive a notification  
>> that the
>> object has changed and a copy of the changed object which we want to  
>> add or
>> modify as a Jess shadow fact in the rules engine.
>>
>> Our problem is that in this environment we do not get a reference to  
>> the
>> original object but a new (by value) copy of the object.  So, we  
>> want to
>> modify the existing Jess fact with the new copy. Assuming we have the
>> FactIDValue (from the original rete.add) is there a reasonably  
>> simple way to
>> do this?
>>
>> Currently we are using a FactFilter to get the existing object, call
>> rete.remove() to remove the old copy and then rete.add() with the  
>> new copy.
>> This is of course prone to potential race conditions, etc.
>>
>> What we would like to do is use modify() or updateObject() but both  
>> of these
>> seem to require that the original object reference be maintained.
>>
>> Thanks in advance.
>>
>> --------------------------------------------------------------------
>> 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] .
>> --------------------------------------------------------------------
>>
>
> --------------------------------------------------------------------
> 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]
> --------------------------------------------------------------------
>

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

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