2007/6/14, rules-users-request(a)lists.jboss.org <
rules-users-request(a)lists.jboss.org>:
Send rules-users mailing list submissions to
rules-users(a)lists.jboss.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
rules-users-request(a)lists.jboss.org
You can reach the person managing the list at
rules-users-owner(a)lists.jboss.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."
Today's Topics:
1. How to get value of global variable from one rule to another
(Alexander Komissarov)
2. RE: How to get value of global variable from one rule
toanother (Anstis, Michael (M.))
3. Re: How to get value of global variable from one rule to
another (Edson Tirelli)
4. Running on z/OS... (jdepaul)
---------- Пересланное письмо ----------
From: "Alexander Komissarov" <aleks.komissarov(a)gmail.com>
To: rules-users(a)lists.jboss.org
Date: Thu, 14 Jun 2007 16:46:07 +0300
Subject: [rules-users] How to get value of global variable from one rule
to another
Hello,
Please give me advice for best way storing global variables.
global java.lang.Integer res;
global java.lang.Integer res2;
...
I've several number of rules. One rule has variable initialization e.g.:
...
rule "AmountsAreNotNull" salience 20
when
< conditions >
then
...
res = new Integer(a.compareTo(new BigDecimal(25)));
res = (res == -1)?0:res;
res = (res == -1)?0:res;
res2 = new Integer(a.compareTo(b));
res2 = (res2 == -1)?0:res2;
...
end
The values of these variables are proper and equal 1
Then next rule has comparing for res|res2 values, but they have lost their
values (res == null and res2 == null)
rule "CompareValues" salience 10
when
res:Integer(intValue == 0)
res2:Integer(intValue == 0)
result:List()
then
result.add(Boolean.TRUE);
end
What decision you can advise me to save variables value between rules?
Thanks.
____________________
Regards,
Komissarov Alexander
mail: aleks.komissarov(a)gmail.com
icq: 239128267
---------- Пересланное письмо ----------
From: "Anstis, Michael \(M.\)" <manstis1(a)ford.com>
To: "Rules Users List" <rules-users(a)lists.jboss.org>
Date: Thu, 14 Jun 2007 15:03:33 +0100
Subject: RE: [rules-users] How to get value of global variable from one
rule toanother
I believe globals are to be used in the RHS of a rule and not the LHS
which uses "normal" facts.
I would suggest rule "AmountsAreNotNull" asserts new objects that activate
rule "CompareValue" or something similar.
Saving variables between rules should be accomplished using logically
asserted facts.
I hope this helps.
Mike
------------------------------
*From:* rules-users-bounces(a)lists.jboss.org [mailto:
rules-users-bounces(a)lists.jboss.org] *On Behalf Of *Alexander Komissarov
*Sent:* 14 June 2007 14:46
*To:* rules-users(a)lists.jboss.org
*Subject:* [rules-users] How to get value of global variable from one rule
toanother
Hello,
Please give me advice for best way storing global variables.
global java.lang.Integer res;
global java.lang.Integer res2;
...
I've several number of rules. One rule has variable initialization e.g.:
...
rule "AmountsAreNotNull" salience 20
when
< conditions >
then
...
res = new Integer(a.compareTo(new BigDecimal(25)));
res = (res == -1)?0:res;
res = (res == -1)?0:res;
res2 = new Integer(a.compareTo(b));
res2 = (res2 == -1)?0:res2;
...
end
The values of these variables are proper and equal 1
Then next rule has comparing for res|res2 values, but they have lost their
values (res == null and res2 == null)
rule "CompareValues" salience 10
when
res:Integer(intValue == 0)
res2:Integer(intValue == 0)
result:List()
then
result.add(Boolean.TRUE);
end
What decision you can advise me to save variables value between rules?
Thanks.
____________________
Regards,
Komissarov Alexander
mail: aleks.komissarov(a)gmail.com
icq: 239128267
---------- Пересланное письмо ----------
From: "Edson Tirelli" <tirelli(a)post.com>
To: "Rules Users List" <rules-users(a)lists.jboss.org>
Date: Thu, 14 Jun 2007 11:18:28 -0300
Subject: Re: [rules-users] How to get value of global variable from one
rule to another
Globals are intended to provide a way to pass values in and out of the
engine. Not for reasoning and exchange of values between rules.
Values that are changed by rules and are reasoned over are clearly
facts of your domain and should be modeled as such.
[]s
Edson
2007/6/14, Alexander Komissarov <aleks.komissarov(a)gmail.com>:
>
> Hello,
>
> Please give me advice for best way storing global variables.
>
> global java.lang.Integer res;
> global java.lang.Integer res2;
> ...
>
> I've several number of rules. One rule has variable initialization e.g.:
>
> ...
> rule "AmountsAreNotNull" salience 20
> when
> < conditions >
> then
> ...
> res = new Integer(a.compareTo(new BigDecimal(25)));
> res = (res == -1)?0:res;
> res = (res == -1)?0:res;
> res2 = new Integer(a.compareTo(b));
> res2 = (res2 == -1)?0:res2;
> ...
> end
>
> The values of these variables are proper and equal 1
>
> Then next rule has comparing for res|res2 values, but they have lost
> their values (res == null and res2 == null)
>
> rule "CompareValues" salience 10
> when
> res:Integer(intValue == 0)
> res2:Integer(intValue == 0)
> result:List()
> then
> result.add(Boolean.TRUE);
> end
>
> What decision you can advise me to save variables value between rules?
> Thanks.
> ____________________
> Regards,
> Komissarov Alexander
> mail: aleks.komissarov(a)gmail.com
> icq: 239128267
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @
www.jboss.com
---------- Пересланное письмо ----------
From: jdepaul <jjdepaul(a)us.ibm.com>
To: rules-users(a)lists.jboss.org
Date: Thu, 14 Jun 2007 08:42:15 -0700 (PDT)
Subject: [rules-users] Running on z/OS...
Is anyone running DROOLS on z/OS on a mainframe?! Any reason why it would
NOT run on it?!
James
--
View this message in context:
http://www.nabble.com/Running-on-z-OS...-tf3922593.html#a11122860
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Thanks all for explanations, but
Also, I've tried to map these values in the
rule "AmountsAreNotNull" salience 20
when
...
then
...
<res, res2 initialization>
map.put("result",res);
map.put("result2",res2);
...
and check it in the next rule:
rule "CompareValues" salience 10
when
map : Map( keySet contains "result" )
...
"keyset" couldn't found "result" and "result2" mapping
but! when I've checked "keyset" in RHS part of this rule "keyset"
HAS proper
values of "result" and "result2":
...
then
Iterator k = map.keySet().iterator();
while (k.hasNext())
{
String key = k.next().toString();
LOGGER.info("Key: " + key + "; Value: " + map.get
(key).toString());
}
...
end
How I can check values of "result" and "result2" in LHS part of rule
"CompareValues"?
Thanks,
____________________
Regards,
Komissarov Alexander
mail: aleks.komissarov(a)gmail.com
icq: 239128267