SPARQL-LLM: Real-Time SPARQL Query Generation from Natural Language Questions

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Smeros, Panayiotis, Emonet, Vincent, Wang, Ruijie, Sima, Ana-Claudia, de Farias, Tarcisio Mendes
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911322504953856
author Smeros, Panayiotis
Emonet, Vincent
Wang, Ruijie
Sima, Ana-Claudia
de Farias, Tarcisio Mendes
author_facet Smeros, Panayiotis
Emonet, Vincent
Wang, Ruijie
Sima, Ana-Claudia
de Farias, Tarcisio Mendes
contents The advent of large language models is contributing to the emergence of novel approaches that promise to better tackle the challenge of generating structured queries, such as SPARQL queries, from natural language. However, these new approaches mostly focus on response accuracy over a single source while ignoring other evaluation criteria, such as federated query capability over distributed data stores, as well as runtime and cost to generate SPARQL queries. Consequently, they are often not production-ready or easy to deploy over (potentially federated) knowledge graphs with good accuracy. To mitigate these issues, in this paper, we extend our previous work and describe and systematically evaluate SPARQL-LLM, an open-source and triplestore-agnostic approach, powered by lightweight metadata, that generates SPARQL queries from natural language text. First, we describe its architecture, which consists of dedicated components for metadata indexing, prompt building, and query generation and execution. Then, we evaluate it based on a state-of-the-art challenge with multilingual questions, and a collection of questions from three of the most prevalent knowledge graphs within the field of bioinformatics. Our results demonstrate a substantial increase of 24% in the F1 Score on the state-of-the-art challenge, adaptability to high-resource languages such as English and Spanish, as well as ability to form complex and federated bioinformatics queries. Furthermore, we show that SPARQL-LLM is up to 36x faster than other systems participating in the challenge, while costing a maximum of $0.01 per question, making it suitable for real-time, low-cost text-to-SPARQL applications. One such application deployed over real-world decentralized knowledge graphs can be found at https://www.expasy.org/chat.
format Preprint
id arxiv_https___arxiv_org_abs_2512_14277
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle SPARQL-LLM: Real-Time SPARQL Query Generation from Natural Language Questions
Smeros, Panayiotis
Emonet, Vincent
Wang, Ruijie
Sima, Ana-Claudia
de Farias, Tarcisio Mendes
Information Retrieval
Artificial Intelligence
Computation and Language
The advent of large language models is contributing to the emergence of novel approaches that promise to better tackle the challenge of generating structured queries, such as SPARQL queries, from natural language. However, these new approaches mostly focus on response accuracy over a single source while ignoring other evaluation criteria, such as federated query capability over distributed data stores, as well as runtime and cost to generate SPARQL queries. Consequently, they are often not production-ready or easy to deploy over (potentially federated) knowledge graphs with good accuracy. To mitigate these issues, in this paper, we extend our previous work and describe and systematically evaluate SPARQL-LLM, an open-source and triplestore-agnostic approach, powered by lightweight metadata, that generates SPARQL queries from natural language text. First, we describe its architecture, which consists of dedicated components for metadata indexing, prompt building, and query generation and execution. Then, we evaluate it based on a state-of-the-art challenge with multilingual questions, and a collection of questions from three of the most prevalent knowledge graphs within the field of bioinformatics. Our results demonstrate a substantial increase of 24% in the F1 Score on the state-of-the-art challenge, adaptability to high-resource languages such as English and Spanish, as well as ability to form complex and federated bioinformatics queries. Furthermore, we show that SPARQL-LLM is up to 36x faster than other systems participating in the challenge, while costing a maximum of $0.01 per question, making it suitable for real-time, low-cost text-to-SPARQL applications. One such application deployed over real-world decentralized knowledge graphs can be found at https://www.expasy.org/chat.
title SPARQL-LLM: Real-Time SPARQL Query Generation from Natural Language Questions
topic Information Retrieval
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2512.14277