cytoscape.data.readers
Class GMLReader2

java.lang.Object
  extended by cytoscape.data.readers.GMLReader2
All Implemented Interfaces:
GraphReader

public class GMLReader2
extends Object
implements GraphReader

This class is responsible for converting a gml object tree into cytoscape objects New features to the current version: 1. Small bug fixes. 2. Translate all features in the GML file. This includes 3. New Visual Style will be generated when you call this class. The new style saves all visual features (like node shape) and will not be lost even after other style selected.


Field Summary
protected static String ARROW
           
protected static String ARROW_BOTH
           
protected static String ARROW_FIRST
           
protected static String ARROW_LAST
           
protected static String ARROW_NONE
           
protected static String CREATOR
           
protected static String CURVED_LINES
           
protected static String DEFAULT_EDGE_INTERACTION
           
protected static String DIAMOND
           
protected static String EDGE
           
protected static String ELLIPSE
           
protected static String FILL
           
protected static String GRAPH
          The following are all taken to be reserved keywords for gml (note that not all of them are actually keywords according to the spec) Currently, only keywords below are supported by the Visual Style generation methods.
protected static String GRAPHICS
           
protected static String H
           
protected static String HEXAGON
           
protected static String ID
           
protected static String LABEL
           
protected static String LINE
           
protected static String NODE
           
protected static String OCTAGON
           
protected static String OUTLINE
           
protected static String OUTLINE_WIDTH
           
protected static String PARALELLOGRAM
           
protected static String POINT
           
protected static String RECTANGLE
           
protected static String ROOT_INDEX
           
protected static String SOURCE
           
protected static String SOURCE_ARROW
           
protected static String STRAIGHT_LINES
           
protected static String TARGET
           
protected static String TARGET_ARROW
           
protected static String TRIANGLE
           
protected static String TYPE
           
protected static String VERSION
           
protected static String W
           
protected static String WIDTH
           
protected static String X
           
protected static String Y
           
 
Constructor Summary
GMLReader2(String filename)
          Constructor.
GMLReader2(String filename, cytoscape.task.TaskMonitor taskMonitor)
          Constructor.
 
Method Summary
 void applyMaps(String mapSuffix, String VSName)
           
protected  void createGraph()
          This will create the graph model objects.
 void extract()
           
protected  void extractEdge(List list, String edgeName)
           
protected  void extractEdgeAttributes(List list, String edgeName)
           
protected  void extractGraph(List list)
           
protected  void extractNode(List list)
           
protected  void extractNodeAttributes(List list, String nodeName)
           
 Color getColor(String colorString)
          Create a color object from the string like it is stored in a gml file
 CyAttributes getEdgeAttributes()
           
 int[] getEdgeIndicesArray()
          Part of interace contract
static LineType getLineType(int width)
           
 List getList()
          Returns a list containing the gml object tree
 CyAttributes getNodeAttributes()
           
 int[] getNodeIndicesArray()
          Part of interface contract
 giny.model.RootGraph getRootGraph()
           
protected  void initializeStructures()
           
 void layout(giny.view.GraphView myView)
           
protected  void layoutEdge(giny.view.GraphView myView, List list, String edgeName)
          Assign edge visual properties based on pairs in the list matched to the "edge" key world
protected  void layoutEdgeGraphics(giny.view.GraphView myView, List list, giny.view.EdgeView edgeView)
          Assign edge graphics properties
protected  void layoutEdgeGraphicsLine(giny.view.GraphView myView, List list, giny.view.EdgeView edgeView)
          Assign bend points based on the contents of the list associated with a "Line" key We make sure that there is both an x,y present in the underlying point list before trying to generate a bend point
protected  void layoutGraph(giny.view.GraphView myView, List list)
          Lays Out the Graph, based on GML.
protected  void layoutNode(giny.view.GraphView myView, List list)
          Assign node properties based on the values in the list matched to the "node" key.
protected  void layoutNodeGraphics(giny.view.GraphView myView, List list, giny.view.NodeView nodeView)
          This will assign node graphic properties based on the values in the list matches to the "graphics" key word
 void read()
           
 void read(boolean canonicalize)
           
protected  void readEdge(List list)
          This will extract the model information from the list which is matched to an "edge" key.
protected  void readGML(List list)
          This function takes the root level list which defines a gml objec tree
protected  void readGraph(List list)
          This function takes in a list which was given as the value to a "graph" key underneath the main gml list
protected  void readNode(List list)
          This will extract the model information from the list which is matched a "node" key
protected  void releaseStructures()
           
 void setEdgeMaps(VisualMappingManager vizmapper)
           
 void setNodeMaps(VisualMappingManager vizmapper)
           
 void showMaps()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRAPH

protected static String GRAPH
The following are all taken to be reserved keywords for gml (note that not all of them are actually keywords according to the spec) Currently, only keywords below are supported by the Visual Style generation methods. (Maybe we need some documents on "cytoscape-style" GML format...)


NODE

protected static String NODE

EDGE

protected static String EDGE

GRAPHICS

protected static String GRAPHICS

LABEL

protected static String LABEL

SOURCE

protected static String SOURCE

TARGET

protected static String TARGET

X

protected static String X

Y

protected static String Y

H

protected static String H

W

protected static String W

TYPE

protected static String TYPE

ID

protected static String ID

ROOT_INDEX

protected static String ROOT_INDEX

RECTANGLE

protected static String RECTANGLE

ELLIPSE

protected static String ELLIPSE

LINE

protected static String LINE

POINT

protected static String POINT

DIAMOND

protected static String DIAMOND

HEXAGON

protected static String HEXAGON

OCTAGON

protected static String OCTAGON

PARALELLOGRAM

protected static String PARALELLOGRAM

TRIANGLE

protected static String TRIANGLE

FILL

protected static String FILL

WIDTH

protected static String WIDTH

STRAIGHT_LINES

protected static String STRAIGHT_LINES

CURVED_LINES

protected static String CURVED_LINES

SOURCE_ARROW

protected static String SOURCE_ARROW

TARGET_ARROW

protected static String TARGET_ARROW

ARROW

protected static String ARROW

ARROW_NONE

protected static String ARROW_NONE

ARROW_FIRST

protected static String ARROW_FIRST

ARROW_LAST

protected static String ARROW_LAST

ARROW_BOTH

protected static String ARROW_BOTH

OUTLINE

protected static String OUTLINE

OUTLINE_WIDTH

protected static String OUTLINE_WIDTH

DEFAULT_EDGE_INTERACTION

protected static String DEFAULT_EDGE_INTERACTION

VERSION

protected static String VERSION

CREATOR

protected static String CREATOR
Constructor Detail

GMLReader2

public GMLReader2(String filename)
Constructor.

Parameters:
filename - File name.

GMLReader2

public GMLReader2(String filename,
                  cytoscape.task.TaskMonitor taskMonitor)
Constructor.

Parameters:
filename - File name.
taskMonitor - TaskMonitor Object.
Method Detail

setNodeMaps

public void setNodeMaps(VisualMappingManager vizmapper)

setEdgeMaps

public void setEdgeMaps(VisualMappingManager vizmapper)

applyMaps

public void applyMaps(String mapSuffix,
                      String VSName)

read

public void read(boolean canonicalize)
Specified by:
read in interface GraphReader

read

public void read()
Specified by:
read in interface GraphReader

getList

public List getList()
Returns a list containing the gml object tree


initializeStructures

protected void initializeStructures()

releaseStructures

protected void releaseStructures()

createGraph

protected void createGraph()
This will create the graph model objects. This function expects node labels to be unique and edge labels to be unique between a particular source and target If this condition is not met, an error will be printed to the console, and the object will be skipped. That is, it is as though that particular object never existed in the gml file. If an edge depends on a node that was skipped, then that edge will be skipped as well.


readGML

protected void readGML(List list)
This function takes the root level list which defines a gml objec tree


readGraph

protected void readGraph(List list)
This function takes in a list which was given as the value to a "graph" key underneath the main gml list


readNode

protected void readNode(List list)
This will extract the model information from the list which is matched a "node" key


readEdge

protected void readEdge(List list)
This will extract the model information from the list which is matched to an "edge" key.


layout

public void layout(giny.view.GraphView myView)
Specified by:
layout in interface GraphReader

extract

public void extract()

extractGraph

protected void extractGraph(List list)

extractNode

protected void extractNode(List list)

extractEdge

protected void extractEdge(List list,
                           String edgeName)

layoutGraph

protected void layoutGraph(giny.view.GraphView myView,
                           List list)
Lays Out the Graph, based on GML.


layoutNode

protected void layoutNode(giny.view.GraphView myView,
                          List list)
Assign node properties based on the values in the list matched to the "node" key. Mostly just a wrapper around layoutNodeGraphics


layoutNodeGraphics

protected void layoutNodeGraphics(giny.view.GraphView myView,
                                  List list,
                                  giny.view.NodeView nodeView)
This will assign node graphic properties based on the values in the list matches to the "graphics" key word


extractNodeAttributes

protected void extractNodeAttributes(List list,
                                     String nodeName)

extractEdgeAttributes

protected void extractEdgeAttributes(List list,
                                     String edgeName)

getLineType

public static LineType getLineType(int width)

showMaps

public void showMaps()

layoutEdge

protected void layoutEdge(giny.view.GraphView myView,
                          List list,
                          String edgeName)
Assign edge visual properties based on pairs in the list matched to the "edge" key world


layoutEdgeGraphics

protected void layoutEdgeGraphics(giny.view.GraphView myView,
                                  List list,
                                  giny.view.EdgeView edgeView)
Assign edge graphics properties


layoutEdgeGraphicsLine

protected void layoutEdgeGraphicsLine(giny.view.GraphView myView,
                                      List list,
                                      giny.view.EdgeView edgeView)
Assign bend points based on the contents of the list associated with a "Line" key We make sure that there is both an x,y present in the underlying point list before trying to generate a bend point


getNodeIndicesArray

public int[] getNodeIndicesArray()
Part of interface contract

Specified by:
getNodeIndicesArray in interface GraphReader

getEdgeIndicesArray

public int[] getEdgeIndicesArray()
Part of interace contract

Specified by:
getEdgeIndicesArray in interface GraphReader

getRootGraph

public giny.model.RootGraph getRootGraph()
Specified by:
getRootGraph in interface GraphReader
Returns:
null, there is no GML reader available outside of Y-Files right now

getNodeAttributes

public CyAttributes getNodeAttributes()
Specified by:
getNodeAttributes in interface GraphReader
Returns:
the node attributes that were read in from the GML file.

getEdgeAttributes

public CyAttributes getEdgeAttributes()
Specified by:
getEdgeAttributes in interface GraphReader
Returns:
the edge attributes that were read in from the GML file.

getColor

public Color getColor(String colorString)
Create a color object from the string like it is stored in a gml file