Details
-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
5.1.0.FINAL
-
Workaround Exists
-
Description
When building a simple rule, we discovered that the resulting "rete tree" did not reused some node conditions, dispite they are listed in the same order. After some different approaches we get to the expected tree using explicit predicates.
Shouldn't both alternatives generate the same tree? And if don't, can some optimization be created in Drools CORE to handle this?
Note that although the tree is different, it uses the same node types.
OPTION 1: OPTIMIZED RETE TREE
------
{{{
#created on: 09/11/2010
package aa
#list any import classes here.
import br.com.auster.om.invoice.telco.CallDetail;
import br.com.auster.om.invoice.telco.ServiceTypeEnum;
import br.com.auster.om.util.UnitCounter;
import br.com.auster.om.util.UnitCounter.TypeOfUnitEnum;
import br.com.auster.om.invoice.telco.TelcoCustomer;
rule "call duration check 1"
when
CallDetail( serviceType == ServiceTypeEnum.VOICE,
$realDuration : realDuration -> ($realDuration.getType() == TypeOfUnitEnum.TIME),
$billedDuration : billedDuration -> ($billedDuration.getType() == TypeOfUnitEnum.TIME),
realDuration.seconds <= 3 )
then
// TODO
end
rule "call duration check 2"
when
CallDetail( serviceType == ServiceTypeEnum.VOICE,
$realDuration : realDuration -> ($realDuration.getType() == TypeOfUnitEnum.TIME),
$billedDuration : billedDuration -> ($billedDuration.getType() == TypeOfUnitEnum.TIME),
realDuration.seconds > 3 )
then
// TODO
end
rule "call-duration-check - realDuration > 30"
when
CallDetail( serviceType == ServiceTypeEnum.VOICE,
$realDuration : realDuration -> ($realDuration.getType() == TypeOfUnitEnum.TIME),
$billedDuration : billedDuration -> ($billedDuration.getType() == TypeOfUnitEnum.TIME),
realDuration.seconds > 30 )
then
// TODO
end
}}}
OPTION 2: NOT-OPTIMIZED RETE TREE
------
{{
}