[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2781) Optimization for sub-attributes in LHS conditions
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Wed May 18 00:45:01 EDT 2011
[ https://issues.jboss.org/browse/JBRULES-2781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602814#comment-12602814 ]
Mark Proctor commented on JBRULES-2781:
---------------------------------------
In theory it should. For java dialect we compare byte[], for mvel we compare String.
> Optimization for sub-attributes in LHS conditions
> -------------------------------------------------
>
> Key: JBRULES-2781
> URL: https://issues.jboss.org/browse/JBRULES-2781
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: drools-compiler, drools-core
> Affects Versions: 5.1.0.FINAL
> Environment: Windows XP & 7 Pro, Eclipse Galileo, JDK 1.6 update 21
> Reporter: Frederico Ramos
> Assignee: Mark Proctor
> Priority: Minor
> Labels: optimization, rete_tree
> Attachments: notOptimized.png, optimized.png
>
>
> 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
> ------
> {{{
> #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.type == TypeOfUnitEnum.TIME,
> $billedDuration : billedDuration.type == TypeOfUnitEnum.TIME,
> realDuration.seconds <= 3 )
> then
> // TODO
> end
> rule "call duration check 2"
>
> when
> CallDetail( serviceType == ServiceTypeEnum.VOICE,
> $realDuration : realDuration.type == TypeOfUnitEnum.TIME,
> $billedDuration : billedDuration.type == TypeOfUnitEnum.TIME,
> realDuration.seconds > 3 )
>
> then
> // TODO
> end
> rule "call-duration-check - realDuration > 30"
>
> when
> CallDetail( serviceType == ServiceTypeEnum.VOICE,
> $realDuration : realDuration.type == TypeOfUnitEnum.TIME,
> $billedDuration : billedDuration.type == TypeOfUnitEnum.TIME,
> realDuration.seconds > 30 )
> then
> // TODO
>
> end
> }}}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list