[jboss-jira] [JBoss JIRA] Commented: (JBRULES-1219) Using DSL and accumulate in Drools BRMS leads to unexpected results

Martin Klinke (JIRA) jira-events at lists.jboss.org
Fri Jun 27 07:50:31 EDT 2008


    [ http://jira.jboss.com/jira/browse/JBRULES-1219?page=comments#action_12419187 ] 
            
Martin Klinke commented on JBRULES-1219:
----------------------------------------

I'm pretty new to Drools and wanted to have a rule like the one described in the above thread. Since the documentation says that the "-" feature cannot be used for accumulate right now, I tried the collect approach. Unfortunately, it does not seem to work for me (although the original poster claims the opposite). 
I have defined the following DSL:

[when]There are more than {N} things=ArrayList(size > {N}) from collect ( Thing() ) 
[when]- thing name {thingName}=thingName == {thingName}
[when]- color {color}=color == {color}
[then]Limit exceeded=System.out.println("Limit exceeded");

The rule looks like this:

package thing

import com.sample.Thing

expander thing.dsl

rule "More than 5 things"

	when
		There are more than 5 things
			- thing name 'Foo'
			- color 'blue'
	then 
		Limit exceeded
		
end

The generated DRL looks like this:

package thing

import com.sample.Thing

rule "More than 5 things"

	when
	ArrayList(size > 5) from collect ( Thing(, thingName == 'Foo', color == 'blue' ) )
	then 
	System.out.println("Limit exceeded");
		
end

Please note the superfluous comma in " from collect ( Thing(, thingName..."
Am I doing anything wrong here or this another bug concering "collect" with DSLs?

> Using DSL and accumulate in Drools BRMS leads to unexpected results
> -------------------------------------------------------------------
>
>                 Key: JBRULES-1219
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-1219
>             Project: JBoss Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Drl Parser/Builder
>    Affects Versions: 4.0.1
>         Environment: HP-UX java version "1.5.0.05" 
>            Reporter: Cristiano Giuffrida
>         Assigned To: Edson Tirelli
>             Fix For: FUTURE
>
>
> Details of this problem are described in the following thread:
> http://www.nabble.com/Using-DSL-and-accumulate-in-Drools-BRMS-leads-to-unexpected-results-tf4421763.html#a12612164

-- 
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

        



More information about the jboss-jira mailing list