Code Knowledge Graph Bug Localization for Text-Code Mismatch

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Traditional IR-based bug localization methods suffer from a mismatch between bug report text and source code file word text, leading to inefficiencies in identifying and repairing software bugs.

Innovation Solution

A method and system utilizing a code knowledge graph, involving source code extraction, parsing to AST, constructing a code knowledge graph, crawling bug reports, preprocessing, named entity recognition, and vector representation to calculate cosine similarities for bug localization.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Extent of automation

If traditional information retrieval technology is used for bug localization, then the process can be automated, but the accuracy deteriorates due to mismatch between bug report text and source code

Engineering Contradiction:
Improveautomation of bug localizationVSAvoidaccuracy of bug localization
Core Design Contradiction:
Extent of automationVSMeasurement precision

Solution Approach 1:

The patent introduces a code knowledge graph as an intermediary representation that bridges bug reports and source code. Instead of directly matching text to code, the system transforms both into knowledge graph representations (entities and relationships) that can be semantically compared, resolving the text-mismatch problem while maintaining automation

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system changes the representation parameters from raw text to structured knowledge graph data. Bug reports and source code are both converted into knowledge graph formats with entities (classes, methods, variables) and relationships, enabling accurate semantic matching beyond simple text similarity

Inventive Principle:
Principle #35Parameter changes

2Measurement precision

If source codes are parsed into AST and converted to knowledge graphs, then the accuracy of bug localization improves, but the system complexity increases

Engineering Contradiction:
Improveaccuracy of bug localizationVSAvoidcomplexity of code processing system
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent segments the code processing into distinct modular steps: parsing source code to AST, extracting entities and relationships, constructing knowledge graph, and performing similarity calculation. This segmentation makes the complex system more manageable and maintainable while preserving accuracy

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The code knowledge graph construction process serves multiple functions simultaneously: it structures code information, extracts semantic relationships, and creates a representation suitable for similarity matching. This multi-functionality reduces the need for separate processing stages, managing complexity

Inventive Principle:
Principle #6Universality (Multi-functionality)

3Measurement precision

If named entity recognition and vector representation are performed on bug reports, then the matching precision improves, but the processing time increases

Engineering Contradiction:
Improveprecision of bug report matchingVSAvoidprocessing time for bug localization
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The system performs named entity recognition and knowledge graph construction as preliminary actions on the source code before similarity calculation. By pre-processing the code into a structured knowledge graph format, the actual matching process becomes faster and more efficient, reducing overall processing time while maintaining precision

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS12632365B2Method and system for bug localization based on code knowledge graph
Publication Date: 2026.05.19 YANGZHOU UNIV
  • US12632365B2 patent drawing
  • US12632365B2 patent drawing
  • US12632365B2 patent drawing

AI summary

Disclosed are a method and a system for bug localization based on a code knowledge graph, including the steps of: extracting source codes from a Git version control system, parsing in the source codes to generate an abstract syntax tree (AST), constructing a code knowledge graph, preprocessing the summary and description of a bug report crawled from a Bugzilla bug tracking system, and performing the named entity recognition to identify bug-related entity sequence, converting the code knowledge graph and the bug-related entity sequence into vector representation through an embedding algorithm, calculating cosine similarities of vector representations between the code knowledge graph and the bug entity sequence, ranking the similarities from high to low to generate a list of suspicious methods, filtering redundant information in the source codes, identifying bug-related entity elements in the bug report, and reserving the bug-related information.