query-4d8271bbc966a108fe4362a83039bcd2

rq turtle/ttl

Sum only when months, not yearHello Given that JNB airport (and some other, like the Indian ones) publishes only fiscal year stats, I downloaded each month, so that it would be easy to compute a civil year total. here's the code

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel  
?year (sum(?number) as ?number) 
WHERE {  {?item wdt:P238 ?IATA
VALUES ?IATA {"JNB"}.}.  
  ?item p:P3872 ?statement.
  ?statement pq:P585 ?time.
  bind (YEAR(?time) AS ?year) 
  ?statement ps:P3872 ?number.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". }
  MINUS { ?statement wikibase:rank wikibase:DeprecatedRank }
  FILTER (?year >1985)
} group by ?year ?item ?itemLabel
order by ?item desc (?year)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?IATA") v1("?item"):::projected v7("?number"):::projected v4("?statement") v5("?time") v6("?year"):::projected c7(["bd:serviceParam"]):::iri c9(["fr,en"]):::literal c11(["wikibase:DeprecatedRank"]):::iri f0[["?year > '1985^^xsd:integer'"]] f0 --> v6 v1 --"p:direct/P238"--> v4 bind1[/VALUES ?IATA/] bind1-->v4 bind10(["JNB"]) bind10 --> bind1 v1 --"p:P3872"--> v4 v4 --"p:qualifier/P585"--> v5 bind2[/"year-from-dateTime(?time)"/] v5 --o bind2 bind2 --as--o v6 v4 --"p:statement/P3872"--> v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v4 --"wikibase:rank"--> c11 end bind5[/"sum(?number)"/] v7 --o bind5 bind5 --as--o v7