Hi.

I localized the problem. The following lines lead to the described behavior:

/for (Translog tr : translog) {
        if (tr.getTransType() == 1 && !(tr.getUserID().compareTo("null") == 0)) 
{
                FactHandle tr_insert = ksession.insert(tr);
                ksession.fireAllRules();
                ksession.retract(tr_insert);
        }
}/

If I run the program with the changed lines
/for (Translog tr : translog) {
        if (tr.getTransType() == 1 && !(tr.getUserID().compareTo("null") == 0)) 
{
                ksession.insert(tr);
        }
}
ksession.fireAllRules();/

it doesn't work as I expect it. I didn't change the according rule
/rule "filter products with category and brand for slot 1"
        salience 20
        activation-group "productfilter slot 1"
        when
                Translog($pid : itemID, $uid : userID)
                Product(pid == $pid, brand != "", $price : netUnitPrice,
$brand : brand)
                ProductCategory(pid == $pid, $cid : cid, $root : root)
                Category(cid == $cid, $cname : cname)
                FilterCriteria(categories_slot1 contains $root)
                FilterCriteria(brands contains $brand)
                not Recommendation(pid == $pid, slot == 1, uid == $uid)
        then
                insert(new Recommendation($pid, $price, $brand, $cname, $cid, 
(byte)1,
$root, $uid));
end/

In the end I show all Recommendation-facts in the console using a query.
There should be at least 4, grouped by uid (userid). But with the corrected
lines I only get one Recommendation-fact.
/query "recomm for slot 1"
        $recomm_max     : Recommendation(slot == 1, $recomm_value : 
recommValue, $uid :
uid)
        not Recommendation(slot == 1, recommValue > $recomm_value, uid == $uid)
end/

The same applies for the query, without grouping by uid:
/query "recomm for slot 1"
        $recomm_max     : Recommendation(slot == 1)
end/

I chose the first (wrong) solution, with retracting the Translog-facts
directly after firing, because it is transaction data. For my test there are
only a few lines, but in the productive scenario there are at least 100.000
records to insert.

Regards...



--
View this message in context: 
http://drools.46999.n3.nabble.com/Different-results-with-same-fact-base-tp4021000p4021056.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to