model.setRemovalGroup(node, [name])

Add the specified node or nodes to a named removal group. The purpose of this function is to identify a group of nodes. If a group name is not specified the default name group is used. Each identity is scoped to an individual pattern. Those nodes must be created and managed solely by the pattern making the call. Adding nodes managed by other patterns will have undefined behavior. The function may be called multiple times within the pattern.

On completion of the pattern all nodes created or confirmed as belonging to a group in the previous execution of the pattern are examined. If a node does not appear in the same group in the new run it is deleted.

Removal groups only delete nodes, relationships are not deleted. BMC Atrium Discovery 9.0 has extended removal groups allowing deletion of both nodes and relationships.

By default the system associates the group nodes with the trigger node. This means that the trigger node must be an inferred node or it will differ with every invocation of the pattern. This can be overcome by specifying an inferred anchor node for a named group.

You can prevent a removal group being removed using the model.suppressRemovalGroup function.

For example, the following code creates a group named dbs. On the first run this contains all the discovered databases. On the second run, if any databases are not seen then they are automatically removed upon the completion of the pattern.

for row in dbs do
  db := model.DatabaseDetail(key := row.key, name :=;
  model.setRemovalGroup(db, "dbs");
end for;

Changing the name of a removal group

In the course of writing a pattern you may choose to change the name of a removal group. When you upload the new pattern with the changed removal group name, and the pattern runs, the original removal group and the nodes it contains are removed. The removal group with the new name is created, but does not have the same nodes added as they have been removed. On subsequent scans the nodes are recreated and are added to the new group when the pattern runs.

Was this page helpful? Yes No Submitting... Thank you