Debugging Rule Activations and Cancellations
by Yuri de Wit
I am working on an appication that does not have many rules 40-50
rules but each rule has between 1 to 2 pages of columns and
predicates, but have thousands of facts.
Even though by using the DefaultAgendaListener I can figure the rules
that were added or removed from the agenda while fact are asserted it
is sometimes time consuming to figure out among those 1 or 2 pages of
predicates on each rule why some one did or did not activate.
I was wondering if there is a better way to know why a rule was added
or removed from the agenda. Maybe a report or a callback showing the
precicates evaluated and the one that failed with the fact that cause
it to fail.
Forgive me if there is already a way or procedure I should follow to
accomplish the above.
thanks,
-- yuri
17 years, 5 months
Re: rules-users Digest, Vol 7, Issue 35
by Daniel E Chapman
Unfortunately, we're using the 3.0 version, so I don't think we can use
the repository. That may be necessary with a future version, when we
allow users to make their own rules. Right now, we can be sure that the
only rules changes are coming from developers.
Our challenge is that the way we push out a change to the rules is with a
central process which does not have access to the working memory (nor
should it), it merely compiles the rules and places them in a central
location (a database table). The rules are actually being executed by a
series of drones. Those drones pull the serialized copy of the rules from
the common area before they execute. Since we currently do not allow
users to make their own rules, we can safely assume that no changes are
introduced that might invalidate the working memories. So, we haven't
tried that, but I'm not sure that we would be able to.
Would it be safer to use the getGlobals() and getObjects() methods to
serialize that data, instead of serializing the workingMemory itself? (and
then when we start back up, deserialize the rules, create a new working
memory, and setGlobal() and assertObject() all of our serialized data).
... or am I missing something even simpler?
Thanks once again for your very speedy response!
Daniel,
I think what you are trying to achieve requires some careful planning.
If
you use the repository, you have a versioned rule base that make sure you
don't lose your working memory.
Although, without the repo, only thing I can think of is you making
sure
your application always loads the wm into memory, perform the rules
replacement (adding/removing rules), so the working memory gets properly
updated, and then serializes your wm back to the database.... did you
tried
that?
[]s
Edson
2007/6/14, Daniel E Chapman <dechapma(a)us.ibm.com>:
>
>
> Hello!
>
> We found a problem with the interaction of a serialized working memory
and
> updates to the rules.
>
> Our process involves serializing the working memory to a database.
Later,
> when we load the serialized version of the working memory back from the
> database, if we've updated the rules it will detect that fact and it
will
> throw away our carefully preserved working memory. We suspect this is
> because the working memory maintains a reference to the rules as they
were
> when the working memory is originally serialized.
>
> I'm wondering if there is some way to accomplish what we're trying to
do,
> either a way to serialize the working memory with no reference to the
rules
> or some way to have the working memory update to accomodate any changes
to
> the rules that may have occurred since it was serialized.
>
> I know that some other rules engines, such as FairIsaac's Blaze engine,
> have complex schemes where you can have versioned rules in a repository
and
> update the rules in that fashion. I'm not sure that we're trying to do
> anything quite so complex, just a way to occasionally push out a new
version
> of our rules without having to lose all of the work we've done to the
> working memory in the past.
>
> (There may come a time where we may intend for the working memories to
be
> cleared out, but I think we can do that in a manual fashion when the
time
> comes.)
>
> Thanks for your time, hopefully there's an easy answer!
>
>
> _______________________________________________
> 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
17 years, 5 months
RE: [rules-users] JBRMS - Rule IDs/Referencing
by Michael Rhoden
Be happy to help, it just takes a bit to understand your coding
environment and standards. My first goal is to point out the need for
exposed Rule IDs and try to understand the system the way it sits.
As a side note, I found a feature to "export to a zip file" under the
Admin->Manage Backups. It doesn't seem to work or maybe it just writes
the file to some default location. I did search my hard drive for any
new Zips so I guess it just doesn't work atm.
Thanks,
Michael Rhoden
_____
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
Sent: Friday, June 15, 2007 10:29 AM
To: Rules Users List
Subject: Re: [rules-users] JBRMS - Rule IDs/Referencing
The system is an "asset managemnt system", every item is an asset from
the rule to the package configuration. You can reference any item using
a unique name + package name + version, each item also has a UUID
(provided by the JCR node). However we don't have any remoting/ws api
access to this info - you would have to build ontop of the programmatic
api provided in drools-repository. The versioning is multi dimensional
too - i.e. a Package configuration is itself versioned against specific
versions of rules, if you want to update the Package to a new version of
a Rule, you must create a new version of the Package Configuration.
So it sounds like it doesn't do what you want now, but the foundations
are there and you can get involved with us and help us change that.
Mark
Michael Rhoden wrote:
I have a question about rule storage and referencing with the JBRMS.
Mostly this is directed to Michael Neale (since I believe this is his
baby), but since I cant catch him on IRC I'll post it to here to see
if others have this similar concern.
A little history before I get to the question. We have been using
drools since 2.x (still on 2.x) and have developed much around the
core engine. The way we currently store rules is in a database, at
runtime we pull them out and write an xml file. What this allows is
rule referencing back to the authoring source. We translate from
DB->XML so the "then" returns the ID. We also use it to create unique
names for rules. In our editor we have notes, versions and the
complete rule code, similar to the new JBRMS. When a rule fires in
our system the purpose may be to show an error or change a price.
Either way sometimes people ask why did this fire, or further, they
dispute the rule all together. So in each message or price change we
track the ID of the rule being fired/applied.
From that we have developed 2 tools, one to lookup a rule and see a
great deal of info about that rule (whats/whys), the other is an
Override tool that allows you, given authority, to associate a rule
ID to a transaction and have coded so when the engine fires this
rule, it will be ignored by the system. Obviously how we override is
not something I expect you to solve, but giving me the ability by
having a unique ID would be.
I would think the desire to "Track" and "Override" a rule is pretty
high for most people using a rule system in an enterprise. What makes
this possible is exposing a unique identifier in the storage of rules
(think database and editor) as well as the execution of rules (as
they fire). I setup the MR2 of the JBRMS and tried to look at the
storage system to see if a rule had some unique identifier that we
could use, and found none. Seems like a rulebase is a blob, though
maybe I'm just looking at it wrong.
So my question and/or request is there a way to have each rule have a
unique identifier (by version is fine) in the JBRMS storage system. I
think this is the first step, the second is harder but make the
system associate the ID to a rule at execution ("then"). Similar to
the option of expiring a rule at X date.
While this may not seem huge, and is definitely not as cool as
changing semantics in MVEL, it is a huge barrier of adopting this new
very feature rich JBRMS.
Thanks,
Michael Rhoden
_____
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
17 years, 5 months
Re: [rules-users] How to get value of global variable from one rule to another
by Alexander Komissarov
From: "Edson Tirelli" <tirelli(a)post.com>
> To: "Rules Users List" <rules-users(a)lists.jboss.org>
> Date: Fri, 15 Jun 2007 11:33:52 -0300
> Subject: Re: [rules-users] How to get value of global variable from one
> rule to another
>
> Alexander,
>
> Remember that the LHS is always evaluated at assert time and RHS is
> always executed at rule firing time. So, when you change something at rule
> firing time that you want to cause a reevaluation of the LHS, you must
> notify the engine calling "modify":
>
>
> map.put("result",res);
> map.put("result2",res2);
>
> modify( map );
>
>
> []s
>
> Edson
>
>
>
>
> 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
> >
> > _______________________________________________
> > 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
Thank you for advice, but unfortunately,
using modify(map) in the rule "AmountsAreNotNull" cause difficulties like
infinite loop execution all previous rules INCLUDING this rule and EXCLUDING
final compare rule.
____________________
Regards,
Komissarov Alexander
mail: aleks.komissarov(a)gmail.com
icq: 239128267
17 years, 5 months
JBRMS - Rule IDs/Referencing
by Michael Rhoden
I have a question about rule storage and referencing with the JBRMS.
Mostly this is directed to Michael Neale (since I believe this is his
baby), but since I cant catch him on IRC I'll post it to here to see if
others have this similar concern.
A little history before I get to the question. We have been using drools
since 2.x (still on 2.x) and have developed much around the core engine.
The way we currently store rules is in a database, at runtime we pull
them out and write an xml file. What this allows is rule referencing
back to the authoring source. We translate from DB->XML so the "then"
returns the ID. We also use it to create unique names for rules. In our
editor we have notes, versions and the complete rule code, similar to
the new JBRMS. When a rule fires in our system the purpose may be to
show an error or change a price. Either way sometimes people ask why did
this fire, or further, they dispute the rule all together. So in each
message or price change we track the ID of the rule being fired/applied.
From that we have developed 2 tools, one to lookup a rule and see a
great deal of info about that rule (whats/whys), the other is an
Override tool that allows you, given authority, to associate a rule ID
to a transaction and have coded so when the engine fires this rule, it
will be ignored by the system. Obviously how we override is not
something I expect you to solve, but giving me the ability by having a
unique ID would be.
I would think the desire to "Track" and "Override" a rule is pretty high
for most people using a rule system in an enterprise. What makes this
possible is exposing a unique identifier in the storage of rules (think
database and editor) as well as the execution of rules (as they fire). I
setup the MR2 of the JBRMS and tried to look at the storage system to
see if a rule had some unique identifier that we could use, and found
none. Seems like a rulebase is a blob, though maybe I'm just looking at
it wrong.
So my question and/or request is there a way to have each rule have a
unique identifier (by version is fine) in the JBRMS storage system. I
think this is the first step, the second is harder but make the system
associate the ID to a rule at execution ("then"). Similar to the option
of expiring a rule at X date.
While this may not seem huge, and is definitely not as cool as changing
semantics in MVEL, it is a huge barrier of adopting this new very
feature rich JBRMS.
Thanks,
Michael Rhoden
17 years, 5 months
REMINDER CfP RuleML-2007
by Adrian Paschke
Dear Prospective Author of RuleML-2007,
This is just a friendly reminder that the deadline for the RuleML-2007
abstract submission is
Friday, June 15, 2007.
Please upload a plain text abstract in our EasyChair submission page at
http://www.easychair.org/RuleML2007/.
All information regarding submission requirements are
elaborated in the RuleML-2007 web site at:
http://2007.ruleml.org/index-Dateien/Page577.htm
Sincerely,
Adrian Paschke
Yevgen Biletskiy
RuleML-2007 Program Co-Chairs
[ our apologies should you receive this message more than one time ]
The International RuleML Symposium
on Rule Interchange and Applications (RuleML-2007)
October 25-26, 2007, Orlando, Florida
http://2007.ruleml.org
=====================================================================
Co-located with:
The 10th International Business Rules Forum
http://www.businessrulesforum.com
=====================================================================
The International RuleML Symposium on Rule Interchange and Applications
(RuleML-2007) will take place, October 25-26, 2007, in Orlando, Florida
<http://2007.ruleml.org>, co-located with The 10th International
Business Rules Forum <http://www.businessrulesforum.com>. RuleML-2007 is
devoted to practical distributed rule technologies and rule-based
applications which need language standards for rules operating in the
context of, e.g., the Semantic Web, Intelligent Multi-Agent Systems,
Event-Driven Architectures and Service-Oriented Computing Applications.
A RuleML-2007 Challenge with prizes will be organized to demonstrate
tools, use cases, and applications. Abstracts are due June 15, 2007.
Papers are due June 29, 2007.
=====================================================================
17 years, 5 months
Synchronization of Working Memory
by Daniel E Chapman
Hello!
We found a problem with the interaction of a serialized working memory and
updates to the rules.
Our process involves serializing the working memory to a database. Later,
when we load the serialized version of the working memory back from the
database, if we've updated the rules it will detect that fact and it will
throw away our carefully preserved working memory. We suspect this is
because the working memory maintains a reference to the rules as they were
when the working memory is originally serialized.
I'm wondering if there is some way to accomplish what we're trying to do,
either a way to serialize the working memory with no reference to the
rules or some way to have the working memory update to accomodate any
changes to the rules that may have occurred since it was serialized.
I know that some other rules engines, such as FairIsaac's Blaze engine,
have complex schemes where you can have versioned rules in a repository
and update the rules in that fashion. I'm not sure that we're trying to
do anything quite so complex, just a way to occasionally push out a new
version of our rules without having to lose all of the work we've done to
the working memory in the past.
(There may come a time where we may intend for the working memories to be
cleared out, but I think we can do that in a manual fashion when the time
comes.)
Thanks for your time, hopefully there's an easy answer!
17 years, 5 months
Re: [rules-users] How to get value of global variable from one rule to another
by Alexander Komissarov
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
17 years, 5 months