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.
Figures & tables
Fig. 1: Given a query: “Which drugs are used to treat tetany?” Rule‑based methods assume a non-existent relation and returns None; Learning-based methods reach the disease but over-includes Ca , failing to address pragmatic constraints; LLM‑assisted, constraint-based methods generation captures implicit intent and respects ontology, yielding clinically appropriate answers.
Fig. 2: UniQGen Framework Overview
TABLE II: GraphQ & WebQSP results across SPARQL and Cypher; all queried over the same Neptune-managed endpoint; best per column in bold , second best underlined .
Fig. 4: Efficiency Analysis
?city
hosted
?e:OlympicGames
?city
country
USA
?city
name
?city_name
?e:OlympicGames
type
?season
?e:OlympicGames
year
?host_year
Table 5
ID
Constraint in CTable
c1
(c:City)-[:hosted]->(e:OlympicGames)
c2
c.country = ’USA’
c3
e.year > 1896
c4
e.type = ’Winter’
c5
e.type = ’Summer’
Table 6
Methods
Category
Train
Query
WebQSP Performance
CBR-KBQA (CBR) [ 31 ]
Case-based reasoning (non-parametric)
Y
Y
F1=72.8, EM=70.0
QGG [ 32 ]
Semantic parsing (step-wise)
Y
Y
F1=74.0
RNG-KBQA [ 33 ]
Semantic parsing (seq2seq)
Y
Y
F1=75.6, EM=71.1
NSM [ 34 ]
Neural symbolic / GNN
Y
N
F1=74.3
UniKGQA [ 35 ]
GNN-based retrieval
Y
N
F1=72.2, Hit@1=77.2
StructGPT [ 36 ]
LLM+KG (structured prompting)
N
N
Hit@1=72.6
TABLE III: Representative KGQA methods and reported performance on WebQSP. “Train” indicates task-specific training; “Query” indicates whether the method outputs an executable query (e.g., SPARQL/logical form) rather than only answers. Reported metrics vary across papers (F1/EM vs Hit@1).