query-9fb7ec9790cd2512992c70f58c042e2c

rq turtle/ttl

Doc Taxon Wish for MW API access from WDQS: bd:serviceParam wikibase:limit value to not use continuations but still make more API calls: Wikidata:Request a query#List of article sizesI recently made this query as response to a request at

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 ?sitelink ?site ?endpoint ?title ?size ?size_kbyte
WHERE
{
  ?sitelink schema:about wd:Q18207978.
  ?sitelink schema:isPartOf ?site.
  ?sitelink schema:name ?title.
  BIND (STRBEFORE(STRAFTER(STR(?site), "https://"), "/") AS ?endpoint)
  BIND (STR(?title) AS ?title_nolang)
  SERVICE wikibase:mwapi
  {
    bd:serviceParam wikibase:endpoint ?endpoint.
    bd:serviceParam wikibase:api "Generator".
    bd:serviceParam mwapi:generator "revisions".
    bd:serviceParam mwapi:titles ?title_nolang.
    bd:serviceParam mwapi:prop "revisions".
    bd:serviceParam mwapi:rvprop "size".
    bd:serviceParam mwapi:grvdir "older".
    bd:serviceParam mwapi:grvlimit "max".
    ?size wikibase:apiOutput "revisions/rev[last()]/@size".
  }
  BIND (ROUND(xsd:integer(?size)/1024) AS ?size_kbyte)
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?endpoint"):::projected v2("?site"):::projected v1("?sitelink"):::projected v6("?size"):::projected v7("?size_kbyte"):::projected v3("?title"):::projected v5("?title_nolang") c21(["revisions/rev#91;last()#93;/@size"]):::literal c19(["max"]):::literal c6(["bd:serviceParam"]):::iri c15(["size"]):::literal c2(["wd:Q18207978"]):::iri c11(["revisions"]):::literal c17(["older"]):::literal c9(["Generator"]):::literal v1 --"schema:about"--> c2 v1 --"schema:isPartOf"--> v2 v1 --"schema:name"--> v3 bind0[/"substring-before(substring-after(str(?site),'https://'),'/')"/] v2 --o bind0 bind0 --as--o v4 bind1[/"str(?title)"/] v3 --o bind1 bind1 --as--o v5 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c6 --"mwapi:endpoint"--> v4 c6 --"mwapi:api"--> c9 c6 --"mwapi:generator"--> c11 c6 --"mwapi:titles"--> v5 c6 --"mwapi:prop"--> c11 c6 --"mwapi:rvprop"--> c15 c6 --"mwapi:grvdir"--> c17 c6 --"mwapi:grvlimit"--> c19 v6 --"mwapi:apiOutput"--> c21 end bind2[/"numeric-round(http://www.w3.org/2001/XMLSchema#integer(?size) / '1024^^xsd:integer')"/] v6 --o bind2 bind2 --as--o v7