FW: [rules-users] Variable assignment in DSL

Shyam, Pallav (MSCIBARRA) Pallav.Shyam at mscibarra.com
Wed Sep 3 15:13:20 EDT 2008


Hi Matt,

Going by the below example I have come across a senario which seems like
a bug to me.

Here is my dsl
[condition][]{varname} is a Volume where {constraints}={varname} :
RawVolumeTs ( where {constraints} )
[condition][]where {attr} is "{value}"={attr} == "{value}"
[condition][]and {attr} is {value}=, {attr} == {value}

Now,
v1 is a Volume where status is "NV" and sourceId is 2

Translates to 
v1 : RawVolumeTs (status == "NV", sourceId == 2 )

Only when I put an extra space after and. Otherwise the ending quote of
"NV" get cut-off resulting in

v1 : RawVolumeTs (status == "NV, sourceId == 2 )

Also
v1 is a Volume where status is "NV"  and sourceId is 2  and volume is
1000

Give a totally incorrect drl
v1 : RawVolumeTs (status == "NV", sourceId == 2  and volume is 1000 )

Thanks
Pallav

-----Original Message-----
From: Shyam, Pallav (MSCIBARRA) 
Sent: Wednesday, September 03, 2008 11:55 PM
To: 'Matt Geis'
Subject: RE: [rules-users] Variable assignment in DSL

Great. This is really exiting.

Thanks,
Pallav 

-----Original Message-----
From: Matt Geis [mailto:mgeis at yahoo.com]
Sent: Wednesday, September 03, 2008 11:24 PM
To: rules-users at lists.jboss.org
Cc: Shyam, Pallav (MSCIBARRA)
Subject: Re: [rules-users] Variable assignment in DSL

how about changing the first line of your DSL map to...

[condition][]{varname} is a Volume where {constraints} = {varname} :
RawVolumeTs (where {constraints} )


That way, your DSL would read...

rule "RT(2) against FT(32)"
    when
        V1 is a Volume where status is "NA"  and sourceId is "ABC"
        V2 is a Volume where status is "NA"  and sourceId is "XYZ"
    then
end    

and the resulting DRL would read...


rule "RT(2) against FT(32)"
    when
    V1 : RawVolumeTs (status == "NA", sourceId == "ABC")
    V2 : RawVolumeTs (status == "NA", sourceId == "XYZ")
    then
End
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.




More information about the rules-users mailing list