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

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

public class TransformFilterImplicitJoin
extends TransformCopy

Optimizer for transforming implicit joins. These covers queries like the following:

 SELECT *
 WHERE
 {
   ?s a ?type1 .
   ?t a ?type2 .
   FILTER(?s = ?t)
 }
 

Clearly this is a trivial example but doing this optimization can have big performance gains since it can completely eliminate cross products that we would otherwise be required to evaluate. The optimization where applicable results in a query of the following form:

 SELECT *
 WHERE
 {
   ?s a ?type1 .
   ?s a ?type1 .
   BIND(?s AS ?t)
 }
 

The optimizer does not cover the implicit left join case, for that see TransformImplicitLeftJoin

Applicability

This optimization aims to eliminate implicit joins of the form ?x = ?y or SAMETERM(?x, ?y), the latter can almost always be safely eliminated while the former may only be eliminated in the case where we can guarantee that at least one of the variables is a non-literal e.g. it occurs in the subject/predicate position. In the case where this is not true the optimization may not be made since we cannot assume that we can map value equality to term equality by making the optimization.

Known Limitations/To Do


Field Summary
 
Fields inherited from class com.hp.hpl.jena.sparql.algebra.TransformCopy
COPY_ALWAYS, COPY_ONLY_ON_CHANGE
 
Constructor Summary
TransformFilterImplicitJoin()
           
 
Method Summary
 Op transform(OpFilter opFilter, 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, transform
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformFilterImplicitJoin

public TransformFilterImplicitJoin()
Method Detail

transform

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


Licenced under the Apache License, Version 2.0