The following rule doesn't compile :
dialect "mvel"
import drools.DroolsPojo
import function com.google.common.`collect`.Iterables.getOnlyElement;
rule "rule1"
when
$dpojo : DroolsPojo(answers!=null)
$list : List() from collect ( String(length > 0) from $dpojo.answers )
$testObject : String() from getOnlyElement($list) // <---- ** The error**
// ... more constraints
then
System.out.println("testObject: " + $testObject)
end
I already found out that it's getOnlyElement() that causes the error. I'm using drools version 5.1
Why does it not work? How can I fix it? Any help is welcome. Thanks in advance.
Error :
java.lang.AssertionError: Unable to determine the used declarations.
[Error: not a statement, or badly formed structure]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0] : [Rule name='rule1']