The Meta-Environment API

nl.cwi.sen1.visplugin.graphplugin
Class GraphBuilder

java.lang.Object
  extended by nl.cwi.sen1.visplugin.graphplugin.GraphBuilder

public class GraphBuilder
extends java.lang.Object


Field Summary
private  java.lang.String m_attributedGraphTuple
           
private  nl.cwi.sen1.relationstores.Factory m_factory
          Factory used to create types.
private  java.util.HashMap<java.lang.String,nl.cwi.sen1.relationstores.types.Location> m_locCache
          Cache and register the Locations for created Nodes
private  java.util.HashMap<java.lang.String,prefuse.data.Node> m_nodeCache
          Cache/registry for created nodes.
private  java.lang.String m_relationGraph
          Supported graph relation.
private  java.lang.String m_relationGraphTuple
           
 
Constructor Summary
GraphBuilder(nl.cwi.sen1.relationstores.Factory factory)
           
 
Method Summary
 prefuse.data.Graph buildGraphFromRTuple(nl.cwi.sen1.relationstores.types.RTuple fact)
          Convert RTuple into a Graph Dataset.
private  prefuse.data.Graph convertAttributedGraphDataset(nl.cwi.sen1.relationstores.types.RElemElements elements)
           
private  prefuse.data.Graph convertRelStrStrToDataset(nl.cwi.sen1.relationstores.types.RElemElements elements)
          Convert RTuple relation([str,str]) into a graph dataset.
private  prefuse.data.Graph convertRelTupleTupleToDataset(nl.cwi.sen1.relationstores.types.RElemElements elements)
          Convert RTuple relation([tuple([str,loc]),tuple([str,loc])]) into a graph dataset.
 nl.cwi.sen1.relationstores.types.Location getOrCreateLocation(java.lang.String nodeName, nl.cwi.sen1.relationstores.types.Location nodeLocation)
          Create (if it does not exist) or return the Location identified by the nodeName.
 prefuse.data.Node getOrCreateNode(prefuse.data.Graph graph, java.lang.String nodeName)
          Create (if it does not exist) or return the node identified by the nodeName
private  boolean isAttributedGraphRelation(nl.cwi.sen1.relationstores.types.RTuple fact)
           
 boolean isRelStrStr(nl.cwi.sen1.relationstores.types.RTuple fact)
          Check to see if the RTuple is indeed a str,str relation.
 boolean isRelTupleTuple(nl.cwi.sen1.relationstores.types.RTuple fact)
          Check to see if the RTuple is indeed a tuple([str,loc]),tuple([str,loc]) relation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_nodeCache

private java.util.HashMap<java.lang.String,prefuse.data.Node> m_nodeCache
Cache/registry for created nodes.


m_locCache

private java.util.HashMap<java.lang.String,nl.cwi.sen1.relationstores.types.Location> m_locCache
Cache and register the Locations for created Nodes


m_factory

private nl.cwi.sen1.relationstores.Factory m_factory
Factory used to create types.


m_relationGraph

private final java.lang.String m_relationGraph
Supported graph relation.

See Also:
Constant Field Values

m_relationGraphTuple

private final java.lang.String m_relationGraphTuple
See Also:
Constant Field Values

m_attributedGraphTuple

private final java.lang.String m_attributedGraphTuple
See Also:
Constant Field Values
Constructor Detail

GraphBuilder

public GraphBuilder(nl.cwi.sen1.relationstores.Factory factory)
Parameters:
factory -
Method Detail

buildGraphFromRTuple

public prefuse.data.Graph buildGraphFromRTuple(nl.cwi.sen1.relationstores.types.RTuple fact)
Convert RTuple into a Graph Dataset.

Parameters:
fact - RTuple with the data
Returns:
PieChart dataset

convertAttributedGraphDataset

private prefuse.data.Graph convertAttributedGraphDataset(nl.cwi.sen1.relationstores.types.RElemElements elements)

convertRelTupleTupleToDataset

private prefuse.data.Graph convertRelTupleTupleToDataset(nl.cwi.sen1.relationstores.types.RElemElements elements)
Convert RTuple relation([tuple([str,loc]),tuple([str,loc])]) into a graph dataset. and register the Location attributes to allow click through.

Parameters:
elements - RTuple with the data
Returns:
Graph dataset for graph

convertRelStrStrToDataset

private prefuse.data.Graph convertRelStrStrToDataset(nl.cwi.sen1.relationstores.types.RElemElements elements)
Convert RTuple relation([str,str]) into a graph dataset.

Parameters:
fact - RTuple with the data
Returns:
Graph dataset for graph

getOrCreateNode

public prefuse.data.Node getOrCreateNode(prefuse.data.Graph graph,
                                         java.lang.String nodeName)
Create (if it does not exist) or return the node identified by the nodeName

Parameters:
graph -
nodeName -
Returns:
The node identified by the nodeName or a new node if no node existed with this name.

getOrCreateLocation

public nl.cwi.sen1.relationstores.types.Location getOrCreateLocation(java.lang.String nodeName,
                                                                     nl.cwi.sen1.relationstores.types.Location nodeLocation)
Create (if it does not exist) or return the Location identified by the nodeName. When searching for a location giving a nodeId the nodeLocation must be zero. Then it returns null when nothing is found.

Parameters:
nodeName - The name of the location we are looking for or creating a Location for
Returns:
The Location identified by the nodeName

isAttributedGraphRelation

private boolean isAttributedGraphRelation(nl.cwi.sen1.relationstores.types.RTuple fact)
Parameters:
fact -
Returns:
true if the RTuple contains a fact of the expected type

isRelStrStr

public boolean isRelStrStr(nl.cwi.sen1.relationstores.types.RTuple fact)
Check to see if the RTuple is indeed a str,str relation.

Parameters:
fact - RTuple to test.
Returns:
True if it is the correct str,str type.

isRelTupleTuple

public boolean isRelTupleTuple(nl.cwi.sen1.relationstores.types.RTuple fact)
Check to see if the RTuple is indeed a tuple([str,loc]),tuple([str,loc]) relation.

Parameters:
fact - RTuple to test.
Returns:
True if it is the correct str,str type.

The Meta-Environment API