query-77d2fa537f164ec710b40a949f743e62

rq turtle/ttl

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

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 (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:date < ?value) && ("2018-00-00"^^xsd:date > ?value))
  MINUS {
    ?item p:P3872 ?statement2.
    ?statement2 pq:P585 ?value2.
    FILTER(("2017-12-31"^^xsd:date < ?value2) && ("2019-00-00"^^xsd:date > ?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)

Query found at

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