Page MenuHomePhabricator

Wikidata Query Service results should be capable of displaying a report title (new feature request)
Closed, ResolvedPublic

Description

As a query writer I want to provide a title for my query in order to provide more context to my query and make it easier to understand.

Problem:
Queries (and especially embedded queries) don't give enough context to the query that is being shared. Embedded queries are very often shared on Twitter for example. We also default to embedded mode when copying the short URL to the result.

We want to provide a new special syntax ( #queryTitle: foo ) that editors can add to their queries. The argument of this special syntax will then be used as the title of the query. We already have similar special syntax to influence the default view of the result.

Example:
https://twitter.com/exmusica/status/1383234852141506561

BDD
GIVEN a SPARQL query
AND the query contains a comment defining the query title
WHEN viewing the query result in embedded or non-embedded mode
THEN the title is displayed at the top of the query

Acceptance criteria:

  • title is displayed if and only if it is defined in the query

Original report:
WDQS report results, and especially those from embedded queries, would benefit from the ability to provide a title describing the contents of the report.

This is especially the case given the availability of the 'Short URL to result', which provides a link to an embed.html version of the report.

Consider https://w.wiki/4z$ ... what is it a report of? If you know how to get to the SPARQL and can understand it, you're good. If not then the report, without context, is mostly useless.

So, this feature request is for the provision of a Title parameter that can be included with the WDQS SPARQL (e.g. #title= ), allowing a title string to be associated with the SPARQL such that the title is displayed on report output - both when the output is viewed within the WDQS editing screen, and when the output is viewed via an embed.html rendition.

Event Timeline

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

I would like to be able to display a title too.

The best thing we have so far is to add a comment. Perhaps we could do something similar to #defaultView: for titles, e.g. #queryTitle:?

Lydia_Pintscher subscribed.

I was thinking of only doing this in embedded views. @Tagishsimon your original report indicates you also think this is useful for non-embedded? What do others think?

You can already do this with a #TEMPLATE with no variables (example), though the presentation could probably still be improved.

link this to https://phabricator.wikimedia.org/T185476 ... both presentation and specification of the title within the SPARQL could be improved. Arguably per T185476 and its children, there is considerable room for improvement of, clarity of configuration of, and documentation of charts. Right now it's a dark art.

Fair enough. Ok then let's make this work for embedded and non-embedded views.

It also needs to display the title in the page title. This is what my tab list looks like for the window I have SPARQL queries in:

query-service-tabs.png (797×214 px, 9 KB)

Without updating the page title, it's near impossible to find a particular query in my open windows, in my browser history or in my bookmarks. (I have so many open because it's time-consuming to work out which ones are queries I want to save and which ones were links I opened or queries that I don't need any more - I have to read through each query to find out what it does before I can do anything else with it.)

When I remember, I've been using comments of the form #queryTitle: ... (copying the style of defaultView as I mentioned in my previous comment) and also made myself a little browser extension a while back which updates the page title. The code for the Firefox version is at https://github.com/nikkiwd/wdqsqt, seems I never added the Chrome version.

You can already do this with a #TEMPLATE with no variables (example), though the presentation could probably still be improved.

I don't see a title on that page...?

You can already do this with a #TEMPLATE with no variables (example), though the presentation could probably still be improved.

I don't see a title on that page...?

Screenshot_2021-04-21 Wikidata Query Service.png (373×448 px, 14 KB) Screenshot_2021-04-21 Wikidata Query Service-2.png (465×468 px, 24 KB)

@Lydia_Pintscher

There's some discussion about whether the parameter should be #queryTitle or #title. Both are mentioned in the original report.

Which would you prefer?

Ah good catch. I was thinking #queryTitle first but thinking some more about it #title is probably better. This would keep the query shorter and make it a little less likely to run into limits for URL shortening.

Change 681940 had a related patch set uploaded (by Adamham; author: Adamham):

[wikidata/query/gui@master] Add a parameter using comments to the query to allow for a title

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

Change 681940 merged by jenkins-bot:

[wikidata/query/gui@master] Add a parameter using comments to the query to allow for a title

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

Yay 🍾 So cool to see this live!

@Lydia_Pintscher Have marked this issue as resolved.

It seems this feature is still undocumented (discussed in https://www.wikidata.org/wiki/Wikidata_talk:SPARQL_query_service#title:). after 5 months In my opinion it is a waste of developer time to develop something, and then don't make sure it is documented so the users can learn about it and use it - what isn't known and therefore not used , isn't useful. You should prioritize the documentation side of WDQS more. Also the wikibase:limitContinuations predicate in the MWAPI service has been undocumented for years, and many of the different result view parameters are just mentioned without explanation.