Page MenuHomePhabricator

When saving an image to Wikidata (P18), a semi-automated gadget could suggest to add depicted (P180) on Wikimedia Commons
Open, In Progress, Needs TriagePublic

Description

When adding an image on Wikidata, it would be nice to have a gadget able to suggest to add the depicted (P180) on Wikimedia Commons too.

Image (P18) on WikidataDepicted (P180) on Wikimedia Commons
Wikidata Barack Obama pick image.png (790×1 px, 168 KB)
Wikimedia Commons Barack Obama depicts.png (1×924 px, 535 KB)

Suggested pseudo-code

  1. (base case) assume that the depicted cannot be proposed
  2. after a Wikidata user saves an image (P18 statement)
    1. query image statements from Wikimedia Commons (API wbgetclaims: example request for this file)
      1. check if the image already has at least one "depicted" (P180) statement
        1. if not:
          1. ✅ assume that the depicted can be proposed in Wikimedia Commons
        2. if yes (this code branch can be omitted in the first version):
          1. check whenever none of the depicted entities is: the original entity (e.g. Barack Obama) or something even more specific (e.g. about cats, let's say kitten, Tibetan cat, etc. · example SPARQL query to find more specific elements)
            1. ✅ assume that the depicted can be proposed in Wikimedia Commons

When we know that the depicted can be proposed in Wikimedia Commons, I expect an OOUI simple message asking something like:

How does this image represent [ENTITY LABEL]?
Buttons: [Normally, or not particularly] · [Main subject]

Then save the statement as not prominent (rank = normal) or (rank = preferred).


(We can also think of a vice-versa gadget from Wikimedia Commons, but this Task is about designing a gadget for Wikidata)


What do you think about?

How to create a Gadget

Nobody proposed a stub user script. Feel free to create an user script. Guide:

https://www.mediawiki.org/wiki/Gadget_kitchen

Event Timeline

I've also read the description of good first task an this may fit. Everyone can start an user gadget.

Thank you for tagging this task with good first task for Wikimedia newcomers!

Newcomers often may not be aware of things that may seem obvious to seasoned contributors, so please take a moment to reflect on how this task might look to somebody who has never contributed to Wikimedia projects.

A good first task is a self-contained, non-controversial task with a clear approach. It should be well-described with pointers to help a completely new contributor, for example it should clearly pointed to the codebase URL and provide clear steps to help a contributor get setup for success. We've included some guidelines at https://phabricator.wikimedia.org/tag/good_first_task/ !

Thank you for helping us drive new contributions to our projects <3

ParasharSarthak changed the task status from Open to In Progress.Oct 3 2024, 9:00 AM

When we know that the depicted can be proposed in Wikimedia Commons, I expect an OOUI simple message asking something like:

How does this image represent [ENTITY LABEL]?
Buttons: [Normally, or not particularly] · [Main subject]

There should also be a third button that doesn’t add any statement. This can be used for example if a more specific P180 statement has been, or could be, added (e.g. DANA 2004 ubt.jpeg, which is used for “ship”, should have P180=Dana, not P180=ship), or if, for some reason, an image is used that doesn’t actually depict the subject (for example, in lack of a better picture, P18 for an author is the cover of a book written by them).