[JBoss JIRA] Created: (JBRULES-1457) please support containment test for map keys
by Godmar Back (JIRA)
please support containment test for map keys
--------------------------------------------
Key: JBRULES-1457
URL: http://jira.jboss.com/jira/browse/JBRULES-1457
Project: JBoss Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: Drl Parser/Builder
Affects Versions: 4.0.4
Environment: any
Reporter: Godmar Back
Using MVEL as the language for clauses, there is no way to test whether a map's key contain a value.
For instance:
rule "number 1"
when
e : S(map.keySet() contains "x")
then
System.out.println("rule number 1");
end
leads to a syntax error because Drool's parser does not allow function calls ("keySet())" in clauses.
On the other hand, MVEL (according to Mike Brocks, please read http://jira.codehaus.org/browse/MVEL-53 ) does not provide an operator to test containment in a map's set (or values). He said he's considering adding a shortcut such as .keys and .values in 2.0 and recommended I open a Drools JIRA issue.
Please provide a way to test for membership in a map's key and value set.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 1 month
[JBoss JIRA] Created: (JBRULES-1559) Ability to negate a constraint group
by Dirk Bergstrom (JIRA)
Ability to negate a constraint group
------------------------------------
Key: JBRULES-1559
URL: http://jira.jboss.com/jira/browse/JBRULES-1559
Project: JBoss Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: Drl Parser/Builder
Affects Versions: FUTURE
Reporter: Dirk Bergstrom
Assigned To: Mark Proctor
Priority: Minor
I want to write a rule that says "Find all long-eared dogs that do not have
short, black hair". This seems like the simple way to do it:
collect( Dog( ears=="long",
not (hair=="short" && color=="black") )
But that doesn't parse. Some digging through the archives unearthed a mention
of De Morgan's laws, which leads to: http://en.wikipedia.org/wiki/De_Morgan's_laws
Which explains that I can instead write:
collect( Dog( ears=="long", (hair!="short" || color!="black") )
Which, after some mental effort, turns out to be the right thing.
However, had I not found the reference to De Morgan's Law, it would have taken
me a long time to get there (if indeed I ever would have). The end result is
also quite difficult to parse if you're not a logician, and thus not very
user-friendly.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 1 month