query-6aced98863581111214b0a00bfe31ee8
.User:TweetsFactsAndQueries/Queries/UN member states with most identical labels across languages. A more detailed version of 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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?state ?string ?languages ?labels ?percent ?ratio
WHERE {
{
SELECT ?state ?string (COUNT(*) AS ?languages) WHERE {
{
SELECT ?state ?label ?string WHERE {
INCLUDE %states.
?state rdfs:label ?label.
BIND(STR(?label) AS ?string)
}
}
}
GROUP BY ?state ?string
HAVING(?languages > 1)
}
{
SELECT ?state (COUNT(*) AS ?labels) WHERE {
{
SELECT ?state ?label ?string WHERE {
INCLUDE %states.
?state rdfs:label ?label.
BIND(STR(?label) AS ?string)
}
}
}
GROUP BY ?state
}
BIND(?languages / ?labels AS ?ratio)
BIND(CONCAT(SUBSTR(STR(?ratio * 100), 1, 5), "%") AS ?percent)
}
ORDER BY DESC(?languages)