Reputation: 597
Is there a library in java that allows me to programmatically create class diagram from fetched data (similar to the diagram below)? Specifically, I want to create a database reference diagram (image below).
EDIT: As to prevent misunderstanding, I did not want a UML Diagram of my java code. Rather, I want to generate diagrams from the data that I got from the database (via Java) and output them in image form.
Upvotes: 2
Views: 4463
Reputation: 4547
In two steps , we can create diagrams based on object/table relationships.
Step 1: use DOT (graph description language) to create graph representation of the relationships.
DOT is a plain text graph description language. It is a simple way of describing graphs that both humans and computer programs can use. syntax is very easy to learn. create this file like you create some text file using your preferred programming language.
Step 2: Use DOT reader libraries to render as picture.
There are lot of libraries are available to render DOT file.
Graphviz - A collection of libraries and utilities to manipulate and render graphs
Canviz - a JavaScript library for rendering dot files.
Viz.js - A simple Graphviz JavaScript client
Grappa - A Java wrapper for using the Graphviz libraries.
Beluging - A Python & Google Cloud based viewer of DOT and Beluga extensions.
Tulip can import dot files for analysis
OmniGraffle can import a subset of DOT, producing an editable document. (The result cannot be exported back to DOT, however.)
ZGRViewer, a GraphViz/DOT Viewer link
VizierFX, A Flex graph rendering library link
Gephi - an interactive visualization and exploration platform for all kinds of networks and complex systems, dynamic and hierarchical graphs
Upvotes: 4
Reputation: 8005
I believe most of the libraries listed here: Java graph library for dynamic visualisation should work for that use-case.
If you are looking for ready-made tool that can do this out-of-the box you might want to take a look at the "Reference Graphs" section in the DbVisualizer Gallery.
Upvotes: 1
Reputation: 4801
I don't know whether the solutions can generate an identical image to that, but;
These diagrams are referred to as 'UML diagrams' and generating UML diagrams from a Java project is discussed here;
Generate UML Class Diagram from Java Project
Upvotes: 0