Version: 1.1.1

org.biomoby.client
Class Graphviz

java.lang.Object
  extended by org.biomoby.client.Graphviz

public abstract class Graphviz
extends Object

A utility class that understands how to create graphviz graphs from a set of ServiceEdges, or from other data structures.

Version:
$Id: Graphviz.java,v 1.9 2005/08/26 06:27:04 senger Exp $
Author:
Martin Senger

Field Summary
static String PROP_HIGHLIGHT
          Property name.
static String PROP_HIGHLIGHT_COLOR
          Property name.
static String PROP_IMAGEMAP
          Property name.
static String PROP_RANKDIR
          Property name.
 
Constructor Summary
Graphviz()
           
 
Method Summary
static String createDataTypesGraph(MobyDataType[] dataTypes, Properties props)
          Creates a graph connecting 'dataTypes' using their ISA relationship and showing also their HASA children.
static String createServicesGraph(ServicesEdge[][] paths, int fromPath, int toPath, String[] pathNames, Properties props)
          Creates a graph connecting Moby services as defined in a set of the graph 'paths'.
static String createServicesGraph(ServicesEdge[] edges, Properties props)
          Creates a graph connecting Moby services as defined in a set of the graph 'edges'.
static String createServiceTypesGraph(MobyServiceType[] serviceTypes, Properties props)
          Creates a graph connecting 'serviceTypes' using their ISA relationship.
static String quoteIt(String name)
          Surround given text by quotes.
static String trName(String name)
          Replaces dashes by underscores in 'name'.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_RANKDIR

public static final String PROP_RANKDIR
Property name. Sets direction of graph layout. If sets to "LR", the graph is laid out from left to right, i.e., directed edges tend to go from left to right. Other value is "TB" where graphs are laid out from top to bottom. Default is "LR".

See Also:
Constant Field Values

PROP_HIGHLIGHT

public static final String PROP_HIGHLIGHT
Property name. It contains a name of an element that should be highlighted in the resulting graph.

See Also:
Constant Field Values

PROP_HIGHLIGHT_COLOR

public static final String PROP_HIGHLIGHT_COLOR
Property name. It contains a name of a color that should be used to highlight an element (see PROP_HIGHLIGHT. Default is "cyan2".

See Also:
Constant Field Values

PROP_IMAGEMAP

public static final String PROP_IMAGEMAP
Property name. It indicates that the graph should create URLs for graph nodes (except the highlighted one - see @{link #PROP_HIGHLIGHT}). The default URL is taken from this property. If this property exists but has an empty value, the URL for individual nodes are still going to be created, but not the deafult one. The URLs for individual nodes are taken from the "comment" field of the data objects for whom are nodes created. No URL is created for a node where the comment field is empty.

See Also:
Constant Field Values
Constructor Detail

Graphviz

public Graphviz()
Method Detail

createServicesGraph

public static String createServicesGraph(ServicesEdge[] edges,
                                         Properties props)
Creates a graph connecting Moby services as defined in a set of the graph 'edges'.

Parameters:
edges - represent services and their connectors in the created graph; some edges may be of type DataServiceEdge (which is a subclass of ServicesEdge) - those represent a special type of connection betweern a service and an input or ouput data type
props - are some properties that can influence how the graph will look like; see the property names elswhere in this API what properties are understood
Returns:
a string with all definitions as understood by 'dot' program (from the graphviz package); this string can be saved in a '.dot' file that can be passed to a dot program to produce graphs in many available image formats

createServicesGraph

public static String createServicesGraph(ServicesEdge[][] paths,
                                         int fromPath,
                                         int toPath,
                                         String[] pathNames,
                                         Properties props)
Creates a graph connecting Moby services as defined in a set of the graph 'paths'. The resulting graph will include only paths (as separate clusters) starting from paths[fromPath] to paths[toPath].

Parameters:
paths - is an array of edges; each set of edges defines one path; some edges may be of type DataServiceEdge (which is a subclass of ServicesEdge) - those represent a special type of connection betweern a service and an input or ouput data type
fromPath - a starting index in array 'paths'
toPath - an ending index in array 'paths'
pathNames - gives names of 'paths' (it may be used to label individual graph clusters); the array should have the same dimension as 'path' - and their elements should correspond to each other
props - are some properties that can influence how the graph will look like; see the property names elswhere in this API what properties are understood
Returns:
a string with all definitions as understood by 'dot' program (from the graphviz package); this string can be saved in a '.dot' file that can be passed to a dot program to produce graphs in many available image formats

createDataTypesGraph

public static String createDataTypesGraph(MobyDataType[] dataTypes,
                                          Properties props)
Creates a graph connecting 'dataTypes' using their ISA relationship and showing also their HASA children.

Parameters:
dataTypes - represent nodes in the created graph
props - are some properties that can influence how the graph will look like; see the property names elswhere in this API what properties are understood
Returns:
a string with all definitions as understood by 'dot' program (from the graphviz package); this string can be saved in a '.dot' file that can be passed to a dot program to produce graphs in many available formats

createServiceTypesGraph

public static String createServiceTypesGraph(MobyServiceType[] serviceTypes,
                                             Properties props)
Creates a graph connecting 'serviceTypes' using their ISA relationship.

Parameters:
serviceTypes - represent nodes in the created graph
props - are some properties that can influence how the graph will look like; see the property names elswhere in this API what properties are understood
Returns:
a string with all definitions as understood by 'dot' program (from the graphviz package); this string can be saved in a '.dot' file that can be passed to a dot program to produce graphs in many available formats

trName

public static String trName(String name)
Replaces dashes by underscores in 'name'. Because I found that sometimes the dashes in the node names in Graphviz caused me some problems (or was I mistaken?).

Parameters:
name - to be changed
Returns:
changed 'name'

quoteIt

public static String quoteIt(String name)
Surround given text by quotes. This will prevent errors encoutered by 'dot' when names have whitespaces or when they are identical to the 'dot's keywords (such as 'edge').

Parameters:
name - to be quoted
Returns:
changed 'name'

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010