query-c903d64d2a804c0d747d3e53593dbebc
Propertiesquantity (P1114)point in time (P585)
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
#cumulative growth of UAE items (stolen from 99of9)
#defaultView:LineChart
SELECT (SAMPLE(?date) AS ?date) (SUM(?count) AS ?cumulative_count) ?milestone WHERE {
{
SELECT ?qid_rounded (COUNT(?item) AS ?count) (SAMPLE(?item) AS ?exampleitem) WHERE {
?item ?property wd:Q878.
BIND(xsd:integer(SUBSTR(STR(?item), 33 )) AS ?qid)
BIND(xsd:integer(?qid / 20000 ) AS ?qid_cut)
BIND(?qid_cut * 20000 AS ?qid_rounded)
}
GROUP BY ?qid_rounded
}
wd:Q38074555 p:P1114 ?milestonep.
?milestonep ps:P1114 ?milestone.
FILTER(?milestone > ?qid_rounded)
?milestonep pq:P585 ?date.
}
GROUP BY ?milestone
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?count"):::projected
v11("?cumulative_count")
v11("?date"):::projected
v8("?exampleitem")
v3("?item")
v1("?milestone"):::projected
v9("?milestonep")
v4("?property")
v5("?qid")
v6("?qid_cut")
v7("?qid_rounded")
c1(["wd:Q878"]):::iri
c2(["wd:Q38074555"]):::iri
f0[["?milestone > ?qid_rounded"]]
f0 --> v1
f0 --> v7
v3 -->v4--> c1
bind1[/"http://www.w3.org/2001/XMLSchema#integer(substring(str(?item),'33^^xsd:integer'))"/]
v3 --o bind1
bind1 --as--o v5
bind2[/"http://www.w3.org/2001/XMLSchema#integer(?qid / '20000^^xsd:integer')"/]
v5 --o bind2
bind2 --as--o v6
bind3[/"?qid_cut * '20000^^xsd:integer'"/]
v6 --o bind3
bind3 --as--o v7
bind6[/"count(?item)"/]
v3 --o bind6
bind6 --as--o v7
bind7[/"sample(?item)"/]
v3 --o bind7
bind7 --as--o v8
c2 --"p:P1114"--> v9
v9 --"p:statement/P1114"--> v1
v9 --"p:qualifier/P585"--> v11
bind10[/"sample(?date)"/]
v11 --o bind10
bind10 --as--o v11
bind11[/"sum(?count)"/]
v7 --o bind11
bind11 --as--o v11