query-ab5de197867420b175f75c9378959f31
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?all ?names
WHERE
{
SELECT ?other (sum(?count) as ?all) (GROUP_CONCAT(DISTINCT CONCAT(?ru, " (",str(?count),"), ") ) as ?names)
{
{
SELECT ?other ?ru (COUNT(DISTINCT ?p ) as ?count)
WHERE
{
?p wdt:P27 wd:Q159 ; wdt:P21 wd:Q6581072 ; wdt:P734 ?item .
?item wdt:P1705 ?ru .
{ ?item wdt:P460* ?other } UNION { ?other wdt:P460* ?item } .
}
GROUP BY ?other ?ru
ORDER BY ?ru
}}
GROUP bY ?other
}
ORDER BY DESC(?all)
LIMIT 100
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?all"):::projected
v6("?count")
v4("?item")
v7("?names"):::projected
v5("?other")
v3("?p")
v2("?ru")
c2(["wd:Q159"]):::iri
c4(["wd:Q6581072"]):::iri
v3 --"wdt:P27"--> c2
v3 --"wdt:P21"--> c4
v3 --"wdt:P734"--> v4
v4 --"wdt:P1705"--> v2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v5 --"wdt:P460"--> v4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P460"--> v5
end
union0r <== or ==> union0l
end
bind1[/"count(?p)"/]
v3 --o bind1
bind1 --as--o v6
bind4[/"sum(?count)"/]
v6 --o bind4
bind4 --as--o v7
bind5[/"concat(?ru,' (',str(?count),'), ')"/]
v2 --o bind5
v6 --o bind5
bind5 --as--o v7