[rules-users] Insert new facts in WorkingMemory event handler

Bruno Freudensprung bruno.freudensprung at temis.com
Mon Dec 6 06:19:37 EST 2010


Hi,

Yes, I see what you mean! That's why, before starting, I wanted to make 
sure that I was not completly mistaken ;-).
Please find my answers below.

Bruno.

Gabor Szokoli a écrit :
> That looks like a drools retelling of the chicken and egg problem to
> me: how do you intend to insert new Instances or Types ?
>   
Yes, I must admit I've had the same feeling too :-).
I have an XML containing those Instances (many) and Types (few and 
"unique"), all of them being XML elements :

<type id="1"/>
<type id="2"/>
<instance typeRefid="1" />
<instance typeRefid="1" />
<instance typeRefid="2" />
<instance typeRefid="2" />
<instance typeRefid="2" />

 and I simply plan to read my XML and add the corresponding objects into 
the session, then to fire the rules.

> >From the logical point of view, why do you need to retract
> unreferenced facts? Do you see performance issues from too many facts?
>   
Well... I wanted to delegate the whole "logic" to Drools and I imagined 
that I could "listen" to Drools' WorkingMemory's retraction events in 
order to remove the corresponding elements from the input XML.

Bruno.





More information about the rules-users mailing list