json-rule-editor
Updating existing rules:
To edit / view / validate the existing rule files, upload the ruleset directory, where you maintain the rule files like application src directory or anything else, or drag and drop the appropriate files into rule editor.
Note:
There is no restrictions in place to limit the number of files to be imported. However, it wouldn’t allow you to import / create the duplicate rule name to avoid confusion. (File names are case sensitive)
We will take the same example “Employee Salary” for this section, lets assume there is a ask from business to add another fact called “employee type” (contractor or permanent) to decide the salary criteria. We will see below how to update the existing rules in such situation.
Step1: Upload existing rules
- Launch json rule editor or install locally via git clone
- Select the ‘Choose ruleset directory’ to select directory or drag and drop the rule files.
-
Click Upload button
Step2: Add new fact
Go to Employee-Salary rule. If you have just only one rule file, its selected by default
- Click Add icon at top right corner of tool bar.
-
Give new fact name and data type.
-
Click Add Facts button
Step3: Update the existing decisions with new fact
Go to Decisions tab
- Click View Conditions of outcome you want to modify.
-
Click edit icon at top right corner of decision panel displayed.
-
Select the top node in decision panel where you want to add additional fact. In this case, select all top node as highlighted in red circle
-
Select Add facts menu in “Step 2: Add / Remove facts” and fill in the new fact value
- Click Edit Rulecase button
Note:
If you want to edit existing fact value in decision, like, changing the experience fact from 10 to 11 or 12 years. you have to delete the particular fact by selecting the node and Click Remove in “Step 2: Add / Remove facts”
Step4: Add new decision with new fact
We will add one more new decision to handle another employment type say Contractor with different salary outcome.
- Click Add icon at right corner of tool bar.
- Repeat the steps of creating new decisions as mentioned in the Step 4: here
-
Add all three facts like designation, experience and type
-
Specify the outcome value to this new decisions and Click ‘Add Rulecase’ button
Step5: Validate decisions
Go to Validate tab
- Specify the values against facts
-
Click validate button to verify new values are returning for employee type ‘Contractor’
Step5: Generate rule sheet
Go to Generate tab
- Click generate button if you are happy to proceed.
Note:
Json rule file will be generated at your default browser download folder.
Caution:
Please be careful when you remove / edit fact name under Facts tab in the existing rule file. The updated changes of facts wouldn’t be reflected into the decision conditions. Also, it might impact the validation functionality as well as existing decisison functionalities.