Graph Query Generation with Constraint-guided Large Language Agents

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Wang, Mengying, Jedema, Nicolaas, Pandey, Rahul, Krishnan, RaviKiran, Lehmann, Jens, Wu, Yinghui
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909009338957824
author Wang, Mengying
Jedema, Nicolaas
Pandey, Rahul
Krishnan, RaviKiran
Lehmann, Jens
Wu, Yinghui
author_facet Wang, Mengying
Jedema, Nicolaas
Pandey, Rahul
Krishnan, RaviKiran
Lehmann, Jens
Wu, Yinghui
contents Knowledge Graph Question Answering (KGQA) has advanced through structured query generation, yet most efforts target RDF/SPARQL, leaving Cypher and property graphs underexplored, despite increasing demand for unified KGQA in industry settings. We propose UniQGen, a novel constraint-based framework that employs LLM agents to dynamically extract and refine representative graph query clauses into executable, intent-aligned graph queries across query languages. The foundation of our method is a variant of Chase & Backchase, a family of algorithms for query optimization and reformulation. We extend Chase & Backchase with a dynamic reasoning process over query constraints that also interact with LLMs for query quality estimation. With a Cypher-supported Freebase graph deployed on Amazon Neptune, we extensively evaluate our approach on popular KGQA benchmarks (GraphQ, GrailQA, and WebQSP). We demonstrate that UniQGen outperforms state-of-the-art graph query generation techniques in both accuracy and efficiency, with F1 gains of 31.6% on GraphQ and 4.9% on GrailQA. Unlike prior methods, our framework does not require fine-tuning for schema matching, making it more extensible to schema-less graphs and semantics in query workloads, and is more suitable for enterprise-grade KGQA. We release Cypher outputs and a Neptune-ready Freebase snapshot to support reproducible, cross-language KGQA research.
format Preprint
id arxiv_https___arxiv_org_abs_2605_00845
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Graph Query Generation with Constraint-guided Large Language Agents
Wang, Mengying
Jedema, Nicolaas
Pandey, Rahul
Krishnan, RaviKiran
Lehmann, Jens
Wu, Yinghui
Databases
Artificial Intelligence
Computation and Language
Knowledge Graph Question Answering (KGQA) has advanced through structured query generation, yet most efforts target RDF/SPARQL, leaving Cypher and property graphs underexplored, despite increasing demand for unified KGQA in industry settings. We propose UniQGen, a novel constraint-based framework that employs LLM agents to dynamically extract and refine representative graph query clauses into executable, intent-aligned graph queries across query languages. The foundation of our method is a variant of Chase & Backchase, a family of algorithms for query optimization and reformulation. We extend Chase & Backchase with a dynamic reasoning process over query constraints that also interact with LLMs for query quality estimation. With a Cypher-supported Freebase graph deployed on Amazon Neptune, we extensively evaluate our approach on popular KGQA benchmarks (GraphQ, GrailQA, and WebQSP). We demonstrate that UniQGen outperforms state-of-the-art graph query generation techniques in both accuracy and efficiency, with F1 gains of 31.6% on GraphQ and 4.9% on GrailQA. Unlike prior methods, our framework does not require fine-tuning for schema matching, making it more extensible to schema-less graphs and semantics in query workloads, and is more suitable for enterprise-grade KGQA. We release Cypher outputs and a Neptune-ready Freebase snapshot to support reproducible, cross-language KGQA research.
title Graph Query Generation with Constraint-guided Large Language Agents
topic Databases
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2605.00845