You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a performance benefit of propagating facts through the rete graph in bulk. This is possible through the use of batch methods exposed by the ISession - InsertAll, UpdateAll, RetractAll.
However, when rules yield linked facts, they are propagated one by one, without any mechanism to achieve a similar performance benefit by batching fact propagation. Consider the following:
RuleA
Match Fact1
Yield Fact2
RuleB
Match Fact2
It is possible to insert a 1000 instances of Fact1 in bulk, but RuleA will fire for each instance of Fact1 and will yield a new instance of Fact2. Those instances of Fact2 will get propagated through the rete graph one by one.
This feature will allow queuing of linked facts, instead of propagating them immediately, allowing the client application to initiate the propagation of queued linked facts in bulk.
By default NRules will continue to automatically propagate linked facts after the execution of each rule's actions, so there is no change in behavior for existing applications, unless they explicitly enable this feature.
For example:
session.AutoPropagateLinkedFacts =false;//Default is true
session.InsertAll(factsOfTypeFact1);//Fact1 facts propagate in bulk, and RuleA activates
session.Fire();//RuleA fires
session.PropagateLinked();//Linked facts Fact2 are propagated in bulk and RuleB activates
session.Fire();//RuleB fires
Note:
Explicit insertion, update or retraction of facts through the session will also flush the linked facts queue and propagate those linked facts.
The text was updated successfully, but these errors were encountered:
There is a performance benefit of propagating facts through the rete graph in bulk. This is possible through the use of batch methods exposed by the
ISession
-InsertAll
,UpdateAll
,RetractAll
.However, when rules yield linked facts, they are propagated one by one, without any mechanism to achieve a similar performance benefit by batching fact propagation. Consider the following:
It is possible to insert a 1000 instances of Fact1 in bulk, but RuleA will fire for each instance of Fact1 and will yield a new instance of Fact2. Those instances of Fact2 will get propagated through the rete graph one by one.
This feature will allow queuing of linked facts, instead of propagating them immediately, allowing the client application to initiate the propagation of queued linked facts in bulk.
By default NRules will continue to automatically propagate linked facts after the execution of each rule's actions, so there is no change in behavior for existing applications, unless they explicitly enable this feature.
For example:
Note:
Explicit insertion, update or retraction of facts through the session will also flush the linked facts queue and propagate those linked facts.
The text was updated successfully, but these errors were encountered: