com.hp.hpl.jena.sparql.algebra.optimize
Class TransformOrderByDistinctApplication

java.lang.Object
  extended by com.hp.hpl.jena.sparql.algebra.TransformCopy
      extended by com.hp.hpl.jena.sparql.algebra.optimize.TransformOrderByDistinctApplication
All Implemented Interfaces:
Transform

public class TransformOrderByDistinctApplication
extends TransformCopy

Improved optimization for ORDER BY plus DISTINCT or REDUCED combinations, see JENA-441 for original proposal and discussion.

This optimization is enabled by default as with most ARQ optimizations and may be disabled by setting the symbol ARQ.optOrderByDistinctApplication to false.

Optimization Applicability

This is a limited optimization that applies in the case where you have a query that meets the following conditions:

Essentially this takes algebras of the following form:

 (distinct 
   (project (?var) 
     (order (?var) 
       ... )))
 

And produces algebra of the following form:

 (order (?var)
   (distinct 
     (project (?var) 
       ... )))
 

In the general case this in unsafe because it would change the semantics of the query since ORDER BY can access variables that are not projected. However if the conditions outlined are met then this optimization is safe, the algebras will be semantically equivalent and the resulting form likely significantly more performant, of course YMMV depending on how much data you are querying.


Field Summary
 
Fields inherited from class com.hp.hpl.jena.sparql.algebra.TransformCopy
COPY_ALWAYS, COPY_ONLY_ON_CHANGE
 
Constructor Summary
TransformOrderByDistinctApplication()
           
 
Method Summary
 Op transform(OpDistinct opDistinct, Op subOp)
           
 Op transform(OpReduced opReduced, Op subOp)
           
 
Methods inherited from class com.hp.hpl.jena.sparql.algebra.TransformCopy
transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformOrderByDistinctApplication

public TransformOrderByDistinctApplication()
Method Detail

transform

public Op transform(OpDistinct opDistinct,
                    Op subOp)
Specified by:
transform in interface Transform
Overrides:
transform in class TransformCopy

transform

public Op transform(OpReduced opReduced,
                    Op subOp)
Specified by:
transform in interface Transform
Overrides:
transform in class TransformCopy


Licenced under the Apache License, Version 2.0