问题
I am interested in creating rules for Drools Planner. I want that a user can create his own rules in a java app before starting the Drools Planner. Maybe a Drools-rule-file could be generated after the user has added his rules. Would this be possible or do I have to create the rule-file while developing the whole java application?
Many thanks...
回答1:
Yes it's possible.
The trick is to build your own RuleBase
and set it in the Planner config.
See section "5.3.4.2.2. A RuleBase (possibly defined by Guvnor)" in the manual.
You can construct a RuleBase
by several, depending on how you want your user to edit his/her rules:
- From a DRL file. This presumes the user knows DRL. See Drools Expert manual.
- From a DSL file. This allows you to use natural language.
- From the guvnor webapp. This allows you to use the tooling Guvnor, such as a guided rule editor, a decision tables spreadsheet, ... You can even use a changeset.
- From guvnor in eclipse or a standalone app (under development and experimental). There's some work being in this area, but it's still young.
来源:https://stackoverflow.com/questions/11017613/live-rule-creation-in-drools-planner