[rules-users] Major problems with dynamic rules

Edson Tirelli tirelli at post.com
Wed Jan 24 17:35:11 EST 2007


   Justine,

   I believe the problem bellow is related to the other problem you 
reported in the http://jira.jboss.com/jira/browse/JBRULES-612.
   More specifically, there was a cache stale problem that I fixed as 
part of JBRULES-612.
 
   Before opening a new JIRA, can you please test with the source code from:

http://anonsvn.labs.jboss.com/labs/jbossrules/branches/3.0.x/

   I think you will find the problem already solved. If not, let me know 
and I will work on this one too.

   The fix will be released in the 3.0.6 version.

   Thank you for reporting and providing the test cases.

   Regards,
       Edson

Justine Hlista wrote:

> Sure -- I've got a little tar file that contains the isolated example. 
> Should I send it to you, or do you want me to create an issue in JIRA?
>
> My current workaround (which is to reference all the fact classes that 
> my dynamic rules might be interested in) seems to be working for now, 
> but I don't really trust it since it seems so odd.
>
> Thanks!
> Justine
>
> On 1/22/07, *Michael Neale* <michael.neale at gmail.com 
> <mailto:michael.neale at gmail.com>> wrote:
>
>     Hi Justine. It does sound like something is amiss, could you wrap
>     up a unit test for this ? is that possible, then we can slap it to
>     a JIRA and fix it.
>
>     Thanks,
>
>     Michael.
>
>     On 1/23/07, *Justine Hlista* <justine at vsasset.com
>     <mailto:justine at vsasset.com>> wrote:
>
>         Hello,
>
>         I am having some major problems working with dynamic rules.
>         This may be a showstopper for us. Perhaps I have missed
>         something in the docs.
>
>         The main problem is significantly different behavior depending
>         on when I assert facts versus when I read drl files that use
>         them.
>
>         It *appears* that I must class load all potential fact classes
>         by referencing them in a dummy rule before I assert facts and
>         and begin using dynamic rules against them. But that is a guess.
>
>         An example:
>
>         I have 2 rule files and 1 fact class (class factA with a
>         String field1).
>
>         ---------------------
>         testCase1.drl:
>         ---------------------
>         rule Bootstrap
>             when
>                 a : factA(field1=="blah")
>             then
>                 System.out.println("bootstrap: a blah");
>         end
>         ---------------------
>         testCase2.drl:
>         ---------------------
>         rule "aIsHello"
>             when
>                 a: factA(field1=="hello")
>             then
>                 System.out.println("a: " + a.getField1());
>                 a.setField1("world");
>                 modify(a);
>         end
>
>         rule "aIsWorld"
>             when
>                 a: factA(field1 == "world")
>             then
>                 System.out.println("Retracted a with field1 = " +
>         a.getField1());
>                 retract(a);
>         end
>
>
>         If I first assert my factA (workingMemory.assertObject( new
>         factA("hello")) ) before loading either drl file, only rule
>         "aIsHello" fires.
>
>         If I first load testCase1.drl and then assert factA and then
>         load testCase2.drl, then both rule "aIsHello" and rule
>         "aIsWorld" both fire. This is the expected behavior (at least
>         for me).
>
>         If I modify testCase1.drl such that it does not reference
>         class factA but some other class (e.g. factAtoo), then only
>         rule "aIsHello" fires (as in the first case).
>
>         I am extremely confused, as I would at least expect the same
>         behavior in all cases. For our application, it is critical
>         that we be able to assert facts and modify rules independently
>         and dynamically. What am I missing about how dynamic rules
>         should work??
>
>         Any help is greatly appreciated!
>
>         Justine
>
>
>
>
>         _______________________________________________
>         rules-users mailing list
>         rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>         https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
>     _______________________________________________
>     rules-users mailing list
>     rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>rules-users mailing list
>rules-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>  
>


-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-users mailing list