query-eda242735f68d151fb5f188b676d2d0e

rq turtle/ttl

Countries of citizenship of discoverers of elements

Use at

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#>
SELECT ?countryLabel (COUNT(?element) AS ?count) (GROUP_CONCAT(DISTINCT ?elementLabel) AS ?list) WHERE {
?element wdt:P31 wd:Q11344; # chemical element
         wdt:P61/wdt:P27 ?country. # nationality of discoverer
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
                        ?country rdfs:label ?countryLabel. ?element rdfs:label ?elementLabel}
} GROUP BY ?countryLabel
ORDER BY DESC (?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?count") v3("?country") v4("?countryLabel"):::projected v2("?element"):::projected v5("?elementLabel"):::projected v6("?list") a1((" ")) c6(["bd:serviceParam"]):::iri c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal c2(["wd:Q11344"]):::iri v2 --"wdt:P31"--> c2 v2 --"wdt:P61"--> a1 a1 --"wdt:P27"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 v3 --"rdfs:label"--> v4 v2 --"rdfs:label"--> v5 end bind2[/"count(?element)"/] v2 --o bind2 bind2 --as--o v6 bind3[/"?elementLabel"/] v5 --o bind3 bind3 --as--o v6