且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将Java POJO转换为Drools DRL,反之亦然

更新时间:2023-11-05 23:33:22

我不确定您的Java POJO是什么?它们代表规则,模式,约束等吗?

I am not sure what are your Java POJOs? Are they representing Rules, Patterns, Constraints, etc?

如果是这样,Drools有一个内部规范模型可以代表所有类型的知识资产[1]。我们不建议您直接使用它,因为它是一个内部API,并且可能会发生更改。

If so, Drools has an internal canonical model for representing all types of knowledge assets [1]. We do not recommend using it directly though, as it is an internal API and subject to change.

您的另一种选择是使用实际的规则描述符构建器API [2 ]动态生成规则[3]。

Another option for you is to use the actual rule descriptor builder API [2] to generate your rules dynamically [3].

最后,如果您有基于Web的UI,并且希望允许用户在其中编写规则,则可以选择将guvnor的规则编辑器嵌入到自己的应用程序中[4]。

Finally, if you have a web based UI and you want to allow users to author your rules in there, you have the option to embed guvnor's rule editor into your own application [4].

希望这会有所帮助。

[1] https://github.com/droolsjbpm/drools/tree/ master / drools-compiler / src / main / java / org / drools / lang / descr

[2] https://github.com/droolsjbpm/drools/tree/ master / drools-compiler / src / main / java / org / drools / lang / api

[3] https://github.com/droolsjbpm/ drools / blob / master / drools-compiler / src / test / java / org / drools / lang / api / D escrBuilderTest.java

[4] http://www.plugtree.com/guvnor-embed-asset%E2%80%99s-editor-in-your-application/