In the previous article we learned how to create a new project in Oracle Policy Modeling and we got familiar with using the OPM tool.
In this article we will go further and write some more rules and learn more about rule writing in OPM.
So to start with rules writing, lets open our Mortgage Eligibility project in the OPM tool by clicking the “Open Project” button from the “Project” tab and selecting the Mortgage Eligibility project from the list as shown in the below screenshot.
Now let’s go to the Rules tab and open the Mortgage Eligibility Rules document and start writing the rules.
In the above rules document I have written 5 rules. Let’s go through each one of them.
The first rule is our goal (the end result which we are trying to achieve i.e. to find out if the applicant is eligible to apply for a mortgage). It is dependent on the condition that the applicant passes all the conditions of a mortgage application (which is our second rule). So our first rule will be a top-level attribute in our Data model (Data tab) which will be dependent on an intermediate level attribute. The rule in itself is self-explanatory.
The second rule will then become our intermediate level attribute which will be dependent on some other intermediate level attribute and some base level attribute (inputs from the user). Again the rule in itself is self-explanatory.
The third, fourth and fifth rule are again intermediate level attributes which depends on the base level attribute (i.e. the inputs from the user).
In the fourth rule we have used a Rule Table. The Rule Table starts with a Conclusion at the top and then a Value and Condition statements on each new row. The left hand column in each row is the Value and the right hand column is the Condition. If the Condition is satisfied then the value associated to that condition is assigned to the Conclusion, if no condition is satisfied then the value associated to the otherwise condition will be assigned.
The fifth rule using an inbuilt OPM function to calculate the applicant’s age in years. The YearDifference function provides the year difference between the current date and the applicant’s date of birth. We will look into some other inbuilt functions provided by OPM in the later articles.
Next let’s go and check our Data Model in the Data tab.
As you can see in the above screenshot, we have several new attributes created to hold the data for our new rules. Some of these are Intermediate while the rest are the Input (base-level). Some time it might happen that the type of the attribute is not the one which we want or the type of the attribute has Auto next to it, in such instance we need to edit the type to select the correct type. To edit the type double click on the attribute and select the correct type from the Type drop down.
Once we are happy with our Data Model we can switch to the Interview tab to test our rules.
To test the rules click on the Debug button from the Interview tab. The below is what we get.
If you prefer testing the rules by directly providing the data to the attributes then click on the Data tab in the debugger and right click on each base level (input) attributes and provide the required data. This will automatically run the rules and populate the intermediate and the top-level (goal) attributes.
The Decision tab on the debugger can be used to show how the decision was reached. If you righ click on the top-level attribute and click Show Decision, it will take you the Decision tab and using the tree-like heirarchy show how the result was reached.
The below screenshot shows the decision for our top-level attribute.
To sumamrise, in this article:
- We learnt to open an existing OPM project
- We wrote some rules and got bit more familiar with rule writing in OPM
- We learnt to use the Rules Table
- We learnt about functions in OPM
- We saw how the rules got translated into attributes and how to edit attributes
- We tested our rules using the debugger (both using Screens and raw Data)
In the later articles we will learn about various different inbuilt OPM functions while writing some more rules