de.fuberlin.wiwiss.d2rq.engine
Class PushDownOpFilterVisitor

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.engine.PushDownOpFilterVisitor
All Implemented Interfaces:
OpVisitor

public class PushDownOpFilterVisitor
extends Object
implements OpVisitor

Visitor for traversing the operator-tree, moving down any filter conditions as far as possible.

Author:
Herwig Leimer, Richard Cyganiak (richard@cyganiak.de)

Constructor Summary
PushDownOpFilterVisitor()
           
 
Method Summary
 Op result()
          Returns the changed operator-tree
static Op transform(Op op)
           
 void visit(OpAssign opAssign)
           
 void visit(OpBGP op)
          When there are some filterexpressions which belong to an OpBGP, the OpBGP will be converted to an OpFilteredBGP.
 void visit(OpConditional opCondition)
           
 void visit(OpDatasetNames dsNames)
           
 void visit(OpDiff opDiff)
          When visiting an OpDiff 3 conditions for moving down the filterconditions are checked.
 void visit(OpDisjunction opDisjunction)
           
 void visit(OpDistinct opDistinct)
           
 void visit(OpExt opExt)
           
 void visit(OpExtend opExtend)
           
 void visit(OpFilter opFilter)
          When visiting an OpFilter, all its filterconditions are collected during the top-down-stepping.
 void visit(OpGraph opGraph)
           
 void visit(OpGroup opGroup)
           
 void visit(OpJoin opJoin)
          When visiting an OpJoin 3 conditions for moving down the filterconditions are checked.
 void visit(OpLabel opLabel)
           
 void visit(OpLeftJoin opLeftJoin)
          When visiting an OpJoin 2 conditions for moving down the filterconditions are checked.
 void visit(OpList opList)
           
 void visit(OpMinus opMinus)
          TODO I have no clue if this actually works Filter(A-B,e) = Filter(A,e)-B
 void visit(OpNull opNull)
           
 void visit(OpOrder opOrder)
           
 void visit(OpPath opPath)
           
 void visit(OpProcedure opProc)
           
 void visit(OpProject opProject)
           
 void visit(OpPropFunc opPropFunc)
           
 void visit(OpQuad opQuad)
           
 void visit(OpQuadPattern quadPattern)
           
 void visit(OpReduced opReduced)
           
 void visit(OpSequence opSequence)
           
 void visit(OpService opService)
           
 void visit(OpSlice opSlice)
           
 void visit(OpTable opTable)
           
 void visit(OpTopN opTop)
           
 void visit(OpTriple opTriple)
           
 void visit(OpUnion opUnion)
          When visiting an OpUnion also 3 conditions for moving down the filterconditions are checked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PushDownOpFilterVisitor

public PushDownOpFilterVisitor()
Method Detail

transform

public static Op transform(Op op)

result

public Op result()
Returns the changed operator-tree

Returns:
Op - root-node of the operator-tree

visit

public void visit(OpFilter opFilter)
When visiting an OpFilter, all its filterconditions are collected during the top-down-stepping. During the bottom-up-stepping all filterconditions which were moved down, are removed

Specified by:
visit in interface OpVisitor

visit

public void visit(OpUnion opUnion)
When visiting an OpUnion also 3 conditions for moving down the filterconditions are checked. Only when a condition is satisfied, the filtercondition can be moved down to the next operator in the tree. Otherwise the condition will stay here and during the bottum-up-stepping an OpFilter containing these remained filterconditions will be inserted in the operator-tree. Conditions for moving down a filtercondition: (M1, M2 are graphpatterns, F is a filtercondition) 1) Filter(Union(M1, M2), F)) will become Union(Filter(M1, F), M2) when the filterexpression is only referenced to M1 2) Filter(Union(M1, M2), F)) will become Union(M1, Filter(M2, F)) when the filterexpression is only referenced to M2 TODO: Dubious! Shouldn't this be Union(Filter(M1,F), Filter(M2,F))? What does the code actually do? 3) Filter(Union(M1, M2), F)) will become Join(Union(M1, F), Union(M2, F)) when the filterexpression is referenced to M1 and M2

Specified by:
visit in interface OpVisitor

visit

public void visit(OpJoin opJoin)
When visiting an OpJoin 3 conditions for moving down the filterconditions are checked. Only when a condition is satisfied, the filtercondition can be moved down to the next operator in the tree. Otherwise the condition will stay here and during the bottum-up-stepping an OpFilter containing these remained filterconditions will be inserted in the operator-tree. Conditions for moving down a filtercondition: (M1, M2 are graphpatterns, F is a filtercondition) 1) Filter(Join(M1, M2), F)) will become Join(Filter(M1, F), M2) when the filterexpression is only referenced to M1 2) Filter(Join(M1, M2), F)) will become Join(M1, Filter(M2, F)) when the filterexpression is only referenced to M2 3) Filter(Join(M1, M2), F)) will become Join(Filter(M1, F), Filter(M2, F)) when the filterexpression is referenced to M1 and M2

Specified by:
visit in interface OpVisitor

visit

public void visit(OpBGP op)
When there are some filterexpressions which belong to an OpBGP, the OpBGP will be converted to an OpFilteredBGP. A OpFilteredBGP is nearly the same like an OpBGP but it has a link to its parent, which is an OpFilter with the coresponding filter-conditions, because in the transforming-process of the OpBGPs to OpD2RQs a link to the above OpFilter is needed.

Specified by:
visit in interface OpVisitor

visit

public void visit(OpDiff opDiff)
When visiting an OpDiff 3 conditions for moving down the filterconditions are checked. Only when a condition is satisfied, the filtercondition can be moved down to the next operator in the tree. Otherwise the condition will stay here and during the bottom-up-stepping an OpFilter containing these remained filterconditions will be inserted in the operator-tree. Conditions for moving down a filtercondition: (M1, M2 are graphpatterns, F is a filtercondition) 1) Filter(Diff(M1, M2), F)) will become Diff(Filter(M1, F), M2) when the filterexpression is only referenced to M1 2) Filter(Diff(M1, M2), F)) will become Diff(M1, Filter(M2, F)) when the filterexpression is only referenced to M2 3) Filter(Diff(M1, M2), F)) will become Diff(Filter(M1, F), Filter(M2, F)) when the filterexpression is referenced to M1 and M2

Specified by:
visit in interface OpVisitor

visit

public void visit(OpConditional opCondition)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpProcedure opProc)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpPropFunc opPropFunc)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpTable opTable)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpQuadPattern quadPattern)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpPath opPath)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpTriple opTriple)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpDatasetNames dsNames)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpSequence opSequence)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpLeftJoin opLeftJoin)
When visiting an OpJoin 2 conditions for moving down the filterconditions are checked. Only when a condition is satisfied, the filtercondition can be moved down to the next operator in the tree. Otherwise the condition will stay here and during the bottum-up-stepping an OpFilter containing these remained filterconditions will be inserted in the operator-tree. Conditions for moving down a filtercondition: (M1, M2 are graphpatterns, F is a filtercondition) 1) Filter(LeftJoin(M1, M2), F)) will become LeftJoin(Filter(M1, F), M2) when the filterexpression is only referenced to M1 2) Filter(LeftJoin(M1, M2), F)) will become LeftJoin(Filter(M1, F), Filter(M2, F)) when the filterexpression is referenced to M1 and M2

Specified by:
visit in interface OpVisitor

visit

public void visit(OpGraph opGraph)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpService opService)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpExt opExt)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpNull opNull)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpLabel opLabel)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpList opList)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpOrder opOrder)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpProject opProject)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpDistinct opDistinct)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpReduced opReduced)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpAssign opAssign)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpSlice opSlice)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpGroup opGroup)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpExtend opExtend)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpMinus opMinus)
TODO I have no clue if this actually works Filter(A-B,e) = Filter(A,e)-B

Specified by:
visit in interface OpVisitor

visit

public void visit(OpDisjunction opDisjunction)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpTopN opTop)
Specified by:
visit in interface OpVisitor

visit

public void visit(OpQuad opQuad)
Specified by:
visit in interface OpVisitor