| 摘要: |
| Text2SQL技术通过减少非专业用户与关系数据库交互的技术障碍, 已发展为数据分析和数据库管理的重要工具. 以GPT为代表的大语言模型 (large language model, LLM)的引入, 进一步提升了Text2SQL系统的性能. 然而, 由于空间数据涉及复杂的几何关系、多样化的查询类型和对高精度语义理解的需求, 现有的Text2SQL技术难以直接适用于空间数据库领域. 为了解决上述问题, 降低普通用户与空间数据库的交互门槛, 提出了面向空间数据库的自然语言查询 (natural language query, NLQ)转换方法. 该方法有两个核心阶段: (1) 自然语言理解; (2) 可执行语言生成. 在阶段(1)中使用实体信息提取算法提取关键查询实体, 并基于大语言模型构建空间数据查询语料库进而确定查询类型. 在阶段(2)中根据查询类型选择结构化语言模型 (structured language model, SLM), 然后将实体映射到结构化语言模型中, 得到最终的空间数据库可执行语言. 在多组真实数据集上的实验结果表明, 该方法可以实现从用户的自然语言查询到空间数据库可执行语言的高效转换. |
| 关键词: 空间数据库 自然语言接口 数据库自然语言接口 语义解析 查询处理 |
| DOI:10.13328/j.cnki.jos.007514 |
| 分类号:TP311 |
| 基金项目:国家自然科学基金(62472217, U23A20296) |
|
| Natural Language Query Transformation Method for Spatial Databases Based on Large Language Model |
|
LIU Meng-Yi1, XU Jian-Qiu1, TONG Yong-Xin2
|
|
1.College of Computer Science and Technology/College of Software, Nanjing University of Aeronautics and Astronautics, Nanjing 211106, China;2.School of Computer Science and Engineering, Beihang University, Beijing 100191, China
|
| Abstract: |
| Text2SQL has evolved into a significant tool for data analysis and database management by reducing the technical barriers for non-expert users to interact with relational databases. The introduction of large language model (LLM), represented by GPT, further improves the performance of Text2SQL systems. However, existing Text2SQL techniques are difficult to apply directly to the spatial database domain because spatial data involves complex geometric relationships, diverse query types, and the demand for high-precision semantic understanding. To address these issues and lower the threshold for interaction between non-experts and spatial databases, a natural language query (NLQ) transformation method for spatial databases is proposed. The method consists of two core phases: (1) natural language understanding; (2) executable language generation. In phase (1), an entity information extraction algorithm is employed to extract key query entities, and a spatial data query corpus is constructed based on large language models to determine the query type. In phase (2), a structured language model (SLM) is selected according to the query type, and the entities are then mapped into the structured language model to generate the final executable language for spatial databases. Experimental results on multiple real-world datasets demonstrate that the proposed method enables efficient transformation from natural language queries to executable languages of spatial databases. |
| Key words: spatial database natural language interface natural language interface for databases semantic parsing query processing |