query-41ed1d10fa309b66be32c989ccf62794
All sizes of Wikipedia articles on a topic
Use at
- https://query.wikidata.org/sparql
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 ?size
WHERE {
VALUES ?item1 {wd:Q9438}
?sitelink schema:about ?item1 # get Wikimedia pages
FILTER(CONTAINS(str(?sitelink), ".wikipedia.org/")) # only Wikipedia articles
?sitelink schema:name ?title ; schema:isPartOf ?site.
BIND(REPLACE(SUBSTR(STR(?site), 9), '/', '') AS ?endpoint)
OPTIONAL{
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Generator" ;
wikibase:endpoint ?endpoint ;
mwapi:generator "allpages" ;
mwapi:gapfrom ?title ;
mwapi:gapto ?title ;
mwapi:prop "revisions" ;
mwapi:rvprop "size" .
?bytes wikibase:apiOutput "revisions/rev/@size" .
}
BIND (xsd:integer(?bytes) AS ?size)
}
} ORDER BY DESC(?size)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?bytes")
v6("?endpoint")
v3("?item1")
v5("?site")
v2("?sitelink"):::projected
v8("?size"):::projected
v4("?title")
c19(["revisions/rev/@size"]):::literal
c6(["bd:serviceParam"]):::iri
c17(["size"]):::literal
c11(["allpages"]):::literal
c15(["revisions"]):::literal
c8(["Generator"]):::literal
f0[["contains(str(?sitelink),'.wikipedia.org/')"]]
f0 --> v2
bind1[/VALUES ?item1/]
bind1-->v3
bind10(["wd:Q9438"])
bind10 --> bind1
v2 --"schema:about"--> v3
v2 --"schema:name"--> v4
v2 --"schema:isPartOf"--> v5
bind2[/"replace(substring(str(?site),'9^^xsd:integer'),'/','')"/]
v5 --o bind2
bind2 --as--o v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c6 -."mwapi:api".-> c8
c6 --"mwapi:endpoint"--> v6
c6 --"mwapi:generator"--> c11
c6 --"mwapi:gapfrom"--> v4
c6 --"mwapi:gapto"--> v4
c6 --"mwapi:prop"--> c15
c6 --"mwapi:rvprop"--> c17
v7 --"mwapi:apiOutput"--> c19
end
bind3[/"http://www.w3.org/2001/XMLSchema#integer(?bytes)"/]
v7 --o bind3
bind3 --as--o v8
end