Hi,

 

I’m trying to figure out an issue for three days now and I’m getting kind of desperate, so I hope someone can help.

I’m using Drools in combination with an EMF model which is modeling a computer network. On init, I read the whole structure of the model and insert all elements into the working memory. Some of the entities share the super class “Device” which has an attribute “state”.

 

Now I’m having the following rule to change an attribute of one of the model entities:

 

rule "Set received status to model"

      when

            $event : SomeEvent (

                  $hostname : hostname,

                  $hoststate : hoststate,

                  $timestamp : timestamp

            )

           

            $device : Device (

                  name == $hostname

            )

           

      then

            modify($device) {

                  setState($hoststate);

            }

            db.commit(false);

                       

            retract($event);       

            System.err.println("Set status of " + $device + " to " + $hoststate);

end

 

… which works perfectly fine. Anyway, what I want to do in this test case is to react whenever all child devices of a mutual parent device (e.g. hosts on one switch) are no longer reachable. I thought of a rule like the following:

 

rule "Parent Children Test"

      when 

            $parent : Device (

                  $children : eContents,

                  eContents.size > 0

            )

           

            forall (

                  $child : Device (

                        state == "DOWN"

                  ) from $children

            )

           

      then       

           

end

 

… which by the way worked perfectly fine as long as I was not using objects from a model. My first idea was that for some strange reason the object might get copied so that I actually would have two different references after modifying it, but this is not the case. When I initialize the rule base with the circumstances that the second rule would fire, it really does. It just seems as it would not being evaluated after changing the attribute, but this is not the case either! So all I can think of is some strange caching, maybe in combination with the forall statement? Maybe someone has some experience when using Drools with EMF + CDO and experienced as similar issue?

Any help would be very very very much appreciated!

Thanks in advance

 

Georg