Cardiff University | Prifysgol Caerdydd ORCA
Online Research @ Cardiff 
WelshClear Cookie - decide language by browser settings

Prompting large language models based on semantic schema for text-to-Cypher transformation towards domain Q&A

Wan, Yuwei, Chen, Zheyuan, Liu, Ying ORCID: https://orcid.org/0000-0001-9319-5940, Chen, Chong and Packianather, Michael ORCID: https://orcid.org/0000-0002-9436-8206 2025. Prompting large language models based on semantic schema for text-to-Cypher transformation towards domain Q&A. Decision Support Systems 199 , 114553. 10.1016/j.dss.2025.114553

[thumbnail of 1-s2.0-S016792362500154X-main.pdf] PDF - Published Version
Available under License Creative Commons Attribution Non-commercial.

Download (3MB)

Abstract

Translating natural language inquiries into executable Cypher queries (text-to-Cypher) is a persistent bottleneck for non-technical teams relying on knowledge graphs (KGs) in fast-changing industrial settings. Rule and template converters need frequent updates as schemas evolve, while supervised and fine-tuned parsers require recurring training. This study proposes a schema-guided prompting approach, namely text-to-Cypher with semantic schema (T2CSS), to align large language models (LLMs) with domain knowledge for producing accurate Cypher. T2CSS distils a domain ontology into a lightweight semantic schema and uses adaptive filtering to inject the relevant subgraph and essential Cypher rules into the prompt for constraining generation and reducing schema-agnostic errors. This design keeps the prompt focused and within context length limits while providing the necessary domain grounding. Comparative experiments demonstrate that T2CSS with GPT-4 outperformed baseline models and achieved 86 % accuracy in producing correct Cypher queries. In practice, this study reduces retraining and maintenance effort, shortens turnaround times, and broadens KG access for non-experts.

Item Type: Article
Date Type: Publication
Status: Published
Schools: Schools > Engineering
Publisher: Elsevier
ISSN: 0167-9236
Date of First Compliant Deposit: 20 October 2025
Date of Acceptance: 4 October 2025
Last Modified: 20 Oct 2025 12:45
URI: https://orca.cardiff.ac.uk/id/eprint/181762

Actions (repository staff only)

Edit Item Edit Item

Downloads

Downloads per month over past year

View more statistics