query-d953d867af5de7f699698a84228b4b21

rq turtle/ttl

The following query uses these:

Use at

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#>
# Stats for people from Tel Aviv University, as per 
# https://www.wikidata.org/wiki/User:Daniel_Mietchen/TAU_people
# which is updated about once a day by ListeriaBot

#defaultView:LineChart
SELECT ?day ?count 
{
  BIND (CONCAT(" items") AS ?p)
#  BIND (CONCAT("&sum; ") AS ?r)
  SERVICE wikibase:mwapi {
      bd:serviceParam wikibase:api "Generator" ; 
                      wikibase:endpoint "www.wikidata.org" ; 
                      mwapi:generator "allpages" ; 
                      mwapi:gapfrom "Daniel_Mietchen/TAU_people" ; 
                      mwapi:gapto "Daniel_Mietchen/TAU_people" ; 
                      mwapi:gapnamespace "2" ; 
                      mwapi:prop "revisions" ; 
                      mwapi:rvprop "content|timestamp" ; 
                      mwapi:rvlimit "1" ; 
                      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-12-31T00:00:00Z"^^xsd:dateTime) .
  FILTER (?day <= "2019-02-01T00:00:00Z"^^xsd:dateTime) .
  BIND (STRAFTER(?r1, "&sum; ") 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") c5(["bd:serviceParam"]):::iri c11(["allpages"]):::literal c24(["ListeriaBot"]):::literal c18(["revisions"]):::literal c9(["www.wikidata.org"]):::literal c13(["Daniel_Mietchen/TAU_people"]):::literal c20(["content|timestamp"]):::literal c22(["1"]):::literal c16(["2"]):::literal c26(["revisions/rev#91;1#93;/@timestamp"]):::literal c27(["revisions/rev#91;1#93;/text()"]):::literal c7(["Generator"]):::literal f0[["?count > '0^^xsd:integer'"]] f0 --> v8 f1[["?day <= '2019-02-01T00:00:00Z^^xsd:dateTime'"]] f1 --> v6 f2[["?day >= '2018-12-31T00:00:00Z^^xsd:dateTime'"]] f2 --> v6 bind3[/"concat(' items')"/] bind3 --as--o v3 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c5 --"mwapi:api"--> c7 c5 --"mwapi:endpoint"--> c9 c5 --"mwapi:generator"--> c11 c5 --"mwapi:gapfrom"--> c13 c5 --"mwapi:gapto"--> c13 c5 --"mwapi:gapnamespace"--> c16 c5 --"mwapi:prop"--> c18 c5 --"mwapi:rvprop"--> c20 c5 --"mwapi:rvlimit"--> c22 c5 --"mwapi:rvuser"--> c24 v4 --"mwapi:apiOutput"--> c26 v5 --"mwapi:apiOutput"--> c27 end bind4[/"http://www.w3.org/2001/XMLSchema#dateTime(?t1)"/] v4 --o bind4 bind4 --as--o v6 bind5[/"substring-after(?r1,'&sum; ')"/] v5 --o bind5 bind5 --as--o v6 bind6[/"substring-before(?BeforeString,?p)"/] v6 --o bind6 v3 --o bind6 bind6 --as--o v7 bind7[/"if(contains(?r1,?p),http://www.w3.org/2001/XMLSchema#integer(?AfterString),'-1^^xsd:integer')"/] v5 --o bind7 v3 --o bind7 v7 --o bind7 bind7 --as--o v8