Hi,
I am novice in Drools. Up to my following problem nearly everything worked
fine for me.
In my case I thought mixing the two group mentioned is the right way, and it
could be the right way if I use it in a correct way. The problem is that I
don't get a result.
...
rule "pets"
salience 20
ruleflow-group "pets"
activation-group "categories"
when
$tr : Translog($trpid : pid)
$p : Product(pid == $trpid, $pid : pid, $price : price, $brand :
brand)
$pcat : ProductCategory(pid == $pid, $cid : cid)
$cat : Category(cid == $cid, cname == "pets", $cname : cname)
then
insert(new Recommendation($pid, $price, $brand, $cname));
end
rule "remove everything except pets"
salience 19
ruleflow-group "pets"
when
$recomm : Recommendation((cname == "food") || (cname == "vegetable")
||
(cname == "drinks"))
then
retract($recomm)
end
rule "food"
salience 16
ruleflow-group "food"
activation-group "categories"
when
$tr : Translog($trpid : pid)
$p : Product(pid == $trpid, $pid : pid, $price : price, $brand :
brand)
$pcat : ProductCategory(pid == $pid, $cid : cid)
$cat : Category(cid == $cid, cname == "food", $cname : cname)
then
insert(new Recommendation($pid, $price, $brand, $cname));
end
rule "remove everything except food"
salience 15
ruleflow-group "food"
when
$recomm : Recommendation((cname == "vegetable") || (cname ==
"drinks"))
then
retract($recomm)
end
...
The idea is that I firstly add a new object (Recommendation) to my working
memory. After that I check if there are already existing
Recommendation-objects. Such objects that are from a less important category
should now be removed. The priority attribute is the /cname/ (category
name). So in the end there can be more Recommendation objects of one
category but never of different categories.
I request the result in the following way (perhaps this is incorrect):
rule "show recomms"
salience 5
when
$recomm : Recommendation()
then
System.out.println($recomm);
end
So the result is an empty console, but with my test data there should be two
Recommendation objects in my working memory after terminating.
--
View this message in context:
http://drools.46999.n3.nabble.com/mixing-activation-group-and-ruleflow-gr...
Sent from the Drools: User forum mailing list archive at
Nabble.com.