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

https://wse-research.org/LoRiS
MIT License
3 stars 2 forks source link
large-language-models llm natural-language-generation nlg python python3 sparql streamlit verbalization

: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

++++

== 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

To Be Done.

== 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.