it.unibo.cs.USI.tools
Class TopKNode
java.lang.Object
it.unibo.cs.USI.tools.TopKNode
public class TopKNode
- extends java.lang.Object
- Author:
- Matteo Magnani
Jun 3, 2005 12:05:02 AM
Instances of this class represent nodes in the tree built to
compute the top-k sets of mappings. Each node in the tree represents a set of mappings,
its plausibility/belief/probability (depending on how the tree is initialized), and information
about the nodes contained in its subtree. Its children are computed taking the same mappings,
and changing one of them with the next most likely mapping.
-
Constructor Summary |
TopKNode(double likelihood,
int minChildToCreate,
int level)
This constructor is only used to create the root node of a TopKTree. |
TopKNode(TopKNode parent,
int index,
int level)
Creates the index^th child of node 'parent'. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
orderedMappings
public static MappingValuePair[][] orderedMappings
children
private java.util.ArrayList children
parent
private TopKNode parent
mappings
private java.util.Map mappings
maxLikelihoodInSubtree
private double maxLikelihoodInSubtree
likelihood
private double likelihood
visited
private boolean visited
minChildToCreate
private int minChildToCreate
level
private int level
TopKNode
public TopKNode(double likelihood,
int minChildToCreate,
int level)
- This constructor is only used to create the root node of a TopKTree.
- Parameters:
likelihood
- The likelihood of this set of mappings.minChildToCreate
- TODO It should be the cardinality of pairs of schema objects...
TopKNode
public TopKNode(TopKNode parent,
int index,
int level)
throws java.lang.Exception
- Creates the index^th child of node 'parent'. This object is
automatically inserted in the array of children of'parent'.
- Parameters:
parent
- index
-
- Throws:
java.lang.Exception
newChild
public void newChild(int index)
- Creates the index^th child of this node.
- Parameters:
index
-
deleteChild
public void deleteChild(TopKNode node)
setParent
public void setParent(TopKNode node)
getParent
public TopKNode getParent()
setMaxLikelihoodInSubtree
public void setMaxLikelihoodInSubtree(double value)
getMaxLikelihoodInSubtree
public double getMaxLikelihoodInSubtree()
getMappings
public java.util.Map getMappings()
isVisited
public boolean isVisited()
- Returns:
- Returns the visited.
setVisited
public void setVisited(boolean visited)
- When a node is visited, it is considered to be included in the
top-K results. A node is visited when it has the highest likelihood
among the unvisited nodes. If we do not check if a node corresponds to
an inconsistent solution, when visited it is always included in the top-k results.
- Parameters:
visited
- The value to set.
getMaxChild
public TopKNode getMaxChild()
- Returns:
- Returns the child whose subtree contains the node
corresponding to the most likely set of mappings. Only unvisited
nodes are considered.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getMinChildToCreate
public int getMinChildToCreate()
- Returns:
- Returns the index of the first node that can be child of the
current node.
setMinChildToCreate
public void setMinChildToCreate(int index)
- Parameters:
index
- the index of the first node that can be child of this node.
toMappingArray
public int[] toMappingArray()
- Returns:
- An array with all the mappings corresponding to this node.
getLikelihood
public double getLikelihood()
- Returns:
- Returns the likelihood of this node.
setLikelihood
public void setLikelihood(double likelihood)
- Parameters:
likelihood
- The likelihood to set.
printChildren
public void printChildren()
getDummyLikelihood
public double getDummyLikelihood()