Entity Relationship Diagram Extraction from Source Code
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for representing relationships among database tables, such as in software maintenance and application modernization, often lead to mismatches between design documents and source code over time, making it difficult to accurately capture and maintain these relationships.
Innovation Solution
A computer-implemented method and system that analyzes programs to extract tables with Structured Query Language (SQL) statements and call graphs, counts co-occurrences of table pairs, computes shortest path lengths, and creates edges based on these analyses to generate entity-relationship diagrams.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of information
If design documents are used to represent database table relationships, then relationships can be initially documented, but mismatches occur over time between design documents and source code
Solution Approach 1:
Instead of maintaining design documents to represent source code relationships, the patent inverts the approach by automatically extracting relationships directly from source code. The system analyzes SQL statements and call graphs in the code to build entity-relationship diagrams, ensuring the documentation always reflects the actual code state rather than becoming outdated.
Solution Approach 2:
The system enables the source code to self-document its own relationships. By automatically analyzing SQL statements and call graphs within the codebase, the system generates entity-relationship diagrams without requiring separate manual documentation processes, making the code itself the source of truth for relationship information.
2Measurement precision
If manual documentation methods are used, then initial relationships can be captured, but accuracy deteriorates over time due to mismatches with evolving source code
Solution Approach 1:
The patent replaces manual mechanical documentation processes with automated computational analysis. Instead of manually creating and updating design documents, the system uses algorithms to analyze SQL statements and call graphs, automatically generating and updating entity-relationship diagrams to maintain precision without manual intervention.
Solution Approach 2:
The system establishes a feedback loop where entity-relationship diagrams are continuously regenerated from source code analysis. This feedback mechanism ensures that any changes in the codebase automatically reflect in the documentation, maintaining accuracy by constantly comparing the documented relationships against the actual code structure.
3Reliability
If design documents are maintained separately from source code, then initial relationships can be documented, but the relationships become difficult to maintain and synchronize
Solution Approach 1:
The patent merges the documentation process with the source code itself by extracting relationship information directly from SQL statements and call graphs within the code. This integration eliminates the separation between design documents and source code, making maintenance easier since changes in either automatically reflect in the other through the same analysis pipeline.
Data Source
AI summary
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.


