Dynamic ValueRangeProvider
by Andrew Varner
Optaplanners,
I'm looking to add some dynamic goodness to ValueRangeProvider. The only way I see to specify a ValueRangeProvider is via annotation.
I'd like to be able to generate the id and Collection of candidate values dynamically. Is it possible to generate the ValueRangeProvider data outside of an annotation?
For example:
public class MyDataSource {
public Collection getValues(String id) {
…
return values;
}
}
Thanks,
Drew
12 years, 6 months
WG: Drools Fusion 6.0.0.CR3
by Weiss, Wolfgang
Hi all!
I tried out Drools 6.0.0.CR3 and I have some difficulties in detecting patterns with rules containing temporal parameters. I'm using following rule:
rule "detect turn shifts"
agenda-group "evaluation"
salience 100
when
$aae : AudioActivityEvent(value >= 50) from entry-point "LowLevelES"
not(AudioActivityEvent(value < 50, userID == $aae.userID, this after[0, 300ms] $aae) from entry-point "LowLevelES")
then
logger.info("turn shift START, user ID: " + $aae.getUserID() + ", " + $aae.toString());
// do something else ...
end
When inserting events following happens:
12:43:05,914 [main ] DEBUG ReteooRuleBase - Starting Engine in PHREAK mode
12:43:06,225 [main ] INFO SemanticLifter - incoming event: AudioActivityEvent [userID=1, value=100.0]
12:43:06,295 [main ] INFO SemanticLifter - incoming event: AudioActivityEvent [userID=1, value=0.0]
12:43:06,344 [main ] INFO SemanticLifter - incoming event: AudioActivityEvent [userID=1, value=100.0]
12:43:11,096 [main ] INFO SemanticLifter - incoming event: AudioActivityEvent [userID=1, value=0.0]
12:43:11,100 [main ] INFO SemanticLifter - turn shift START, user ID: 1, AudioActivityEvent [userID=1, value=100.0]
...
The "turn shift start" should be detected 300ms after the third incoming event (12:43:06,344) which is not the case here. This rule worked for me when using Drools 5.5.0 and 6.0.0.Beta2 but not with 6.0.0.CR3 - I did not try any other version.
This is my code to insert events:
streamEntryPoint = ksession.getEntryPoint("LowLevelES");
...
streamEntryPoint.insert(lowLevelEvent);
ksession.getAgenda().getAgendaGroup("evaluation").setFocus();
ksession.fireAllRules();
"AudioActivityEvent" is declared as an event with the @role attribute. I also tried to use the following option: "RuleEngineOption.RETEOO", but with no difference.
Best regards,
Wolfgang
12 years, 6 months
A Drools CEP Scenario - did I get it right?
by amarok
I got the following scenario:
- I need a Web Service that reasons over received sensor events (1000+ per
day and client) in realtime and send messages if certain patterns occur.
- The web service has many clients (100-1000) but their events / facts do
not interfere (each client has his own state and events that change his
state).
- Each client also has his own rules (10-100) (but they are parameterized
generic rules - I thought maybe I could use rule templates or DSL to let
clients individualize their rules).
- Some rules are time dependant (e.g. if event (type=x) does not occour at
least within half an hour after 8:00 a.m. (where 8 o'clock is a rule
parameter) -> send a message), others are accumulative (e.g. if number of
events within 5h is > 3).
I'd like to use drools CEP for this. I already read some documentation and
tutorials but my first examples do not really work as I expected. Now I fear
to have some general misconception about Drools/CEP. If someone could have a
look over my ideas, I'd be very glad!
How I would do it:
-> Every client would have his own KnowledgeBase with his (individualized)
rules. Rules would be stored in guvnor or on a mysql database as plain text.
-> Every client would have his own KnowledgeBase / StatefullKnowledgeSession
on the service, that knows about recent sensor events and some facts about
the client. Events automatically are disposed of once they are not relevant
anymore.
-> A static hashmap will hold references to the session for each client.
(clientID -> KnowledgeSession)
-> Sessions are created when a new client joins the system, but are normally
not disposed unless the client completely leaves the system.
-> When a new Event is received (HTTP PUT), the session corresponding to the
client would be retrieved from the HashMap and the new event would be
inserted via an event stream. Then (for every new event)
session.fireAllRules() would be called on the clients KnowledgeSession.
-> The Knowledge Base would run in STREAM mode to be able to reason over
time windows and automatically expire (=delete?!) events. This would keep
memory usage in within bounds(?)
-> pseudo clock allows me to write tests or simulate the system with records
of old events. (Is it possible to test timer, cron and sliding-window rules
with pseudo clock? Can I explicitly set the time of the pseudo clock?)
I appreciate your help!
--
View this message in context: http://drools.46999.n3.nabble.com/A-Drools-CEP-Scenario-did-I-get-it-righ...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
MultiThreaded Drools implemetation
by ashwindrool
Hi,
I need to implement multithread drools execution.
Following i want to do
1. Load more than one drools rule set say drl1 and drl2.
2. Use core data model (facts) such that when independent thread executing
rules it doesnot modify facts simultaneously otherwise other drl wont get
executed.
3. Merging output of both drls into one output model.
Can any one provide me example to above conditions
Thnks....
--
View this message in context: http://drools.46999.n3.nabble.com/MultiThreaded-Drools-implemetation-tp40...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
Events in wrong order - will it cause problems?
by Alexander Wolf
I used to let drools set the timestamp of events automatically, but a new requirement forces me to use @timestamp for my events.
Normally my events should come in the right order, but sometimes (as the events origin from mobile devices) it can occur that the order is incorrect.
I tested with "wrong" timestamps and it seems like they would work alright - but I think I read somewhere, that events inserted in a wrong order might be ignored in some circumstances (especially by CEP rules).
How can events in wrong order cause problems?
12 years, 6 months
Guvnor 5.5 pkg compile error - Unable to build expression for action
by pritispin
Hi All,
I'm not able to compile an imported pkg from eclipse inside guvnor. The
package is imported into defaultPackage and the process definition of the
imported packages has tns:package:defaultPackage.
I'm runnnig the jbpm-fullinstaller 5.5 which starts jBossAS7. The errors,
when I compile the package after the process is being imported, are
following:
1) Unable to analyze expression ClientTaskDetail clientTaskDetail = new
ClientTaskDetail();
2) Unable to build expression for action ClientTaskDetail
Now in the process definiton, there is an import of the business class which
works fine in eclipse.
Seems like guvnor is not finding the business jar in the classpath.
So I packaged the business jar inside the drools-guvnor.war and redeployed
it (followed ant stop.demo; ant start.demo) but still keep getting the same
error.
Can someone please point me to a tool that will suggest what jars are being
loaded into the runtime or a possible resolution for this classpath issue
when it is not finding the business jar that is being reference inside the
process definition.
BTW, this process definiton does not have any rules inside it - it just have
bunch of script tasks that references business service jars.
Thanks you for your time.
~Priti
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-5-pkg-compile-error-Unable-to-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months