EUVIMEDEUVIMED entdecken
Open Access · CC BY 4.0

Accurate SPARQL generation via in-context learning and schema-based query construction

Hikaru Nagazumi iD, Yuki Moriya iD, Shuichi Kawashima iD, Toshiaki Katayama iD, Kana Shimizu iD

Bioinformatics · 03.05.2026 · 42 (5)

DOI: 10.1093/bioinformatics/btag174 ↗

Kurz gefasst

Fachartikel in der Zeitschrift Bioinformatics, online erschienen am 08.04.2026. Verfasst von Hikaru Nagazumi und 4 weiteren Autor:innen. Beteiligte Einrichtung: Faculty of Science and Engineering, Waseda University, Shinjuku-ku, Tokyo 169-8555, Japan. Hauptthemen laut MEDLINE: Computational Biology, Software, Natural Language Processing. Die Arbeit nennt 15 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY 4.0).

AbstractSchlagwörterBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

Motivation Integrated analysis across biological databases is becoming increasingly important in life science research, leading many public databases to adopt Semantic Web technologies, also known as knowledge graphs. However, biological data possesses inherently complex and diverse structures, which makes the resulting Resource Description Framework (RDF) schemas intricate and difficult for non-expert users to master, preventing them from translating natural language questions into correct SPARQL queries. Although recent large language model (LLM)-based approaches show potential for automatic SPARQL query generation, they often suffer from structural hallucinations and require large-scale training data to capture schema-specific structures. In this study, we propose a novel framework that avoids hallucinations and requires no training data by combining LLM-based word extraction with a schema-based SPARQL query builder. Results The LLM extracts variables and parameters from the user’s question based on a predefined schema, and the query builder generates a syntactically correct SPARQL query accordingly. By providing a predefined schema in prompts, our method eliminates the need for training data. Experimental results on UniProt, Rhea, and Bgee demonstrate that our method outperforms baseline LLM-based methods using fine-tuning and prompt-tuning in terms of the similarity between search results obtained from generated and expert-written queries. Furthermore, we developed a proof-of-concept chatbot system that enables users to query RDF databases via natural language input, demonstrating the practical utility of our approach in improving access to biological data resources. Availability and implementation Experimental environment: https://github.com/scott2121/sparql_query_generator (DOI: https://doi.org/10.5281/zenodo.18539213). Chatbot: https://github.com/scott2121/sparql_query_chatbot (DOI: https://doi.org/10.5281/zenodo.18539225).

Schlagwörter

MeSH-Schlagwörter (MEDLINE)

Computational BiologySoftwareNatural Language ProcessingLarge Language ModelsDatabases, FactualAlgorithms

Autor:innen und Institutionen

  • Faculty of Science and Engineering, Waseda University, Shinjuku-ku, Tokyo 169-8555, Japan.
  • Database Center for Life Science, Kashiwa, Chiba 277-0871, Japan.

ORCID-Profile: Hikaru Nagazumi, Yuki Moriya, Shuichi Kawashima, Toshiaki Katayama, Kana Shimizu

Zitieren

APA

Nagazumi, H., Moriya, Y., Kawashima, S., Katayama, T., & Shimizu, K. (2026). Accurate SPARQL generation via in-context learning and schema-based query construction. Bioinformatics, 42(5). https://doi.org/10.1093/bioinformatics/btag174

Vancouver

Nagazumi H, Moriya Y, Kawashima S, Katayama T, Shimizu K. Accurate SPARQL generation via in-context learning and schema-based query construction. Bioinformatics. 2026;42(5). doi:10.1093/bioinformatics/btag174

BibTeX
@article{Nagazumi2026,
  author = {Nagazumi, Hikaru and Moriya, Yuki and Kawashima, Shuichi and Katayama, Toshiaki and Shimizu, Kana},
  title = {Accurate SPARQL generation via in-context learning and schema-based query construction},
  journal = {Bioinformatics},
  year = {2026},
  volume = {42},
  number = {5},
  doi = {10.1093/bioinformatics/btag174}
}
Kostenlos starten →