[ 
https://issues.apache.org/jira/browse/JENA-630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rob Vesse resolved JENA-630.
----------------------------

    Resolution: Fixed

Ok, I think I now have this sorted out, {{ExprTransformConstantFold}} now takes 
advantage of the results of foldings lower down the tree and also defers to 
{{ExprTransformCopy}} where folding has no effect.

For your complex example I now see the following output (I added the same 
{{println}} as you and additional ones to {{ExprTransformConstantFold}}:

{noformat}
transform ExprFunction2: ( 5 + 6 ) - 5 - 6
ExprFunction2: ( 5 + 6 )
NodeValue: 5
NodeValue: 6
transform ExprFunction2: ( 8 + 9 ) - 8 - 9
ExprFunction2: ( 8 + 9 )
NodeValue: 8
NodeValue: 9
transform ExprFunction2: ( ( 5 + 6 ) * ( 8 + 9 ) ) - 11 - 17
ExprFunction2: ( 11 * 17 )
NodeValue: 11
NodeValue: 17
transform ExprFunction2: ( 1 + ( ( 5 + 6 ) * ( 8 + 9 ) ) ) - 1 - 187
ExprFunction2: ( 1 + 187 )
NodeValue: 1
NodeValue: 187
{noformat}

So you can see that now each expression is only considered once and folds lower 
in the tree propagate directly up the tree.

I'm now marking this as resolved again.

> Do constant folding as part of query optimisation
> -------------------------------------------------
>
>                 Key: JENA-630
>                 URL: https://issues.apache.org/jira/browse/JENA-630
>             Project: Apache Jena
>          Issue Type: Improvement
>          Components: ARQ
>    Affects Versions: Jena 2.11.1
>            Reporter: Rob Vesse
>            Assignee: Rob Vesse
>             Fix For: Jena 2.11.2
>
>
> Currently Jena does not automatically simplify expressions by constant 
> folding even though the function API actually has support for this already 
> baked into it.
> This issue will track work to integrate a transform for this into the 
> standard optimiser.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to