[rules-users] 'from global' and the workingMemory

Anstis, Michael (M.) manstis1 at ford.com
Wed Jul 30 04:55:19 EDT 2008


I believe the "from" keyword will iterate only the items in list1.

I don't consider it naïve though; just doing what it is documented to do.

If you want to iterate facts in the RETE network you need to insert them into working memory.

You could use a rule to do this (copy from a global into WM) or do it from your application.

-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Yoni Mazar
Sent: 30 July 2008 09:46
To: rules-users at lists.jboss.org
Subject: [rules-users] 'from global' and the workingMemory


Hi all,

Let's look at the following example:
****DRL file***************
global java.util.List list1;
global java.util.List list2;
rule "r1" when Fact(...) from list1 then ....
****Application************
List<Fact> facts1 = ...
List<Fact> facts2 = ...
List<Fact> allFacts= facts1+facts2

StatelessSession session = ...
session.setGlobal("list1", facts1);
session.setGlobal("list2", facts2);

session.execute(allFacts)
The question: will rule "r1" use the facts from the working memory and a
rete algorithm, or will it naively loop on list1 items?

BTW, can we use generic in the DRL section? for example:
global java.util.List<Fact> list1;

Thanks for the help, Yoni
-- 
View this message in context: http://www.nabble.com/%27from-global%27-and-the-workingMemory-tp18728639p18728639.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list