Wikimedia Belgium Projects/ListeriaBot/Query

From Wikimedia Belgium
Jump to navigation Jump to search

Wikimedia Belgium (WMBE) manages its projects through Wikidata.

When organising projects like edit-a-thons, it can be confusing, difficult, and laborious how to identify relevant pages.

Sometimes, it might be needed to have a list of item numbers for running e.g. a Pywikibot script.


This project approach is data driven:

  • All data in one central place (Wikidata)
  • Easy to write queries and to automate data processing using Pywikibot
  • Enabling automated reporting
  • Linkable against all Wikimedia platforms (e.g. Wikipedia, Wikimedia Commons, including SDC)


The following can be a typical flow for managing such project:

  1. Create a Wikiproject in Wikidata
  2. Create or amend Wikidata items that are maintained by the project:
    • Create claim (P6104) (maintained by) Wikiproject
  3. Create a Wikipedia project page
  4. Add a ListeriaBot subpage using the above Wikiproject item number, via a below query
  5. Create new Wikipedia pages
  6. Link the Wikipedia pages to the equivalent Wikidata item

Below you can find a list of example WMBE projects.


Wiki projects in Belgium[edit]

SELECT ?item ?linkcount WHERE {
  ?item wdt:P31 wd:Q16695773;
    wdt:P17 wd:Q31;
    wikibase:sitelinks ?linkcount.


Wiki projects organised by Wikimedia Belgium[edit]

This is a list of projects organised by Wikimedia Belgium:

SELECT ?wikiproject ?wikiprojectLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?wikiproject wdt:P31 wd:Q16695773.
  ?wikiproject wdt:P664 wd:Q18398868.


It has been created by starting Wikidata Query, then entering the search items "wikiproject" and "WMBE" in the Filter section.

Wiki projects related to Wikimedia Belgium[edit]

SELECT ?item ?itemLabel WHERE {
  ?item wdt:P31 wd:Q16695773.
  { ?item wdt:P664 wd:Q18398868. }
  { ?item wdt:P710 wd:Q18398868. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }


Items linked to Wikimedia Belgium projects[edit]

This becomes a huge list...

  ?item wdt:P6104 ?wikiproject.
  ?wikiproject wdt:P31 wd:Q16695773;
    wdt:P664 wd:Q18398868.


Missing language labels for items[edit]

SELECT distinct ?item WHERE {
  ?item wdt:P6104 ?wikiproject;
    wdt:P31 wd:Q5.
  ?wikiproject wdt:P31 wd:Q16695773;
    wdt:P664 wd:Q18398868.
    ?item rdfs:label ?label.
    FILTER((LANG(?label)) = "da")


The list of Q-numbers can be fed into a Pywikibot script to add the missing labels.

See also[edit]