Page MenuHomePhabricator

inbuilt function: convert a Commons File name to a Media ID
Open, LowPublicFeature

Description

Feature summary:
To show images on AW we need their media ID. At the moment, Wikidata image claims (P18 and related properties) all return filename strings. Either we need to augment the return from a Wikidata item fetch, or we need an inbuilt function to convert a Commons File name to a Media ID.

Use case(s):
https://www.mediawiki.org/wiki/Help:Wikifunctions/Images suggests creating a useful function: "Image from a Wikidata item — take a Wikidata item and emit an <ext-wikilambda-image> using the M-ID of the item's image (P18) claim."

Benefits:
This will enable better use of Wikidata's P18 and similar properties.

Event Timeline

I ran into this on Z36053. I personally prefer the creation of a new function. From what I'm reading it looks like a fairly simple call to Commons' API.

Note: This is sadly a pretty major piece of work, as it would need to connect the orchestrator to Wikidata, so SRE/Security build-out and sign-off would be needed, plus all the rate limiting/API monitoring/etc. (like we did for Wikidata access).

To me it's important in the long run, but not a super high priority until we are bot-templating articles that need to fetch Wikidata-curated images automatically. When we're building an article by hand it's not hard (and more fun) to look up an image of choice.

But I wonder if we have made things harder for ourselves by requiring MIDs rather than filenames. As far as I know, all the other Wiki systems use filenames at the user end. And this is also what Wikidata supplies. Maybe it would be easier to add a filename route to getting an image in the article?

Yet another option would be for WIkidata to host a new property for the MID (e.g. as a qualifier to all the image properties.

Yet another option would be for WIkidata to host a new property for the MID (e.g. as a qualifier to all the image properties.

That's an option, yes; replacing P18 everywhere would be quite the churn, though. I leave that to the Wikidata team and community!