query-41a359f6fa85cfc131f8955d41adb89b
The following query uses these:
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 bd: <http://www.bigdata.com/rdf#>
# Usage chart for Template:Scholia on the English Wikipedia
# Note: this chart is based on https://www.wikidata.org/wiki/Wikidata:WikiProject_Source_MetaData/Wikidata_lists/Usage_of_Template_Scholia/English_Wikipedia
# which is updated about once a day by ListeriaBot
#defaultView:LineChart
SELECT ?day ?count
{
BIND (CONCAT(" items") AS ?p)
# BIND (CONCAT("∑ ") AS ?r)
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Generator" ;
wikibase:endpoint "www.wikidata.org" ;
mwapi:generator "allpages" ;
mwapi:gapfrom "WikiProject_Source_MetaData/Wikidata_lists/Usage_of_Template_Scholia/English_Wikipedia" ;
mwapi:gapto "WikiProject_Source_MetaData/Wikidata_lists/Usage_of_Template_Scholia/English_Wikipedia" ;
mwapi:gapnamespace "4" ;
mwapi:prop "revisions" ;
mwapi:rvprop "content|timestamp" ;
mwapi:rvlimit "7" ;
mwapi:rvuser "ListeriaBot" .
?t1 wikibase:apiOutput "revisions/rev[1]/@timestamp" . ?r1 wikibase:apiOutput "revisions/rev[1]/text()" .
}
BIND (xsd:dateTime(?t1) AS ?day)
FILTER (?day >= "2018-08-01T00:00:00Z"^^xsd:dateTime) .
BIND (STRAFTER(?r1, "∑ ") AS ?BeforeString)
BIND (STRBEFORE(?BeforeString, ?p) AS ?AfterString)
BIND (IF(CONTAINS(?r1, ?p), xsd:integer(?AfterString), -1) AS ?count)
FILTER (?count > 0 )
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?AfterString")
v6("?BeforeString")
v8("?count"):::projected
v6("?day"):::projected
v3("?p")
v5("?r1")
v4("?t1")
c4(["bd:serviceParam"]):::iri
c10(["allpages"]):::literal
c23(["ListeriaBot"]):::literal
c17(["revisions"]):::literal
c8(["www.wikidata.org"]):::literal
c19(["content|timestamp"]):::literal
c25(["revisions/rev#91;1#93;/@timestamp"]):::literal
c26(["revisions/rev#91;1#93;/text()"]):::literal
c15(["4"]):::literal
c21(["7"]):::literal
c6(["Generator"]):::literal
c12(["WikiProject_Source_MetaData/Wikidata_lists/Usage_of_Template_Scholia/English_Wikipedia"]):::literal
f0[["?count > '0^^xsd:integer'"]]
f0 --> v8
f1[["?day >= '2018-08-01T00:00:00Z^^xsd:dateTime'"]]
f1 --> v6
bind2[/"concat(' items')"/]
bind2 --as--o v3
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c4 --"mwapi:api"--> c6
c4 --"mwapi:endpoint"--> c8
c4 --"mwapi:generator"--> c10
c4 --"mwapi:gapfrom"--> c12
c4 --"mwapi:gapto"--> c12
c4 --"mwapi:gapnamespace"--> c15
c4 --"mwapi:prop"--> c17
c4 --"mwapi:rvprop"--> c19
c4 --"mwapi:rvlimit"--> c21
c4 --"mwapi:rvuser"--> c23
v4 --"mwapi:apiOutput"--> c25
v5 --"mwapi:apiOutput"--> c26
end
bind3[/"http://www.w3.org/2001/XMLSchema#dateTime(?t1)"/]
v4 --o bind3
bind3 --as--o v6
bind4[/"substring-after(?r1,'∑ ')"/]
v5 --o bind4
bind4 --as--o v6
bind5[/"substring-before(?BeforeString,?p)"/]
v6 --o bind5
v3 --o bind5
bind5 --as--o v7
bind6[/"if(contains(?r1,?p),http://www.w3.org/2001/XMLSchema#integer(?AfterString),'-1^^xsd:integer')"/]
v5 --o bind6
v3 --o bind6
v7 --o bind6
bind6 --as--o v8