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(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Yoni Mazar
Sent: 30 July 2008 09:46
To: rules-users(a)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-tp18728639p...
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users