Page MenuHomePhabricator

table view on Wikidata Query Service -- allow link text for urls
Open, MediumPublic

Description

A query like the below allows currently displays the full url.

SELECT	?item ?itemLabel (URI(CONCAT("https://example.com/",?itemLabel)) as ?url)	
{
  	?item wdt:P31 wd:Q5
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
LIMIT 10

try it!

It would be interesting to shorten this to a display text, e.g.

instead of:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 360631 had a related patch set uploaded (by Jonas Kress (WMDE); owner: Jonas Kress (WMDE)):
[wikidata/query/gui@master] Abbreviate label of links when formatting

https://gerrit.wikimedia.org/r/360631

Change 360631 abandoned by Jonas Kress (WMDE):
Abbreviate label of links when formatting

https://gerrit.wikimedia.org/r/360631

This came up a couple of days ago in discussion again on the wikidata Telegram channel, with several people wishing it was possible, since "displaying the whole url often breaks the table layout".

@LucasWerkmeister noted that a couple of other tickets have discussed making aspects of the table view more configurable, viz T223736#5503032 and T227702#5498545

@Nikki suggested that the whenever there was a pair of columns ?variable and ?variableText, then if ?variable was a url and ?variableText was text, the UI could present them in a single column with the latter as link text.

This was well-received, and welcomed as a proposal that seemed sensible and intuitive.

@Nikki suggested that the whenever there was a pair of columns ?variable and ?variableText, then if ?variable was a url and ?variableText was text, the UI could present them in a single column with the latter as link text.

This was well-received, and welcomed as a proposal that seemed sensible and intuitive.

By whom? I don’t see any reaction to that message in the Telegram channel (the discussion seems to have wound down after it).

Also, we already use ?variable and ?variableLabel for a combined value in several other result views, so I don’t think we should introduce ?variableText doing effectively the same thing as ?variableLabel. I still think result view options are the way to go – but rather than having the user specify the variables to combine (as proposed in T227702#5498905), perhaps it should just be a flag: if it is set (by default it would stay unset), then the table view should combine any ?variable and ?variableLabel variables it sees, just like other result views already do by default.

Also, we already use ?variable and ?variableLabel for a combined value in several other result views, so I don’t think we should introduce ?variableText doing effectively the same thing as ?variableLabel. I still think result view options are the way to go – but rather than having the user specify the variables to combine (as proposed in T227702#5498905), perhaps it should just be a flag: if it is set (by default it would stay unset), then the table view should combine any ?variable and ?variableLabel variables it sees, just like other result views already do by default.

I can see that being quite annoying if you want to include an ID and a URL in your results. For me, wanting URLs to not mess up the table is completely separate from whether I want to display IDs in the results. I don't particularly care what the link text is for a URL is or what the variable is called, I just want URLs to be shorter.

I'm not a fan of doing it via result view options because something as basic as being able to include URLs in a query without messing up the table layout should be simple to do. I have to look up how the result view options are supposed to work every single time I try to use them and it seems to involve manually writing JSON which can hardly be considered simple.