query-6fc1682d0c5047e9905e5c8f47f0ba27

rq turtle/ttl

Count the number of statements in a specific item ]reply[12:22, 19 May 2018 (UTC)) talk (OmmmmidI'd like to write a query that looks inside the items that are instances of human, and have "sex or gender" as male, and sorts them by their number of statements. Probably a bit heavy:

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 ?item ?itemLabel ?statementCount
WHERE 
{
  ?item wdt:P31 wd:Q5.
  ?item wdt:P21 wd:Q6581097.
  ?item wikibase:statements ?statementCount.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item"):::projected v2("?statementCount"):::projected c7(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c4(["wd:Q6581097"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal v1 --"wdt:P31"--> c2 v1 --"wdt:P21"--> c4 v1 --"wikibase:statements"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end