ad-freiburg / qlever-ui

A user interface for QLever
Apache License 2.0
19 stars 12 forks source link

Content negotiation #88

Open WolfgangFahl opened 1 week ago

WolfgangFahl commented 1 week ago

Feature Request: Support Content Negotiation for Raw SPARQL Query Retrieval

Summary: It would be extremely useful to retrieve the raw SPARQL query directly from a short URL via content negotiation. This feature would allow users to request the SPARQL query in a specific format, making programmatic access and integration simpler and more efficient.

Use Case: Currently, users have to parse the HTML content to extract the SPARQL query, which adds unnecessary complexity and overhead. Supporting content negotiation would streamline this process.

Proposed Solution: Implement content negotiation for URLs, allowing users to specify the desired format (e.g., text/plain or another appropriate MIME type) in the Accept header of the HTTP request to directly retrieve the raw SPARQL query.

Example curl Command:

curl -H "Accept: text/plain" -L "https://qlever.cs.uni-freiburg.de/wikidata/h6p82D"

should return

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT * WHERE {
  ?person wdt:P31 wd:Q5 .
  ?pesron wdt:P106 ?occupation .
}