Commons:Wiki Loves Monuments 2010/template system
To organize the lists of monuments we use a template system at the Dutch Wikipedia. This system was crucial for all the automatic processing of the images.
The lists
[edit]We have two templates
- A header template (nl:Template:Tabelkop rijksmonumenten) producing the header of the (html) table
- A row template (nl:Template:Tabelrij rijksmonument) producing a single row of the (html) table
The row templates contain the different fields in a structured format in the form "|<field name>=<value>". Every rijksmonument has an unique id, this is included in each row.
Harvesting
[edit]Because the data is structured it's possible to harvest all the templates. For this we use a pywikipedia based bot (source). The bot runs every night and loops over all pages in the namespace containing the "Tabelrij rijksmonument" template. This data ends up in a nice mysql table (layout). This database (dump) is the source of all other tools.
Tools
[edit]All images of a Rijksmonument should contain {{Rijksmonument|<id>}}. This information is used by the bots to do their magic.
Categorize rijksmonumenten
[edit]Based on the id in {{Rijksmonument}} it's possible to extract the list page on the Dutch Wikipedia. If that page contains a Commonscat template, add that category. If it doesn't contain one, take a look at the categories in which the list is categorized to see if these do include such a link to Commons. [1]
Add topic category
[edit]Based on the id in {{Rijksmonument}} it's possible to find the topic assigned by the RCE. {{Rijksmonument category}} (check out the source) is used to match this to a Commons topic category. source
Object location
[edit]Based on the id in {{Rijksmonument}} it's possible to find the latitude and longitude of the object. The bot adds {{Object location}} based on this information. source
Rijksmonumenten without id
[edit]Make a list of Rijksmonumenten which are in a Rijksmonumenten category, but don't contain a (valid) id and put the list on Wikipedia. source
Unused rijksmonumenten photos
[edit]Make a list of Rijksmonumenten which could be used in one of the lists and put the list on Wikipedia. source
Intersect categories
[edit]This is not really a special bot for the monuments project, but it is very useful. I will do deep category intersection to push photo's down the category tree. For example a photo is in Category:Churches in the Netherlands and in Category:Haarlem, the bot will move the image to Category:Churches in Haarlem. source
Other wikipedia's?
[edit]This system could easily be ported to other Wikipedia's. You'll need to agree on a row template to use and each monument should have an unique id. If you have that porting this system to for your local Wikipedia should be straightforward.