Source Code Knowledge Graph Construction

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Source code for software programs often becomes complex and difficult to understand due to its large size and longevity, making it challenging to extract knowledge from, which is essential for tasks like question answering.

Innovation Solution

A method and system for constructing or augmenting a knowledge graph from source code by extracting concepts and relationships, performing entity and relation completion, and identifying repeated patterns across the code, utilizing a processor and memory to generate a knowledge graph that integrates with natural language processing and dynamic analysis.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Duration of action of stationary object

If source code is maintained for long periods and programs grow in size, then the program's functionality and history are preserved, but the code becomes difficult to understand and knowledge extraction becomes challenging

Engineering Contradiction:
Improveprogram longevityVSAvoidcode understandability
Core Design Contradiction:
Duration of action of stationary objectVSEase of operation

Solution Approach 1:

The patent introduces knowledge graphs as an intermediary layer between the source code and human users. The knowledge graph extracts and structures semantic information from the code, creating a mediator that makes the code's meaning accessible without requiring direct reading of the complex source code. This intermediary captures entities, relationships, and patterns, presenting them in a comprehensible format that bridges the gap between long-lived complex code and human understanding.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If source code becomes large and complex, then more functionality can be implemented, but no single individual can understand the entire codebase

Engineering Contradiction:
Improveprogram functionalityVSAvoidcode complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent applies segmentation by breaking down the complex codebase into discrete entities and relationships that can be independently analyzed and represented in the knowledge graph. Code elements such as classes, functions, variables, and their interrelationships are segmented and modeled as separate nodes and edges, making the overall system manageable despite its scale and complexity.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent transitions from analyzing code in its traditional linear textual form to representing it in a graphical knowledge graph dimension. This dimensional change allows complex relationships to be visualized and queried in a structured space where semantic connections are explicit, enabling understanding of large codebases through graph-based navigation rather than linear reading.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

3Ease of manufacture

If traditional code analysis methods are used, then implementation is straightforward, but extraction of embedded knowledge and semantic relationships is insufficient

Engineering Contradiction:
Improveanalysis implementationVSAvoidembedded knowledge extraction
Core Design Contradiction:
Ease of manufactureVSLoss of information

Solution Approach 1:

The patent replaces traditional mechanical text-based code analysis methods with a semantic knowledge graph system. Instead of relying on keyword searching or static code analysis, the system uses entity recognition, relationship extraction, and pattern matching algorithms that operate on the semantic structure of the code, substituting superficial textual analysis with deeper semantic understanding.

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

Data Source

PatentUS11334692B2Extracting a knowledge graph from program source code
Publication Date: 2022.05.17 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11334692B2 patent drawing
  • US11334692B2 patent drawing
  • US11334692B2 patent drawing

AI summary

Entities and relations associated with source code of a program are extracted. An entity completion on the extracted entities and relationships is performed to produce a knowledge graph of the source code. Repeated patterns of relationships are identified from the knowledge graph across the source code.