pykci: A Compact Urban Knowledge Graph for Semantic and Spatial Queries using LLMs

๐Ÿ“… 2026-07-01
๐Ÿ“ˆ Citations: 0
โœจ Influential: 0
๐Ÿ“„ PDF
๐Ÿค– AI Summary
This work proposes an end-to-end approach to efficiently transform fully modular CityGML 2.0 datasets into compact urban knowledge graphs in Neo4j, addressing the limitations of CityGMLโ€™s XML-based exchange format, which is semantically rich yet ill-suited for direct querying or analytical tasks. The method innovatively integrates R-tree spatial indexing with a model-agnostic text-to-Cypher translation mechanism, enabling natural language-driven joint semantic and spatial queries. The system combines a large language model (LLM) interface, a graph database backend, and OGC 3D Tiles for visualization, and demonstrates its feasibility on Hamburgโ€™s LoD2 dataset through complex use cases such as identifying suitable rooftops for greening. The architecture ensures data locality, auditability of results, and mitigation of LLM hallucinations.
๐Ÿ“ Abstract
CityGML, the OGC standard for modeling, storage, and exchange of semantic 3D city models, describes urban objects with detailed semantics, geometry, and topology. Yet this richness is difficult to query directly: CityGML's XML encoding is designed for exchange rather than analysis, and relational mappings expose it through schemas requiring expert knowledge. We present pykci (Python Knowledge Graph for Cities), an open-source system that transforms CityGML 2.0 datasets into a compact urban knowledge graph in Neo4j and makes it queryable in natural language. The graph schema covers all thematic feature modules of CityGML 2.0 across all levels of detail and is spatially indexed with an R-tree for efficient geometric retrieval. A complete end-to-end Python pipeline ingests CityGML datasets into the knowledge graph, exports them to OGC 3D Tiles for interactive visualization, and supports lossless round-trip export of all content back to CityGML. For querying, the graph is paired with a large language model through a model-agnostic text-to-Cypher mechanism: the graph schema is supplied as context, and the model translates natural-language questions into Cypher queries executed against the graph. We evaluate both a locally running open-weight model, which keeps sensitive city data on-premise, and a state-of-the-art commercial model for the most demanding spatial and semantic queries. Answers are grounded in exact city data rather than the model's parametric memory, reducing hallucination and providing auditable provenance for every response. We demonstrate the system on open-government CityGML LoD2 datasets from Hamburg, Germany, including complex semantic and spatial queries such as identifying roof surfaces suitable for greening. pykci enables urban planners, GIS practitioners, and citizens to interact with semantic 3D city models without expertise in query languages and database schemas.
Problem

Research questions and friction points this paper is trying to address.

CityGML
urban knowledge graph
semantic query
spatial query
natural language querying
Innovation

Methods, ideas, or system contributions that make the work stand out.

Urban Knowledge Graph
CityGML
Natural Language Querying
Spatial Indexing
LLM-to-Cypher Translation
๐Ÿ”Ž Similar Papers
No similar papers found.
๐Ÿ’ผ Related Jobs
No related jobs found.
H
Huynh Duc An Son Nguyen
HafenCity University Hamburg, Computational Methods Lab, Hamburg, Germany
L
Lukas Arzoumanidis
HafenCity University Hamburg, Computational Methods Lab, Hamburg, Germany
Y
Youness Dehbi
HafenCity University Hamburg, Computational Methods Lab, Hamburg, Germany