Page MenuHomePhabricator

QueryService UI: Suggest/tooltip triggers on wdt: without PREFIX, but gives local results
Open, MediumPublic

Description

imported from GitHub issues: https://github.com/wbstack/queryservice-ui/issues/4

GreenReaper:
If I type wdt:[CTRL+SPACE] (or wd:/ps: etc.) I get a popup box offering to autocomplete an entity. I can type P1 or Q2 and get results - but they're _local_ results, not Wikidata results. This is cool… but it isn't right, as that PREFIX isn't redefined in the query.

Conversely, using prefixes that _are_ defined in the query, and refer to local entities, doesn't work:

Unknown prefix 'wfd:'.

Similarly, mousing over wdt:P6 gives a popup with data on the local P6, even though it will actually use another P6.

This may mislead the user into writing [queries that run, but not as expected](https://furry.wikibase.cloud/query/sparql?explain&query=%23defaultView%3ATable%0A%0APREFIX%20wfd%3A%20%3Chttps%3A%2F%2Ffurry.wikibase.cloud%2Fentity%2F%3E%0APREFIX%20wfdt%3A%20%3Chttps%3A%2F%2Ffurry.wikibase.cloud%2Fprop%2Fdirect%2F%3E%0APREFIX%20wfp%3A%20%3Chttps%3A%2F%2Ffurry.wikibase.cloud%2Fprop%2F%3E%0A%0ASELECT%20%3FitemLabel%20%3FcreationDate%20(CONCAT(%22https%3A%2F%2Fen.wikifur.com%2Fw%2Fimages%2F%22%2C%20substr(%3FlogoMD5%2C%201%2C%201)%2C%20%22%2F%22%2C%20substr(%3FlogoMD5%2C%201%2C%202)%2C%20%22%2F%22%2C%20%3FlogoFileName)%20AS%20%3FlogoURL)%0AWHERE%0A%7B%0A%20%20%20%20%3Fitem%20wfdt%3AP2%20wfd%3AQ2%20.%0A%20%20%20%20%3Fitem%20wdt%3AP6%20%3FcreationDate%20.%0A%09SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22%20%7D%0A%20%20%20%20OPTIONAL%20%7B%0A%20%20%20%20%20%20%3Fitem%20wfdt%3AP15%20%3FlogoFileName.%0A%20%20%20%20%20%20BIND(MD5(%3FlogoFileName)%20as%20%3FlogoMD5).%0A%20%20%20%20%7D%0A%7D), because the query service uses Wikidata as wdt:.

The situation is different to e.g. the Wikibase Registry where [wdt: has been modified](https://wikibase-registry-query.wmflabs.org/proxy/wdqs/bigdata/namespace/wdq/sparql?explain&query=%23defaultView%3ATimeline%0ASELECT%20%3Fitem%20%3FitemLabel%20%3FcreationDate%20(SAMPLE(%3Flogo)%20AS%20%3Fimage)%0AWHERE%0A%7B%0A%20%20%20%20%3Fitem%20wdt%3AP11%20wd%3AQ20%20.%0A%20%20%20%20%3Fitem%20wdt%3AP5%20%3FcreationDate%20.%0A%09SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%2Cen%22%20%7D%0A%20%20%20%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP8%20%3Flogo%20%7D%0A%7D%0AGROUP%20BY%20%3Fitem%20%3FitemLabel%20%3FcreationDate). (I don't think doing this is a good idea.)

Ideally, autosuggest would use prefixes defined by the server, modified by any PREFIX within the query - but this may not be easy. Perhaps using the new way of adding local prefixes would be helpful? It might also lead to fragmentation and incompatible queries. Adding such site prefixes automatically (if defined) might at least give a strong hint that you should declare them to use them.

Event Timeline

bb010g renamed this task from QuerySercice UI: Suggest/tooltip triggers on wdt: without PREFIX, but gives local results to QueryService UI: Suggest/tooltip triggers on wdt: without PREFIX, but gives local results.Feb 21 2024, 10:12 AM
Charlie_WMDE subscribed.

Thanks for bringing this up. As I see it, this requires some research to better understand user needs across our user base and defining how the Query Service prefixes (for Cloud and Suite) should function moving forward. I've added this ticket to T335448 as a subticket since they seem related.

Anton.Kokh triaged this task as Medium priority.Jun 11 2024, 3:27 PM