Oracle Policy Modeling, the tool used to create and build rulebase, comes with lot of features to make your project perfect. Managing the project elements like the attributes, entities are really important to have a well organized rulebase. Creating and maintaining properties file is mandatory for high level/complex projects. You can decide to make it optional but, will affect your ability to do customizations, implement plugins like custom formatter plugin, and do input validation. Because all of this depends on the attribute properties which is accessible only via properties file. We will decide to go with no properties file if we are dealing with OPA projects with just one rule document/simple rules. Let’s see how to create properties file in OPM and what are the benefits of creating one.
Create/Add Properties File in OPA Project
Let’s start by creating a sample project. Open OPM tool and go to file->new project;
Give some name for the project. I am using ‘PropFile’ as the name.
Now you will get the Project Explorer view which shows you the project structure. Right click on the properties folder and select Add New Properties File. You can add anywhere in the project but, I will recommend to maintain the project structure as it is.
Managing Attributes and Entities
To explain this, I am creating a sample project. In this project, I have two rule docs. One main rule doc which has the conclusion where we find the person is eligible or not based on two conditions. First, his age is above 18 and second, the person has a credit card where the latter is inferred from two other conditions which is written as separate rule doc. This is not that complex rule but, for the sake of understanding, we can create two properties file to maintain the attributes involved. There will be a main prop file and the second one is created to maintain the attributes involved in finding ‘the person has a credit card’ conclusion.
Right click on the Rules folder and select Add new Word Document. Create two docs named Main Rule.doc and Credit Card Rule.doc. Open each doc and write the following rules;
Now add the attributes to the properties file. From the first doc select ‘the person is eligible’ and click ‘add attribute’ button from the Oracle Policy Automation toolbar in word. Under the File section, from the drop down select Main prop.xsrc which is used to store attributes from our main rule document. Add the remaining ‘the person is above 18’ and ‘the person has credit card’ as Boolean attribute to the main properties file.
Once you complete adding go to the OPM tool and double click on the Main prop file and you can see the attributes you have added listed.
Now open the Credit Card Prop document and do the same. Here select the property file as Credit Card Prop as the save location.
Add all the attributes and if you open the file from the OPM tool you will be able to see this.
Creating entities also easy. You just need to open the respective file and right click on Global and select Add New Entity.
The main benefit of OPA build engine is that, during the time of rulebase build, the process will take care of rules that are defined in multiple docs irrespective of the property file that they are defined.
Now, lets see what are the operations that can be done in an attribute that is defined in the property file. If you right click any of the attribute you will get this list of options.
New Attribute – will create a new attribute. You can define attributes here and then use the attribute text in rules.
Generate Public Name – for creating unique public names. Public names are like identifier. This is important when you integrate OPA rulebase to seibel or SOA or external apps. SOA, the middleware maps the values from external systems to rulebase using the public name.
Show in Build Model – build model is more like a consolidated view of all the entities and attributes used. You can see all the entities, attributes that are spread across multiple properties files as one single model image. See below image where all the attributes from both the properties file are consolidated under the global entity.
Edit Attribute – this option will let you edit the attribute name, public name, for Boolean attribute you can change the generated questions etc.
Copy Text & Copy Attribute ID – used to copy the attribute text and the public name of the attribute.
Change Text Globally – used to change the text in multiple docs. This option is very handy when you have written the rule containing this text in multiple word document. Instead of opening each doc and change individually you can just change it here and the changes will get reflected globally.
Cut,Copy and Paste Attribute – the usual cut,copy, paste operation. Using this you can cut,copy,paste attribute from one file to another.
Rule Browser – will provide you with a snapshot view of the rule behind inferring that variable. For eg: if I select Rule Browser option for the person is eligible variable then I will get this;
Find Attribute Usage – This is very useful option and every rule writer must know. Clicking this option for any attribute will show you the documents where the attributes are used. See the left side of the image where the attribute usage is shown.
Just right click on the attribute there and select View in Word option. This will open the word document where the rule is defined.
If you double click the attribute you will be able to see the rule snippet.
Report –> Dependent Base Attributes – this option will let you see the base attributes that a particular attribute is dependent on. For eg: if you select this option for the person has credit card attribute then you will get the base attributes that are related to it.
These are the main operations that can be performed in attribute. Maintaining a properties file is very important for better interpretation of a rulebase. It is highly recommend you keep these standard while working in a project. Hope you liked the post. Do post your queries as comment or use Contact Me form to reach me out via mail. Thank you for reading.