arrow
Return

JDQuery: Query-Driven Defect Localization for Java Source Code Based on Code Knowledge Graphs

delete2026-09-02
delete0
delete
OA
AI
T
Tianyuan Hu *
T
Tong Wang
DOI:10.3390/electronics15173827delete
deleteOriginal
deleteShare
deleteSave
Abstract

Abstract

En 中文
Java is one of the most widely used object-oriented programming languages, making accurate and efficient defect localization essential for improving software quality and reliability. Conventional static analysis techniques primarily rely on predefined rules and localized syntactic matching, which may limit their ability to capture complex structural and semantic relationships among program entities. To address these limitations, this paper proposes JDQuery, a query-driven defect localization framework for Java source code based on a code knowledge graph. The framework parses Java source code into abstract syntax trees (ASTs), extracts software entities and their semantic relationships according to a formalized domain ontology, and constructs a unified code knowledge graph that integrates syntactic and semantic information. Based on the structural characteristics of Java defects, defect patterns are translated into Cypher queries, enabling flexible defect localization through graph pattern matching. Experiments on multiple open-source Java projects, including both injected defects and native real-world defects, demonstrate that JDQuery achieves precision values of 97.20% and 92.87% on two projects of different code sizes. A comparative evaluation with PMD further shows that JDQuery achieves substantially higher recall while maintaining comparable precision for the evaluated defects. Efficiency experiments demonstrate that JDQuery maintains millisecond-level query latency even when processing large-scale Java projects.
Keywords:
code knowledge graph
defect localization
cypher query
An Efficient and Scalable Platform for Java Source Code Analysis Using Overlaid Graph Representations
err2020-01-01
err18
errOAAI
errRodriguez-Prieto, Oscar; Mycroft, Alan; Ortin, Francisco
errShare
errSave
Query Expansion Based on Crowd Knowledge for Code Search
err2016-09-01
err125
errOAAI
errNie, Liming; Jiang, He; Ren, Zhilei; Sun, Zeyi; Li, Xiaochen
errShare
errSave
Querying Knowledge Graphs by Example Entity Tuples
err2015-10-01
err65
errOAAI
errJayaram, Nandish; Khan, Arijit; Li, Chengkai; Yan, Xifeng; Elmasri, Ramez
errShare
errSave
XCoS: Explainable Code Search Based on Query Scoping and Knowledge Graph
err2023-09-29
err9
errOAAI
errWang, Chong; Peng, Xin; Xing, Zhenchang; Zhang, Yue; Liu, Mingwei; Luo, Rong; Meng, Xiujie
errShare
errSave
Knowledge graphs: Construction, management and querying
err2019-10-28
err15
errOAAI
errKejriwal, Mayank; Sequeda, Juan; Lopez, Vanessa
errShare
errSave
errShare
errSave

Journal

Electronics cover
Electronics
IF:
2.6
Papers:
1.1W
Citations:
5.1W

Organization

Nanjing Tech University cover
Nanjing Tech University
Scholars:
4.1K
Papers: 988
Citations: 1.9W
Anhui University of Technology cover
Anhui University of Technology
Scholars:
1.2K
Papers: 318
Citations: 4.5K
Cited Papers

Cited Papers

CodeKGC: Code Language Model for Generative Knowledge Graph Construction
err2024-03-09
err0
errOAAI
errZhen Bi; Jing Chen; Yinuo Jiang; Feiyu Xiong; Wei Guo; Huajun Chen; Ningyu Zhang
errShare
errSave
errShare
errSave
Detect Defects of Solidity Smart Contract Based on the Knowledge Graph
err2024-03-01
err10
PREAI
errHu, Tianyuan; Li, Bixin; Pan, Zhenyu; Qian, Chen
errShare
errSave
A Java typestate checker supporting inheritance
err2022-09-01
err0
PREAI
errBacchiani,Lorenzo; Bravetti,Mario; Giunti,Marco; Mota,João; Ravara,António
errShare
errSave
Semantic-Enriched Code Knowledge Graph to Reveal Unknowns in Smart Contract Code Reuse
err2023-09-30
err2
errOAAI
errHuang, Qing; Liao, Dianshu; Xing, Zhenchang; Zuo, Zhengkang; Wang, Changjing; Xia, Xin
errShare
errSave
researcher View more