de.fuberlin.wiwiss.d2rq.algebra
Class JoinOptimizer
java.lang.Object
de.fuberlin.wiwiss.d2rq.algebra.JoinOptimizer
public class JoinOptimizer
- extends Object
Removes unnecessary joins from a TripleRelation
in cases
where this is possible without affecting the result. This is an
optimization.
A join J from table T1 to table T2 with join condition
T1.c_1 = T2.c_1 && T1.c_2 = T2.c_2 && ...
can be removed if these conditions hold:
- The only join mentioning T2 is J.
- All columns of T2 that are selected or constrained or used in
an expression occur in J's join condition.
- All values of T1.c_n are guaranteed to occur
in T2.c_n, that is, there is a foreign key constraint
on T1.c_n.
In this case, J can be dropped, and all mentions of T2.c_n
can be replaced with T1.c_n.
TODO: Currently this only is used for TripleRelations in FindQuery but it could be used for NodeRelations in SPARQL queries too
TODO: Prune unnecessary aliases after removing joins
- Author:
- Richard Cyganiak (richard@cyganiak.de)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JoinOptimizer
public JoinOptimizer(TripleRelation relation)
- Constructs a new JoinOptimizer.
- Parameters:
relation
- The TripleRelation to be optimized
optimize
public TripleRelation optimize()