query-865dae504b04d95b778faf3b614b4437

rq turtle/ttl

Count the number of genes in each taxon by NCBI Tax ID

SELECT (COUNT(?gene) as ?count) ?taxon ?taxonLabel ?taxids WHERE { values ?taxids {"559292" "6239" "7227" "7955" "10090" "10116" "9606"} ?taxon wdt:P685 ?taxids . ?gene wdt:P703 ?taxon . ?gene wdt:P351 ?en SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?taxon ?taxonLabel ?taxids ORDER BY DESC(?count)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Count the number of genes in each taxon by NCBI Tax ID

SELECT (COUNT(?gene) as ?count) ?taxon ?taxonLabel ?taxids WHERE {
  values ?taxids {"559292" "6239" "7227" "7955" "10090" "10116" "9606"}
  ?taxon wdt:P685 ?taxids .
  ?gene wdt:P703 ?taxon .
  ?gene wdt:P351 ?en
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} GROUP BY ?taxon ?taxonLabel ?taxids
ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?count") v5("?en") v4("?gene"):::projected v2("?taxids"):::projected v3("?taxon"):::projected c5(["bd:serviceParam"]):::iri c7(["en"]):::literal bind0[/VALUES ?taxids/] bind0-->v2 bind00(["559292"]) bind00 --> bind0 bind01(["6239"]) bind01 --> bind0 bind02(["7227"]) bind02 --> bind0 bind03(["7955"]) bind03 --> bind0 bind04(["10090"]) bind04 --> bind0 bind05(["10116"]) bind05 --> bind0 bind06(["9606"]) bind06 --> bind0 v3 --"wdt:P685"--> v2 v4 --"wdt:P703"--> v3 v4 --"wdt:P351"--> v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end bind2[/"count(?gene)"/] v4 --o bind2 bind2 --as--o v6