README.adoc
March 6, 2026 ยท View on GitHub
:toc: :toclevels: 5 :toc-placement!: :source-highlighter: highlight.js ifdef::env-github[] :tip-caption: :bulb: :note-caption: :information_source: :important-caption: :heavy_exclamation_mark: :caution-caption: :fire: :warning-caption: :warning: :github-repository: https://github.com/WSE-research/LoRiS--LLM-generated-Representations-of-SPARQL-queries endif::[]
++++
++++
= LoRiS -- LLM-generated natural-language representations of SPARQL queries over Wikidata and DBpedia
Linked Data technologies are used in many applications. Despite the ease of the triple form, learning the standard query language SPARQL and understanding SPARQL queries might become cumbersome. For example, if IRIs of the knowledge graph are formed using numeric IDs (e.g., Wikidata) a human might need additional effort to understand the semantics of a SPARQL query. In addition, the sheer number of properties and classes modeled in a knowledge graph can overwhelm developers and end users. Hence, converting SPARQL to a native tongue might develop a deeper query structure understanding and mitigate possible mistakes made by developers.
We present here LoRiS, a demo application that generates natural language representations of SPARQL queries for the DBpedia and Wikidata Knowledge Graphs. For the generation, the demo supports 3 Large Language Models that can be used with 2 prompt types. The demo provides the option of generating natural-language text in 3 languages.
This tool was implemented in Python 3 using the https://streamlit.io/[Streamlit] library.
toc::[]
//++++
//

//Screenshot
//
//++++
=== ๐ Click on the preview below to see the demo recording ๐
ifdef::env-github[] image:https://img.youtube.com/vi/s499PeolbOg/maxresdefault.jpg[link=https://youtu.be/s499PeolbOg] endif::[]
== Online Demo
The online demo is available at https://wse-research.org/LoRiS-LLM-generated-representations-of-SPARQL-queries (or shorter at https://wse-research.org/LoRiS).
== Building and Running the Application
=== Running locally with Python 3.8+
==== Install dependencies
===== Install Python dependencies
[source, bash]
pip install -r requirements.txt
Note: If you are using a virtual environment, make sure to activate it before running the command.
==== Run the Application
[source, bash]
python -m streamlit run loris--llm-based-explanations-for-sparql-queries.py --server.port=8501
After that, you can access the application at http://localhost:8501.
=== Docker
The application is available at https://hub.docker.com/repository/docker/wseresearch/loris-llm-generated-representations-of-sparql-queries/general[Dockerhub] for free use in your environment.
==== Run Dockerhub Image
[source, bash]
docker run --rm -p 8501:8501 --name loris --env-file=service_config/files/env wseresearch/loris-llm-generated-representations-of-sparql-queries
==== Build local Docker Image
[source, bash]
docker build -t loris:latest .
==== Run local Docker Image
[source, bash]
docker run --rm -p 8501:8501 --name loris --env-file=service_config/files/env loris:latest
Now, you can access the application at http://localhost:8501.
== Cite
Perevalov, A., Gashkov, A., Eltsova, M., Both, A. (2024). Understanding SPARQL Queries: Are We Already There? Multilingual Natural Language Generation Based on SPARQL Queries and Large Language Models. In: Demartini, G., et al. The Semantic Web โ ISWC 2024. ISWC 2024. Lecture Notes in Computer Science, vol 15232. Springer, Cham. https://doi.org/10.1007/978-3-031-77850-6_10
@InProceedings{Perevalov2024:ISWC:understanding_SPARQL_queries,
title="Understanding {SPARQL} Queries: Are We Already There? Multilingual Natural Language Generation Based on {SPARQL} Queries and Large Language Models",
author="Aleksandr Perevalov
and Aleksandr Gashkov
and Maria Eltsova
and Andreas Both",
editor="Gianluca Demartini
and Katja Hose
and Maribel Acosta
and Matteo Palmonari
and Gong Cheng
and Hala Skaf-Molli
and Nicolas Ferranti
and Daniel Hern{\'a}ndez
and Aidan Hogan",
booktitle="The Semantic Web -- {ISWC} 2024",
year="2024",
publisher="Springer Nature Switzerland",
address="Cham",
pages="173--191",
keywords="SPARQL, natural language generation, large language models, multilingual, query verbalization, semantic web",
abstract="SPARQL is a standard query language for RDF data. Interpreting SPARQL queries might be a challenge, in particular, while being not familiar with the technical specifications of SPARQL or the meaning of the thing identified by a resource. In our study, we take an initial step toward employing Large Language Models to verbalize SPARQL queries, i.e., convert them to natural language. While other research often focused only on English verbalizations, we also implemented the transformation into German and Russian textual representations. The experimental framework leverages a combination of proprietary and open-source models, with enhancements achieved through further fine-tuning these models. Our methodology is assessed using the well-known question answering datasets QALD-9-plus and QALD-10, focusing on the aforementioned three languages: English, German, and Russian. To analyze performance quality, we employ metrics for machine translation alongside a survey for human evaluation. Although we encountered specific error types such as question over-specification, linguistic discrepancies, and semantic mismatches, the findings of our research indicate that Large Language Models are well-suited for the task of translating SPARQL queries into natural language, s.t., the semantics of SPARQL queries is represented in the mother tongue of the users.",
isbn="978-3-031-77850-6",
doi="10.1007/978-3-031-77850-6_10"
}
== Contribute
We are happy to receive your contributions. Please create a pull request or an {github-repository}/issues/new[issue]. As this tool is published under the {github-repository}/blob/main/LICENSE[MIT license], feel free to {github-repository}/fork[fork] it and use it in your own projects.
== Disclaimer
This tool just temporarily stores the image data. This tool is provided "as is" and without any warranty, express or implied.