query-409f9e7f9729ac3219a3f7ef43339453
.(P1412)languages spoken, written or signed , or (P103)native language , (P37)official language +(P27)country of citizenship . “French” is here used as a shorthand for “probably French-speaking”, as inferred from on Mastodon and on TwitterOriginally posted
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:BarChart
SELECT ?givenName ?givenNameLabel (COUNT(DISTINCT ?character) AS ?count) ?authorClassification WHERE {
BIND(wd:Q150 AS ?language)
?character wdt:P31/wdt:P279* wd:Q95074;
(wdt:P27/wdt:P37)|wdt:P103|wdt:P1412 ?language;
wdt:P735 ?givenName;
wdt:P170 ?author.
OPTIONAL { ?author (wdt:P27/wdt:P37)|wdt:P103|wdt:P1412 ?language. BIND(1 AS ?authorSpeaksLanguage) }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en".
?givenName rdfs:label ?givenNameLabel.
?language rdfs:label ?languageLabel.
}
BIND(IF(BOUND(?authorSpeaksLanguage), ?languageLabel, "other"@en) AS ?authorClassification)
}
GROUP BY ?givenName ?givenNameLabel ?authorClassification
ORDER BY DESC(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?author")
v9("?authorClassification"):::projected
v6("?authorSpeaksLanguage")
v3("?character"):::projected
v10("?count")
v4("?givenName"):::projected
v7("?givenNameLabel"):::projected
v2("?language")
v8("?languageLabel")
a1((" "))
a2((" "))
a3((" "))
c13(["en"]):::literal
c3(["wd:Q95074"]):::iri
c11(["bd:serviceParam"]):::iri
bind0[/"'wd:Q150'"/]
bind0 --as--o v2
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P1412"--> v2
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P103"--> v2
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P27"--> a2
a2 --"wdt:P37"--> v2
end
union0r <== or ==> union0l
end
v3 --"wdt:P735"--> v4
v3 --"wdt:P170"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
v5 -."wdt:P1412".-> v2
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
v5 --"wdt:P103"--> v2
end
union3r <== or ==> union3l
end
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v5 --"wdt:P27"--> a3
a3 --"wdt:P37"--> v2
end
union2r <== or ==> union2l
end
bind1[/"'1^^xsd:integer'"/]
bind1 --as--o v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
v4 --"rdfs:label"--> v7
v2 --"rdfs:label"--> v8
end
bind2[/"if(bound(?authorSpeaksLanguage),?languageLabel,sother^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>')"/]
v6 --o bind2
v8 --o bind2
bind2 --as--o v9
bind4[/"count(?character)"/]
v3 --o bind4
bind4 --as--o v10