DROOLS having RHS dynamic(5.0)
by shikha.x.aggarwal@jpmchase.com
Hi,
I am looking to use drools where I can have users subscribed to specific
alerts. Hence for example -
I can have a rule like ->
Rule 1 -> amount < {amount}
Where {amount} is the value which the user defines at the time of
subscribing, hence the user wants to recieve an alert when the amount in
his account < {amount} that he just subscribed to.
I was trying to use the DROOLS template feature and was even able to
succesfully execute this specific scenario. The use case I was executing
is, when an event of type Rule 1 occurs , I get all users who are
subscribed to rule 1, and then create a drl file for all of those users
with there custom data substituted as part of {amount}. Now I fire the
rules(note I have multiple rules one for each user} which executes for
this specific event and gives the required results(The above example is
just a sample example). My area of concerns are -
1. Is Rule engine really the platform I am looking at? As I dont have any
complex logic , I just want to use some component which can evaluate my
Events that arrive with different subscription rules?
2. If I regenearte the drl file every time an event arrives (I need to
because every time a iff type of rule can fire and the list of subscribers
can be different as well), this would have a performace impact as the
rules are compiled and generated every time and not really cached?
Please let me know if the problem is not clear. Any help/inputs in this
regard would be highly appreciated.
Thanks
Shikha
-----------------------------------------
This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, data and other information are not
warranted as to completeness or accuracy and are subject to change
without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.
This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.
16 years
Rules Scoring
by Waleed Zedan
Hi,
We are in the process of evaluating JBOSS Drools for our software and so far
Drools found to be a perfect match for most of our requirements.
Recently our customer has requested for a very interesting and important
requirement and its synopysis is given below
Rule
LHS
Condition 1 / Condition Group 1 (assoicated weightage is 20)
Condition 2 / Condition Group 2 (assoicated weightage is 50)
Condition 3 / Condition Group 3 (assoicated weightage is 30)
RHS
Rule Action / Output
While calling the Rule Engine, the Rule Engine client will say "Give me all
the Rule Output for the Rules matching 50% of the LHS"
i.e. We need to know the percentage of LHS match in the RHS
Using this percentage, we will call the Rule Action / Output
Sample:
if Condition 2 / Condition Group 2 and Condition 1 / Condition Group 1 are
satisfied, then we need to have 70% (50% + 20%) match in the RHS.
Thanks a lot for your help and time.
--
Waleed Zedan
SCJP 1.4 , CCNA
16 years
Nested Rules
by Vishal Deshmukh
Hi
I am using Drools 4.0.4 with Eclipse 3.2. I m much happy with the results. But now my application needs nested loops..
Can i write nested rules like
rule "rule 1 " // if condition of rule 1 is true then only execute rule 2 other wise skip it
when
condition is true
then
execute rule2
rule "rule 2 "
when
condition is true
then
action
rule "rule 3"
when
condition is true
then
action
Thanks and Rgards
Vishal
16 years
Chart notation, update, and infinite loops
by Dan Seaver
I'm trying to find a good technique for updating specific facts in working
memory. What I'm currently doing is something like this:
Rule "Update Amount"
when
amountFact : Fact(name == "Amount")
charge : Charge()
then
Double amount = amountFact.getAmount();
Double chargeAmount = charge.getAmount();
amountFact.setAmount(amount + chargeAmount);
update(amountFact);
end
The update statement causes an infinite loop.
I tried using no-loop, which works if there is 1 charge, but not if there
are more than one.
Any help with solutions or strategies would be much appreciated.
--
View this message in context: http://www.nabble.com/Chart-notation%2C-update%2C-and-infinite-loops-tp20...
Sent from the drools - user mailing list archive at Nabble.com.
16 years
Serialization in Drools 5.0 M2
by siddhartha banik
Hi Drools Team,
I am trying out new Serialization technique introduced in Drools 5.0 using "
org.drools.marshalling.DefaultMarshaller".
The use case I am trying, is:
Create a Stateful session.
Then Serialize that.
Try to load the the serialized session
back.
Loading of serialized session is working good if, I try that in same java
program & same object of DefaultMarshaller is used during serialization & de
serialization of the Stateful session.
But, when I tried a different instance of DefaultMarshaller to read back the
saved session, that is not working anymore. I am getting a exception :
java.lang.NullPointerException
at org.drools.common.DefaultFactHandle.<init>(DefaultFactHandle.java:78)
at
org.drools.marshalling.InputMarshaller.readFactHandle(InputMarshaller.java:331)
at
org.drools.marshalling.InputMarshaller.readFactHandles(InputMarshaller.java:277)
at
org.drools.marshalling.InputMarshaller.readSession(InputMarshaller.java:179)
at org.drools.marshalling.DefaultMarshaller.read(DefaultMarshaller.java:58)
at org.drools.marshalling.DefaultMarshaller.read(DefaultMarshaller.java:15)
at
org.drools.reteoo.ReteooRuleBase.readStatefulSession(ReteooRuleBase.java:277)
at
org.drools.common.AbstractRuleBase.readStatefulSession(AbstractRuleBase.java:321)
at
com.sample.test.NewMarshallingTest.testSerializationInFile_1(NewMarshallingTest.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
With Drools 4.0.7 ... I can serialize a Stateful session & at later point of
time I can deserialize that back. For our usecase, the feature is very
critical.
Does Drools 5.0 support that ? DefaultMarshaller is not serializable. So
once a Stateful session is serialized. At Later point of time, I am not
able to read that back.
I have attached my test files.
Best Regards!
Siddhartha
16 years
can we mix java n mvel dialect in LHS
by techy
Hello,
I have some drools beginner questions
1.what is default dialect if it is not specified?
2. can We mix java and mvel syntax in LHS?
Ex:
class Cheese(String type,Set<String> ingredients)
Is this valid LHS?
when cheese : Cheese(ingredients.getIngredients().size > 3,type ==
"American")
3. In my sample program , I have a following condition which never executes
even if i have "sugar" ingredient. any help?
when cheese : Cheese(ingredients contains "sugar")
--
View this message in context: http://www.nabble.com/can-we-mix-java-n-mvel-dialect-in-LHS-tp20330087p20...
Sent from the drools - user mailing list archive at Nabble.com.
16 years
Complex rule
by Bryan Hansen
Not really sure how to go about writing this in a rule or whether or not the
logic belongs in a rule (I think it does, but if you don't please comment as
to why).
I have a list of objects that contain date objects. If the list contains 10
objects that date are before mine then I want them to take a break.
The business case is similar to that of an HR system. If they have worked
too many days out of the last 12 then they need to take a break.
I am guessing it would have to use the "collect" attribute, but how would
you do the date logic in a LHS clause?
Thanks for any guidance on this.
16 years
Newbie question on accessing predecessor and successor in a list
by CSchr
Hi everyone!
I'm relatively new to Drools and rule languages.
I'm wondering if it is possible to access the predecessor and successor in a
match using from operator on an (Array)List. I have something like this
(simplified):
...
$segment : Segment( countries contains Country.Switzerland && ... ) from
$journey.segmentList
$preSegment : Segment ( indexOf(this) == indexOf($segment) - 1,
countries not contains Country.Switzerland && ...
) from $journey.segmentList
I need something like indexOf() for the exact predecessor of the matched
segment.
If the matched business object was an element of a double linked list it
would be easy. Unfortunately I don't have the luxury to change the business
object into knowing it's predecessor or successor. I have to prove that we
could write our java coded business rules in Drools rule language without
changing the business object model.
Thanks in advance,
Chris
--
View this message in context: http://www.nabble.com/Newbie-question-on-accessing-predecessor-and-succes...
Sent from the drools - user mailing list archive at Nabble.com.
16 years