Toward efficient cross-departmental relational data retrieval: a knowledge-constrained LLM-graph framework for smart cities
Xiaolong He, Xinyue Li, Xi Kuai, Zihao Qiu, Renjie Gu · 2025
The integration and application of multi-sectoral data assets has become critical for effective urban governance. Although most urban datasets reside in relational databases, inherent challenges persist: 1) heterogeneous naming conventions across departments, and 2) systemic data silos obstructing cross-domain integration, which create barriers to precise schema recognition and SQL generation. To address these, we propose a knowledge-constrained, large language model (LLM)-driven framework for urban data query. Our framework implements two modules: (1) An object-oriented abstraction layer that models urban governance entities with graph-based model, establishing multilevel schema relationships; (2) An LLM-powered engine that converts natural language queries into graph traversals and syntactically valid SQL. Experimental results demonstrate:(1) Effective graph representation of multi-departmental schema information through node-edge mappings; (2) Superior performance of GPT-4o with 70.2128% accuracy improvements over baseline. This AI solution breaks down cross-departmental data barriers and aids urban information management decision-making.