It occurred to me that I could write Entity-Relationship diagrams using Graphviz, but I knew it would be clunky. I created a quick bit of Perl to translate a simple ER description language into Graphviz code, which I have called Erdot.
For example:
entity foo entity bar entity baz attr a b c weak entity quux relate abc foo bar!* relate def bar* baz* attr z relate manages foo<manager> foo<subordinate> weak relate ghi baz quux
becomes:
Current issues:
- The heirarchical layout used by dot is not much like the layout of a typical hand-drawn diagram. Other layout engines included with Graphviz provide a better layout, but fail to correctly handle edge labels. There might be a way to configure one of those engines to avoid drawing the edge labels on top of everything else (and each other).
- The script could be much more powerful if the ER descriptions were parsed with a CFG instead of a quick hack. Maybe I will take this as an opportunity to learn about the grammar system in Perl 6.
0 comments:
Post a Comment