Drools 规则检查具有复合值限制的集合
我想检查一个集合是否包含不三个元素。在java中我会做
!(collection.contains("s1") && collection.contains("s2") && collection.contains("s3"))
How can I do this with drools?我搜索了两个小时并尝试了任何方法,但找不到这个“简单”问题的解决方案。我发现“复合值限制”正是我所需要的,但它不适用于集合和“包含”运算符。
我将不胜感激您的回答。
拿但业
I want to check if a collection contains not three elements. In java I would do
!(collection.contains("s1") && collection.contains("s2") && collection.contains("s3"))
How can I do this with drools? I searched for two hours and tried anything but can't find a solution for this "simple" problem. I found the "Compound Value Restriction" which is what I exactly need, but it does not work for collections and the "contains" operator.
I would appreciate your answers.
Nathanael
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这执行了 Java 代码的操作:
This does what the Java code does:
我认为,你可以采用规则方言“java”。
以下示例可以帮助您。
希望这有帮助。
谢谢。
I think, You can take rule dialect "java".
Following sample can help you.
Hope this help.
Thanks.