Skip to content

WSE-research/LoRiS-LLM-generated-Representations-of-SPARQL-queries

Repository files navigation

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 Streamlit library.




Screenshot

Building and Running the Application

Running locally with Python 3.8+

Install dependencies

Install Python dependencies
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

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 Dockerhub for free use in your environment.

Run Dockerhub Image

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

docker build -t loris:latest .

Run local Docker Image

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

To Be Done.

Contribute

We are happy to receive your contributions. Please create a pull request or an issue. As this tool is published under the MIT license, feel free to 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.