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
editThis 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
editThe following can be a typical flow for managing such project:
- Create a Wikiproject in Wikidata
- Create or amend Wikidata items that are maintained by the project:
- Create claim (P6104) (maintained by) Wikiproject
- Create a Wikipedia project page
- Add a ListeriaBot subpage using the above Wikiproject item number, via a below query
- Create new Wikipedia pages
- Link the Wikipedia pages to the equivalent Wikidata item
Below you can find a list of example WMBE projects.
Queries
editWiki projects in Belgium
editSELECT ?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
editThis 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.
Wiki projects related to Wikimedia Belgium
editSELECT ?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
editThis 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
editSELECT 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- You can run the copy_label.py script.
- Use the above queries with WDFIST to link images to Wikidata items
- Manage Wiki projects using Wikidata
- Campaign and events tool
- Wikimedia Belgium projects: