drools - Will logical facts be re-inserted when an object is updated but the updated fields from that object are not included in the rule that adds the fact? -


what want find out drools truth maintenance system re-insert logical fact (basically update existing 1 fresh object) when object part of rule inserting changed none of fields included in rule have changed?

below example show i'm talking about. lets have 2 classes below:

public class class1{     int x;     int y;     int z; } public class class2{     class1 class1;     int x;     int y; } public class logicalfact{     class2 class2; } 

and next 2 example rules insert logical fact object class "logicalfact" :

rule "example1"     when         $class2 : class2(x > 20)             insertlogical(new logicalfact($class2)); end  rule "example2"     when         $class2 : class2(class1.x > 10, x > 20)             insertlogical(new logicalfact($class2)); end 

lets y field class2 object ("class2") changed , z field class1 object on class2 object ("class2") pointing @ changed. in "example2" rule change in field y and/or change in field class1.z somehow cause rule re-evaluated , create , insert logical fact again scratch though these values not changed? different in "example1" case because uses x, evaluated if x class2 object changed?

an edge case setting same values again fields part of rule, in case insert logical fact again?

going further if logical facts being inserted again scratch re-evaluate rules used, though there not difference?

 /* based on "logicalfact" object inserting logical fact class   "anotherlogicalfact". */   rule "logical-fact-rule"      when logicalfact(...)               insertlogical(new anotherlogicalfact());  end 

the rules in example simple might more complex including use of accumulate functions etc. re-evaluating rules rules nothing costly process.

probably of taken care of , truth maintenance system sticking created logical fact if there no change values on rules based. wanted ask opinion sure.

if turns out true best way approach it?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -