Glumly is a simple Python script that I wrote to help me generate UML diagrams to embed in a presentation. It parses an input file with a few basic rules, and it outputs a DOT file that is interpreted with Graphviz.
Before developing Glumly, I had been testing yUML and I had liked it, so I wanted to make my UML graphs looks as yUML ones. To achieve a similar result, I embellished the SVG obtained from Graphviz with xsltproc using the notugly-full.xsl stylesheet by Michael Kennedy wich was written as an extension of notugly.xls by Vidar Hokstad.
To make UML diagrams with Glumly you need to:
Download Glumly v0.2 from here:
The Glumly script takes two optional arguments: an input and an output file. If no input or output file is provided, stdin and stdout are used.
$ ./glumly.py --help
Glumly, a free yUML-like UML creator for DOT.
Usage: glumly.py {inputfile|- {outputfile}}
The suggested piping is using Graphviz to compile the DOT output and xsltproc to apply the notugly-full.xsl stylesheet. The piping looks like:
$ ./glumly.py inputfile.txt | dot -Tsvg | xsltproc notugly-full.xsl - > outputfile.svg
The pipe step using xsltproc and notugly-full.xsl could be omitted... but the output will be UGLY!.
The input is an ASCII tab delimited file. Each line may begin with an identifier or with a numeral for comments. The identifiers fall into two categories: connections and other properties.
All connections have a single letter identifier and share the same syntax. In a connection row, the first col is the identifier and the second and third cols are the names of the connected nodes. If a fourth col is found, it is used as a label at the end of the connection, in the same way a fifth col is used as a label at the begin of the connection. In labels the * and .. symbols are treated as special ones and replaced by Unicode infinity (∞) and ellipsis (‥).
The connection identifiers are:
Other properties are:
This input, contained in a file called example.txt:
# A color CO Customer green CO Delivery yellow # Connections: # ID Begin End End label Begin label A Customer Order orders 0..* 1 S Order Product * * S Order Delivery 1 C Order LineItem * * D Category Product H Delivery International H Delivery National
Compiled with:
$ ./glumly.py example.txt | dot -Tsvg | xsltproc -o example.svg notugly-full.xsl - $ inkscape example.svg -e example.png
Produces this PNG graph:
(Here you can compare with the yUML representation of the same UML diagram.)
The same example compiled with Graphviz but omitting the notugly step looks ugly as you can see here.
Glumly is distributed under the BOLA license, which means public domain (if applies).
All feedback is welcome.