User:Bouzinac/Fréquentations

Fréquentation/Patronage of (x) airport(s)Edit

SELECT ?item ?itemLabel ?year
(sample(?number) as ?number)
WHERE {
 values ?item {wd:Q17430 wd:Q642313 wd:Q17431} .
 ?item p:P3872 ?statement.
 ?statement pq:P585 ?time.
 ?statement ps:P3872 ?number.
 bind (YEAR(?time) AS ?year)
 FILTER(?year>=1979) .
 SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
 MINUS { ?statement wikibase:rank wikibase:DeprecatedRank }
} group by ?year ?item ?itemLabel
order by ?item desc (?year)

Try it!

Fréquentation/Patronage of (x) airport(s) in a countryEdit

SELECT ?item ?itemLabel ?year
(sample(?number) as ?number)
WHERE {
 values ?item {wd:Q17430 wd:Q642313 wd:Q17431} .
 ?item p:P3872 ?statement.
 ?statement pq:P585 ?time.
 ?statement ps:P3872 ?number.
 BIND (YEAR(?time) AS ?year)
 FILTER(?year>=1979) .
 SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
 MINUS { ?statement wikibase:rank wikibase:DeprecatedRank }
} group by ?year ?item ?itemLabel
order by ?item desc (?year)

Try it!

Fréquentation/Patronage of (x) airport(s) in an administrative régionEdit

SELECT ?item ?itemLabel ?year
(sample(?number) as ?number)
WHERE {
 ?item p:P131/ps:P131 wd:Q30971.
 ?item p:P3872 ?statement.
 ?statement pq:P585 ?time.
 ?statement ps:P3872 ?number.
 BIND (YEAR(?time) AS ?year)
 FILTER(?year>=1979) .
 SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
 MINUS { ?statement wikibase:rank wikibase:DeprecatedRank }
} group by ?year ?item ?itemLabel
order by ?item desc (?year)

Try it!

Fréquentation/patronage of (x) airports with international ,domestic, total statEdit

SELECT ?item ?itemLabel ?year ?whereLabel
(sample(?number) as ?number)
WHERE {
 values ?item {wd:Q1049719} .
 ?item p:P3872 ?statement.
 ?statement pq:P585 ?time.
 ?statement pq:P518 ?where.
 ?statement ps:P3872 ?number.
 bind (YEAR(?time) AS ?year)
 FILTER(?year>=1979) .
 SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
 MINUS { ?statement wikibase:rank wikibase:DeprecatedRank }
} group by ?year ?item ?itemLabel ?where ?whereLabel
order by ?item desc (?year)

Try it!

Fréquentation/patronage of airport with specific IATA codeEdit

SELECT ?item ?itemLabel (max(?number) as ?passengers) 
?year
with {
  select ?item ?statement ?year ?timevalue ?numberperperiod{
    ?item wdt:P238 ?IATA
 VALUES ?IATA {"ICN"}.
    ?item p:P3872 ?statement.
    ?statement pqv:P585 ?timevalue
               ; ps:P3872 ?numberperperiod.
    ?timevalue wikibase:timeValue ?date .
    optional { ?statement pq:P518 ?applies .}
filter(bound(?applies)=false || ?applies = wd:Q2165236 )
bind(if(bound(?applies)=false,"no applies","everywhere") as ?where )
MINUS { ?statement wikibase:rank wikibase:DeprecatedRank }
bind (YEAR(?date) AS ?year)
FILTER (?year >1949).
FILTER (?year < year(now())).
}
} as %airport
where {
  {
select ?item ?year (sum(?numberperperiod) as ?number) {
include %airport .
?timevalue wikibase:timePrecision ?prec filter ( ?prec > 9 )
} group by ?item  ?year
  } union {
      ?timevalue wikibase:timePrecision 9 .
    bind (?numberperperiod as ?number)
      include %airport
  } .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
} group by ?item ?itemLabel ?year
order by ?item desc (?year)

Try it!

Fréquentation/patronage of (x) airports with only total passenger statEdit

SELECT ?item ?itemLabel ?year ?where
(sample(?number) as ?number)
WHERE {
 values ?item {wd:Q1049719} .
 ?item p:P3872 ?statement.
 ?statement pq:P585 ?time.
 ?statement pq:P518 ?where.
 ?statement ps:P3872 ?number.
 bind (YEAR(?time) AS ?year)
 FILTER(?year>=1979) .
 filter(?where= wd:Q2165236).
 SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
 MINUS { ?statement wikibase:rank wikibase:DeprecatedRank }
} group by ?year ?item ?itemLabel ?where ?whereLabel
order by ?item desc (?year)

Try it!

Fréquentation patronage of x airports that have data for 2017 but not 2018Edit

SELECT ?item ?itemLabel ?pays ?paysLabel (SUM(?number) AS ?numbers) WHERE {
  ?item wdt:P31/wdt:P279* wd:Q1248784;
    p:P3872 ?statement.
  ?statement pq:P585 ?value.
   ?statement ps:P3872 ?number.
  FILTER(("2016-12-31"^^xsd:dateTime < ?value) && ("2018-00-00"^^xsd:dateTime > ?value))
  MINUS {
    ?item p:P3872 ?statement2.
    ?statement2 pq:P585 ?value2.
    FILTER(("2017-12-31"^^xsd:dateTime < ?value2) && ("2019-00-00"^^xsd:dateTime > ?value2))
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?item wdt:P17 ?pays. }
}
GROUP BY ?item ?itemLabel ?pays ?paysLabel
ORDER BY DESC(?numbers)

Try it!

Fréquentation patronage of x airports that have data for 2018 but not 2019Edit

SELECT ?item ?itemLabel ?pays ?paysLabel (max(?value) as ?DateMax) (SUM(?number) AS ?numbers) WHERE {
  ?item wdt:P31/wdt:P279* wd:Q1248784;
    p:P3872 ?statement.
  ?statement pq:P585 ?value.
   ?statement ps:P3872 ?number.
  FILTER(("2017-12-31"^^xsd:dateTime < ?value) && ("2019-00-00"^^xsd:dateTime > ?value))
  MINUS {
    ?item p:P3872 ?statement2.
    ?statement2 pq:P585 ?value2.
    FILTER(("2018-12-31"^^xsd:dateTime < ?value2) && ("2020-00-00"^^xsd:dateTime > ?value2))
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,en". }
  OPTIONAL { ?item wdt:P17 ?pays. }
}
GROUP BY ?item ?itemLabel ?pays ?paysLabel
ORDER BY DESC(?paysLabel) desc(?numbers)

Try it!