Schema Injection Strategies for LLM-Based Text-to-Cypher Query Translation: An Empirical Study
Artikel i vetenskaplig tidskrift, 2026

Software ecosystems generate complex data traces which can be represented through graph models and stored in graph databases. While large language models (LLMs) offer promising no-code interfaces for querying such databases by translating natural language to database queries, their effectiveness heavily depends on how database schema information is provided. This paper presents a comprehensive evaluation of different schema injection techniques for LLM-driven graph database query generation. We systematically evaluate four key dimensions: schema source, prompt placement, query categories, and results relevancy. Our automated evaluation pipeline records execution outcomes across 50 test queries spanning five query categories. In addition, a human evaluation is conducted for the returned data from each query execution. Results show that LLM-generation of Cypher queries is sensitive to schema source and injection point. In addition, results show that providing the dynamically generated schema through the APOC.meta.graph method yields more relevant and executable queries on average compared to static schema summaries, while injecting schema information in the system prompt outperforms injection in the user prompt. The evaluation provides actionable insights for optimising LLM-driven graph database interfaces and highlights the need for advanced context and software engineering to enable reliable LLM-based solutions.

database schema

information processing

query translation

software ecosystems

large language models

graph database

Knowledge management

Författare

Shady Hegazy

Siemens

Muhammad Ammar

Siemens

Christoph Elsner

Siemens

Jan Bosch

Göteborgs universitet

Chalmers, Data- och informationsteknik, Interaktionsdesign och Software Engineering

Helena Holmstrom Olsson

Malmö universitet

Journal of Information and Knowledge Management

0219-6492 (ISSN) 1793-6926 (eISSN)

Vol. In Press

Ämneskategorier (SSIF 2025)

Programvaruteknik

Datavetenskap (datalogi)

Systemvetenskap, informationssystem och informatik

DOI

10.1142/S0219649226500541

Mer information

Senast uppdaterat

2026-07-10