Design and application of a semantic-driven geospatial modeling knowledge graph based on large language models - Jianyuan Liang; Shuyang Hou; Anqi Zhao; Qingyang Xu; Longgang Xiang; Rui Li; Huayi Wu (Geo-spatial Information Science)
While leveraging large language models (LLMs) for intelligent geospatial modeling has garnered significant attention, the limited domain-specific knowledge of LLMs often leads to inefficient or unreliable geo-analysis model generation. Crowdsourced geoprocessing scripts encapsulate extensive expert knowledge for different geospatial modeling tasks, where code snippets are strategically combined into functional steps to build application-specific modeling processes. However, extracting these modeling processes from heterogeneous geoprocessing scripts and integrating them for reuse remains challenging due to the complexity of code interdependencies, the heterogeneity of scripting approaches, and the need for domain-specific customization. To address this, we propose S-GMKG, a knowledge graph that systematically extracts and integrates modeling processes from scripts as structured semantic units. Two strategies are introduced: a skeleton-based extraction method and a knowledge-enhanced chain of thought (CoT) approach, which facilitate automated modeling process extraction for S-GMKG via prompt engineering. Furthermore, a self-canonicalization and knowledge augmentation process is proposed to refine the S-GMKG. Consequently, S-GMKG serves as a robust external knowledge source to provide interpretable, graph-based modeling solutions and synergizes with LLMs for geospatial tasks. We implemented the S-GMKG using 4820 geoprocessing scripts and evaluated it across various LLMs. Results indicate that most scripts in the S-GMKG can be represented as modeling processes with 3–7 functional steps, with the proposed strategies achieving 3.2%–14.5% higher recall rates in relationship identification for these functional steps. Case studies in two distinct scenarios demonstrate the practicality of S-GMKG, particularly in collaborating with LLMs to generate code for geospatial modeling.