开发者

drools drl how to do not conditions

开发者 https://www.devze.com 2023-01-09 11:44 出处:网络
I am trying to write a rule in drools drl language where I am want to do something like !(A && B) but it doesnt seem to like the ! operator or the word not. I am struggling to find good docume

I am trying to write a rule in drools drl language where I am want to do something like !(A && B) but it doesnt seem to like the ! operator or the word not. I am struggling to find good documentation on drools

Please see sample code below:

  rule "Test Rule"
   when
      testBean : testBean(!(testList contains "test"  &开发者_如何学编程amp;& testList2 contains "test2"))
   then
      testBean.setText( "This is a test" );
   end

I would appreciate any help than anyone can give me

thanks in advance


It looks like there is an open defect with the not operator

https://jira.jboss.org/browse/JBRULES-2404

Another good article on negation, uses 'neg' or 'naf' instead of 'not'

http://blog.athico.com/search?q=negation

rule "Test Rule"
   when
      testBean : testBean((testList not contains "test"  && testList2 contains "test2"))
   then
      testBean.setText( "This is a test" );
   end


For me, I use ==false syntax

testBean : testBean(false==(testList contains "test"  && testList2 contains "test2"))
0

精彩评论

暂无评论...
验证码 换一张
取 消