query-8fa2b26b37b63206f8767f82fb128ce7

rq turtle/ttl

Stats on the number of identifiers for a given collectionHi! ; but I would like to get, basically, histograms bins: out of 40K items, X have 0 ids, Y have between 1 and 5, and Z have more than 10 (I’ll adjust the bins later :)) have no identifiers at all. I already track how many items Wikidata:WikiProject Video gamesI want to track our efforts with Identifiers in I tried hard, but I’m really not sure how to do that in SPARQL That’s how far I got for the counts for every item:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?entity (COUNT(DISTINCT(?property)) as ?count) WHERE {
  ?entity wdt:P31 wd:Q7889.
  OPTIONAL {
    ?property rdf:type wikibase:Property;
      wikibase:propertyType wikibase:ExternalId;
      (wdt:P31/(wdt:P279*)) wd:Q28147643;
      wikibase:directClaim ?wdt.
    ?entity ?wdt ?id.
  }
}
GROUP BY ?entity

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?count") v1("?entity"):::projected v4("?id") v2("?property"):::projected v3("?wdt") a1((" ")) c4(["wikibase:Property"]):::iri c2(["wd:Q7889"]):::iri c8(["wd:Q28147643"]):::iri c6(["wikibase:ExternalId"]):::iri v1 --"wdt:P31"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."a".-> c4 v2 --"wikibase:propertyType"--> c6 v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c8 v2 --"wikibase:directClaim"--> v3 v1 -->v3--> v4 end bind1[/"count(?property)"/] v2 --o bind1 bind1 --as--o v5