2

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.

enter image description here

user1542639
  • 597
  • 6
  • 21
  • I believe these are usually referred to as 'UML diagrams'; this could help you in a google search. – Anti Earth May 21 '13 at 09:26
  • Sorry, I asked my senior at work, they said it's called "Class Diagram", so that's how I came up with the term. – user1542639 May 21 '13 at 09:32
  • According to that table in the right hand side of this [wiki article](http://en.wikipedia.org/wiki/Class_diagram), Class Diagram is a type of structural UML diagram. My bad – Anti Earth May 21 '13 at 10:29
  • possible duplicate of [Java graph library for dynamic visualisation](http://stackoverflow.com/questions/6162618/java-graph-library-for-dynamic-visualisation) – Ilmari Karonen Jul 25 '13 at 19:43

3 Answers3

4

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
Bala
  • 4,427
  • 6
  • 26
  • 29
1

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.

Community
  • 1
  • 1
Sebastian
  • 7,729
  • 2
  • 37
  • 69
0

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

Community
  • 1
  • 1
Anti Earth
  • 4,671
  • 13
  • 52
  • 83