felix.optimizer
Class DMOOptimizer

java.lang.Object
  extended by felix.optimizer.DMOOptimizer

public class DMOOptimizer
extends java.lang.Object

An object of DMOOptimer takes inputs as a DMO, analyzes its logic plan, and fill in its physical plan. Current version of the DMOOptimizer will only optimize the materialization trade-off. Note that, this class does not touch the DB directly, instead it uses an instance of CostModel.

Author:
Ce Zhang

Field Summary
 CostModel cm
          Cost model used to optimize the DMO.
 
Constructor Summary
DMOOptimizer(CostModel _cm)
          The constructor.
 
Method Summary
 void close()
          Close the database connection used in this DMOOptimizer.
 java.util.HashMap<tuffy.ra.ConjunctiveQuery,java.util.HashMap<tuffy.mln.Literal,tuffy.ra.ConjunctiveQuery>> generateAllPossiblePlans(tuffy.mln.Literal head, java.util.ArrayList<tuffy.mln.Literal> subgoals, java.util.ArrayList<java.lang.String> additionalSelList, java.util.HashMap<java.lang.String,java.lang.String> typeMapping)
          Given a literal as goal, a set of literals as subgoals, generate all possible binary decompositions of this set of subgoals.
 java.lang.String giveMeTheSignatureOfTwoQuery(java.util.HashMap<tuffy.mln.Literal,tuffy.ra.ConjunctiveQuery> sets)
          Returns signature of query set.
 void optimizeDMO(ConcurrentOperatorsBucket cob)
          Optimize all DMOs appearing in the given ConcurrentOperatorsBucket.
 void optimizeMateralization(DataMovementOperator dmo)
          Optimize the materialization trade-off of the given DMO.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cm

public CostModel cm
Cost model used to optimize the DMO.

Constructor Detail

DMOOptimizer

public DMOOptimizer(CostModel _cm)
The constructor.

Parameters:
_cm -
Method Detail

close

public void close()
Close the database connection used in this DMOOptimizer.


optimizeDMO

public void optimizeDMO(ConcurrentOperatorsBucket cob)
Optimize all DMOs appearing in the given ConcurrentOperatorsBucket.

Parameters:
cob -

giveMeTheSignatureOfTwoQuery

public java.lang.String giveMeTheSignatureOfTwoQuery(java.util.HashMap<tuffy.mln.Literal,tuffy.ra.ConjunctiveQuery> sets)
Returns signature of query set.

Parameters:
sets -
Returns:

optimizeMateralization

public void optimizeMateralization(DataMovementOperator dmo)
Optimize the materialization trade-off of the given DMO.

Parameters:
dmo -

generateAllPossiblePlans

public java.util.HashMap<tuffy.ra.ConjunctiveQuery,java.util.HashMap<tuffy.mln.Literal,tuffy.ra.ConjunctiveQuery>> generateAllPossiblePlans(tuffy.mln.Literal head,
                                                                                                                                            java.util.ArrayList<tuffy.mln.Literal> subgoals,
                                                                                                                                            java.util.ArrayList<java.lang.String> additionalSelList,
                                                                                                                                            java.util.HashMap<java.lang.String,java.lang.String> typeMapping)
Given a literal as goal, a set of literals as subgoals, generate all possible binary decompositions of this set of subgoals. The decomposition looks like:
Q(...) :- Q1(...), Q2(...)
Q1(...) :- g1, g2, ...
Q2(...) :- g1', g2', ...

Q1 and Q2 are materialized, and Q will be regarded as a view. If Q2 is null, this is equivalent to the fully-materialized case.

Parameters:
head - goal
subgoals - set of subgoals
additionalSelList - terms needed to be maintained in the variable list of Q1 and Q2. By default all variables needed to compute Q from Q1 and Q2 will be automatically maintained, however, if you want to maintain others, add them in this list.
typeMapping - If you want some variables in Q1 and Q2 have special types (e.g., double instead of constant ID), put them in this map.
Returns:
Mappings from Q to Q1 and Q2.