GRASP: Generic Reasoning And SPARQL Generation across Knowledge Graphs

Sebastian Walter, Hannah Bast
7/10/2025
cs.CLcs.DBcs.IR

No official code found. Best implementation: ad-freiburg/grasp (25 stars, Apache-2.0, last commit 2026-04-24).

Abstract

We propose a new approach for generating SPARQL queries on RDF knowledge graphs from natural language questions or keyword queries, using a large language model. Our approach does not require fine-tuning. Instead, it uses the language model to explore the knowledge graph by strategically executing SPARQL queries and searching for relevant IRIs and literals. We evaluate our approach on a variety of benchmarks (for knowledge graphs of different kinds and sizes) and language models (of different scales and types, commercial as well as open-source) and compare it with existing approaches. On Wikidata we reach state-of-the-art results on multiple benchmarks, despite the zero-shot setting. On Freebase we come close to the best few-shot methods. On other, less commonly evaluated knowledge graphs and benchmarks our approach also performs well overall. We conduct several additional studies, like comparing different ways of searching the graphs, incorporating a feedback mechanism, or making use of few-shot examples.

View on arXivView PDF

Code Implementations(1)

ad-freiburg/graspCommunity72%
Apache-2.0

GRASP: Generic Reasoning and SPARQL generation across Knowledge Graphs

2514CSS, LexMay 10, 20256 months agoApache-2.0

Similar Papers

Cite this paper

@article{walter2025grasp,
  title  = {GRASP: Generic Reasoning And SPARQL Generation across Knowledge Graphs},
  author = {Sebastian Walter and Hannah Bast},
  year   = {2025},
  eprint = {2507.08107},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.08107v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.08107.svg)](https://codeofpaper.com/paper/2507.08107)

Discussion