Need help with setFocus
by new2drools
Hi All,
Need some help with understanding setFocus.
I have the following use case:
if (condition1) {
if (condition2) {
} else if (condition3) {
} else if (condition 4) {
}
}
if (condition5) {
if (condition2) {
} else if (condition3) {
} else if (condition 4) {
}
}
I created 3 rules (rule2, rule3, rule4) for checking condition2, condition3,
condition4 and
created 1 agenda group (groupX) for them.
I created 2 rules (rule1, rule5) for checking condition1, condition5 and
created 1 agenda group(groupY) for them.
rule "rule1"
agenda-group "groupY"
when
//
then
drools.setFocus("groupX");
end
rule "rule3"
agenda-group "groupX"
activation-group "someActiveGroup"
when
//
then
//
end
>From the java code:
ksession.getAgenda().getAgendaGroup("groupY").setFocus();
Problem: The first time, drools.setFocus("groupX") is invoked, I see that
it's working fine. rule2 or rule3 or rule4 get triggered. But, the SECOND
time that drools.setFocus("groupX") is invoked, I don't see that any rule in
agenda-group groupX is being invoked...even though one of the rule's LHS
explicitly matches...thinking that the activation-group is cancelling all
the activation's (after one rule in that activation group is fired), I even
removed the activation-group statement. But, it didn't help...ideally, I
would like to bunch rule2, rule3, rule4 in one activation group.
Can you please let me know as to why the second invocation of setFocus is
not working? I even tried to remove everything in LHS of rule2/3/4, to see
if the second invocation would work...it doesn't...
Thanks!!
--
View this message in context: http://www.nabble.com/Need-help-with-setFocus-tp24177742p24177742.html
Sent from the drools - user mailing list archive at Nabble.com.
1 week, 6 days
Drools beginner - unable to resolve method using strict-mode
by Stefan Schuster
Hi,
I'm new to drools, and I made my first steps using the very nice
video-tutorial "Build Pong in 13 minutes using JBoss Drools" found here:
http://www.youtube.com/watch?v=Omj4PR3v-nI
Eclipse shows building errors, but Pong start anyway. What does this error
mean?
in move.drl there is following rule:
*<rule "Move Bat Up" timer(expr: bat.speed, bat.speed) no-loop when*
* ui : PongUI( ready == true )*
* ( KeyPressed( keyText == "A" ) and bat : Bat( playerId ==
PlayerId.PlayerOne, y > pconf.padding + pconf.sideLineWidth )*
* or*
* KeyPressed( keyText == "K" ) and bat : Bat( playerId ==
PlayerId.PlayerTwo, y > pconf.padding + pconf.sideLineWidth ) ) *
* td : TableDirty( ) *
*then *
* tableG = ui.getTablePanel().getTableG();*
* tableG.setColor( Color.BLACK ); // background*
* tableG.fillRect( bat.x, bat.y, bat.width, bat.height );*
* *
* modify( bat ) { y = bat.y - 2 };*
* tableG.setColor( Color.WHITE ); // background*
* tableG.fillRect( bat.x, bat.y, bat.width, bat.height ); *
* modify( td ) { dirty = true };*
*end*
the error message is:
[Error: unable to resolve method using strict-mode:
org.drools.spi.KnowledgeHelper.td<http://org.drools.spi.knowledgehelper.td/>
()]
[Near : {... @Modify with( td ) { dirty = true }; ....}]
in another File (ui.drl) TableDirty is defined:
*declare TableDirty*
* @propertyReactive*
* dirty : boolean*
*end*
Any ideas what this error message means? And why can I start pong despite
this error?
Thanks a lot for helping me
Stefan
4 months
conways game of life
by Mark Proctor
For anyone looking for a good and complex example on how to write rules
properly, please look at Conways Game of Life in drools-examples, for
extra bonus points compare it to the old version in M1. You'll see
nearly all the logic is moved from java to the drl and we have removed
the need for nested objects by using objects relaitionally, which also
allows us to exploit cross products to drive the application.
Mark
4 months
Need help in drool workbench
by RANJAN Nalini
Hi Team,
Hope you are doing good..
We are new in drool workbench and we are planning to use drools workbench for our upcoming project..
This development we are going to do across different region..
Currently we have common drools workbench which hosted in one PC...Major issue which we are facing is that whenever we do modification from one region and its break to other region development..
Is there any way to do our development without impacting to other region code ?.
Do we have any mechanism to disable rule which has been written by one developer and it can be enable only when flag will be true(like toggle features) ?
Regards,
Nalini Ranjan
=========================================================
Ce message et toutes les pieces jointes (ci-apres le "message")
sont confidentiels et susceptibles de contenir des informations
couvertes par le secret professionnel. Ce message est etabli
a l'intention exclusive de ses destinataires. Toute utilisation
ou diffusion non autorisee interdite.
Tout message electronique est susceptible d'alteration. La SOCIETE GENERALE
et ses filiales declinent toute responsabilite au titre de ce message
s'il a ete altere, deforme falsifie.
=========================================================
This message and any attachments (the "message") are confidential,
intended solely for the addresses, and may contain legally privileged
information. Any unauthorized use or dissemination is prohibited.
E-mails are susceptible to alteration. Neither SOCIETE GENERALE nor any
of its subsidiaries or affiliates shall be liable for the message
if altered, changed or falsified.
=========================================================
9 years, 1 month
Compiled template rule ordering
by Patrick Conreaux
Hi,
I am attempting to compile a rule template and expecting the resulting rules
to preserve the ordering of the template and of the rows in the CSV file.
However, it doesn't appear that ordering is preserved. Is this a bug, or is
there a workaround?
I would like to rely on the implicit top-down salience by having rules in a
specified order within the same file. (I'm aware that mutually exclusive
rules are preferred, but this greatly complicates maintaining the rules for
my use case, as does maintaining salience values.)
Using the (slightly-modified) cheese example, this template...
template header
age
type
log
package org.drools.examples.templates;
global java.util.List list;
rule "first rule"
when
eval(true)
then
System.out.println("first rule");
end
template "cheesefans"
rule "Cheese fans_(a){row.rowNumber}"
when
Person(age == @{age})
Cheese(type == "@{type}")
then
list.add("@{log}");
end
end template
rule "last rule"
when
eval(true)
then
System.out.print("last rule");
end
...results in the following output, where the first and last rule appear
at the top followed
by the template rules in *reverse *row order. Any suggestions to achieve
the desired order?
package org.drools.examples.templates;
global java.util.List list;
rule "first rule"
when
eval(true)
then
System.out.println("first rule");
end
rule "last rule"
when
eval(true)
then
System.out.print("last rule");
end
rule "Cheese fans_3"
when
Person(age == Really old guy)
Cheese(type == "65")
then
list.add("provolone");
end
rule "Cheese fans_2"
when
Person(age == Young guy)
Cheese(type == "21")
then
list.add("cheddar");
end
rule "Cheese fans_1"
when
Person(age == Old guy)
Cheese(type == "42")
then
list.add("stilton");
end
Cheers,
Patrick
9 years, 2 months