Rule Templates with empty cells
by jschmied
Hi!
If I write rules in a decision table I can leave cells empty if I don't need
to use all of the conditions in a row.
How can I do this with the ExternalSpreadsheetCompiler?
I would need something like:
rule "rule_(a){row.rowNumber}"
when
$s : MyType1()
@ifDefined{field1} $e : MyType2(val1 == "@{field1}") from $s.SUB;
@ifDefined{field2} $e : MyType2(val2 == "@{field2}") from $s.SUB;
then
retract($s);
end
Thanks
Juergen
--
View this message in context: http://n3.nabble.com/Rule-Templates-with-empty-cells-tp138571p138571.html
Sent from the Drools - User mailing list archive at Nabble.com.
16 years, 2 months
"collection contains" problem
by Mike Dougherty
Hello all,
I've been getting more and more into using Drools Expert, but I certainly still have a lot to learn. I have almost a complete rules file ready to go. But I am having an issue with the LHS checking that a collection contains a certain object value. The rule currently looks like this:
rule "Rule Name"
no-loop true
when
property : StatusProperty( name == "propertyName", value == "valueA" )
t : TrainingStatus( currentSection == "section_a", properties contains property )
then
t.setNextSection( "section_b" );
t.setPreviousSection( "section_overview" );
update( t );
end
The TrainingStatus object has the following fields:
public class TrainingStatus implements Serializable {
private String currentSection;
private String nextSection;
private String previousSection;
private Set<StatusProperty> properties = new TreeSet<StatusProperty>();
}
And the StatusProperty object has the following:
public class StatusProperty implements Serializable {
private String name;
private String value;
}
I'm inserting a TrainingStatus object that should match this rule. But the resulting object does not have the nextSection and previousSection fields set to the values they should.
Can anyone advise on how to get this rule working as expected?
Thanks for your help!
Mike
16 years, 2 months
Human Task Example
by Chuck Irvine
Hello. Is there a complete Human Task example that someone could point me
to? I'm looking for an example that uses the Eclipse task plugin to allow
users to complete tasks. Thanks! -Chuck
16 years, 2 months
confused on when to call fireAllRules
by Charles Binford
Hi, I'm trying to add some functionality to my 4.0.7 based project and
am realizing I don't understand some basics as well as I thought I did.
Until now, I've been using a very simple model: create session, insert
facts, fire rules, destroy session. My new functionality needs to use a
long lived session. I also may find the duration feature useful so I
searched through the examples and found the TroubleTicketExample. Now
what has be confused is that example shows rules firing AFTER control
has been returned from the fireAllRules() call. I tried to create
something similar - call fireAllRules, then call session.update(han,
obj) - but nothing happens. If I call fireAllRules again (after the
update) then my rule fires as expected. My test didn't use any
duration statement. Is that the magic in the TroubleTicketExample? If
so, then how does one have a clue as to whether one needs to call
fireAllRules after an update or not (i.e. no way to tell if a duration
rule is keeping it running)? Obviously I'm missing some basic
understanding here. Please enlighten me.
Thanks,
Charles Binford
16 years, 2 months
Better Performance and Maintainability?
by HonorGod
Hi,
Can someone plz help me understand performance and maintainability in the
following scenario - ?
I load tons of rows of data from database and store them in an object fact
model [POJO based] and apply the rules using decision tables and finally
persist data.
vs
I load tons of rows of data from database and store them in an object fact
model [HashMap - Key - Value] and apply the rules using decision tables and
finally persist data.
The difference in the above two scenarios is that one of them is pojo based
and the other is key-value pairs that are used on LHS of the decision
tables. When I use Key-Value approach I had to do lot of conversion in terms
converting the conditions into eval statements and validations but where as
the pojo approach is very straight forward and less validations.
Which approach gives me better performance and maintainability?
I would consider the following before I make a decision -
1 - size of data
2 - frequency at which the data changes [in terms of adding new conditions /
adding new columns / removal of new columns etc]
3 - re-usability
Thank You!
--
View this message in context: http://n3.nabble.com/Better-Performance-and-Maintainability-tp136941p1369...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years, 2 months
drools-solver recover the score of last step
by dmzpippo-drools@yahoo.it
Hi all,
is possible in a DRL file, useded for droos-solver, recover the score of last step?
I need it because with the rule I calculate a function score f(n); to diverrsificate the research if f(n) is bigger then f(n) of last step then add a penality...
regards
16 years, 2 months
Is this possible in Guvnor?
by HonorGod
Hi,
I have a single fact model with 5 [a1, a2,a3, a4, and a5] different
attributes. I have 3 decision tables in the following fashion
Decision Table 1
---------------------------------------------
condition | condition | condition | Action |
---------------------------------------------
a1 | a2 | a3 | a4 = a1+a3|
----------------------------------------------
Once I have the value of a4, I need to hit different set of rules which are
stored in second decision table
Decision Table 2
---------------------------------------------
condition | condition | condition | Action |
---------------------------------------------
a1 | a2 | a4 | a5 = a4 |
----------------------------------------------
Once I have the value of a5, I need to hit different set of rules which are
store in third decision table
Decision Table 3
------------------------------------------------------------------------
condition | condition | condition | condition | condition | Action
|
-------------------------------------------------------------------------
a1 | a2 | a3 | a4 | a5 |
computeValue() |
------------------------------------------------------------------------
I don't have any problem when I load the rules into individual KnowledgeBase
and fire the rules one after the other as follows -
<code>
// apply rules from decision table 1
StatefulKnowledgeSession kSession =
knowledgeBase1.newStatefulKnowledgeSession() ;
kSession.insert(caEventDO);
kSession.fireAllRules();
// apply rules from decision table 2
kSession = knowledgeBase2.newStatefulKnowledgeSession() ;
kSession.insert(caEventDO);
kSession.fireAllRules();
// apply rules from decision table 3
kSession = knowledgeBase3.newStatefulKnowledgeSession() ;
kSession.insert(caEventDO);
kSession.fireAllRules();
kSession.dispose() ;
</code>
But when I upload the decision tables into Guvnor and use the package / drl
from the package snapshot my second set of rules are not fired at all.
How do I resolve this issue?
Please help.
Thanks
--
View this message in context: http://n3.nabble.com/Is-this-possible-in-Guvnor-tp122132p122132.html
Sent from the Drools - User mailing list archive at Nabble.com.
16 years, 2 months
How do you know when all rules have finished
by drooler
Hi,
New to Drools. Could not find a specific answer to this, but it may be there
in the forum somewhere. I have written a rule set for testing the 'fitness'
of 3000 generations of organizms. The rules always test fitness against the
last dozen or so generations. So I need to start at generation 13 and then
when all rules have run against that generation and referencing the previous
12 I need to increment the 'current' generation so that it points at
generation 14. All rules are written relative to that current generation.
How do I know when to increment to the next generation as I need to be
certain that Drools has fired all the rules for the current generation?
Once I have done that, I have some modification objects to put in working
memory that influences the 'fitness' of the generations. These modification
objects have up to 5 parameters. I what to be able to vary these 5
parameters and retest. Rather than tweak them and re run the 3000
generations is there a way to use the Planner where different moves can
alter the 5 parameters and determine a score to measure whether the
modifications are enduring over many generations. In other words the score
does not relate to an individual generation but a lasting affect over many
generations.
Thx.
David
--
View this message in context: http://n3.nabble.com/How-do-you-know-when-all-rules-have-finished-tp13476...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years, 2 months