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

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

public class TransformPromoteTableEmpty
extends TransformCopy

Optimizer that ensures that table empty is promoted as high up a query as is possible

table empty is an operator that may be introduced into the algebra by other optimizations and represents the case where the optimizer can a priori determine that some portion of a query will produce no results. The classic example of this are FILTER clauses that may be determined to always return false and thus negate the need to evaluate their inner operations.

Other optimizers introduce table empty at the point in the query where they are optimizing, often its presence in a query may render a larger portion of even the entire query superfluous so this optimizer is designed to promote it up through the query as necessary.

As detailed below this is not guaranteed to eliminate all portions of a query rather it aims to eliminate portions where not doing so can cause expensive and unnecessary evaluation to happen e.g. evaluating the left hand side of a join (which may itself be a deeply nested operator) only to join it with table empty and thus discard all the work that had been done.

Table Empty Promotions

The optimizer makes the following promotions:

All other operators are left untouched either because it cannot be promoted through them or because doing so has no clear benefit since applying them over table empty should be minimal work anyway.


Field Summary
 
Fields inherited from class com.hp.hpl.jena.sparql.algebra.TransformCopy
COPY_ALWAYS, COPY_ONLY_ON_CHANGE
 
Constructor Summary
TransformPromoteTableEmpty()
           
 
Method Summary
 Op transform(OpAssign opAssign, Op subOp)
           
 Op transform(OpExtend opExtend, Op subOp)
           
 Op transform(OpGraph opGraph, Op subOp)
           
 Op transform(OpJoin opJoin, Op left, Op right)
           
 Op transform(OpLeftJoin opLeftJoin, Op left, Op right)
           
 Op transform(OpMinus opMinus, Op left, Op right)
           
 Op transform(OpUnion opUnion, Op left, Op right)
           
 
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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformPromoteTableEmpty

public TransformPromoteTableEmpty()
Method Detail

transform

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

transform

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

transform

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

transform

public Op transform(OpJoin opJoin,
                    Op left,
                    Op right)
Specified by:
transform in interface Transform
Overrides:
transform in class TransformCopy

transform

public Op transform(OpLeftJoin opLeftJoin,
                    Op left,
                    Op right)
Specified by:
transform in interface Transform
Overrides:
transform in class TransformCopy

transform

public Op transform(OpMinus opMinus,
                    Op left,
                    Op right)
Specified by:
transform in interface Transform
Overrides:
transform in class TransformCopy

transform

public Op transform(OpUnion opUnion,
                    Op left,
                    Op right)
Specified by:
transform in interface Transform
Overrides:
transform in class TransformCopy


Licenced under the Apache License, Version 2.0