wmde / wikibase-release-pipeline

BSD 3-Clause "New" or "Revised" License
45 stars 33 forks source link

Custom query examples in WDQS #692

Closed felipe-mr1 closed 1 month ago

felipe-mr1 commented 4 months ago

Is it possible to add/edit the query examples in WDQS? I would like to add my own examples since I have other items and properties.

wdqs-examples

olea commented 3 months ago

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:

olea commented 3 months ago

Also, to be able of adding query examples related with your instance is an excellent suggestion, IMHO.

rti commented 2 months ago

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

olea commented 2 months ago

@Robert:

Is this change included in the next release or should it be managed only by users?

El lun, 9 sept 2024, 8:39, rti @.***> escribió:

Hi @felipe-mr1 https://github.com/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

— Reply to this email directly, view it on GitHub https://github.com/wmde/wikibase-release-pipeline/issues/692#issuecomment-2337251858, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABCPU7KMLKGTZWMRYTXWCLZVU7CPAVCNFSM6AAAAABJQZMJKOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZXGI2TCOBVHA . You are receiving this because you commented.Message ID: @.***>

rti commented 2 months ago

@olea The above example is how it could be done with the current version by the user.

rti commented 1 month ago

Will close this now. Feel free to reopen if you have further questions.