query-af5cd01e0868949b8fd8a3a571566c8b

rq turtle/ttl

Propertieson focus list of Wikimedia project (P5008)quantity (P1114)point in time (P585)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
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/>
#defaultView:AreaChart
SELECT ?date ?cumulativecount 
{

    {   SELECT ?milestonep (COUNT(?item) as ?cumulativecount)              # cumulative count of items meeting the filtering criteria below
        WHERE
        {
          { SELECT ?item { ?item wdt:P5008 wd:Q15304953 .}  LIMIT 100000 } # items within scope of the project
          BIND( xsd:integer( substr(str(?item), 33)) as ?qid)              # get the QID of the item
          wd:Q38074555 p:P1114 ?milestonep .                               # get list of QID milestones
          ?milestonep ps:P1114 ?milestone .
          FILTER( ?milestone > ?qid )                                      # only consider milestones newer than the item
        }
        GROUP BY ?milestonep
    }          
    ?milestonep pq:P585 ?date                                              # get the date when the QID milestone was reached
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?cumulativecount"):::projected v6("?date"):::projected v3("?item") v1("?milestone") v4("?milestonep") v4("?qid") c3(["wd:Q38074555"]):::iri c2(["wd:Q15304953"]):::iri f0[["?milestone > ?qid"]] f0 --> v1 f0 --> v4 v3 --"p:direct/P5008"--> c2 bind1[/"http://www.w3.org/2001/XMLSchema#integer(substring(str(?item),'33^^xsd:integer'))"/] v3 --o bind1 bind1 --as--o v4 c3 --"p:P1114"--> v4 v4 --"p:statement/P1114"--> v1 bind3[/"count(?item)"/] v3 --o bind3 bind3 --as--o v5 v4 --"p:qualifier/P585"--> v6