can drools support complex rules
by Bhushan Bhangale
Hi,
I recently came across Drools. I gone through the documentation and the
examples provide are quite simple. I want to know if it can be really
applied to complex real world problems.
Take for example,
If a customer login within 5 minutes from two different locations, mark the
user invalid.
How can I write the above rule in drools? I have the data when the user last
logged in and the data of current login. You can say two objects.
May be my understanding is wrong but looks like based on rule I have to pass
all the required data. How can then at real time new rules can be added?
For example,
If the customer location is not on a list of valid locations, mark the user
invalid.
For the above rule I need to pass a list of valid locations as well.
Now how about "Customer login from more than 5 locations in the last one
month"?
Thanks
Mr. Bhangale Bhushan
Associate Manager
Kale Consultants Ltd.
<mailto:bhushan_bhangale@kaleconsultants.com>
bhushan_bhangale(a)kaleconsultants.com
tel:
<http://www.plaxo.com/click_to_call?lang=en&src=jj_signature&To=%2B91+%280%2
9206+608+3777&Email=bhushan_bhangale(a)kaleconsultants.com> +91 (0)206 608
3777
<http://www.kaleconsultants.com> http://www.kaleconsultants.com
Disclaimer: This email (including any attachments) is intended for the sole
use of the recipient/s and may contain material that is CONFIDENTIAL. Any
unauthorized disclosure / copying / distribution or forwarding of this message
or part is STRICTLY PROHIBITED. If you have erroneously received this message,
please delete it immediately and notify the sender. No liability is assumed for
any errors and/or omissions in the contents of this message. Information in
this message that does not relate to the official business of this Company
shall be understood as neither given nor endorsed by it. If verification is
required please request a hard-copy version.
To know more about Kale Consultants, visit www.kaleconsultants.com
-=-=-=-=-=-=-=-=-=-
15 years, 6 months
Not able to build documentation from version 5.0 source
by dpointzero-drools@yahoo.com.sg
Hi,
I am new to Drools and I am not able to build the documentation from the source code.
The versions of the various software I am using are as follows:
- Drools: 5.0.1.26597.FINAL.
- Maven: 2.1.0
- OS: Mac OS X 10.5.7 (on an Intel-Mac)
- Java: 1.5.0_16
The error messages I see when trying to build the documentation are as follows:
----------------------------------------------------------------------------------------------------------------
~/Developmen.../drools-5.0-src\>mvn -e -Ddocumentation clean package
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='org.drools:docbook-style-drools'}' and 'Vertex{label='org.drools:docbook-style-drools'}' introduces to cycle in the graph org.drools:docbook-style-drools --> org.drools:docbook-style-drools
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='org.drools:docbook-style-drools'}' and 'Vertex{label='org.drools:docbook-style-drools'}' introduces to cycle in the graph org.drools:docbook-style-drools --> org.drools:docbook-style-drools
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:323)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: hidden.org.codehaus.plexus.util.dag.CycleDetectedException: Edge between 'Vertex{label='org.drools:docbook-style-drools'}' and 'Vertex{label='org.drools:docbook-style-drools'}' introduces to cycle in the graph org.drools:docbook-style-drools --> org.drools:docbook-style-drools
at hidden.org.codehaus.plexus.util.dag.DAG.addEdge(DAG.java:127)
at hidden.org.codehaus.plexus.util.dag.DAG.addEdge(DAG.java:107)
at org.apache.maven.project.ProjectSorter.addEdgeWithParentCheck(ProjectSorter.java:351)
at org.apache.maven.project.ProjectSorter.<init>(ProjectSorter.java:161)
at org.apache.maven.execution.ReactorManager.<init>(ReactorManager.java:99)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316)
... 10 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue May 19 17:48:42 EDT 2009
[INFO] Final Memory: 9M/247M
[INFO] ------------------------------------------------------------------------
~/Developmen.../drools-5.0-src\>
----------------------------------------------------------------------------------------------------------------
Any pointer is appreciated. Thanks!
regards,
Daniel
15 years, 6 months
rule with low Salience is fired too early
by David Boaz
Dear all,
First, let me inform that we are using stateless sessions in Drools 5 CR1.
In my application I have to compute a score and if the score is above a
threshold, an alert is created. The score is accumulated from many small
rules (actually, generated from excel using drools decision-tables).
Initially, many input objects and a Score object initialized to zero are
inserted. The form of my rules is:
1 rule “accumulate #1”
2 when
3 Input(....)
4 s:Score()
5 then
6 s.add(4) // 4 is just an example
7 end
8
9 rule “threshold”
10 when
11 Score(value>40)
12 then
13 Alert.create(..)
14 end
1.The Score object was actually accumulated as expected. But for some
reason, the “threshold” rule fired once when the score.value was still ==0.
2.I tried to set the salience of the “threshold” rule to -1 (low priority).
But it didn't affect the rule firing.
3.I suspected that the engine was not informed that the score object was
updated in the first rules. So, I added a call to drools.update(s) after
line 6. That solved the issue and the “threshold” rule actually fired. But
now, I noticed that several alerts were created because the score was set
several times to a value>40.
4.To solve that new issue, I set again the salience of the threshold rule to
-1. This time, only one alert was created.
My concern is that I don't understand what happened. Can someone please
explain?
To my understanding, the situation described in my second bullet should
work. Initially, all the inserted objects are checked in the RETE network
and an agenda is created. The activation for the “threshold” rule is the
last one. I don't see the reason how can the threshold rule fire before all
the accumulate rules were fired.
Thanks for the help, David
--
View this message in context: http://www.nabble.com/rule-with-low-Salience-is-fired-too-early-tp2358559...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 6 months
Rules Debugging
by Vikas Phonsa
Hi All,
I'm using Drools 4.0.7 with Java 1.4.
Some of my rules are throwing exceptions and my goal is to get a list of names of all rules that are being executed (till the point the exception is thrown).
I have tried doing
stateLesssession.addEventListener( new DebugAgendaEventListener() );
and it does give me a bunch of information about the agenda. But I want to narrow it down to the rules that are actually executed.
Which event it called right after the execution control goes inside a rule (before the 'when' condition is executed)?
Thanks,
Vikas
This email and/or any files or attachments transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this e-mail and/or any files or attachments transmitted with it is strictly forbidden. If you have received this email in error, please delete the e-mail and/or any files or attachments, and also notify the system manager (PostMaster(a)mercuryinsurance.com) of the error. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email and/or any files or attachments transmitted with it.
15 years, 6 months
Re: [rules-users] Rules and Hibernate Question
by Greg Barton
Global is probably how I'd do it. Now, outside the rules you might want to get fancy, like IOC or a ThreadLocal, but inside a global is fine. (unless you're in multithreaded mode with a single hibernate session, which is bad because hibernate sessions are not thread safe.)
GreG
On May 15, 2009, at 14:54, Shannon Lal <shannonlal2909(a)gmail.com> wrote:
Thanks for the response. How would you recommend passing it in? Via the Global Memory or another way?
Shannon
On Fri, May 15, 2009 at 4:50 PM, Greg Barton <greg_barton(a)yahoo.com> wrote:
It depends on your transaction needs. A hibernate session can only encompass one db transaction. So if you need to execute more than one db transaction in one rule firing session, then pass in a hibernate SessionFactory to spawn multiple hibernate Sessions. Otherwise pass in a hibernate Session.
GreG
On May 15, 2009, at 11:42, Shannon Lal <shannonlal2909(a)gmail.com> wrote:
I have a question about using Hibernate with Rules. I am wondering if there is some standard practices on how one should reference the Hibernate Session inside a rule. Should this be passed in as a global variable? Is there a better way of doing this? Any advice on this would be greatly appreciated.
Thanks
Shannon
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
15 years, 6 months
Re: [rules-users] Rules and Hibernate Question
by Greg Barton
It depends on your transaction needs. A hibernate session can only encompass one db transaction. So if you need to execute more than one db transaction in one rule firing session, then pass in a hibernate SessionFactory to spawn multiple hibernate Sessions. Otherwise pass in a hibernate Session.
GreG
On May 15, 2009, at 11:42, Shannon Lal <shannonlal2909(a)gmail.com> wrote:
I have a question about using Hibernate with Rules. I am wondering if there is some standard practices on how one should reference the Hibernate Session inside a rule. Should this be passed in as a global variable? Is there a better way of doing this? Any advice on this would be greatly appreciated.
Thanks
Shannon
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
15 years, 6 months
Rules and Hibernate Question
by Shannon Lal
I have a question about using Hibernate with Rules. I am wondering if there
is some standard practices on how one should reference the Hibernate Session
inside a rule. Should this be passed in as a global variable? Is there a
better way of doing this? Any advice on this would be greatly appreciated.
Thanks
Shannon
15 years, 6 months
Comparing names
by Ian Spence
Hello all,
I am new to Drools…
I have a scenario
Each fact object will have the structure:
Title
Proprietor Group
Proprietor Name
E.g.
2100-100
J2 ½ share
SMITH, JOHN
JONES, FRED
T ½ share
BROWN, CHARLIE
2100-101
J2 ½ share
BROWN, CHARLIE
JONES, FRED
T ½ share
SMITH, JOHN
2100-102
T ½ share
BROWN, CHARLIE
J2 ½ share
JONES, FRED
SMITH, JOHN
The group names and the proprietor names must be the same across each
Title. The scenario above is a valid case. A failed case would result for
Title 2100-100 if we add an extra Proprietor name e.g. WHITE, MARY.
I anticipate having one rule to cater for this. I am hedging towards the
‘collect’ operator but cannot get a clear picture on how to implement it.
--
Regards,
Ian Spence
15 years, 6 months
ClassCastException
by Christoph Kramer
Hi all,
i've some problems with a ClassCastException when using the
"or"-conditional element.
I have different Java-Beans which all have some string-values. Now I
want to create one rule which is able to handle every type of my classes
because it would be a lot of work to create one rule for every class.
Depending on the type of beans in the working memory the programm is
crashing with an ClassCastException.
Here is a snippet of my drl-file with the "crashing-rule":
rule "BizLocation"
when
$epc : EPC()
QuantityEventType(epcClass == $epc.value ,$bizLoc: bizLocation
!=null ) or AggregationEventType(childEPCs.epc contains $epc, $bizLoc :
bizLocation != null) or ObjectEventType(epcList.epc contains $epc,
$bizLoc : bizLocation != null)
then
System.out.println("BizLocation: " +$bizLoc.getId());
end
There are some EPC's in the working memory and some Events (which might
be of type QuantityEventType, AggregationEventType or ObjectEventType).
When there are only ObjectEventType in the working memory, everything
works fine, but wenn there is an QuantityEventType this rule crashes
with "org.fosstrak.epcis.model.QuantityEventType cannot be cast to
org.fosstrak.epcis.model.ObjectEventType".
I've lot of other, similar rules some of them crashing, others don't.
Can anyone give me a hint where is the error?
Thanks,
Christoph
PS: Sorry for the bad english :(
15 years, 6 months