[
https://jira.jboss.org/jira/browse/JBRULES-1632?page=com.atlassian.jira.p...
]
Bob MacDonald commented on JBRULES-1632:
----------------------------------------
I just ran into this problem and looked into it a bit. I found the problem to be with the
patternFinder regular expression string used in the DefaultExpander. To be more specific
the org\drools\lang\dsl\DefaultExpander.java class defines patternString as:
private static final Pattern patternFinder = Pattern.compile( "\\((.*?)\\)"
);
But I think it should be
private static final Pattern patternFinder = Pattern.compile( "\\((.*)\\)"
);
Notice I removed the ? from the string. This changes the regular expression
from a reluctant match to greedy and appears to have solved the problem (at
least in the testing I've done).
DSL expander can't add a field constraint to a fact when a
previous field constraint has parentheses
----------------------------------------------------------------------------------------------------
Key: JBRULES-1632
URL:
https://jira.jboss.org/jira/browse/JBRULES-1632
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-compiler
Affects Versions: 4.0.7
Reporter: Pierre De Swert
Assignee: Edson Tirelli
Fix For: 5.0.0.M3
I have made a little example to reproduce the problem.
Let us assume we have a very simple Wine class...
public class Wine {
private int age;
private String type;
private String country;
private String vineyard;
....
I define the following in my DSL:
[condition][]Il existe un vin "{i}"={i} : Wine()
[condition][]- plus vieux que "{y}"=age > {y}
[condition][]- du crû "{c}"=vineyard == "{c}"
In the following rule, I can't add the last field constraint when the age of the
prvious one is
"($y + 10)"
rule "Very Old Wine"
when
#conditions
# there is a wine 10 years older than a person
> Person($y : age)
Il existe un vin "$v"
- plus vieux que "($y + 10)"
# - plus vieux que "$y"
- du crû "Nuits-Saint-Georges"
then
#actions
End
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira