Incremental informations about Drools match

天大地大妈咪最大 提交于 2019-12-13 02:49:12

问题


I am trying to use Drools as an rule engine to a synchronizer. The synchronizer does some changes in the system based on some conditions which will be checked using Drools.

fireAllRules() and the matches

Suppose there can be 'matches'** m0, m1, m2 and m3 against my rules. In the image above I have shown what are the matches for two fireAllRules().

When running fireAllRules() first time, 'I get'*** matches m0, m1 and m2.

Then my synchronizer does some changes in the system. On second run of fireAllRules(), I get matches m1, m2 and m3.

What my synchronizer needs at this stage is to identify the following:

  • match m0 is removed.
  • matches m1 and m2 are repeated. ( old matches)
  • match m4 is a new match.

Since Drools is an incremental pattern match-er, I am curious whether there is a way to get these information ( in the bullet points above).

** by 'match' I mean a collection of fact satisfying the 'when' part of the rule. So if I have two object of type Test() in working memory, a simple rule like

when
t : Test()

should have two matches m0 and m1 containing information about two Test() objects.

*** by 'I get' I mean I require Drools to provide me this. I do not know how to get this.

来源:https://stackoverflow.com/questions/45675993/incremental-informations-about-drools-match

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!