[rules-users] How to Compute against WorkingMemory in Drools ?

vr veneet at aol.in
Fri Apr 26 08:36:42 EDT 2013


Not sure i fully understand the approach, Can you elaborate the same via a
mock example please.

>> "insert the facts into Working Memory as they arrive and after the last
>> one."

Do you mean the Batch of alerts needs to be explictly moved to the WM
somehow ?.


*My DRL snapshot*

rule "CORRELATION"
salience 1
    when
        $alert : Alert()       
        $list : ArrayList() from collect (Alert ( sourceName=="NETWORK")
from $alert.alerts)
    then 
        checkForAlertDescription($list,drools.getWorkingMemory(),$alert);   
//Update the alert list
end



function void checkForAlertDescription(ArrayList list,WorkingMemory wm,Alert
alert) { 
      
/// i update the alert array list via fetching the list i received from the
rule above/
   ArrayList<Alert> alist =new ArrayList<Alert>();
        for(int i=0;i<list.size();i++){        
         if( ((Alert)list.get(i)).getAlertDescription().contains("ERR"))
             alist.add((Alert)list.get(i));       
          }

         alert.setAlerts(list);

         
}








-----
Thanks for the support ...!!! 
VR

--
View this message in context: http://drools.46999.n3.nabble.com/How-to-Compute-against-WorkingMemory-in-Drools-tp4023550p4023555.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list