2 Replies Latest reply on Mar 19, 2012 11:02 PM by hardawaycg

    why java.util.Map doesn't work on RHS update

    hardawaycg

      my rule just like this:

      ==================java code=====================

      ......

      StatefulKnowledgeSession statefulKSession = kbase.newStatefulKnowledgeSession();

      Map valueMap = new HashMap();

      valueMap.put("year", "2012");

      statefulKSession.insert(valueMap);

      statefulKSession.fireAllRules();

      ......

      ==============================================

      =================rule code======================

      rule "rule1"

                lock-on-active true

                salience 100

           when

                $m : Map(this["year"] == "2012")

          then

                System.out.println(drools.getRule().getName());

                //String state = service.getState();

                $m.put("state","2");

                update($m);

      end

       

      rule "rule2"

        lock-on-active true

        salience 99

           when

                  $map : Map(this["state"] == "2")

          then

                System.out.println(drools.getRule().getName());

      end

      =============================================

       

      i insert a HashMap as a fact to the working memory

      my first rule(rule1) just get "state" from service ,then put into the map then update ,and in the next rule(rule2) judge "state" ,but it never goes into rule2's RHS,why?

       

      any guys can help me? tks