UMLGraph examples
UMLGraph is a tool to create UML diagrams from text files. An alternative to UMLGraph is plantuml. PlantUML provides a plugin for the project management software Trac. Here is an example of a class diagram for UMLGraph
# create a java file for UMLGraph cat > Test.java<<EOF /** * @opt shape node * @note Located in the * machine room * @note Sun Blade 6048 * @depend - - - MapLocation * @depend - - - DataMine */ class Server{} /** @opt shape component */ class MapLocation {} /** @opt shape component */ class DataMine {} /** * CPU-munching * components that must * run on this server * @opt shape note * @opt commentname * @assoc - - - MapLocation * @assoc - - - DataMine */ class munchComment {} EOF sudo bash # if you installed Java 7: cd /usr/lib/jvm/java-7-openjdk-amd64/lib/ wget http://www.umlgraph.org/jars/UmlGraph-5.6.6.jar exit java -jar /usr/lib/jvm/java-7-openjdk-amd64/lib/UmlGraph-5.6.6.jar -private Test.java # convert class diagram to an image dot -T png -o classDiagram.png graph.dot eog classDiagram.png
Example of a sequence diagram for UMLGraph:
# create the text file for the sequence diagram cat >sequenceExample.pic<<EOF #/usr/bin/pic2plot -Tps .PS copy "sequence.pic"; # Define the objects object(C,":Client"); object(S,":Server"); step(); # Message sequences active(C); message(C,S,"hello()"); active(S); rmessage(S,C,"world"); inactive(S); inactive(C); step(); # Complete remaining complete(C); complete(S); .PE EOF wget http://www.umlgraph.org/UMLGraph-5.6.6.tar.gz tar xzvf UMLGraph-5.6.6.tar.gz cp UMLGraph-5.6.6/src/sequence.pic . pic2plot -T ps sequenceExample.pic > sequenceExample.ps convert -density 300 sequenceExample.ps sequenceExample.png eog sequenceExample.png














