Entity Relationship Diagram Extraction from Source Code

Resolve Bottlenecks,
Find Innovative Solutions
Generate 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

VSEngineering 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

Engineering Contradiction:
Improveaccuracy of table relationshipsVSAvoidtime drift between documentation and code
Core Design Contradiction:
Loss of informationVSLoss of time

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.

Inventive Principle:
Principle #13The other way round (Inversion)

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.

Inventive Principle:
Principle #25Self-service

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

Engineering Contradiction:
Improveaccuracy of relationship representationVSAvoidcomplexity of maintaining documentation
Core Design Contradiction:
Measurement precisionVSDevice complexity

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.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

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.

Inventive Principle:
Principle #23Feedback

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

Engineering Contradiction:
Improveaccuracy of table relationshipsVSAvoidease of maintaining relationships
Core Design Contradiction:
ReliabilityVSEase of operation

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.

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentUS20230168884A1Extracting entity relationship diagrams from source code
Publication Date: 2023.06.01 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US20230168884A1 patent drawing
  • US20230168884A1 patent drawing
  • US20230168884A1 patent drawing

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.