UMLGraph - Declarative Drawing of UML Diagrams

UMLGraph banner UMLGraph allows the declarative specification and drawing of UML class and sequence diagrams. The current features are part of an ongoing effort aiming to provide support for all types UML diagrams. An IEEE Software article titled On the declarative specification of models explains the rationale behind this approach. The tehnology behind UMLGraph was used to draw many of the diagrams appearing in the books Code Quality: The Open Source Perspective (Addison Wesley, 2006) and Code Reading: The Open Source Perspective (Addison Wesley, 2003). In addition, the UMLGraphDoc doclet included in this distribution automatically adds UML diagrams to javadoc documentation.

Many programs build on UMLGraph; follow this link for more details. In addition, Martin Fowler, the author of UML Distilled, writes:

I thought I'd send you a note saying how much I enjoyed discovering UML Graph. I've long fancied a text based way of describing UML diagrams, but never felt sufficiently time-rich to develop anything.
Martin has created a bliki entry describing his ideas of what an ideal textual language might look like.

Class Diagrams

One specifies a class diagram using the Java syntax complemented by javadoc tags. Running the UmlGraph doclet on the specification will generate a Graphviz diagram specification that can be automatically processed to create Postscript, GIF, SVG, JPEG, fig, or Framemaker drawings.

The following is an example of a class diagram specification and the resulting UML diagram:

class Person {
	String Name;
}

class Employee extends Person {}

class Client extends Person {}
Simple UML class diagram

Sequence Diagrams

One specifies a sequence diagram using pic macros to define objects and method invocations. The GNU plotutils pic2plot program can then process the sequence diagram to create a PNG, PNM, (pseudo)GIF, SVG, AI, Postscript, CGM, FIG, PCL, HPGL, Regis, or TEK drawing.

The following is an example of a sequence diagram specification and the resulting UML diagram:

# Define the objects
object(O,"o:Toolkit");
placeholder_object(P);
step();

# Activation and messages
active(O);
message(O,O,"callbackLoop()");
create_message(O,P,"p:Peer");
message(O,P,"handleExpose()");
active(P);
return_message(P,O,"");
inactive(P);
destroy_message(O,P);
inactive(O);

# Complete the lifeline of O
step();
complete(O);
Simple UML sequence diagram

Download and Links

UMLGraph is hereby made freely available as Open Source Software. The current version of UMLGraph is 5.0. You can download UMLGraph and its documentation from the following links:

Diomidis Spinellis home page


Valid XHTML 1.0! Level Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0 Creative Commons License Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-Share Alike 3.0 Greece License.
Last modified: $Date: 2008/03/17 08:42:35 $