rule engine - Drools : Template for Multiple patterns of same format -
i have drools rule rule file as:
package com.test import com.test.fact.feature; global com.test.course subjects; rule "cs" when feature( subjectname=="math", rating >= 6) feature( subjectname=="computers", rating >= 9) feature( subjectname=="electronics", rating >= 3) subjects.addsubjectname("computers"); end rule "physics" when feature( subjectname=="math", rating >= 9) feature( subjectname=="physics", rating >= 9) subjects.addsubjectname("physics"); end
the patterns in when clause can changed pattern definitions defining subject placed in database table as: patterndefinition (patternname,featurename, featurevalue) patterndefinition table name patternname, featurename , featurevalue columns.
e.g. rule "cs", definitions pattern name "cs" follows:
row 1 -> cs, math, >=9 row 2 -> cs, computers, >=9 row 3 -> cs, electronincs, >=3
i cannot change database tables there huge amount of data , being referred lot of sub-projects.
the definitions particular rule can change new subjects added or if definitions changed (lets rating requirement particular subject changes). these changed in database background.
i required convert above rule drools-template application-startup automatically pick changes in database , prepare drools rule file reading template , database data.
i have been able configure single feature template not multiple in single rule.
please suggest.
a primitive solution define n templates, 1, 2,... n rows per rule/pattern name.
for more intelligent solution 1 need know purpose of these rules. feature name added global list, , why?
Comments
Post a Comment