query-adc9e8e8c838c447b28cfb854dd49d8d

rq turtle/ttl

And this one gives the stats:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?letter (count(distinct ?article) as ?count)  WHERE
{
  ?article schema:about wd:Q16520 . ?article schema:name ?name . ?article schema:inLanguage ?lang . ?article schema:isPartOf ?x .
  FILTER CONTAINS(str(?x), "wikipedia") . # only Wikipedias
  optional { filter(STRSTARTS(?name, 'B')) . bind('B' as ?letter) } # title starts with B
  optional { filter(STRSTARTS(?name, 'P')) . bind('P' as ?letter) } # title starts with P
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} group by ?letter

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?article"):::projected v6("?count") v4("?lang") v6("?letter"):::projected v1("?name") v2("?x") c10(["bd:serviceParam"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal c5(["wd:Q16520"]):::iri f0[["contains(str(?x),'wikipedia')"]] f0 --> v2 v3 --"schema:about"--> c5 v3 --"schema:name"--> v1 v3 --"schema:inLanguage"--> v4 v3 --"schema:isPartOf"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; bind1[/"'B'"/] bind1 --as--o v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; bind2[/"'P'"/] bind2 --as--o v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 -."wikibase:language".-> c12 end bind4[/"count(?article)"/] v3 --o bind4 bind4 --as--o v6