query-e13d29c25115af844b769995dc892791

rq turtle/ttl

title: Genera of species with at least one habitat statement SELECT DISTINCT ?topicparent ?taxonname (COUNT(DISTINCT ?item) AS ?count)

WHERE {

?topic wdt:P2974 [] . ?item wdt:P921 ?topic. ?topic wdt:P171 ?topicparent . ?topicparent wdt:P105 wd:Q34740 . ?topicparent wdt:P225 ?taxonname .

} GROUP BY ?topicparent ?taxonname ORDER BY DESC(?count)

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
#title: Genera of species with at least one habitat statement
SELECT 
  DISTINCT
    ?topicparent ?taxonname (COUNT(DISTINCT ?item) AS ?count)

WHERE {

  ?topic wdt:P2974 [] .
  ?item wdt:P921 ?topic.
  ?topic wdt:P171 ?topicparent .
  ?topicparent wdt:P105 wd:Q34740 .
  ?topicparent wdt:P225 ?taxonname .

}
GROUP BY ?topicparent ?taxonname
ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?count") v3("?item"):::projected v5("?taxonname"):::projected v2("?topic") v4("?topicparent"):::projected a1((" ")) c5(["wd:Q34740"]):::iri v2 --"wdt:P2974"--> a1 v3 --"wdt:P921"--> v2 v2 --"wdt:P171"--> v4 v4 --"wdt:P105"--> c5 v4 --"wdt:P225"--> v5 bind1[/"count(?item)"/] v3 --o bind1 bind1 --as--o v6