Page MenuHomePhabricator

Allow linking to specific statements in Structured data on Commons
Closed, ResolvedPublic

Description

On Wikidata you can have a link like https://www.wikidata.org/wiki/Q56051850#P6216 that links to P6216 property of Q56051850 item. On Commons link like https://commons.wikimedia.org/wiki/File:Arbeiderswoning_Oostwold_4.jpg#P6216 should also link to P6216 property of Arbeiderswoning_Oostwold_4.jpg file.

COVID-19 Deployment Criteria

  • Can you roll back this change without lasting impact?
    1. A recovery plan is required as this will help identify our capacity for recovering from the failure
    2. THIS IS A KEY QUESTION, if you can’t answer it, you shouldn’t deploy
  • Probably it can be simply rolled back without any impact other than a bit of cache pollution.
  • Is specialized knowledge required to support this change in production? If so, are there multiple people with this knowledge?
  • Not required. This is a nice-to-have on the one hand, and used by on-wiki module on the other hand. The nice-to-have part doesn’t require any support; the module change is ready and already deployed.
  • Is there a way to increase confidence about the correctness of this change?
    1. Reviews (Design, Code, etc)
    2. Testing coverage (unit tests, integration tests)
    3. Manual testing (e.g. Beta, vagrant, docker)

Event Timeline

Jarekt created this task.Dec 22 2019, 11:37 PM
Restricted Application added a project: Wikidata. · View Herald TranscriptDec 22 2019, 11:37 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

In T222321 @dcausse also thought we should have

direct reference to a particular statement (like the statement id anchor on wikibase entity e.g. https://www.wikidata.org/wiki/Q1#Q1$8983b0ea-4a9c-0902-c0db-785db33f767c)

I would like to have it so if an infobox pulls some informatio from SDC than I would like to add an edit icon to it, which when clicked would lead to the statement where the information come from.

Jarekt added a comment.Mar 3 2020, 2:14 PM

In the next version of {{information}} template we are planning to add SDC icons to fields which were filled by information from SDC. I think those icons should link to properties where the data is stored. Can we at least agree, if we are going to be able to link to specific properties and if so what would be the format? The actual implementation can follow later. That way I can add it to the next release. I am trying to have only occasional updates to template used on 50+ M pages.

@matthiasmullie if I recall correctly, we talked about this a while ago and there was a problem with using anchor tags because of the tab on the file page. Does that sound familiar? Any way we might be able to work around this?

Correct: we can't rely on default browser behaviour of scrolling to anchors, because the content is hidden.
But we can implement a similar behavior on our own.

@Jarekt would you want to link to the specific statement (i.e. File:Something.jpg#M63$b81f5051-4288-a4d9-cc31-ba8b200b5e0e - the statement's GUID), or just the property level (i.e. File:Something.jpg#P180 or something similar)

I would say property level.

Salgo60 added a comment.EditedMar 3 2020, 11:51 PM

I would also say possibility to set language in the URL is important as default is english and many WD objects miss english label and you get just a Q number which is a mess

  1. Property level with a language parameter eg. File:Something.jpg?uselang=zh#P180 compare WD Q1231009?uselang=zh#P608 and fallback language en

@Jarekt would you want to link to the specific statement (i.e. File:Something.jpg#M63$b81f5051-4288-a4d9-cc31-ba8b200b5e0e - the statement's GUID), or just the property level (i.e. File:Something.jpg#P180 or something similar)

What I need is property level links (i.e. File:Something.jpg#P180)

Example:
{{Information}} template in this file looks like


and most fields, like author, date, source, etc., are not set in wikitext but in SDC. The template has SDC icons to the right of field names, like source, and I would like this icon to link to SDC's P7482, since that is the place where source info can be modified. On Wikidata such link would be done by adding "#P7482" to the page url, so ideally the link would be File:Something.jpg#P7482.

Restricted Application added a project: Structured-Data-Backlog. · View Herald TranscriptMar 16 2020, 3:33 PM

Correct: we can't rely on default browser behaviour of scrolling to anchors, because the content is hidden.
But we can implement a similar behavior on our own.

But we should add an HTML ID, even if it doesn’t work on its own in the default experience: in the JavaScript-less experience, the custom JS won’t do anything, but there aren’t any tabs, either, so the anchor-based solution does work. (And the anchor can be used in the custom JS as well, by the way.)

Change 583091 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Allow linking to specific statements

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

CBogen updated the task description. (Show Details)Mar 25 2020, 6:23 PM
Tacsipacsi updated the task description. (Show Details)Mar 25 2020, 6:59 PM

Change 583091 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Allow linking to specific statements

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

Ready for testing on Beta Commons

Etonkovidova added a comment.EditedApr 16 2020, 12:18 AM

@Ramsey-WMF - I looked at the anchors on e.g. https://commons.wikimedia.beta.wmflabs.org/wiki/File:Lion_fountain_statue.png (Structured data tab), and there are only few anchors. No anchors for added property, e.g. d:Special:EntityPage/P740 (athe "coordinate location" property on the page and on the screenshot:

As per comment https://phabricator.wikimedia.org/T241338#5939601, the summary does have anchors:

Comparing the link form the task description - https://www.wikidata.org/wiki/Q56051850#P6216 - the anchor is also outlined and each property on the page will its anchor link.

I noticed that this is deployed now. That is great! Two questions:

  • I thing the anchor to captions is "#ooui-php-4". Is that going to be true for all the files? Is there some better name for it? And if not, can we rename it to something like "#captions"?
  • As @Etonkovidova mentioned above, links to Wikidata properties are nicely outlined. Can we do the same on Commons? Without the outline it is hard to tell which property are we were linking to.

Checked in production (test-commons.wiki, commonswiki - wmf.28) - @Ramsey - there are two things for review and please let me know if some follow-up ticket(s) are needed (along with @Jarekt 's comment above) :

  • the statements get anchors (not qualifiers where the properties are present too) - which was the scope of this task
betalabs commons wmf.28

That’s most probably just a cache issue, which will go away as caches expire—https://commons.wikimedia.org/wiki/File:18-as_villamos_(4097).jpg#P1259 didn’t work either, but a purge (action=purge) fixed it. (By the way, it jumps quite a lot up and down as all the JavaScript stuff loads, but that’s another task.)

That’s most probably just a cache issue, which will go away as caches expire—https://commons.wikimedia.org/wiki/File:18-as_villamos_(4097).jpg#P1259 didn’t work either, but a purge (action=purge) fixed it. (By the way, it jumps quite a lot up and down as all the JavaScript stuff loads, but that’s another task.)

@Tacsipacsi - you're right; re-checked and all seems to be fine with anchoring old statements. And yes, there is an issue with loading the page (showing the File information page, showing the fields in the Edit mode etc). The animated gif below (click to see it running) illustrate the page reload:

Ramsey-WMF closed this task as Resolved.Apr 17 2020, 8:34 PM

Thanks, everyone. I think the original task in this ticket is addressed and working on production. But the new issues that were brought up now have their own separate tasks set up as subtasks of this one.