I'll see if I can reproduce it in 5.6.. I'm traveling so it will take a couple of days
T-Mobile. America's First Nationwide 4G Network
rrdh <rrdh@gmx.net> wrote:
>Ah, thanks for letting me know! I'll try an earlier version then.
>
>
>On Sun, Jul 14, 2013 at 8:54 PM, Wolfgang Laun <wolfgang.laun@gmail.com>wrote:
>
>> It's a bug, possibly a regression from 5.2.0 that has been in 5.3.0,
>> 5.4.0 and is still in 5.5.0.
>>
>> It should be very simple to add http://codetidy.com/6206/ as a test
>> case so that this will be fixed.
>>
>> -W
>>
>>
>> On 14/07/2013, Wolfgang Laun <wolfgang.laun@gmail.com> wrote:
>> > Which Drools version do you use?
>> >
>> > On 14/07/2013, k <rrdh@gmx.net> wrote:
>> >> Hi,
>> >> basically it's the same problem this guy had
>> >>
>> http://stackoverflow.com/questions/11485122/non-template-dynamic-rules-in-drools
>> >> <
>> http://stackoverflow.com/questions/11485122/non-template-dynamic-rules-in-drools
>> >
>> >>
>> >> , but the links in that question don't work.
>> >>
>> >> I'd like to dynamically add rules to a running session, but can use
>> >> 'eval'
>> >> only in the very first one. If I add a second rule like the following,
>> it
>> >> won't execute:
>> >>
>> >> ---
>> >>
>> >> String test2 =
>> >> "\nrule id4" +
>> >> "\nwhen" +
>> >> "\neval(0 == 0)" + // if this eval is removed, "done2" is inserted
>> >> "\nthen" +
>> >> "\ninsertLogical( \"done2\" );" +
>> >> "\nend";
>> >>
>> >> kbuilder.add(ResourceFactory.newByteArrayResource(test2.getBytes()),
>> >> ResourceType.DRL);
>> >>
>> session.getKnowledgeBase().addKnowledgePackages(kbuilder.getKnowledgePackages());
>> >>
>> >> fired = session.fireAllRules();
>> >> System.out.println(fired); // 0
>> >> effects = session.getObjects();
>> >> assertTrue("fired", effects.contains("done2")); // fails
>> >>
>> >> ---
>> >>
>> >> You can see the complete Test at http://codetidy.com/6206/
>> >>
>> >> I'm also not sure if this is the correct way to dynamically add rules,
>> so
>> >> please let me know, if there's a better way to add rules from strings.
>> >>
>> >> How can I dynamically add new rules to a running session and still use
>> >> eval?
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >> http://drools.46999.n3.nabble.com/Dynamic-Rules-and-Eval-tp4024908.html
>> >> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> >> _______________________________________________
>> >> rules-users mailing list
>> >> rules-users@lists.jboss.org
>> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>
>> >
>> _______________________________________________
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>_______________________________________________
>rules-users mailing list
>rules-users@lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users