query-f06be8b8a31f4b5e4b246c57d81c1cf6
TODO
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#>
# Chart of P921 usage
# Note: this chart is based on https://www.wikidata.org/wiki/Template:Property_uses
# which is updated once a day by PLbot
#defaultView:LineChart
SELECT ?day ?count {
{BIND(?c1 AS ?count) BIND(?d1 AS ?day) { SELECT (".+\\|921=(\\d+).+" as ?r) ("|921=" as ?p)
(IF(CONTAINS(?r1, ?p), xsd:integer(REPLACE(?r1, ?r, "$1")), -1) AS ?c1) (xsd:dateTime(?t1) AS ?d1)
{ SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Generator" ; wikibase:endpoint "www.wikidata.org" ; mwapi:generator "allpages" ;
mwapi:gapfrom "Property_uses" ; mwapi:gapto "Property_uses" ; mwapi:gapnamespace "10" ;
mwapi:prop "revisions" ; mwapi:rvprop "content|timestamp" ; mwapi:rvlimit "50" ; mwapi:rvuser "PLbot" .
?t1 wikibase:apiOutput "revisions/rev[1]/@timestamp" . ?r1 wikibase:apiOutput "revisions/rev[1]/text()" .
}
}
}}
FILTER(?count != -1)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?c1")
v2("?count"):::projected
v8("?d1")
v2("?day"):::projected
v6("?p")
v5("?r")
v4("?r1")
v3("?t1")
c22(["PLbot"]):::literal
c11(["Property_uses"]):::literal
c3(["bd:serviceParam"]):::iri
c9(["allpages"]):::literal
c16(["revisions"]):::literal
c20(["50"]):::literal
c14(["10"]):::literal
c7(["www.wikidata.org"]):::literal
c18(["content|timestamp"]):::literal
c24(["revisions/rev#91;1#93;/@timestamp"]):::literal
c25(["revisions/rev#91;1#93;/text()"]):::literal
c5(["Generator"]):::literal
f0[["?count != '-1^^xsd:integer'"]]
f0 --> v2
bind1[/"?c1"/]
v7 --o bind1
bind1 --as--o v2
bind2[/"?d1"/]
v8 --o bind2
bind2 --as--o v2
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c3 --"mwapi:api"--> c5
c3 --"mwapi:endpoint"--> c7
c3 --"mwapi:generator"--> c9
c3 --"mwapi:gapfrom"--> c11
c3 --"mwapi:gapto"--> c11
c3 --"mwapi:gapnamespace"--> c14
c3 --"mwapi:prop"--> c16
c3 --"mwapi:rvprop"--> c18
c3 --"mwapi:rvlimit"--> c20
c3 --"mwapi:rvuser"--> c22
v3 --"mwapi:apiOutput"--> c24
v4 --"mwapi:apiOutput"--> c25
end
bind3[/"'.+\|921=(\d+).+'"/]
bind3 --as--o v5
bind4[/"'|921='"/]
bind4 --as--o v6
bind5[/"if(contains(?r1,?p),http://www.w3.org/2001/XMLSchema#integer(replace(?r1,?r,'$1')),'-1^^xsd:integer')"/]
v4 --o bind5
v6 --o bind5
v5 --o bind5
bind5 --as--o v7
bind6[/"http://www.w3.org/2001/XMLSchema#dateTime(?t1)"/]
v3 --o bind6
bind6 --as--o v8