'How can I query SPARQL endpoints in spring web app

I'm trying to build a web application that will allow an user to write a SPARQL query and select an endpoint, and the app will send the query to the selected endpoint. Is there a simple way to do this?

As far as I understand, you can send GET and POST requests to an endpoint. A way to send an endpoint to https://dbpedia.org/ for example, is with the following url: https://dbpedia.org/sparql?default-graphuri=http%3A%2F%2Fdbpedia.org&query=select+distinct+%3FConcept+where+{[]+a+%3FConcept}+LIMIT+100&format=text%2Fhtml&timeout=0 - where the first part of the url is the selected endpoint and the second part is the entered query. My initial idea was to construct urls this way and than get the results. However, I'm sure there has to be a simpler, more efficient way to do this. I tried to look for solutions online, but I found very little information on this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source