Extracting entity relationship diagrams from source code
A computer-implemented method is described for creating an entity relationship diagram. In one embodiment, the method for creating the entity relationship diagram can include analyzing programs to extract tables having references to SQL statements and call graphs. The method may further include counting a number of co-occurrences of pairs of tables having the references to SQL statements. Creating first edges based on the number of co-occurrences of pairs of tables having the references to SQL statements. The method may further include computing a shortest path lengths between two programs using pairs of tables in the call graphs based on a program to table use relationship. The method can further include creating second edges based on the shortest path lengths. The entity relationship diagram is plotted from the first edges and the second edges.
1 . A computer-implemented method for creating an entity relationship diagram comprising:
analyzing programs to extract tables having references to structured query language (SQL) statements and call graphs;
counting a number of co-occurrences of pairs of tables having the references to the SQL statements;
creating first edges based on the number of co-occurrences of pairs of tables having the references to SQL statements;
computing a shortest path lengths between two programs using pairs of tables in the call graphs based on a program to table use relationship;
creating second edges based on the shortest path lengths;
plotting the entity relationship diagram from the first edges and the second edges; and
utilizing the entity relationship diagram to perform software maintenance of the programs based on a mismatch between source code of the programs and initial design documents, the mismatch resulting from changes in the source code.
2 . The computer-implemented method of claim 1 , wherein the creating first edges based on the number of co-occurrences of the pairs of tables having the references to the SQL statements comprises controlling first edge creation to provide that a greater number of edges share a lesser number of nodes.
3 . The computer-implemented method of claim 2 , wherein the controlling of the first edge creation includes that the number of edges is a constant multiple of the number of nodes.
4 . The computer-implemented method of claim 1 , wherein the creating the second edges based on the shortest path lengths comprises controlling second edge creation to provide that a greater number of edges share a lesser number of nodes.
5 . The computer-implemented method of claim 4 , wherein the controlling of the second edge creation includes that the number of edges is a constant multiple of the number of nodes.
6 . The computer-implemented method of claim 1 , wherein the plotting the entity relationship diagram from the first edges and the second edges further comprises outputting the pairs of tables between the first edges and the second edges.
7 . A system for generating an entity relationship diagram comprising:
a hardware processor; and
a memory that stores a computer program product, the computer program product when executed by the hardware processor, causes the hardware processor to:
analyze programs to extract tables having references to structured query language (SQL) statements and call graphs;
count a number of co-occurrences of pairs of tables having the references to the SQL statements;
create first edges based on the number of co-occurrences of pairs of tables having the references to SQL statements;
compute a shortest path lengths between two programs using pairs of tables in the call graphs based on a program to table use relationship;
create second edges based on the shortest path lengths;
plot the entity relationship diagram from the first edges and the second edges; and
utilize the entity relationship diagram to perform software maintenance of the programs based on a mismatch between source code of the programs and initial design documents, the mismatch resulting from changes to the source code.
8 . The system of claim 7 , wherein the creating first edges based on the number of co-occurrences of the pairs of tables having the references to the SQL statements comprises controlling first edge creation to provide that a greater number of edges share a lesser number of nodes.
9 . The system of claim 8 , wherein the controlling of the first edge creation includes that the number of edges is a constant multiple of the number of nodes.
10 . The system of claim 7 , wherein the creating the second edges based on the shortest path lengths comprises controlling second edge creation to provide that a greater number of edges share a lesser number of nodes.
11 . The system of claim 10 , wherein the controlling of the second edge creation includes that the number of edges is a constant multiple of the number of nodes.
12 . The system of claim 7 , wherein the plotting the entity relationship diagram from the first edges and the second edges further comprises outputting the pairs of tables between the first edges and the second edges.
13 . A computer program product for generating an entity relationship diagram, the computer program product comprising a computer readable storage medium having computer readable program code embodied therewith, the program code executable by a processor to cause the processor to:
analyze, using the processor, programs to extract tables having references to structured query language (SQL) statements and call graphs;
count, using the processor, a number of co-occurrences of pairs of tables having the references to SQL statement;
create, using the processor, first edges based on the number of co-occurrences of pairs of tables having the references to SQL statements;
calculate, using the processor, a shortest path lengths between two programs using pairs of tables in the call graphs based on a program to table use relationship;
create, using the processor, second edges based on the shortest path lengths;
plot, using the processor, the entity relationship diagram from the first edges and the second edges; and
utilize the entity relationship diagram to perform software maintenance of the programs based on a mismatch between source code of the programs and initial design documents, the mismatch resulting from changes to the source code.
14 . The computer program product of claim 13 , wherein the plotting the entity relationship diagram from the first edges and the second edges further comprises outputting the pairs of tables between the first edges and the second edges.