Edit

Share via


Reassert

To reassert means to call the Assert function on an object that is already in the engine's working memory. A reassert command is equivalent to issuing a retract command for the object, followed by an assert command.

.NET Objects

The object is first retracted and any actions on the agenda for rules that use the object (in a predicate or action) are removed. The object is then asserted back into working memory and evaluated as any object that is newly asserted. This means that any rules that use the object in a predicate are re-evaluated and their actions are added to the agenda as appropriate. Any rules that previously evaluated to true and only use the object in their actions will have their actions re-added to the agenda.

TypedXmlDocument

When a top level TypedXmlDocument (TXD) is reasserted, the child TXDs that are created when the top level TXD is initially asserted have different behaviors depending on the state of the child TXDs. In the case of a new child node or a child node that is dirty, meaning that at least one of its fields has been changed in the policy by using a rule action, an assert, or reassert action is performed on the child node. Any existing child node that is not dirty remains in the working memory. The following example is a simplified scenario that describes the behaviors of the child nodes when their parent node is reasserted.

Assume there are three TXDs currently in the working memory: P, C1, C2, and C3. P is the top level TXD, the parent node; each child node contains a field x.

P

C1 (C1.x = 1)

C2 (C2.x = 1)

C3 (C3.x = 1)

Next, assume the following operations have been performed as a result of rule action:

  • The field (x) value for C2 is updated.

  • C3 is deleted by using user code.

  • An additional child node, D, is added to P by using user code.

Note

A node will not be marked dirty by the Business Rule Engine from operations, of which the engine is not aware. For example, adding, deleting, or modifying a node programmatically in an external application.

The new representation of the objects in working memory is as follows.

P

C1 (C1.x = 1)

C2 (C2.x = 0)

D

Now, reassert P. The following points summarize the behaviors of the child nodes:

  • Node C2 is reasserted, because it has become dirty after its field being updated.

  • Node C3 is retracted from the working memory.

  • Node D is asserted into the working memory.

  • Node C1 remains unchanged in the working memory, because it was not updated before P was reasserted.

TypedDataTable

If Reassert is issued on a TypedDataRow, that row is retracted and then asserted into working memory. If Reassert is issued on the TypedDataTable, all associated TypedDataRows are retracted and then asserted.

DataConnection

All TypedDataRows retrieved through the DataConnection are retracted. All predicates that use the DataConnection are then re-evaluated, causing the DataConnection to be requeried to create the relevant TypedDataRows.

See Also

Engine Control Functions