About Attribute Filter

The following reference page describes the behavior of Attribute filters in general and with respect to the Expand Entire Branch and Stop at Last Node options.

This page discusses:

General Behavior

The attribute filter checks object by object (starting by the leaves) to see if the given criteria is matched.

Main Algorithm

There are three possible results when checking an object against criteria:

  • OK : the criteria matches
  • KO : the criteria does not match
  • NA : the criteria cannot be applied on the object (different types for example)

Criteria Combination

You can combine different criteria with AND or OR keywords. This is very useful to express multi-criteria on the same object. Please refer to these truth tables:

Table 1. AND
NA KO OK
NA na na na
KO na ko ko
OK na ko ok

Table 2. OR
NA KO OK
NA na ko ok
KO ko ko ok
OK ok ok ok

Combinative Criteria

In the below case, the filter is looking for a reference (T0) named ‘toto’ which has a blue instance (T1).

The result will depend on the selected mode:

  • Expand Entire Branch: the entire branch will be returned.
  • Stop at Last Node: only the objects circled in red are returned.



Modes

There are two expand modes: Expand Entire Branch and Stop at Last Node.

Important: The two expand modes have different behaviors and they also treat the root differently.

Expand Entire Branch Mode

All the branches starting from the root and containing an object matching the criteria are returned, even if the intermediate objects and/or leaves do not match the criteria.

Examples: Let’s suppose a path made of R0, inst1, R1, inst2, R2, inst3, R3

Case 1 - If only R3 matches the criteria, the returned path will be [R0, inst1, R1, inst2, R2, inst3, R3]

Case 2 - If only R1 matches the criteria, the returned path will be [R0, inst1, R1, inst2, R2, inst3, R3]



Stop at Last Node Mode

All the paths starting from the root and leading to the last object matching the criteria are returned. If there are any, they are flagged. Only NA objects behind the matching objects are returned. That means that the branch can be truncated.

Example: Let’s suppose a path made of R0, inst1, R1, inst2, R2, inst3, R3.

Case 1 - If only R3 matches the criteria, the returned path will be [R0, inst1, R1, inst2, R2, inst3, R3]

Case 2 - If only R1 matches the criteria, and R2 and R3 are flagged NA, the returned path will be [R0, inst1, R1, inst2, R2, inst3, R3

Case 3 - If only R1 matches the criteria, and R2 and R3 are flagged KO, the returned path will be [R0, inst1, R1]



Application on the Root

Filters applied to the root are treated differently according to the expand mode.

Expand Entire Branch Mode

First, the criteria are applied on root elements (see part A in the figure below). If the result is OK for at least one element in the root, then all the branches starting from the root will be returned. If the result is KO, then the root is flag NA and the process starts from the leaves (see part B in the figure below).



Stop at Last Node Mode

The process starts from the leaves (see part A in the figure below), as described previously. Attribute filter is not applied on the root elements except if the filter contains combinative criteria like T0.T1.T2.name=’toto’ (see part B in the figure below).



With the attribute filter enhancement, the path return cannot end by an instance/repinstance; if it is the case, the instantiated object must be returned (it could be a reference or a representation).

Example: Take the previous structure and think about the following criteria: I3.color=’blue’ OR I3.R3.name = ‘toto’.

If I3’s color is actually blue but R3’s name is not toto, then the entire branch should be returned. First because OK OR KO result is OK. (Please refer to previous truth table). The result cannot end by I3, an instance.

With the AND operator, the result will be different: OK AND KO result is KO.



Depth

In the following structure made of R0, inst1, R1, inst2, R2, inst3, R3, inst4, R4, inst5, R5, suppose that only R2 matches the criteria.



In Expand Entire Branch mode, the returned path is [R0, inst1, R1, inst2, R2, inst3, R3].

In Stop at Last Node mode, the returned path is [R0, inst1, R1, inst2, R2].