query-1685cd91f188b3d89819b7a18a0cde00
or not.(Q5)human statements with that value, regardless of whether the subject item is a (P734)family name . Note that the “overall prevalence in Wikidata” part just counts on Mastodon and on TwitterOriginally posted
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT (SAMPLE(?familyNameLabel_) AS ?familyNameLabel) ?astronauts ?items (CONCAT(SUBSTR(STR(?astronauts / ?items * 100), 1, 5), "%") AS ?percent) WHERE {
{
SELECT ?familyName (COUNT(DISTINCT ?astronaut) AS ?astronauts) WHERE {
?astronaut wdt:P31 wd:Q5;
wdt:P450 ?mission;
wdt:P734 ?familyName.
}
GROUP BY ?familyName
HAVING(?astronauts > 1)
}
{
SELECT ?familyName (COUNT(*) AS ?items) WHERE {
{
SELECT ?familyName (COUNT(DISTINCT ?astronaut) AS ?astronauts) WHERE {
?astronaut wdt:P31 wd:Q5;
wdt:P450 ?mission;
wdt:P734 ?familyName.
}
GROUP BY ?familyName
HAVING(?astronauts > 1)
}
?item wdt:P734 ?familyName.
}
GROUP BY ?familyName
}
?familyName wdt:P1705 ?familyNameLabel_.
}
GROUP BY ?familyName ?astronauts ?items
ORDER BY DESC(?astronauts / ?items) ?familyNameLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?astronaut")
v7("?astronauts"):::projected
v6("?familyName")
v9("?familyNameLabel")
v8("?familyNameLabel_"):::projected
v7("?item")
v8("?items"):::projected
v5("?mission")
v9("?percent")
c3(["wd:Q5"]):::iri
f0[["?astronauts > '1^^xsd:integer'"]]
f0 --> v7
v4 --"wdt:P31"--> c3
v4 --"wdt:P450"--> v5
v4 --"wdt:P734"--> v6
bind2[/"count(?astronaut)"/]
v4 --o bind2
bind2 --as--o v7
f3[["?astronauts > '1^^xsd:integer'"]]
f3 --> v7
v4 --"wdt:P31"--> c3
v4 --"wdt:P450"--> v5
v4 --"wdt:P734"--> v6
bind5[/"count(?astronaut)"/]
v4 --o bind5
bind5 --as--o v7
v7 --"wdt:P734"--> v6
bind7[/"count(*)"/]
bind7 --as--o v8
v6 --"wdt:P1705"--> v8
bind9[/"sample(?familyNameLabel_)"/]
v8 --o bind9
bind9 --as--o v9
bind10[/"concat(substring(str(?astronauts / ?items * '100^^xsd:integer'),'1^^xsd:integer','5^^xsd:integer'),'%')"/]
v7 --o bind10
v8 --o bind10
bind10 --as--o v9