query-c6883892453f8d80c8e491f40e185ced

rq turtle/ttl

Patronage of airport(s) that have data for 2020 but not 2021

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
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/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?pays ?paysLabel (max(?value) as ?DateMax) (SUM(?number) AS ?numbers) WHERE {
  ?item wdt:P31/wdt:P279* wd:Q1248784;
         wdt:P5817 wd:Q55654238;
    p:P3872 ?statement.
  ?statement pq:P585 ?value; ps:P3872 ?number.
  FILTER(("2019-12-31"^^xsd:date < ?value) && ("2021-00-00"^^xsd:date > ?value))
  MINUS {
    ?item p:P3872 ?statement2.
    ?statement2 pq:P585 ?value2.
    FILTER(("2020-12-31"^^xsd:date < ?value2) && ("2022-00-00"^^xsd:date > ?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)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v10("?DateMax") v4("?item"):::projected v6("?number"):::projected v11("?numbers") v9("?pays"):::projected v1("?paysLabel"):::projected v5("?statement") v8("?statement2") v3("?value"):::projected v7("?value2") a1((" ")) c7(["wd:Q55654238"]):::iri c16(["#91;AUTO_LANGUAGE#93;,fr,en"]):::literal c5(["wd:Q1248784"]):::iri c14(["bd:serviceParam"]):::iri f0[["'2019-12-31^^xsd:date' < ?value'2021-00-00^^xsd:date' > ?value"]] f0 --> v3 v4 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c5 v4 --"p:direct/P5817"--> c7 v4 --"p:P3872"--> v5 v5 --"p:qualifier/P585"--> v3 v5 --"p:statement/P3872"--> v6 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; f2[["'2020-12-31^^xsd:date' < ?value2'2022-00-00^^xsd:date' > ?value2"]] f2 --> v7 v4 --"p:P3872"--> v8 v8 --"p:qualifier/P585"--> v7 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:direct/P17".-> v9 end bind5[/"max(?value)"/] v3 --o bind5 bind5 --as--o v10 bind6[/"sum(?number)"/] v6 --o bind6 bind6 --as--o v11