6.2. The asset editor
6.2.1. The asset editor
The edit tab is where assets can be edited. The available options in the edit tab will depend on the type of asset being edited.
Figure 6.1. The asset editor - Edit tab
Source tab shows the DRL source for a selected asset.
Figure 6.2. The asset editor - Source tab
The config tab suggests the set of imports used in the project. Each asset has its own imports and suggest fact types that the user might want to use.
Figure 6.3. The asset editor - Config tab
The Metadata screen displays the generic data and version history of an asset. It allows a user to edit other metadata details, add descriptions and discussions which are specific to a selected asset.
Figure 6.4. The asset editor - Metadata tab
6.2.2. Business rules with the guided editor
Example 6.1. The guided editor
6.2.3. Narrowing Facts Using Package White List
project.importsproject files. For existing projects, you may create this file manually.
Rules for Defining Packages
package-names-white-listfile is a text file that accepts single package names on each line. Packages can contain wildcards as defined below:
| com.redhat.finance: allows facts from only the com.redhat.finance package. Thus, |
| com.redhat.finance.*: allows facts from the sub-packages of the com.redhat.finance package only. Thus, |
| com.redhat.finance.**: this is a combination of the above two rules. Allows |
6.2.4. The Anatomy of a Rule
- WhenThe When part of the rule is the condition that must be met. For instance, a bank providing credit in the form of a loan may specify that customers must be over twenty-one years of age. This would be represented by using when to determine if the customer is over twenty-one years of age.
- ThenThe Then part of the rule is the action to be performed when the conditional part of the rule has been met. For instance, when the customer is under twenty-one years of age, then decline the loan because the applicant is under age.
- OptionalOptional attributes such as salience can be defined on rules.
6.2.6. Adding Conditions or Actions to Rules
Procedure 6.2. Adding Conditions or Actions to Rules
- Click the plus icon in the When section of the guided editor to add a condition, or click the plus icon in the Then section of the guided editor to add an action.
- Select the condition or action from the menu and click Ok. If the package the rule belongs to has been configured to include DSL (Domain Specific Language) sentences, DSL sentences can be chosen from the menu.
- If the condition or action requires input, i.e., a date, true or false, am integer, or other input type, enter the required value.
6.2.7. Adding a Field to a Fact Type
Procedure 6.3. Adding a Field to a Fact Type
Select the ModelFrom the Project Explorer, select the Project and expand the package that contains the model.Select and Open the model from the list by clicking over it.
Add the FieldExpand the fact type by clicking the plus sign next to it and select Add Field.
Enter the Field DetailsAdd the details to the pop up dialogue. In this case, enter the name guarantor in the Field name field and select True or False from the Type drop down menu.Save the changes made to the model by selecting File and Save changes.
6.2.8. Technical Rules (DRL)
Figure 6.5. Technical Rule (DRL)