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

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

public class TransformFilterEquality
extends TransformCopy

A transform that aims to optimize queries where there is an equality constraint on a variable to speed up evaluation e.g

 SELECT *
 WHERE
 {
   ?s ?p ?o .
   FILTER(?s = <http://subject>)
 }
 
Would transform to the following:
 SELECT *
 WHERE
 {
   <http://subject> ?p ?o .
   BIND(<http://subject> AS ?s)
 }
 

Applicability

This optimizer is conservative in that it only makes the optimization where the equality constraint is against a non-literal as otherwise substituting the value changes the query semantics because it switches from value equality to the more restrictive term equality. The optimization is safe for non-literals because for those value and term equality are equivalent (in fact value equality is defined to be term equality).

There are also various nested algebra structures that can make the optimization unsafe and so it does not take place if any of those situations is detected.


Field Summary
 
Fields inherited from class com.hp.hpl.jena.sparql.algebra.TransformCopy
COPY_ALWAYS, COPY_ONLY_ON_CHANGE
 
Constructor Summary
TransformFilterEquality()
           
 
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

TransformFilterEquality

public TransformFilterEquality()
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