Question

I have couple of 1000 rules that look like the below rules and I want to try using DROOLS to code these rules. Do you think I am making the right choice? There are a lot of fields and lot of values(lists and ranges) to check for. Given a data record I have to validate against all possible rules and potentially for efficiency I have to apply the rules only if it applies to record.

a) Valid entries for the XYZField field are blank, zero, 01- 36, 37-44, 96, 97-99; otherwise invalid.

b) If the ABCDCODE is 92200, 92201,and: i) the TTYPE is 1, then the XYZField must be blank or zero; otherwise invalid. ii) the TTYPE is 7, 8 or 9, then the XYZField must not be blank or zero; otherwise invalid.

Please let me know if I am making the right choice by looking at DROOLS DSL for this purpose.

Was it helpful?

Solution

Look at my white paper on Drools Design Patterns especially the section on Data Validation.

The section explains a strategy that circumvents the straightforward creation of one Drools rule per rule in the requirements. Simply put, you use data to describe these rules, insert the data as facts, along with the facts representing actual data, and write rules relating the descriptions to the data. You might say that the rules "interpret" the descriptions against the data.

There are adavantages and disadvantages to this approach, but it ought to be considered before launching into handwritten or spreadsheet rules.

OTHER TIPS

Look into Drools decision tables, which make it easier for someone to input those 1000 rules.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top