Wikimedia Belgium Projects/ListeriaBot/Query

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.

Advantages

edit

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)

Method

edit

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.

Queries

edit

Wiki projects in Belgium

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

Excecute: https://w.wiki/6YgN

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.
}

Excecute: https://w.wiki/$cN

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

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

Excecute: https://w.wiki/6YgB

Items linked to Wikimedia Belgium projects

edit

This becomes a huge list...

SELECT DISTINCT ?item WHERE {
  ?item wdt:P6104 ?wikiproject.
  ?wikiproject wdt:P31 wd:Q16695773;
    wdt:P664 wd:Q18398868.
}

Excecute: https://w.wiki/5KRe

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.
  MINUS {
    ?item rdfs:label ?label.
    FILTER((LANG(?label)) = "da")
  }
}

Excecute: https://w.wiki/5nkB

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

See also

edit