Code Knowledge Graph Bug Localization for Text-Code Mismatch
Find Innovative SolutionsGenerate 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
Engineering 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
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
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
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
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
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
3Measurement precision
If named entity recognition and vector representation are performed on bug reports, then the matching precision improves, but the processing time increases
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
Data Source
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.


