User:Gloumouth1/Queries

From Wikidata
Jump to navigation Jump to search

This page gathers several charts based on data obtained with Wikidata's query service

Extinct languages[edit]

Genesis[edit]

here

Query[edit]

#defaultView:Timeline
SELECT DISTINCT ?language ?languageLabel ?date
WHERE {
	?language wdt:P31/wdt:P279* wd:Q17376908 .	# find instances of subclasses of langoïd
  	FILTER (?locutors = 0) .					# filter the extinct languages
	?language p:P1098 [
      ps:P1098 ?locutors ;						# get the number of locutors of the language
	  pq:P585 ?date								# get the date of extinction
    ]
	SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
	}
}
ORDER BY DESC(?date)
LIMIT 300
Try it!

Screenshot[edit]

Status[edit]

Still needs a lot of work in Wikidata to be complete

Violons d'Ingres[edit]

Genesis[edit]

The idea of this query comes from the French lemma "violon d'Ingres".

Query[edit]

SELECT ?item ?itemLabel
WHERE
{
	?item wdt:P106 wd:Q1028181 .
  	?item wdt:P106 wd:Q1259917 .
  	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Try it!

Weightlifter & pianists[edit]

Genesis[edit]

The idea comes from Kimiko Douglass-Ishizaka (Q92122)

Query[edit]

SELECT ?item ?itemLabel
WHERE
{
	?item wdt:P106 wd:Q486748 .
  	?item wdt:P106 wd:Q13381376 .
  	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Try it!

Gender gap for musicians[edit]

Charts[edit]

Composers birth year per gender:

the same, but per decade:

and the ratio ♀/(♀+♂) gives:

The same decade graph, but superposed with the female writers:

It shows a gap between the 2 peaks : the fifties for writers and seventies for the composers.

Style gap for musicians[edit]

Query[edit]

The following graph was generated thanks to wikidata with this query:

SELECT ?age (COUNT (DISTINCT ?human) AS ?count) WHERE {
		?human wdt:P31 wd:Q5 .
		?human wdt:P136/wdt:P279 wd:Q11399 .
		?human p:P569/psv:P569 ?birth_date_node . 
		?human p:P570/psv:P570 ?death_date_node .
		?birth_date_node wikibase:timeValue ?birth_date .
		?death_date_node wikibase:timeValue ?death_date .
		BIND(FLOOR((?death_date - ?birth_date)/365.25) as ?age)
  		FILTER(?age > 10 && ?age < 110) .
} 
GROUP BY ?age
ORDER BY ?age
Try it!

Charts[edit]

With the same data, but smoothed and normalized:

Gender gap per country[edit]

Map[edit]

For each country: number of women / (number of men + number of women) in Wikidata

Notability per country[edit]

Query[edit]

For each country : number of persons in Wikidata who have the nationality / population of the country

SELECT ?country ?countryLabel ?countryCode ?population ?count ?ratio
WHERE 
{
	?country wdt:P297 ?countryCode .
  	?country wdt:P1082 ?population .
  	{
		SELECT ?country (COUNT(?person) as ?count)
		WHERE
		{
			?person wdt:P27 ?country.
			?country wdt:P31 wd:Q6256 .
		}
		GROUP BY ?country
	}
  	BIND(?count / ?population * 1000 AS ?ratio).
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY DESC(?ratio)
Try it!

Map[edit]

Population pyramid for COVID-19 deaths[edit]

Query[edit]

#defaultView:LineChart
SELECT ?age  (COUNT (DISTINCT ?a) AS ?count) WHERE {
  ?a wdt:P31 wd:Q5 . #instance of human
  ?a wdt:P509 wd:Q84263196 . #dead because of COVID-19
  ?a p:P569/psv:P569 ?birth_date_node .
  ?a p:P570/psv:P570 ?death_date_node .
  ?birth_date_node wikibase:timeValue ?birth_date .
  ?death_date_node wikibase:timeValue ?death_date .
  BIND(floor((year(?death_date) - year(?birth_date)) / 10) * 10 as ?age) #decades agregate
}
GROUP BY ?age
ORDER BY ?age
Try it!

COVID-19 deaths localisation[edit]

Query[edit]

#defaultView:Map
SELECT DISTINCT ?person ?name ?coord_death ?layer WHERE {
  ?person wdt:P509 wd:Q84263196 .
  ?person wdt:P570 ?dod .
  ?person wdt:P20 ?place .
  ?place wdt:P625 ?coord_death .
  BIND(?dod as ?layer)
  ?person rdfs:label ?name filter (lang(?name) = "en")
} ORDER BY ?dod
Try it!


COVID-19 affection localisation[edit]

Query[edit]

#defaultView:Map
SELECT DISTINCT ?person ?name ?coord_birth ?layer WHERE {
  ?person wdt:P1050 wd:Q84263196 .
  ?person wdt:P19 ?place .
  ?place wdt:P625 ?coord_birth .
  ?person rdfs:label ?name filter (lang(?name) = "en")
} ORDER BY ?dod
Try it!