[ https://issues.apache.org/jira/browse/JENA-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15446001#comment-15446001 ]
ASF GitHub Bot commented on JENA-1228: -------------------------------------- Github user afs commented on a diff in the pull request: https://github.com/apache/jena/pull/165#discussion_r76614257 --- Diff: jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/Optimize.java --- @@ -18,82 +18,58 @@ package org.apache.jena.sparql.algebra.optimize; -import org.apache.jena.query.ARQ ; import org.apache.jena.sparql.ARQConstants ; -import org.apache.jena.sparql.SystemARQ ; -import org.apache.jena.sparql.algebra.* ; -import org.apache.jena.sparql.algebra.op.OpLabel ; +import org.apache.jena.sparql.algebra.Op ; import org.apache.jena.sparql.engine.ExecutionContext ; import org.apache.jena.sparql.util.Context ; -import org.apache.jena.sparql.util.Symbol ; -import org.slf4j.Logger ; -import org.slf4j.LoggerFactory ; - -public class Optimize implements Rewrite +/** Optimization of algebra expressions. + * <p> + * New optimization processes can be installed via a global change: + * <pre> + * Optimize.setFactory((cxt)->new MyOptimize(cxt)) ;</pre> + * or on a per-context basis: + * <pre> + * Optimize.RewriterFactory f = (cxt)->new MyOptimize(cxt) ; + * context.set(ARQConstants.sysOptimizerFactory, f) ;<pre> + */ +public class Optimize { - static private Logger log = LoggerFactory.getLogger(Optimize.class) ; - - // A small (one slot) registry to allow plugging in an alternative optimizer + /** Factory for rewriters */ --- End diff -- What difference does it make? It's an interface; there is no static/enclosing distinction. > Allow application code to replace part of the standard "Optimize" sequence. > --------------------------------------------------------------------------- > > Key: JENA-1228 > URL: https://issues.apache.org/jira/browse/JENA-1228 > Project: Apache Jena > Issue Type: Improvement > Reporter: Andy Seaborne > Priority: Minor > > A different optimization step can be installed with a global change: > {noformat} > Optimize.setFactory((cxt)->new MyNewOptimize(cxt)) ; > {noformat} > or on a specific {{Context}}: > {noformat} > Optimize.RewriterFactory f = (cxt)->new OptimizeTQ(cxt) ; > context.set(ARQConstants.sysOptimizerFactory, f) ; > {noformat} > This is a complete replacement. > This JIRA is to allow specific steps to be replaced. This would be quite > useful for development when specific transforms are being fixed or improved. > One way to do this is to make {{Optimize}} have protected methods for each > optimization step thereby exposing the standard policy with the possibility > of different transforms within that policy. > Thus: > {noformat} > class MyNewOptimize extends Optimize > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)