I did assert both (Room and Thermo). I do the setLevel(..) on Object
Thermo only. So I thought I should then modify this. When I do
it seems that the engine doesnt get this. When I do modify the room
instead (not calling any setter on room) it works as expected
(but with sideeffect that other rules meeting the same conditions
do not get fired).
The question actually is: In an object tree (every node a fact) do I
have to modify the nodes/facts which have changed, or can I do a just
_one_ modify(..) on the root node ? (with the engine traversing the
tree and checking which subnode has to be modified and doing so)
For me it looks like the modify on thermometer somehow removes the
fact from memory or disconnecting my thermometer from room or
something.
Michael Neale wrote:
well, if you have both room and thermometer asserted as seperate facts,
you
need to modify each one if you want their changes to be re-considered (not
always the case).
The engine will then re-check all the combinations and create activations
for modified facts - basically its the same as if you retracted and
asserted
those facts anew.
On 2/22/07, seeker <janko.dimitroff(a)dai-labor.de> wrote:
>
> I have a fact which holds a reference to another fact. I wonder which one
> do I have to modify in my RHS.
> My Objects are Room and Thermometer. Room holds reference to Thermometer
> (and that has a property describing the value).
>
> When my rule fires I want to decrease the temperature level to simulate
> that the room gets colder until a certain value A is reached. So the rule
> should be called several times until the actual level equals A.
>
> This works ONE time when I set the new value on Thermometer and modify
> Thermometer, not reaching A (the rule isnt fired again).
> But works as expected when I modify Room instead of Thermometer (rules is
> fired several times).
>
> I'm new to drools and wonder if that is desired or if I do something
> wrong.
>
> To make things more confusing: When several rules met the same
> conditions,
> does only one rule gets fired or do all get fired (as I read it from
> Figure 1.19 of the documention).
>
> If I modify Room my other rules _dont_ get fired. When I had modified
> Thermometer my other rules _do_ get fired.
--
View this message in context:
http://www.nabble.com/modify-object-Tree--tf3268137.html#a9097084
Sent from the drools - user mailing list archive at
Nabble.com.