uk.ac.ic.doc.automed.p2p.qproc.commands
Class TopKMappingCommand

java.lang.Object
  extended by uk.ac.ic.doc.automed.p2p.gui.graph.commands.GCommand
      extended by uk.ac.ic.doc.automed.p2p.qproc.commands.TopKMappingCommand
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class TopKMappingCommand
extends GCommand


Field Summary
private  java.text.NumberFormat fmt
           
private static int section
           
 
Fields inherited from class uk.ac.ic.doc.automed.p2p.gui.graph.commands.GCommand
CMD_EDIT_LABEL, CMD_SHOW_PROPERTIES, cmdID, EVENT_ON_CLICK, EVENT_ON_DOUBLE_CLICK, EVENT_ON_MOUSE_OVER, gviz, label, mode, MODE_ADVANCED, MODE_ALL, MODE_AUTORUN, MODE_DEFAULT, MODE_NOSHOW, MODE_PUBLISHER, MODE_USER
 
Constructor Summary
TopKMappingCommand(GraphViz gviz)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Perform action.
private  java.util.Map calcFetchVector(int k, QueryPlannerResult qpresult, QueryPlannerResult.CoverageSet cset)
          Calculate the fetch vector for each coverage set
private  void calcGlobalRank(QueryPlannerResult.CoverageSet cset)
          Calculate the global rank of each coverage set.
private  java.util.Map fetchMappings(java.util.Map fetchVectorMap, QueryPlannerResult qpresult)
          Get mapping sub-sets from peers and update the local fetch size of the coverage set
private  java.util.Collection generateCoverageSets(QueryPlannerResult qpresult)
           
private  java.util.Collection getCoverageSetStats(QueryPlannerResult qpresult)
          This is invoked to obtain and merge statistics about the coverage sets
It returns a collection of coverage set objects.
private  java.util.Collection getTopRanked(int k, java.util.Collection csets)
          Return a sub-set containing coverage sets whose ranks equal the top rank
private  void mergeCoverageSets(java.util.Collection csets, java.util.Collection edges, java.util.Collection asetcol)
           
private  void rankTopKDistributed(int k, QueryPlannerResult qpresult)
          Generate and rank top-k queries.
This method assumes that no mappings are known initially at the query peer.
private  void showMessage(java.lang.String msg)
           
private  void showMessage(java.lang.String msg, java.lang.Exception e)
           
private  void showStatus(QueryPlannerResult qpresult)
          Show the status of the query planner result.
 
Methods inherited from class uk.ac.ic.doc.automed.p2p.gui.graph.commands.GCommand
copyProperties, eventPerformed, getID, getLabel, getMenuDef, getMode, getOutput, getPeerName, init, isAutoCommand, setOutput, updateMenu
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

section

private static final int section
See Also:
Constant Field Values

fmt

private java.text.NumberFormat fmt
Constructor Detail

TopKMappingCommand

public TopKMappingCommand(GraphViz gviz)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Perform action. If the ActionEvent was null then the call originated from
another software component; otherwise it came from the user (eg. when right-clicking on the context menu).


rankTopKDistributed

private void rankTopKDistributed(int k,
                                 QueryPlannerResult qpresult)
Generate and rank top-k queries.
This method assumes that no mappings are known initially at the query peer. Thus it involves asking the intermeidate peers for the mappings before combining them

Parameters:
qpresult -

getCoverageSetStats

private java.util.Collection getCoverageSetStats(QueryPlannerResult qpresult)
This is invoked to obtain and merge statistics about the coverage sets
It returns a collection of coverage set objects.

Parameters:
qpresult - .

generateCoverageSets

private java.util.Collection generateCoverageSets(QueryPlannerResult qpresult)

mergeCoverageSets

private void mergeCoverageSets(java.util.Collection csets,
                               java.util.Collection edges,
                               java.util.Collection asetcol)

calcGlobalRank

private void calcGlobalRank(QueryPlannerResult.CoverageSet cset)
Calculate the global rank of each coverage set. This is performed after the statistics about all the coverage sets have been obtained and merged from all intermediate peers

Parameters:
cset -

getTopRanked

private java.util.Collection getTopRanked(int k,
                                          java.util.Collection csets)
Return a sub-set containing coverage sets whose ranks equal the top rank

Parameters:
csets -
Returns:

calcFetchVector

private java.util.Map calcFetchVector(int k,
                                      QueryPlannerResult qpresult,
                                      QueryPlannerResult.CoverageSet cset)
Calculate the fetch vector for each coverage set

Parameters:
cset -

fetchMappings

private java.util.Map fetchMappings(java.util.Map fetchVectorMap,
                                    QueryPlannerResult qpresult)
Get mapping sub-sets from peers and update the local fetch size of the coverage set

Parameters:
fetchVectorMap - a hash map: kedge -> List
v -

showStatus

private void showStatus(QueryPlannerResult qpresult)
Show the status of the query planner result.

Parameters:
qpresult -

showMessage

private void showMessage(java.lang.String msg)

showMessage

private void showMessage(java.lang.String msg,
                         java.lang.Exception e)