Junsan Zhang , Ao Lu , Junxiao Han , Yang Zhu , Yudie Yan , Juncai Guo , Yao Wan
{"title":"用于SQL-to-Text生成的异构图神经网络","authors":"Junsan Zhang , Ao Lu , Junxiao Han , Yang Zhu , Yudie Yan , Juncai Guo , Yao Wan","doi":"10.1016/j.infsof.2025.107820","DOIUrl":null,"url":null,"abstract":"<div><h3>Context:</h3><div>Understanding the semantics of SQL queries is crucial for maintaining code and reusing functionalities in database access and management. However, SQL queries often remain challenging to comprehend, even for expert users. In this work, we address this challenge by focusing on SQL-to-Text, a task that translates SQL queries into corresponding natural language questions. Existing approaches predominantly encode SQL queries using their Abstract Syntax Tree (AST) representation and then decode this structure into textual explanations. However, these methods often treat the AST as a homogeneous graph, overlooking the diverse relationships between its nodes, such as parent–child and sibling relationships.</div></div><div><h3>Objective:</h3><div>To address this issue, this paper introduces HeSQLNet: a Heterogeneous Graph Neural Network for SQL-to-Text Generation.</div></div><div><h3>Methods:</h3><div>Specifically, we first propose a Heterogeneous Feature Graph (HFG), which augments the AST with six distinct edge types to better capture the heterogeneous relationships inherent in SQL queries. We further develop a heterogeneous graph neural network with attention, leveraging a two-stage aggregation process to effectively extract and encode these heterogeneous features within the HFG. The enriched HFG representation is then incorporated into an encoder–decoder framework, called HeSQLNet, to generate natural language descriptions of SQL queries. To assess the ability of SQL-to-Text models to handle complex queries and demonstrate compositional generalization, we introduce SpiderComGen, a new compositional generalization dataset derived from the Spider dataset.</div></div><div><h3>Results:</h3><div>We conduct extensive experiments on both the widely-used and our proposed datasets. The experimental results reveal that HeSQLNet significantly outperforms existing state-of-the-art approaches in both effectiveness and generalization capability. Additionally, compared to the recent large language models, human evaluations and case studies show that HeSQLNet delivers not only accurate results but also more concise outputs.</div></div><div><h3>Conclusion:</h3><div>Our HeSQLNet proves that heterogeneous feature fusion and extraction significantly improve SQL-to-Text generation.</div></div>","PeriodicalId":54983,"journal":{"name":"Information and Software Technology","volume":"186 ","pages":"Article 107820"},"PeriodicalIF":3.8000,"publicationDate":"2025-06-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"HeSQLNet: A Heterogeneous graph neural network for SQL-to-Text generation\",\"authors\":\"Junsan Zhang , Ao Lu , Junxiao Han , Yang Zhu , Yudie Yan , Juncai Guo , Yao Wan\",\"doi\":\"10.1016/j.infsof.2025.107820\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"<div><h3>Context:</h3><div>Understanding the semantics of SQL queries is crucial for maintaining code and reusing functionalities in database access and management. However, SQL queries often remain challenging to comprehend, even for expert users. In this work, we address this challenge by focusing on SQL-to-Text, a task that translates SQL queries into corresponding natural language questions. Existing approaches predominantly encode SQL queries using their Abstract Syntax Tree (AST) representation and then decode this structure into textual explanations. However, these methods often treat the AST as a homogeneous graph, overlooking the diverse relationships between its nodes, such as parent–child and sibling relationships.</div></div><div><h3>Objective:</h3><div>To address this issue, this paper introduces HeSQLNet: a Heterogeneous Graph Neural Network for SQL-to-Text Generation.</div></div><div><h3>Methods:</h3><div>Specifically, we first propose a Heterogeneous Feature Graph (HFG), which augments the AST with six distinct edge types to better capture the heterogeneous relationships inherent in SQL queries. We further develop a heterogeneous graph neural network with attention, leveraging a two-stage aggregation process to effectively extract and encode these heterogeneous features within the HFG. The enriched HFG representation is then incorporated into an encoder–decoder framework, called HeSQLNet, to generate natural language descriptions of SQL queries. To assess the ability of SQL-to-Text models to handle complex queries and demonstrate compositional generalization, we introduce SpiderComGen, a new compositional generalization dataset derived from the Spider dataset.</div></div><div><h3>Results:</h3><div>We conduct extensive experiments on both the widely-used and our proposed datasets. The experimental results reveal that HeSQLNet significantly outperforms existing state-of-the-art approaches in both effectiveness and generalization capability. Additionally, compared to the recent large language models, human evaluations and case studies show that HeSQLNet delivers not only accurate results but also more concise outputs.</div></div><div><h3>Conclusion:</h3><div>Our HeSQLNet proves that heterogeneous feature fusion and extraction significantly improve SQL-to-Text generation.</div></div>\",\"PeriodicalId\":54983,\"journal\":{\"name\":\"Information and Software Technology\",\"volume\":\"186 \",\"pages\":\"Article 107820\"},\"PeriodicalIF\":3.8000,\"publicationDate\":\"2025-06-27\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Information and Software Technology\",\"FirstCategoryId\":\"94\",\"ListUrlMain\":\"https://www.sciencedirect.com/science/article/pii/S0950584925001594\",\"RegionNum\":2,\"RegionCategory\":\"计算机科学\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q2\",\"JCRName\":\"COMPUTER SCIENCE, INFORMATION SYSTEMS\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Information and Software Technology","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0950584925001594","RegionNum":2,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q2","JCRName":"COMPUTER SCIENCE, INFORMATION SYSTEMS","Score":null,"Total":0}
HeSQLNet: A Heterogeneous graph neural network for SQL-to-Text generation
Context:
Understanding the semantics of SQL queries is crucial for maintaining code and reusing functionalities in database access and management. However, SQL queries often remain challenging to comprehend, even for expert users. In this work, we address this challenge by focusing on SQL-to-Text, a task that translates SQL queries into corresponding natural language questions. Existing approaches predominantly encode SQL queries using their Abstract Syntax Tree (AST) representation and then decode this structure into textual explanations. However, these methods often treat the AST as a homogeneous graph, overlooking the diverse relationships between its nodes, such as parent–child and sibling relationships.
Objective:
To address this issue, this paper introduces HeSQLNet: a Heterogeneous Graph Neural Network for SQL-to-Text Generation.
Methods:
Specifically, we first propose a Heterogeneous Feature Graph (HFG), which augments the AST with six distinct edge types to better capture the heterogeneous relationships inherent in SQL queries. We further develop a heterogeneous graph neural network with attention, leveraging a two-stage aggregation process to effectively extract and encode these heterogeneous features within the HFG. The enriched HFG representation is then incorporated into an encoder–decoder framework, called HeSQLNet, to generate natural language descriptions of SQL queries. To assess the ability of SQL-to-Text models to handle complex queries and demonstrate compositional generalization, we introduce SpiderComGen, a new compositional generalization dataset derived from the Spider dataset.
Results:
We conduct extensive experiments on both the widely-used and our proposed datasets. The experimental results reveal that HeSQLNet significantly outperforms existing state-of-the-art approaches in both effectiveness and generalization capability. Additionally, compared to the recent large language models, human evaluations and case studies show that HeSQLNet delivers not only accurate results but also more concise outputs.
Conclusion:
Our HeSQLNet proves that heterogeneous feature fusion and extraction significantly improve SQL-to-Text generation.
期刊介绍:
Information and Software Technology is the international archival journal focusing on research and experience that contributes to the improvement of software development practices. The journal''s scope includes methods and techniques to better engineer software and manage its development. Articles submitted for review should have a clear component of software engineering or address ways to improve the engineering and management of software development. Areas covered by the journal include:
• Software management, quality and metrics,
• Software processes,
• Software architecture, modelling, specification, design and programming
• Functional and non-functional software requirements
• Software testing and verification & validation
• Empirical studies of all aspects of engineering and managing software development
Short Communications is a new section dedicated to short papers addressing new ideas, controversial opinions, "Negative" results and much more. Read the Guide for authors for more information.
The journal encourages and welcomes submissions of systematic literature studies (reviews and maps) within the scope of the journal. Information and Software Technology is the premiere outlet for systematic literature studies in software engineering.