Wikidata:WikiProject Source MetaData/Wikidata lists/Usage of Template Scholia/Cross-wiki/Query

From Wikidata
Jump to navigation Jump to search

The following query uses these:

 1 # Usage chart for Template:Scholia across several Wikipedias
 2 # Note: this chart is based on https://www.wikidata.org/wiki/Wikidata:WikiProject_Source_MetaData/Wikidata_lists/Usage_of_Template_Scholia/Cross-wiki
 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   SERVICE wikibase:mwapi {
10       bd:serviceParam wikibase:api "Generator" ; 
11                       wikibase:endpoint "www.wikidata.org" ; 
12                       mwapi:generator "allpages" ; 
13                       mwapi:gapfrom "WikiProject_Source_MetaData/Wikidata_lists/Usage_of_Template_Scholia/Cross-wiki" ; 
14                       mwapi:gapto "WikiProject_Source_MetaData/Wikidata_lists/Usage_of_Template_Scholia/Cross-wiki" ; 
15                       mwapi:gapnamespace "4" ; 
16                       mwapi:prop "revisions" ; 
17                       mwapi:rvprop "content|timestamp" ; 
18                       mwapi:rvlimit "7" ; 
19                       mwapi:rvuser "ListeriaBot" .
20       ?t1 wikibase:apiOutput "revisions/rev[1]/@timestamp" . ?r1 wikibase:apiOutput "revisions/rev[1]/text()" .
21   }
22   BIND (xsd:dateTime(?t1) AS ?day)
23   FILTER (?day >= "2018-08-04T00:00:00Z"^^xsd:dateTime) .
24   BIND (STRAFTER(?r1, "∑ ") AS ?BeforeString) 
25   BIND (STRBEFORE(?BeforeString, ?p) AS ?AfterString) 
26   BIND (IF(CONTAINS(?r1, ?p), xsd:integer(?AfterString), -1) AS ?count)
27   FILTER (?count > 0 )
28 }