Wikidata:WikiProject Source MetaData/Wikidata lists/Usage of Template Scholia/English Wikipedia/Query

From Wikidata
Jump to navigation Jump to search

The following query uses these:

 1 # Usage chart for Template:Scholia on the English Wikipedia
 2 # Note: this chart is based on https://www.wikidata.org/wiki/Wikidata:WikiProject_Source_MetaData/Wikidata_lists/Usage_of_Template_Scholia/English_Wikipedia
 3 # which is updated about once a day by ListeriaBot
 4 
 5 #defaultView:LineChart
 6 SELECT ?day ?count 
 7 {
 8   BIND (CONCAT(" items") AS ?p)
 9 #  BIND (CONCAT("∑ ") AS ?r)
10   SERVICE wikibase:mwapi {
11       bd:serviceParam wikibase:api "Generator" ; 
12                       wikibase:endpoint "www.wikidata.org" ; 
13                       mwapi:generator "allpages" ; 
14                       mwapi:gapfrom "WikiProject_Source_MetaData/Wikidata_lists/Usage_of_Template_Scholia/English_Wikipedia" ; 
15                       mwapi:gapto "WikiProject_Source_MetaData/Wikidata_lists/Usage_of_Template_Scholia/English_Wikipedia" ; 
16                       mwapi:gapnamespace "4" ; 
17                       mwapi:prop "revisions" ; 
18                       mwapi:rvprop "content|timestamp" ; 
19                       mwapi:rvlimit "7" ; 
20                       mwapi:rvuser "ListeriaBot" .
21       ?t1 wikibase:apiOutput "revisions/rev[1]/@timestamp" . ?r1 wikibase:apiOutput "revisions/rev[1]/text()" .
22   }
23   BIND (xsd:dateTime(?t1) AS ?day)
24   FILTER (?day >= "2018-08-01T00:00:00Z"^^xsd:dateTime) .
25   BIND (STRAFTER(?r1, "∑ ") AS ?BeforeString) 
26   BIND (STRBEFORE(?BeforeString, ?p) AS ?AfterString) 
27   BIND (IF(CONTAINS(?r1, ?p), xsd:integer(?AfterString), -1) AS ?count)
28   FILTER (?count > 0 )
29 }