User:Watty62/Learning
I am going to put stuff here, as much as reminder to myself as anything else.
Techniques for querying edit
Mostly derived from tutorials by Martin Poulter and others
Filter item labels by substring edit
(eg find images with Provost in the title) https://w.wiki/696d
or finding items in AAGM collection which still have accession numbers in their label https://w.wiki/696b
edit
edit
edit
Querying two values in a list edit
e.g. Hospitals in Aberdeen City or Aberdeenshire https://w.wiki/H3k
Concatenate a list of things into a single variable edit
e.g a list of instruments played by musicians https://w.wiki/HTT
Calculate ages by taking DOB away from DOD edit
uses Bind(Floor) method https://w.wiki/HTZ
Items within 0.5 km of Duthie Park edit
Aberdeen and North-East History edit
I'm working with local museums, galleries, libraries and archives on a number of small projects. The following queries reflect some of those.
Aberdeen Industry edit
Iron Foundries - a work in progress
Hospitals edit
Where are all the current or former hospitals of the North East ( Aberdeen OR Aberdeenshire ).
It uses the following syntax
Code | Explanation |
---|---|
VALUES ?o { wd:Q189912 wd:Q62274582 } | uses a list of two values for Aberdeen and Aberdeenshire |
?item wdt:P31 wd:Q16917; wdt:P131 ?o . | checks P131 Located in Admin Area with the list of two |
March Stones of Aberdeen edit
There are 67 March stones (boundary stones) in Aberdeen: - 65 with numbers inscribed on them plus one called "Alpha' and one 'Omega'. This query retrieves the 65 which are on WikiData.
We need to identify the missing two! These resources may help:
Plaques edit
I've created a number of queries on plaques in Aberdeen in this blog post on my Aberdeen Plaques project.
This one finds commemorative plaques to former provosts of Aberdeen.
Provosts edit
As part of Code The City 19, I worked with Sara Thomas of WikiMedia UK on a 2-day project to improve the data on Provosts and Lord Provosts of Aberdeen. All of them are listed on Wikipedia.
I've added and tidied the categories for Provost and Lord Provost in Wikidata.
Sara and I collaborated on a write-up of the project.
Currently this finds all (Lord) Provosts their terms, and who proceeded and succeeded them.
This shows the ones with signatures. Loads more to get from this book and upload to Commons.
And this shows the provosts with portrait images.
Listed Buildings edit
Many of the labels (about 1300 of them) were still in the format from when they were first imported bulk imported from Canmore (as far as I know). This meant that they appeared as "Aberdeen, Street Address, Building Name" - or something link that; often more complicated with up to five lines' worth. On 14 Sept 2020, I downloaded all the QIDs and labels and split them on commas, re-ordered them and use Quick Statements to update them on Wikidata. About 90 needed manual fixing which I did before the upload.
You can get a list of all Category A, B and C listed structures in Aberdeen, and show a map of only those lacking a photograph, using this query: https://w.wiki/J2F. Currently there are 1845 missing images.
Shore Porters Society of Aberdeen edit
Is it the oldest company in the UK?
Apparently so https://w.wiki/JSS
Code The City edit
I am co-founder and Trustee of Code The City, a charity which uses data and coding for civic good. We promote the use of open data and open source, run editathons, etc.
We maintain statistics for our main events on Wikidata, and well as details of our Trustees.
To get that data back we use the following queries.
Our events edit
Unconferences edit
We query our unconferences using this query: https://w.wiki/8Edu
The thing to note here is the use of the Point in Time (P585) qualifier of each Number of Participants (P1132) statement to get the date(s) and number of attendees on this dates
?item p:P1132 ?participantStatement . # uses the point in time (P585) qualifier to get the date(s) and attendees on each date
?participantStatement ps:P1132 ?attendees
; pq:P585 ?date .
Hack Weekends edit
This uses the same techniques as the Unconferences query, above.
To query attendances at our Hack Weekends (30 so far over almost 10 years, and mostly multi-day) use the: https://w.wiki/8Ee3
Aberdeen Data Meetups edit
This query will list them by date and number of attendees: https://w.wiki/8Fyb
Aberdeen Python User Group edit
This query will list them by date and number of attendees: https://w.wiki/8Fzp
Trustees edit
This gives a list of Trustees and ordered by their start-date and end date. It picks up current and former trustees: https://w.wiki/8F5q
Again we use qualifying statements
?trustee p:P39 ?trustee_statement.
?trustee_statement ps:P39 wd:Q67378402.
?trustee_statement pq:P2389 wd:Q97908064.
?trustee_statement pq:P580 ?trustee_startdate.
OPTIONAL{?trustee_statement pq:P582 ?trustee_enddate.}
Jazz Musicians edit
I've a real passion for jazz, both as a listener and as a player.
Charlie Parker edit
29 August 2020 was Charlie Parker's centenary.
To celebrate I spent some time fixing all his compositions in Wikidata https://w.wiki/b6b
Filtering contrafacts (see next section) for only Parker compositions: https://w.wiki/aZh
This query returns all Bird’s compositions ordered by year of publication https://w.wiki/aZk
Finally Wikidata allows us to create timelines, such as this one of all of Bird’s tunes: https://w.wiki/aZR You may need to use your down arrow key on your keyboard to see all the results especially in his most prolific years.
Jazz Contrafacts edit
I've been working at adding Jazz Contrafacts to Wikidata. These are alternative melodies written over the chord sequence of another tune.
When I started there were none and now we have almost 250. See https://w.wiki/bJy
Which original tunes' chord sequences are the most popular for jazz musicians creating new melodies? https://w.wiki/jxV
I've been updating the list on Wikidata at the same time: updating the list of [https://en.wikipedia.org/wiki/List_of_jazz_contrafacts |
I also created a rudimentary timeline https://w.wiki/bK2
Currently working on refining this graph: https://w.wiki/k5w
Jazz Musicians - their instruments, dates of birth and death edit
I created this query to helps someone who runs a mailing list in Canada. It retrieves Jazz Musicians' given and family names, their dates of birth and death and a list of their instruments:
The thing to note is how we use the following part of the first line to do the concatenation:
(group_concat(?instrumentLabel; separator=", ") as ?instruments)
and it also needs this Group BY in the second last line to work:
group by ?person ?givenLabel ?familyLabel ?DOB ?DOD
They died young edit
I created this query to test the theory that jazz musician die young.
The interesting thing here, particularly, is the calculation of their age at death using
BIND(FLOOR((?DOD - ?DOB)/365.2425) AS ?age).
Politics edit
UK Chancellors of the Exchequer edit
On the day that Kwasi Kwarteng was sacked and Jeremy Hunt took over, I created this query to show chancellors, their dates in office, calculating the days in the job, and ordering by that.
Home Secretary edit
Same with Suella Braverman. She had the third-shortest career as home secretary after the 1st Marquess of Buckingham and the 1st Duke of Wellington!
From the time it was broken by the BBC that she had resigned, and before I could write the query, someone had updated Wikidata with her end date! All within 5 minutes!
Prime Minister edit
More of the same: https://w.wiki/5rvb
All these are similar to Provosts query above.
Average ages, by party, of parliamentarians edit
Adapted from a query by Jan Ainali, here are
- UK Parliament
- Scottish Parliament
SNP MSPs in the 6th Scottish Parliament who have never been in cabinet edit
Shows how many of the 48 SNP MSPs (at the time of writing) have never held a cabinet position
(note: while the query gets the correct result, the data behind the cabinet positions is a little inconsistent and could do with a tidy up)