Getting started with Drools Fusion
by Tina Vießmann
Hello everybody :)
I'm completely new to the Drools universe. I discovered Drools, or more
specifically Drools Fusion, by searching for a powerful CEP engine.
I've read the DF user guide and came up with some issues about DF
features. It would be great, if anyone can give me some explanations
and/or refer to different information sources.
My questions:
1. Persistence of events:
1. About sliding windows:
It's written that a window contains the last X events/the event
occurred in the last X time units. Is it somehow possible to specify a
time window to
14 years, 6 months
Frequently updated facts and truth maintenance
by bill simms
Hello,
Recently I've been using Drools (version 5.0.1) to build a small sensor
monitoring application and have run into memory consumption issues that seem
to be related to logically inserted facts. The way it is set up there are
Sensor facts which carry numerically encoded "flags" that can signal certain
properties about that Sensor. My intent was to create rules to detect these
flags and insert marker facts in order to abstract how flagging is handled
and make it easier for other rules to use this information. Here is an
example of the rules I'm using:
declare DeltaFlagged
> sensor : Sensor @key
> end
> rule "Delta Flagged"
> agenda-group "delta flag inference"
> auto-focus true
> when
> $sensor: Sensor(eval(isDeltaFlag(flag)))
> then
> DeltaFlagged flagged = new DeltaFlagged();
> flagged.setSensor($sensor);
> insertLogical(flagged);
> end
>
Each Sensor is updated at regular intervals from outside of the rule engine,
several hundred times a day. Similar to the examples given here (
http://blog.athico.com/2007/03/writing-rules-for-monitoring-and-time.html).
This works very well for short periods of time. However, after many
days of operation I can observe a clear memory leak trend. When I inspect a
memory dump I see that there are many LogicalDependency objects created and
stored by the truth maintenance system (on the order of several million) for
each "flag" fact that has been logically inserted. Only one fact is being
inserted per Sensor as expected. I am working under the impression that
Drool's truth maintenance should not be recording duplicate dependencies, so
I'm wondering what I have done wrong with the equals() and hashcode()
methods of my objects to cause Drools to treat each activation of this rule
as a new dependency. My Sensor objects use the default hashcode and equals
methods. Thank you in advance.
Bill
14 years, 6 months
Drools Flow: how to get knowledge session ID from WorkItem
by Alan.Gairey@tessella.com
The subject says it all really: is there any way of determining the
knowledge session ID from the WorkItem argument (or WorkItemManager
argument?) passed in to the executeWorkItem method of an implementation of
the WorkItemHandler interface?
Any help would be very much appreciated.
Thanks,
Alan
14 years, 6 months
Bulk-Retract speed conundrum
by djb
Hi Drools aficionados,
This is further to my request to improve speed. As requested previously, I
am providing an example rule.
So, I found that by only retracting facts after processing multiple claims,
instead of after every claim, I managed to improve speed from 300ms per
claim to 50ms! We need it to be sub-170ms to be a viable option.
But, I need to retract facts. As you can see, if I add new Claim data, it
might match the last guy's claim data (Bad!). It would appear that
'disabling' the data would require an update and take as much time as a
retract.
So, is there any way around this? Am I stuck with 300ms per claim? Would
changing to sequential stateless session be possible, or worthwhile? If I
can't improve the speed, I will have to advice against Drools for the
project.
regards,
Daniel
---------------------
My rules look like this:
rule "RULE_2090"
when
$cl: ClaimLine(historic == false, code == 000000003908, type == "T")
$historic: ClaimLine(historic == true, code >= 000000000052 && <=
000000000052, type == "P", $dt : date)
eval(Utilities.isWithinTimePeriod($dt, $cl.date, "Y", "99"))
$historic_many: ArrayList(size >= 0) from collect(ClaimLine(historic ==
true, code >= 000000000052 && <= 000000000052, type == "P"))
then
String ruleName = drools.getRule().getName();
results.addMessage(ruleName, "000000003908","Only 1 test per day
");
results.setRefer("R");
end
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Bulk-Retract-speed-co...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 6 months
Drools Planner - Time Slots vs Time Periods
by awuttke
Hello,
most of the Drools Planner examples deal with fixed time slots. Lessons are
assigned to defined time slots, nurses are assigned to work at fixed time
slots, etc. So the time slots start at a defined time and have a defined
length.
What I'm looking for is an example which is dealing with flexible time
periods instead (flexible start times and durations).
E.g. a work item needs a defined time to be processed on a machine
(processing time can vary for each work item). In order to keep all machines
busy all the time the work items should be scheduled without gaps if
possible. In addition work items should be assigned only to machines that
have a certain capability required by the work item. Some work items might
have a defined order in which they have to be processed. Some items can have
a defined time when they should start, etc.
I assume that in this case the planner move logic would have to be changed.
Instead of exchanging fixed time slots the time periods would have to be
modified.
Any idea how this could be modelled / implemented?
Thanks for any comment on this,
Andreas
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Planner-Time-S...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 6 months
rule fires while condition is false
by Shai Bentin
I'm running drools 4. It has been running for a long time with no issues.
I have this weird issue now and I'm wondering what can explain this.
I have the following rule defined.
rule "netRepaymentWithLiabilities1"
agenda-group "autoUnderwriting"
when
#conditions
enrichedApplication: EnrichedApplicationVersionTO()
eval
(enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities()
<= 0.65)
decision: Decision()
then
#actions
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!! " +
(enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities()
<= 0.65));
decision.setDecision("APPROVED", "NetRepaymentWthLiblt");
end
This rule invokes although
'enrichedApplication.getNetRepaymentAmountAbilityIncludingLiabilities()'
> 1.
More over in the then part it prints 'false', so how come it invoked
while the condition is not fulfilled? What can cause this?
Shai
14 years, 6 months
Bug in "not" ???
by Tom.E.Murphy@wellsfargo.com
Using Drools Expert 5.0.1
The following rule fires both when the "not" is there, and also if the "not" is commented out. Clearly, both cannot be true, so there is something wrong somewhere.
I've narrowed it down to the testing of the $parentEmploymentId declaration - the AccountHolder CE, which is inside the context of the "not", is referencing $parentEmploymentId, which is declared outside the "not".
If the indicated line is commented out, then the expression behaves sensibly (i.e. fires either when the "not" is used, or when it isn't, but not both). However, an important business semantic element is then missing from the rule.
Is this a bug in Drools, or am I misusing something?
rule "RS7713.9.2_"
when
Employment ( $parentEmploymentId : myId )
not # if the not is commented out, the rule still fires!!!!
(
AccountHolder
(
$parentEmployerInfoId : myId
, parentId == $parentEmploymentId # if this line is commented, it behaves sensibly (per the 'not'), but misses an important business semantic
)
and
BusinessName
(
parentId == $parentEmployerInfoId
, lines contains "DISTRESS"
)
)
then
;
end
Tom Murphy
Business Process Consultant
Wells Fargo HCFG - CORE Deal Decisioning Platform
800 S. Jordan Creek Parkway | West Des Moines, IA 50266
MAC: X2301-01B
Office: 515 324 4853 | Mobile: 515 423 4334
This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.
14 years, 6 months
Smooks Data Loader uses
by JNaylies
Hi all,
I'm new in drools development and I would like toload datas with Smooks Data
Loader.
Unfortunately, I do not find a lot of example of uses.
My need is to load datas from proprietary format and i do not understand all
mechanism.
So, I would thanks you a lot to help me to find good example or good
documentation about this.
Best regards
Jérôme
Ps : sorry for my poor English
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Smooks-Data-Loader-us...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 6 months
how "exists" works exactly?
by Antonio Neto
Hi all,
I don't know exactly why I have a problem in my "exists" function. I've
tried many different ways, but it does not work. Anybody could help me,
please?
I have the following rules:
*rule "diff"
when
$var1: EReference(name == "employee")
$var2: EClass(name == "Company", EAllReferences contains $var1)
not (exists( EPackage(EClassifiers contains $var2 ) ))
then
insertLogical(new IntConstraintOccurrence("diff", 10));
end
rule "ClassesNotReferenced"
when
$q1 : EClass();
$q2 : EPackage(EClassifiers contains $q1);
not( exists ( EReference(EType == $q1) ));
then
insertLogical(new IntConstraintOccurrence("ClassesNotReferenced", 1,
$q1));
end*
and in my facts (and my EPackage) I have 4 instances of EClass "Company"
with a EReference "employee", and another EClass "Person". I still have a
"move" that removes EClasses in my Drools Solver.
I need to have only one classe "Company" after processing. But it removes
only the EClass "Person", when it was supposed to remove one EClass "Person"
and 3 ECLasses "Company". Leaving one EClass "Company" in the end.
The problem is: when Drools tries to remove a EClass "Person" it thinks
that the EClass "Company" does not exists. But in fact there are 3 others.
Any clue about it, please ?
Thanks
Bests regards
Antonio
14 years, 6 months