Skip to content

Instantly share code, notes, and snippets.

@steko
Last active December 14, 2015 01:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steko/5003925 to your computer and use it in GitHub Desktop.
Save steko/5003925 to your computer and use it in GitHub Desktop.
Using Wikimedia Commons as a source for pictures of ancient places in Pleiades

Two alternative ways.

Using categories and custom sortkeys

A possible elegant way to achieve this objective.

Starting point is here:

http://www.mediawiki.org/wiki/API:Categorymembers

with a default example at:

http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Physics&cmsort=timestamp&cmdir=desc&cmprop=ids|title|sortkeyprefix

Even though it is not evident from the example, the "sortkey" attribute is what could help us. Basically, when one image is added to a category on MediaWiki, the syntax used on the page is: [[Category:Pleiades images]]

And the image (or page) will be listed on the category page according to the alphabetic sorting on the page name. However, this default behaviour can be tweaked by using a "sort key", as described in detail here: http://meta.wikimedia.org/wiki/Help:Category#Sort_order and one can imagine a syntax like

[[Category:Pleiades images|depicts=157802]] # a "random" place

The category page on Wikimedia Commons would not be tremendously useful, but the query API is totally awesome and it could be used to run a weekly/monthly run, caching image URLs locally and associating them to places.

Using templates

Christian Consonni suggested using a tool that was developed for the Wiki Loves Monuments (WLM) photographic contest. It allows to retrieve all files that were given the same ID using a MediaWiki template. See e.g.

Fontana del Nettuno, Bologna - paese: Italia (it) - id: 037006698-MIBAC

The ID comes from a separate database (e.g. it is not on Wikipedia or other wiki) so it should work fine with Pleiades.

The easiest way to use this kind of tool would be to use a simple template like {{Pleiades|depicts|12345}}, that could also add a nice box and a link to the Pleiades place page (à la Flickr, even though retrieving the place name may be more complicated).

It is unclear whether the tool is available as open source code to be run customized and run outside of toolserver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment