Knowledge Relations: Using the if...else Syntax  

This scenario aims at providing the expert user with a use example of the Knowledge Relations behavior. The expert user creates a combination containing a Knowledge Advisor rule that drives 2 combinations:
  • Insert_US, which enables the user to insert a manikin matching US standards.
  • Insert_EEC, which enables the user to insert a manikin matching EEC standards.

The scenario is divided into the following steps:

Remember to save the .CATfct, the BktDriver-2D-SAE.CATPart and BktDriver-2D-EEC.CATPart files in the directory corresponding to the CATGraphicPath environment variable.

Create a Technological Type

  1. From the Start>Knowledgeware menu, access the Business Process Knowledge Template workbench.

  2. Create the Driver technological type.

    • Click the Create Technological Type icon () to create a type. The Create technological type dialog box is displayed.

    • Enter the name of the type: Driver.

    • Click OK to validate.

Add a Variable (Attribute)

  1. Add an attribute to the technological type. 

    • Click the Driver type in the specification tree and click the Add Attribute icon ( ). The Add Attribute dialog box is displayed.

    • In the Name field, enter the name of the attribute: Legislation.

    • From the Type scrolling list, select String.

    • In the Value field, enter SAE.

    • Click OK to validate. Double-click the Driver type: Legislation is displayed in the Attributes tab.

Add Behaviors to the Technological Type

  1. Click the Driver type and click the Sequential Combination icon (). SequentialCombination is displayed in the Behaviors view. Double-click SequentialCombination  and double-click Driver in the Behaviors tab.

  2. Double-click the SequentialCombination node. The Sequential Combination editor is displayed. In the Name field, enter Selecting Manikin, and click OK to validate.

  3. Click the Selecting Manikin node and click the Knowledge Relations behavior icon () to create a rule. 

  4. Double-click the KnowledgeRelation node in the Behaviors tab. The Knowledge Relations editor is displayed. 

  5. Click the Attributes tab and add the following attributes:

    Name: Legislation, Type: String.
    Name: Act_EEC, Type: Boolean, Value: false, Quality: Output
    Name: Act_US, Type: Boolean, Value: false, Quality: Output
    For more information about the Quality field, see About the Add Attribute dialog box...
  1. Add a rule to the behavior.

    • Click the Content tab then the Rule icon () in the Knowledge Tools toolbar to add the rule. The Rule Editor is displayed. 

    • Enter the name of the rule and click OK to enter the Rule editor. 

    • In the Rule Editor, enter the following script in the Rule editor. To do so, click the objects in the behaviors tree and use the wizard. Click OK twice to validate and to close the dialog box:

    if Legislation == "SAE"
    {
    Act_EEC = FALSE
    Act_US = TRUE
    }
    else
    {
    Act_EEC = TRUE
    Act_US = FALSE
    }

    At this stage of the scenario, your workbench is similar to the graphic opposite.

     

  2. Link the Knowledge Relation behavior with the Selecting Manikin Combination for the Knowledge Relation to react to the combination changes.

    • Expand the KnowledgeRelations node and right-click the Legislation attribute, and select Legislation object>Link To.
    • Expand the Driver node and click the Legislation attribute. Both attributes are now linked.
  1. Click the Selecting Manikin node in the Behaviors tab and click the Sequential Combination icon () to add a new combination. This new combination will enable the user to load a manikin matching the US standard.  

  2. Double-click the SequentialCombination node in the Behaviors tab. The SequentialCombination editor is displayed. 

    • In the Name field, enter Insert_US.
    • Click OK to validate.
  1. Click the Insert_US combination in the Behaviors tab and click the Load behavior icon. The LoadDocument behavior is displayed in the Behaviors tab.

  2. Double-click the LoadDocument node. The Load Document editor is displayed.

    • In the Properties tab, select Expert&Administrator from the scrolling list of the Behavior States and select the Activate check box.  
    • Click OK to validate.
  1. Click the Insert_US combination in the Behaviors tab and click the Bind Object behavior icon. The BindObject behavior is displayed in the Behaviors tab.

  2. Double-click the BindObject node. The Bind Object editor is displayed.

    • In the Relative name field, enter: ../../../.. to access the root product. For more information about the syntax to use in the Relative name field, see About the Bind mechanism...
    • In the Properties tab, select Expert from the scrolling list of the Behavior States and select the Activate check box.  
    • Click OK to validate.
  1. Click the Insert_US combination in the Behaviors tab and click the Insert Components behavior icon. The InsertComponents behavior is displayed in the Behaviors tab.

  2. Double-click the InsertComponents node. The Insert Components editor opens.

    • From the Definition scrolling list, select Existing Component.
    • Click the Existing component field, expand the LoadDocument node and select the output Document.
    • Click the Father product field, expand the BindObject node and select the output Link.
    • Set the number of instances to 1.
    • In the Properties tab select the Activate and Focus check boxes.  
    • Click OK to validate.
    At this stage of the scenario, your workbench is similar to the graphic opposite.
  1. Click the Selecting Manikin combination in the Behaviors tab and click the Sequential Combination icon () to add a new combination. This new combination will enable the user to load a manikin matching the EEC standard. 

  2. Double-click the SequentialCombination node in the Behaviors tab. The SequentialCombination editor is displayed. 

    • In the Name field, enter Insert_EEC.
    • Click OK to validate.
  1. Click the Insert_EEC node in the Behaviors tab and click the Load behavior icon. The LoadDocument behavior is displayed in the Behaviors tab.

  2. Double-click the LoadDocument node. The Load Document editor is displayed.

    • In the File path field, click and select the BktDriver-2D-EEC.CATPart file.
    • In the Properties tab, select Expert&Administrator from the scrolling list of the Behavior States and select the Activate check box.  
    • Click OK to validate.
  1. Click the Insert_EEC node in the Behaviors tab and click the Bind Object behavior icon. The BindObject behavior is displayed in the Behaviors tab.

  2. Double-click the BindObject node. The Bind Object editor is displayed.

    • In the Relative name field, enter: ../../../.. to access the root product.
    • In the Properties tab, select Expert from the scrolling list of the Behavior States and select the Activate check box.  
    • Click OK to validate.
  1. Click the Insert_EEC node in the Behaviors tab and click the Insert Components behavior icon. 

  2. Double-click the InsertComponents node. The Insert Components editor opens.

    • From the Definition scrolling list, select Existing Component.
    • Click the Existing component field, expand the LoadDocument node and select the output Document.
    • Click the Father product field, expand the BindObject node and select the output Link.
    • Set the number of instances to 1.
    • From the Allow sub typing scrolling list, select false. 
    • In the Behavior States field and select the Activate and Focus check boxes.  
    • Click OK to validate.
  1. Expand the Insert_EEC variables node, right-click the Activity variable, select Activity object>Link To, expand the KnowledgeRelations variables node and click the Act_EEC output. 

  1. Expand the Insert_US variables node, right-click the Activity variable, select Activity object>Link To, expand the KnowledgeRelations variables node and click the Act_US output. 

  2. Save your .CATfct file in the Graphics directory. Click here to open the created .CATfct.

Generate the Workbench

  1. Click the Generate Applicative Workbench icon () to generate a user workbench. Enter the name of the workbench in the Workbench name field, Select Manikin in this example, and select the workbench type, Product here.

Test the Workbench

  1. From the Tools>Options>Knowledgeware>Business Knowledge Template menu, select All Users from the Access Rights scrolling list and click OK to work in a User environment.

  2. Select Product1 in the specification tree and select the Driver check box to type the root product. Its name is now Driver:Product1.

  3. Right-click Driver (product1) and select Selecting Manikin

The manikin matching the US standard is inserted.

  1. Double-click the Legislation attribute located below the driver (Product1) feature and enter EEC in the opening dialog box.

  1. Right-click Driver (product1) and select Driver

The manikin matching the EEC standard is inserted.

For more information about: