Guvnor guided editor and non argument constructor
by Sean Su
It seems that the new fact created by the guided editor must be from
the java class that has the default non argument constructor in
Guvnor. There seems no way we can customize it to pass arguments in.
This would force us to provide setters to the object.
Is this a true statement?
Thanks
Sean
Sent from my iPad
12 years, 7 months
looking for advice
by Bobby Richards
I have not yet determined how I want to implement my problem and was hoping
to get some feedback.
I am using drools to migrate the logic from my automated currency trading
infrastructure. Each currency pair, i.e. eurusd has around
200 attributes associated with it.
This includes range values (high, low, average) for multiple time periods,
volatility information, bid/ask updates etc.
Currently I have classes associated for each, so say for range:
class Range {
double high;
double low;
double avg;
}
Range europe = new Range(); //european trading hours
Range us = new Range(); //us trading hours
Questions:
1. I am wondering if I should not just create a map that lists every
attribute per pair as a key ("eurusd:range:europe:high")? So essentially
my drools session will have one fact, not counting the incoming quotes. I
see on the list that this was a problem before the mvel updates but that
was a while ago.
2. When an incoming quote might modify a value, what is the performance
difference between using a rule to change the value or making the changes
outside of the ksession and referencing the facthandler to modify? Is one
method considered 'cleaner'?
Thanks,
Bobby
12 years, 7 months
Using GUVNOR for FUSION RULES
by Matteo Cusmai
Hi all,
i am novice on GUVNOR, but i would like to define my fusion rules by
graphical tool.
An example of my rules is:
rule "radiation-event"
salience 10
no-loop
when
$obs : RadiationObservation( $obsLocation : location, value > 10
) over window:length(1) from entry-point lowLevelSensorStream
not RadiationEvent( this meets[ 25s ] $obs, location
geoIsWithinDistance[ 5m ] $obsLocation )
then
insert(new RadiationEvent( $obs, "Radiation over 10",
Event.THREAT_HIGH, $obsLocation, $obs.getSensor() ));
end
rule "radiation-update"
salience 5
no-loop
when
$obs : RadiationObservation( $obsLocation : location, value > 10
) over window:length(1) from entry-point lowLevelSensorStream
$event : RadiationEvent( this meets[ 25s ] $obs, location
geoIsWithinDistance[ 5m ] $obsLocation )
then
Event e = Event.clone($event);
e.addObservation($obs);
insert( e );
retract($event);
retract($obs);
end
Is it possibile to define rules such the above using GUVNOR?
Are there some documentation or tutorial?
Thanks a lot in advance,
Matteo Cusmai.
12 years, 7 months
Best practice for 0..1 relations
by Christopher Dolan
What's the best way to encode a fact that's needed in the RHS but is not important in the LHS?
Consider a contrived example of computing total household income for single or married persons. I can think of two ways to encode this rule, but I don't like either of them:
Style 1: one rule for each scenario
rule "household income, single"
when
$p1 : Person()
not Relation(person1 == $p1, type == "spouse")
then
insertLogical(new Income($p1.getIncome()));
end
rule "household income, married"
when
$p1 : Person()
Relation(person1 == $p1, type == "spouse", $p2: person2)
then
insertLogical(new Income($p1.getIncome() + $p2.getIncome()));
end
Style 2: a single rule with a collection
rule "household income "
when
$p1 : Person()
$rels : List() from collect(Relation($p1 == person1, type == "spouse"))
then
insertLogical(new Income($p1.getIncome() + ($rels.size() == 0 ? 0 : $rels.get(0).getPerson2().getIncome()));
end
(please ignore the bug that the income may get inserted twice because people are spouses of each other)
Style 1 is more verbose, but more straightforward: it's how I think of the problem intuitively. Style 2 is much more compact, and is more maintainable if I need to add more predicates or a more complicated RHS. But the idea of needing a List when I know there will be exactly 0 or 1 related facts just seems wrong.
I've searched for some LHS syntax that assigns a variable without participating in boolean evaluation, but I've failed to find anything.
Chris
12 years, 7 months
Problem with logging using Drools 5.3.0
by FlyingEagle
Hello,
I am debugging my drools application with Eclipse. Using Drools runtime
5.1.0 I've got automatically log entries from Drools on the console window.
Now I am using the 5.3.0 runtime and no log entries are available.
I have defined a log4j.properties and put it in the classpath. As trace
level I have defined ALL.
Own log entries are produced and shown on the console, but no entries from
Drools are shown.
Has anybody an idea, what I can do to get the log entries?
Thx
--
View this message in context: http://drools.46999.n3.nabble.com/Problem-with-logging-using-Drools-5-3-0...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months