Wikidata:WikiProject Theatre/Queries
Drama schools by number of students on Wikidata edit
The following query uses these:
- Items: drama school (Q2143781) , human (Q5)
- Properties: instance of (P31) , subclass of (P279) , educated at (P69) , official website (P856) , coordinate location (P625) , reference URL (P854)
Features: map (Q24515275)
#defaultView:Map
# Drama schools by number of students on Wikidata
SELECT ?school ?schoolLabel ?website ?coords ?students ?sourcedStudents (FLOOR(?sourcedStudents/?students*10000)/100 AS ?layer) WHERE {
# Total number of students on Wikidata
{
SELECT ?school (COUNT(?student) AS ?students) WHERE {
?school wdt:P31/wdt:P279* wd:Q2143781 .
?student wdt:P31 wd:Q5 .
?student wdt:P69 ?school .
} GROUP BY ?school ?schoolLabel
}
# Number of students with URL reference on Wikidata
OPTIONAL {
SELECT ?school (COUNT(?student) AS ?sourcedStudents) WHERE {
?school wdt:P31/wdt:P279* wd:Q2143781 .
?student wdt:P31 wd:Q5 .
?student p:P69 ?schoolStatement .
?schoolStatement ps:P69 ?school .
?schoolStatement prov:wasDerivedFrom ?ref .
?ref pr:P854 ?url .
} GROUP BY ?school ?schoolLabel ORDER BY DESC(?students)
}
# Some other useful data
OPTIONAL { ?school wdt:P856 ?website . }
OPTIONAL { ?school wdt:P625 ?coords . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} ORDER BY DESC(?students)
All the plays written by an author born or resident of a place in Québec (Canada) edit
SELECT DISTINCT ?item ?itemLabel ?item2 ?item2Label WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?item (wdt:P7937|wdt:P31) wd:Q25379.
?item wdt:P50 ?item2. # author pivot variable
{SELECT ?item2 WHERE {
?item2 (wdt:P19|wdt:P551)/wdt:P131* wd:Q176.
} limit 100000 }
}