Custom query examples in WDQS
Closed this issue · 6 comments
As I see, the development can't add default examples for your instance since it's empty or you are adding data unknown for the developers.
OTOH, I guess the bundled Wikidata examples should:
- to be deleted
- or need to add the namespaces info to work as a federated query with WDQS.
Also, to be able of adding query examples related with your instance is an excellent suggestion, IMHO.
Hi @felipe-mr1,
Thanks a lot for bringing attention to this issue. Displaying examples from Wikidata on self hosted instances with different vocabulary is indeed misleading.
To add your own examples to your instance, you can point the WDQS-frontend to a wiki different from Wikidata (This could be your Wikibase Suite Deploy MediaWiki) like this:
diff --git a/deploy/config/wdqs-frontend.template.json b/deploy/config/wdqs-frontend.template.json
new file mode 100644
index 0000000..329d34e
--- /dev/null
+++ b/deploy/config/wqds-frontend.template.json
@@ -0,0 +1,24 @@
+{
+ "api": {
+ "sparql": {
+ "uri": "/proxy/wdqs/bigdata/namespace/wdq/sparql"
+ },
+ "wikibase": {
+ "uri": "/proxy/wikibase/w/api.php"
+ },
+ "urlShortener": "tinyurl",
+ "examples": {
+ "server": "https://www.my-wiki-with-sparql-examples.org/",
+ "apiPath": "w/api.php",
+ "pageTitle": "Wikidata:SPARQL_query_service/queries/examples",
+ "pagePathElement": "wiki/"
+ }
+ },
+ "brand": {
+ "title": "$BRAND_TITLE",
+ "logo": "logo.svg",
+ "favicon": "favicon.ico",
+ "copyrightUrl": "$COPYRIGHT_URL",
+ "index": "./index.html"
+ }
+}
diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml
index 336ffb2..4ed304d 100644
--- a/deploy/docker-compose.yml
+++ b/deploy/docker-compose.yml
@@ -130,6 +130,8 @@ services:
depends_on:
- wdqs-proxy
restart: unless-stopped
+ volumes:
+ - ./config/wdqs-frontend.template.json:/templates/custom-config.json
labels:
- "traefik.enable=true"
- "traefik.http.routers.wdqs-frontend.rule=Host(`${WDQS_FRONTEND_PUBLIC_HOST}`)"
This will create a custom configuration file for WDQS-frontend and mount it into the wdqs-frontend
container.
Take the Wikidata examples as a guideline how to format your page so that WDQS-frontend can parse it. https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples
Hope that helps,
Best,
Robert
Will close this now. Feel free to reopen if you have further questions.