On 13 August 2010 18:36, Manav <manav7574(a)yahoo.com> wrote:
Your explanation is absolutely superb. I modified my drl as per
your
suggestions and it's just been completely transformed. Just one question
regarding one suggestion below :
-- is this something like a for each loop in java . This is the first
example i have seen in drl
In a way, yes. Since
Foo( ... ) # match any Foo according to constraints, if any
Bar( ... ) # match any Bar according to constraints, if any
these two patterns produce the Cartesian product, such as a nested loop
does. BUT, the order of the pairings is indeterministic, and changes in WM
might influence this loop, even make it infinitive. Therefore, "in a way".
-- will this automatically iterate over as many languages as have been
inserted ?
That's the whole idea :-)
-- the inserts .. don't they have to be within a rule block ? or
did you
just omit other things to keep it simple
You can do it in the Java application framework. You can also write a
high-salience one-shot rule such as
rule "1st shot"
when
then
insert( new Language( "Japanese" ) );
insert( new Language( "French" ) );
// more of the same
end
Cheers
Wolfgang