query-e9cbfbe11cd968250430d6613291dbc5

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?descendentLabel (count(?mid) as ?distance)  where { 
  ?descendent (wdt:P22|wdt:P25)* ?mid .
  ?mid (wdt:P22|wdt:P25)+ wd:Q9682. 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
group by ?descendentLabel 
order by ?distance ?descendentLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?descendent") v2("?descendentLabel"):::projected v5("?distance") v4("?mid"):::projected c5(["bd:serviceParam"]):::iri c3(["wd:Q9682"]):::iri c7(["en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P25"--> v4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P22"--> v4 end union0r <== or ==> union0l end subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P25"--> c3 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P22"--> c3 end union1r <== or ==> union1l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end bind1[/"count(?mid)"/] v4 --o bind1 bind1 --as--o v5