Rule templates
Rule templates in Drools are a way to generate DRL rules on-the-fly using template files and tabular data sources. By tabular data sources, we mean data that can be expressed in a table. Typical examples of this kind of data source are spreadsheets and tables in databases.
Probably one of the most common questions in Drools mailing lists and forums is how to generate rules from data that is stored outside our application. The typical case is data inside a database. One of the ways to deal with this scenario is by using rule templates.
Another great advantage of rule templates is that the data and the structure of the rule are completely decoupled. The same template can be used for different data sets and the same data set can be used for different templates. This provides great flexibility in comparison with decision tables.
Rule template structure
A Drools rule template is a text file containing special keywords to demarcate the different sections of the template and to define...