Defining a Relationship Filter

You can define a relationship filter by setting conditions for either side of the relationships defined in a scope you own. You might want a scope to be restricted to programs that have a cyclomatic complexity greater than 300 and that are defined in COBOL source files, for example. The example below shows you how to do that step by step.

Condition definitions are based on the Repository Exchange Protocol (RXP), an XML-based API that you can use to interact with application-level information in the workspace repository.

In the Scope Editor, relationships and entities for which a filter has been defined are color-coded magenta. A tool tip over the filtered entity displays the text of the condition.

  1. In the Scope Editor, select the relationship you want to set conditions for and choose:
    • Left Cond in the right-click menu to qualify the entity on the left side of the relationship.
    • Right Cond in the right-click menu to qualify the entity on the right side of the relationship.
  2. The Condition window opens. In the Condition window, click:
    • attribute to qualify the entity according to the value of a given attribute. Programs that have a cyclomatic complexity greater than 300, for example.
    • has (not) related object to qualify the entity according to a given relationship type. Programs defined in COBOL source files, for example.
    • add AND condition to qualify the entity according to inclusive criteria using an AND operator. Programs that have a cyclomatic complexity greater than 300 and that are defined in COBOL source files, for example.
    • add OR condition to qualify the entity according to exclusive criteria using an OR operator. Programs that have a cyclomatic complexity greater than 300 or that are defined in COBOL source files, for example.
  3. The Condition window displays the shell definition for the selected condition. The following steps describe how to qualify the program entity using an AND operator. The procedure for other entities and conditions is similar.
  4. In the definition for the AND condition, click attribute. The definition for the attribute condition is displayed:
    <attr name="..." op="..." arg="..." negate="..."/>
    
    Note: Click the X in a definition to delete the condition.
  5. Click the ellipsis (…) in name="…". The User Input dialog opens. In the User Input dialog, select the Program entity in the Choose entity drop-down and the Cyclomatic Complexity attribute in the Attributes for Program drop-down, then click OK. The attribute is added to the condition definition.
    Note: Click Delete in the User Input dialog to delete the criterion defined in the dialog.
  6. Click the ellipsis (…) in op="…". The User Input dialog opens. In the Choose new value drop-down, choose the greater than (>) symbol, then click OK. The greater than symbol is added to the condition definition.
  7. Click the ellipsis (…) in arg="…". The User Input dialog opens. In the Enter new value drop-down, enter 300, then click OK. The new value is added to the condition definition:
    <attr name="Cyclomatic Complexity" op=">" arg="300"
    negate="..."/>
    
    Note:

    In a condition definition, negate means “not the specified criterion.” Programs that do not have a cyclomatic complexity greater than 300, for example. Click the ellipsis (…) in negate="…" to set its value to true. Ignore the field otherwise.

  8. In the definition for the AND condition, click has (not) related object. The definition for the relationship type condition is displayed:
    <hasrelated negate="...">
    
  9. In the choices for the relationship type condition, click define relationship type.
  10. The choices for the relationship type are displayed. Click define relationship. The definition for the relationship type is displayed:
    <rel name="..." negate="..."/>
    
  11. Click the ellipsis (…) in name="…". The User Input dialog opens. In the Choose entity drop-down, select the Program entity. In the Relations for Program drop-down, select the IsDefinedInCobol relationship, then click OK. The relationship is added to the condition definition:
    - <hasrelated negate="...">
    - <reltype>
    <rel name="IsDefinedInCobol" negate="..."/>
    </reltype>
    </hasrelated>
    
  12. The AND condition is now complete. The diagram scope will be restricted to programs that have a cyclomatic complexity greater than 300 and that are defined in COBOL source files. The full condition looks like this:
    - <cond>
    <and negate="...">
    <attr name="Cyclomatic Complexity" op=">"
    arg="300" negate="..."/>
    - <hasrelated negate="...">
    - <reltype>
    <rel name="IsDefinedInCobol"
    negate="..."/>
    </reltype>
    </hasrelated>
    </and>
    </cond>