HeSQLNet: A Heterogeneous graph neural network for SQL-to-Text generation

IF 3.8 2区 计算机科学 Q2 COMPUTER SCIENCE, INFORMATION SYSTEMS
Junsan Zhang , Ao Lu , Junxiao Han , Yang Zhu , Yudie Yan , Juncai Guo , Yao Wan
{"title":"HeSQLNet: A Heterogeneous graph neural network for SQL-to-Text generation","authors":"Junsan Zhang ,&nbsp;Ao Lu ,&nbsp;Junxiao Han ,&nbsp;Yang Zhu ,&nbsp;Yudie Yan ,&nbsp;Juncai Guo ,&nbsp;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}
引用次数: 0

Abstract

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.
用于SQL-to-Text生成的异构图神经网络
上下文:理解SQL查询的语义对于维护代码和重用数据库访问和管理中的功能至关重要。然而,即使是专家级用户,理解SQL查询仍然是一个挑战。在这项工作中,我们通过关注SQL-to- text来解决这一挑战,这是一项将SQL查询转换为相应的自然语言问题的任务。现有的方法主要使用抽象语法树(AST)表示对SQL查询进行编码,然后将该结构解码为文本解释。然而,这些方法通常将AST视为同构图,忽略了其节点之间的各种关系,例如父子关系和兄弟关系。目的:为了解决这一问题,本文介绍了HeSQLNet:一个用于sql到文本生成的异构图神经网络。方法:具体来说,我们首先提出了一个异构特征图(HFG),它通过六种不同的边缘类型来增强AST,以更好地捕获SQL查询中固有的异构关系。我们进一步开发了一个具有注意力的异构图神经网络,利用两阶段聚合过程有效地提取和编码这些异构特征。然后将丰富的HFG表示合并到称为HeSQLNet的编码器-解码器框架中,以生成SQL查询的自然语言描述。为了评估SQL-to-Text模型处理复杂查询和演示组合泛化的能力,我们引入了SpiderComGen,这是一个从Spider数据集派生出来的新的组合泛化数据集。结果:我们在广泛使用的和我们提出的数据集上进行了广泛的实验。实验结果表明,HeSQLNet在有效性和泛化能力方面都明显优于现有的最先进的方法。此外,与最近的大型语言模型相比,人类评估和案例研究表明,HeSQLNet不仅提供了准确的结果,而且提供了更简洁的输出。结论:我们的HeSQLNet证明了异构特征融合和提取显著提高了SQL-to-Text的生成。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
Information and Software Technology
Information and Software Technology 工程技术-计算机:软件工程
CiteScore
9.10
自引率
7.70%
发文量
164
审稿时长
9.6 weeks
期刊介绍: 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.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信