User:Bouzinac

From Wikidata
Jump to navigation Jump to search
Google-refine-logo.svgThis user loves OpenRefine.
Babel user information
en-5 This user has professional knowledge of English.
fr-N Cet utilisateur a pour langue maternelle le français.
de-2 Dieser Benutzer beherrscht Deutsch auf fortgeschrittenem Niveau.
es-0 Este usuario no tiene ningún conocimiento del español (o lo entiende con mucha dificultad).
it-0 Questo utente non è in grado di comunicare in italiano (o lo capisce solo con notevole difficoltà).
br-0 Ne oar an implijer-mañ tamm Brezhoneg ebet (pe en deus mil boan o kompren anezhañ).
Users by language

Contents

Harvest[edit]

https://tools.wmflabs.org/pltools/harvesttemplates/share.php?action=savenew&siteid=ceb&project=wikipedia&namespace=0&property=131&template=geobox&parameter=region&addprefix=&removeprefix=&category=Mga%20tugpahanan%20sa%20Tinipong%20Bansa&depth=2&set=1&offset=0&limit=10000&wikisyntax=0&

Ontologie des aéroports/Airport ontology in Wikidata[edit]

SELECT ?class ?classLabel (SAMPLE(?item) AS ?sample) WHERE {
  ?class wdt:P279+ wd:Q62447.
  OPTIONAL { ?item wdt:P31 ?class. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?class ?classLabel

Try it!

Voir aussi :

Classification of the class aerodrome (Q62447) View with Reasonator View with SQID
For help about classification, see Wikidata:Classification.
parent classes (classes of items which contain this one item) 
subclasses (classes which contain special kinds of items of this class)
<aerodrome> on wikidata tree visualisation (external tool)(depth=1)
Miga external tool (does not work in Firefox) 
listing of subclasses, number of super and subclasses, properties of the instances: <aerodrome> on Miga
Browse the classes starting from this one 
Browse classes from < aerodrome > with Taxonomy Browser

Sous-classes d'aérodrome.

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 country[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) airports with international ,domestic, total stat[edit]

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 code[edit]

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 stat[edit]

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 2018[edit]

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!

Whole wiki items that have an airport IATA/ICAO/FAA/DGAC/TC_LID code[edit]

Better in Chrome navigator

PREFIX schema: <http://schema.org/>
SELECT  ?item ?itemLabel ?natureLabel ?countryLabel ?IATA ?ICAO (SAMPLE(?Local_Code) AS ?Local_Code)
WHERE {
  OPTIONAL { ?item wdt:P238 ?IATA. }
  OPTIONAL { ?item wdt:P239 ?ICAO. }
  OPTIONAL { ?item wdt:P17 ?country. }
  OPTIONAL { ?item wdt:P240  ?Local_Code. }
  OPTIONAL { ?item wdt:P5699 ?Local_Code. }
  OPTIONAL { ?item wdt:P5746 ?Local_Code. }
  OPTIONAL { ?item wdt:P5851 ?Local_Code. }
  OPTIONAL { ?item wdt:P6120 ?Local_Code. }
  OPTIONAL { ?item wdt:P31 ?nature. }
  MINUS    { ?item wdt:P576 [].}                    # remove items with P576 (dissolved, abolished or demolished) as a main property
  MINUS    { ?item wdt:P582 [].}                    # remove items with P582 (end date) as a main property
  MINUS    { ?item (wdt:P31/wdt:P279*) wd:Q782667. } # exclude motorways where plane can land
  MINUS    { ?item wdt:P31/wdt:P279* wd:Q44665966.} # exclude  airports being build
  MINUS    { ?item wdt:P31/wdt:P279* wd:Q2265915.}  # exclude vol à voile/gliders
  MINUS    { ?item (wdt:P31/wdt:P279*) wd:Q502074. }               # exclude héliports
  MINUS    { ?item a wdno:P17.}                    #exclude airports that aren't physically based in a country
  FILTER( ?item not in 
  (wd:Q60972, wd:Q2886531,wd:Q176146, wd:Q323983, wd:Q388394, wd:Q472049, wd:Q473055, wd:Q576617, wd:Q577946, wd:Q619976, wd:Q649929, wd:Q761001, wd:Q768542, wd:Q939039, wd:Q955268, wd:Q1031829, wd:Q1032113, wd:Q1095676, wd:Q1148639, wd:Q1298115, wd:Q1338960, wd:Q1350451, wd:Q1403609, wd:Q1416857, wd:Q1433509, wd:Q1444594, wd:Q1493010, wd:Q1529149, wd:Q1636887, wd:Q1654635, wd:Q1656800, wd:Q1657595, wd:Q1658031, wd:Q1658500, wd:Q1751264, wd:Q1800787, wd:Q1836818, wd:Q1836849, wd:Q1893607, wd:Q2026702, wd:Q2360285, wd:Q2361539, wd:Q2371958, wd:Q2602457, wd:Q2663480, wd:Q2872473, wd:Q2886451, wd:Q2886460, wd:Q2886467, wd:Q2886488, wd:Q2886489, wd:Q2886504, wd:Q2886563, wd:Q2886566, wd:Q2886568, wd:Q2902833, wd:Q3196747, wd:Q3218170, wd:Q3499338, wd:Q3612693, wd:Q3635552, wd:Q3887690, wd:Q4115006, wd:Q4115518, wd:Q4257441, wd:Q4381026, wd:Q4402324, wd:Q5135044, wd:Q5365417, wd:Q5453767, wd:Q5607481, wd:Q5669602, wd:Q5721555, wd:Q5721576, wd:Q5733903, wd:Q5753943, wd:Q5754926, wd:Q6358138, wd:Q6413305, wd:Q6747097, wd:Q6906023, wd:Q7158431, wd:Q7188237, wd:Q7242494, wd:Q7274959, wd:Q7274976, wd:Q7277289, wd:Q7331905, wd:Q7368132, wd:Q7419397, wd:Q7419671, wd:Q7427836, wd:Q7580932, wd:Q7930596, wd:Q7942651, wd:Q7966282, wd:Q7969333, wd:Q7992372, wd:Q8243338, wd:Q8243340, wd:Q10822643, wd:Q10853535, wd:Q10860387, wd:Q10860397, wd:Q10860400, wd:Q10860405, wd:Q14679983, wd:Q14709491, wd:Q15221694, wd:Q17082712, wd:Q17512364, wd:Q18126343, wd:Q19406831, wd:Q19828268, wd:Q19873178, wd:Q21005896, wd:Q21016007
   , wd:Q56289584  ,wd:Q2886531,wd:Q660972,wd:Q7960223,wd:Q801410,wd:Q801410,wd:Q3271057,wd:Q3612309,wd:Q3015996,wd:Q4860232,wd:Q4651415
,wd:Q1031183,wd:Q441476,wd:Q441476,wd:Q19574887,wd:Q7460182,wd:Q4380750,wd:Q3015119,wd:Q7275460,wd:Q10845888,wd:Q14707052,wd:Q5038426,wd:Q704394,wd:Q704394,wd:Q156971,wd:Q18618942
,wd:Q1427413,wd:Q1835479,wd:Q371816,wd:Q3274819,wd:Q1433608,wd:Q3017040,wd:Q3913284,wd:Q16899355,wd:Q1766303,wd:Q1766303,wd:Q138896,wd:Q3207485,wd:Q681505,wd:Q1433649,wd:Q12694367
,wd:Q3015575,wd:Q2900666,wd:Q3014539,wd:Q2628568,wd:Q6344047,wd:Q1082819,wd:Q325491,wd:Q5659239,wd:Q6516685,wd:Q1655754,wd:Q706994
,wd:Q706994,wd:Q2071294,wd:Q1407551,wd:Q1030738,wd:Q1030738,wd:Q1031547,wd:Q3015041,wd:Q28449604,wd:Q1031594,wd:Q1031594,wd:Q3016361
,wd:Q7275582,wd:Q1654943,wd:Q3014320,wd:Q5065943,wd:Q3015462,wd:Q1800390,wd:Q784017,wd:Q3271311,wd:Q1498314,wd:Q7199307,wd:Q4651612,wd:Q2828202,wd:Q723474,wd:Q1164127,wd:Q174247,wd:Q7275708
,wd:Q47465,wd:Q47465,wd:Q960480,wd:Q2886509,wd:Q980034,wd:Q1780219,wd:Q8190944,wd:Q1513045,wd:Q3298050
,wd:Q3271063,wd:Q3234808,wd:Q1940767,wd:Q1520213,wd:Q18157236,wd:Q18157236,wd:Q7944502,wd:Q12694595,wd:Q2625576,wd:Q7940661,wd:Q3014516,wd:Q2318365,wd:Q6694741,wd:Q3696011,wd:Q652085,wd:Q8058641,wd:Q8058641,wd:Q1030442
,wd:Q1433506,wd:Q1433636)
         )#Exclude military airports sharing same IATA code than another civilian airport
  FILTER( ?IATA not in ( "LON","PAR","NYC","TYO","MOW","BUH" ,"BUE" ,"CHI", "JKT" ,"MIL", "YMQ" ,"OSA", "RIO" ,"ROM" ,"SAO" ,"SPK" ,"SEL", "STO", "YTO" ,"WAS") )  #exclude metropolitan city codes                                                
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". }
} GROUP BY ?item ?itemLabel ?natureLabel ?countryLabel ?ICAO ?IATA
ORDER BY ?country ?natureLabel

Try it!

All airports, sorted by country[edit]

PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?airport ?airportLabel ?pays ?paysLabel (SAMPLE(?coord) AS ?coord) ?ICAO ?IATA (SAMPLE(?Local_Code) AS ?Local_Code) WHERE {
  ?airport (wdt:P31/wdt:P279*) wd:Q62447.
  MINUS { ?airport wdt:P576 _:b2. }                                # remove items with P576 (dissolved, abolished or demolished) as a main property
  MINUS { ?airport wdt:P582 _:b3. }                                # remove items with P582 (end date) as a main property
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q695850. }               # exclude military airports
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q1311670. }              # exclude railways stations
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q7373622. }              # exclude Royal Air Force
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q502074. }               # exclude héliports
  MINUS { ?airport wdt:P31/wdt:P279* wd:Q2265915.}                 # exclude vol à voile/gliders
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q44665966. }             # exclude  airports being build
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q782667. }               # exclude motorways where plane can land
  MINUS { ?airport a wdno:P17.}                                    # exclude airports that aren't physically based in a country
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,[AUTO_LANGUAGE]". }
  OPTIONAL { ?airport wdt:P625  ?coord. }
  OPTIONAL { ?airport wdt:P239  ?ICAO. }
  OPTIONAL { ?airport wdt:P238  ?IATA. }
  optional { ?airport wdt:P17   ?pays.}
  OPTIONAL { ?airport wdt:P240  ?Local_Code. }
  OPTIONAL { ?airport wdt:P5699 ?Local_Code. }
  OPTIONAL { ?airport wdt:P5746 ?Local_Code. }
  OPTIONAL { ?airport wdt:P5851 ?Local_Code. }
  OPTIONAL { ?airport wdt:P6120 ?Local_Code. }
}
GROUP BY ?airport ?airportLabel ?ICAO ?IATA ?pays ?paysLabel
ORDER BY ?paysLabel ?coord

Try it!

Airports in a country[edit]

PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?airport ?airportLabel (SAMPLE(?coord) AS ?coord) ?ICAO ?IATA (SAMPLE(?Local_Code) AS ?Local_Code) WHERE {
  ?airport (wdt:P31/wdt:P279*) wd:Q62447.
  ?airport wdt:P17 wd:Q414.
  MINUS { ?airport wdt:P576 _:b2. }                                # remove items with P576 (dissolved, abolished or demolished) as a main property
  MINUS { ?airport wdt:P582 _:b3. }                                # remove items with P582 (end date) as a main property
#  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q695850. }               # exclude military airports
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q1311670. }              # exclude railways stations
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q7373622. }              # exclude Royal Air Force
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q502074. }               # exclude héliports
  MINUS { ?airport wdt:P31/wdt:P279* wd:Q2265915.}                 # exclude vol à voile/gliders
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q44665966. }             # exclude  airports being build
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q782667. }               # exclude motorways where plane can land
  MINUS { ?airport a wdno:P17.}                                    # exclude airports that aren't physically based in a country
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,[AUTO_LANGUAGE]". }
  OPTIONAL { ?airport wdt:P625  ?coord. }
  OPTIONAL { ?airport wdt:P239  ?ICAO. }
  OPTIONAL { ?airport wdt:P238  ?IATA. }
  OPTIONAL { ?airport wdt:P240  ?Local_Code. }
  OPTIONAL { ?airport wdt:P5699 ?Local_Code. }
  OPTIONAL { ?airport wdt:P5746 ?Local_Code. }
  OPTIONAL { ?airport wdt:P5851 ?Local_Code. }
  OPTIONAL { ?airport wdt:P6120 ?Local_Code. }
}
GROUP BY ?airport ?airportLabel ?ICAO ?IATA
ORDER BY ?coord

Try it!

Airports in the US[edit]

PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

#  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q695850. }               # exclude military airports
SELECT DISTINCT ?localisation_administrativeLabel ?airport ?airportLabel (SAMPLE(?coord) AS ?coord) ?ICAO ?IATA (SAMPLE(?Local_Code) AS ?Local_Code)  WHERE {
  ?airport (wdt:P31/wdt:P279*) wd:Q62447.
  ?airport wdt:P17 wd:Q30.
  MINUS { ?airport wdt:P576 _:b2. }
  MINUS { ?airport wdt:P582 _:b3. }
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q1311670. }
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q7373622. }
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q502074. }
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q2265915. }
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q44665966. }
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q782667. }
  MINUS { ?airport rdf:type wdno:P17. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,[AUTO_LANGUAGE]". }
  OPTIONAL { ?airport wdt:P625 ?coord. }
  OPTIONAL { ?airport wdt:P239 ?ICAO. }
  OPTIONAL { ?airport wdt:P238 ?IATA. }
  OPTIONAL { ?airport wdt:P240 ?Local_Code. }
  OPTIONAL {
    ?airport wdt:P131* ?localisation_administrative.
    ?localisation_administrative wdt:P31 ?type.
    ?type wdt:P279 wd:Q35657.
  }
}
GROUP BY ?airport ?airportLabel ?ICAO ?IATA ?localisation_administrative ?localisation_administrativeLabel
ORDER BY ?coord

Try it!

Dédoublonnage USA[edit]

PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT DISTINCT ?localisation_administrativeLabel ?airport ?airportLabel (SAMPLE(?coord) AS ?coord) ?ICAO ?IATA (SAMPLE(?Local_Code) AS ?Local_Code) WHERE {
 ?airport (wdt:P31/wdt:P279*) wd:Q62447.
?airport wdt:P17 wd:Q30.
MINUS { ?airport wdt:P576 _:b2. }
MINUS { ?airport wdt:P582 _:b3. }
MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q1311670. }
MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q7373622. }
MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q2265915. }
MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q44665966. }
MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q782667. }
MINUS { ?airport rdf:type wdno:P17. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,[AUTO_LANGUAGE]". }
OPTIONAL { ?airport wdt:P625 ?coord. }
OPTIONAL { ?airport wdt:P239 ?ICAO. }
OPTIONAL { ?airport wdt:P238 ?IATA. }
OPTIONAL { ?airport wdt:P240 ?Local_Code. }
OPTIONAL {
?airport wdt:P131* ?localisation_administrative.
?localisation_administrative wdt:P31 ?type.
?type wdt:P279* wd:Q35657.
}
}
GROUP BY ?airport ?airportLabel ?ICAO ?IATA ?localisation_administrative ?localisation_administrativeLabel
ORDER BY ?coord

Try it!

Dédoublonnage USA v2[edit]

PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT DISTINCT ?locLabel ?airport ?airportLabel ?coord ?long ?lat ?ICAO ?IATA ?Local_Code ?dist
{
  {
  SELECT DISTINCT ?loc ?airport (SAMPLE(?_coord) AS ?coord) (SAMPLE(?_long) AS ?long) (SAMPLE(?_lat) AS ?lat) ?ICAO ?IATA (SAMPLE(?Local_Code) AS ?Local_Code)
  {
    ?airport wdt:P31/(wdt:P279*) wd:Q62447;
      wdt:P17 wd:Q30.
    MINUS { ?airport wdt:P576 _:b2. }
    MINUS { ?airport wdt:P582 _:b3. }
    MINUS { ?airport wdt:P31/(wdt:P279*) wd:Q1311670. }
    MINUS { ?airport wdt:P31/(wdt:P279*) wd:Q7373622. }
    MINUS { ?airport wdt:P31/(wdt:P279*) wd:Q2265915. }
    MINUS { ?airport wdt:P31/(wdt:P279*) wd:Q44665966. }
    MINUS { ?airport wdt:P31/(wdt:P279*) wd:Q782667. }
    MINUS { ?airport rdf:type wdno:P17. }
    OPTIONAL {
      ?airport p:P625 [
        a wikibase:BestRank; ps:P625 ?_coord;
        psv:P625 [ wikibase:geoLongitude ?_long; wikibase:geoLatitude ?_lat ]
      ] .
    } .
    OPTIONAL { ?airport wdt:P239 ?ICAO. }
    OPTIONAL { ?airport wdt:P238 ?IATA. }
    OPTIONAL { ?airport wdt:P240 ?Local_Code. }
    OPTIONAL {
      ?airport wdt:P131* ?loc.
      #?loc wdt:P31 ?type.
      #?type (wdt:P279*) wd:Q35657.
    ?loc wdt:P31/wdt:P279* wd:Q10864048 .
    } .
  } GROUP BY ?loc ?airport ?ICAO ?IATA
  } .
  wd:Q934 wdt:P625 ?pole .
  BIND( geof:distance( ?pole, ?coord ) AS ?dist ) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,[AUTO_LANGUAGE]". }
}
ORDER BY ?locLabel ?airport ?airportLabel  ?dist

Try it!

Dédoublonnage USA v3[edit]

PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT DISTINCT ?airport ?airportLabel ?coord ?long ?lat ?ICAO ?IATA ?Local_Code ?dist
{
  {
  SELECT DISTINCT  ?airport (SAMPLE(?_coord) AS ?coord) (SAMPLE(?_long) AS ?long) (SAMPLE(?_lat) AS ?lat) ?ICAO ?IATA (SAMPLE(?Local_Code) AS ?Local_Code)
  {
   ?airport wdt:P31/(wdt:P279*) wd:Q62447.
   ?airport wdt:P131* ?loc.
   ?loc wdt:P131/wdt:P279* wd:Q797 .
    MINUS { ?airport wdt:P576 _:b2. }
    MINUS { ?airport wdt:P582 _:b3. }
    MINUS { ?airport wdt:P31/(wdt:P279*) wd:Q1311670. }
    MINUS { ?airport wdt:P31/(wdt:P279*) wd:Q7373622. }
    MINUS { ?airport wdt:P31/(wdt:P279*) wd:Q2265915. }
    MINUS { ?airport wdt:P31/(wdt:P279*) wd:Q44665966. }
    MINUS { ?airport wdt:P31/(wdt:P279*) wd:Q782667. }
    MINUS { ?airport rdf:type wdno:P17. }
    OPTIONAL {
      ?airport p:P625 [
        a wikibase:BestRank; ps:P625 ?_coord;
        psv:P625 [ wikibase:geoLongitude ?_long; wikibase:geoLatitude ?_lat ]
      ] .
    } .
    OPTIONAL { ?airport wdt:P239 ?ICAO. }
    OPTIONAL { ?airport wdt:P238 ?IATA. }
    OPTIONAL { ?airport wdt:P240 ?Local_Code. }
  } GROUP BY ?airport ?ICAO ?IATA
  } .
  wd:Q1012298 wdt:P625 ?centreUSA .
  BIND( geof:distance( ?centreUSA, ?coord ) AS ?dist ) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,ceb,[AUTO_LANGUAGE]". }
}
ORDER BY  ?airportLabel

Try it!

Airports in a country with a text search[edit]

PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?airport ?airportLabel (SAMPLE(?coord) AS ?coord) ?ICAO ?IATA (SAMPLE(?Local_Code) AS ?Local_Code) WHERE {
  ?airport (wdt:P31/wdt:P279*) wd:Q62447.
  ?airport wdt:P17 wd:Q414.
  MINUS { ?airport wdt:P576 _:b2. }                                # remove items with P576 (dissolved, abolished or demolished) as a main property
  MINUS { ?airport wdt:P582 _:b3. }                                # remove items with P582 (end date) as a main property
#  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q695850. }               # exclude military airports
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q1311670. }              # exclude railways stations
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q7373622. }              # exclude Royal Air Force
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q502074. }               # exclude héliports
  MINUS { ?airport wdt:P31/wdt:P279* wd:Q2265915.}                 # exclude vol à voile/gliders
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q44665966. }             # exclude  airports being build
  MINUS { ?airport (wdt:P31/wdt:P279*) wd:Q782667. }               # exclude motorways where plane can land
  MINUS { ?airport a wdno:P17.}                                    # exclude airports that aren't physically based in a country
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,[AUTO_LANGUAGE]". }
  OPTIONAL { ?airport wdt:P625  ?coord. }
  OPTIONAL { ?airport wdt:P239  ?ICAO. }
  OPTIONAL { ?airport wdt:P238  ?IATA. }
  OPTIONAL { ?airport wdt:P240  ?Local_Code. }
  OPTIONAL { ?airport wdt:P5699 ?Local_Code. }
  OPTIONAL { ?airport wdt:P5746 ?Local_Code. }
  OPTIONAL { ?airport wdt:P5851 ?Local_Code. }
  OPTIONAL { ?airport wdt:P6120 ?Local_Code. }
FILTER(CONTAINS(LCASE(?airportLabel ), "keyword"))
}
GROUP BY ?airport ?airportLabel ?ICAO ?IATA
ORDER BY ?coord

Try it!

Look after a/some specific IATA code(s)[edit]

SELECT distinct ?item ?itemLabel ?natureLabel WHERE {
{?item wdt:P238 ?IATA
VALUES ?IATA { "AMS" "BOO" }.} #item has a P238 value   
  OPTIONAL { ?item wdt:P31 ?nature. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } . #this bit gets labels for Qid values
}

Try it!

Look after a/some specific ICAO code(s)[edit]

SELECT distinct ?item ?itemLabel ?natureLabel WHERE {
{?item wdt:P239 ?ICAO 
VALUES ?ICAO { "HKKG" }.} #item has a P239 value  
OPTIONAL { ?item wdt:P31 ?nature. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } . #this bit gets labels for Qid values
}

Try it!

Look after a/some specific FAA (USA) code(s)[edit]

SELECT distinct ?item ?itemLabel ?natureLabel WHERE {
{?item wdt:P240 ?FAA_LID
VALUES ?FAA_LID { "00AK" }.} #item has a P239 value   
OPTIONAL { ?item wdt:P31 ?nature. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } . #this bit gets labels for Qid values
}

Try it!

Check wiki airport element having neither IATA nor ICAO nor FAA LID[edit]

SELECT DISTINCT ?airport ?airportlabel ?pays ?paysLabel WHERE {
  ?airport (wdt:P31/wdt:P279*) wd:Q62447.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr,de,kk". }
  FILTER(NOT EXISTS { ?airport wdt:P239 ?icao. })
  FILTER(NOT EXISTS { ?airport wdt:P238 ?iata. })
  FILTER(NOT EXISTS { ?airport wdt:P240 ?FAA. })
  FILTER(NOT EXISTS { ?airport wdt:P5699 ?tc_cad.})
  FILTER(NOT EXISTS { ?airport wdt:P5746 ?DGAC.})
  FILTER(NOT EXISTS { ?airport wdt:P5851 ?russ. })
  FILTER(NOT EXISTS { ?airport wdt:P6120 ?argent. })

  FILTER NOT EXISTS { ?airport p:P239 [rdf:type wdno:P239].} #we do not want the ?item if ICAO has a <no value>   
  MINUS {?airport wdt:P576 [].} # remove items with P576 (dissolved, abolished or demolished) as a main property
  MINUS {?airport wdt:P582 [].} # remove items with P582 (end date) as a main property
  MINUS {?airport wdt:P31/wdt:P279* wd:Q695850.} # exclude military airports
  MINUS {?airport wdt:P31/wdt:P279* wd:Q2265915.}  # exclude vol à voile
  MINUS {?airport wdt:P31/wdt:P279* wd:Q1311670.}  # exclude railways stations
  MINUS {?airport a wdno:P17.}                                    #exclude airports that aren't physically based in a country
  MINUS {?airport wdt:P31/wdt:P279* wd:Q7373622.}  # exclude Royal Air Force
  MINUS {?airport (wdt:P31/wdt:P279*) wd:Q782667. } # exclude motorways where plane can land
  minus {?airport wdt:P31/wdt:P279* wd:Q502074.}   # exclude héliports
  minus {?airport wdt:P31/wdt:P279* wd:Q44665966.}   # exclude airports in project
  OPTIONAL {?airport wdt:P17 ?pays. }
} order by ?paysLabel

Try it!

List all elements close to a wikielement[edit]

Add #defaultView:Map pour avoir la carte

SELECT ?place ?placeLabel ?location ?instanceLabel ?dist WHERE {
  wd:Q7901873 wdt:P625 ?loc .
  SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center ?loc .
      bd:serviceParam wikibase:radius 10 . # in kilometers
  }
  OPTIONAL { 
    ?place wdt:P31 ?instance .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
  BIND(geof:distance(?loc, ?location) AS ?dist) .
} ORDER BY ASC(?dist)

Try it!

List all elements close to a GPS point[edit]

#defaultView:Map
SELECT ?place ?placeLabel ?location ?instanceLabel ?dist WHERE {
  SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center "Point(24.71304 10.2059)"^^geo:wktLiteral .
      bd:serviceParam wikibase:radius 30 . # in kilometers
  }
  OPTIONAL { 
    ?place wdt:P31 ?instance .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
  BIND(geof:distance(?loc, ?location) AS ?dist) .
} ORDER BY ASC(?dist)

Try it!

Elements that are inside a rectangle (East/West/North/South)[edit]

#defaultView:Map
SELECT ?item ?country ?coord {
  VALUES ?country { wd:Q258 } .
  ?country p:P1332 [ ps:P1332 ?north; psv:P1332 ?nValue ];
           p:P1333 [ ps:P1333 ?south; psv:P1333 ?sValue ];
           p:P1334 [ ps:P1334 ?east;  psv:P1334 ?eValue ];
           p:P1335 [ ps:P1335 ?west;  psv:P1335 ?wValue ].
  ?nValue wikibase:geoLatitude  ?nLat . hint:Prior hint:rangeSafe true .
  ?sValue wikibase:geoLatitude  ?sLat . hint:Prior hint:rangeSafe true .
  ?eValue wikibase:geoLongitude ?eLon . hint:Prior hint:rangeSafe true .
  ?wValue wikibase:geoLongitude ?wLon . hint:Prior hint:rangeSafe true .
  ?item p:P625 [ a wikibase:BestRank; ps:P625 ?coord; psv:P625 ?cValue ] .
  ?cValue wikibase:geoLatitude  ?lat  . hint:Prior hint:rangeSafe true .
  ?cValue wikibase:geoLongitude ?lon  . hint:Prior hint:rangeSafe true .
  ?cValue  wikibase:geoGlobe ?globe . hint:Prior hint:rangeSafe true .
  BIND(COALESCE(?globe,wd:Q2) as ?Globe)
  FILTER (?Globe =wd:Q2)
  MINUS { ?item wdt:P17 [] } .  
  MINUS { ?item (wdt:P31/wdt:P279*) wd:Q4830453. }              # exclude ENTREPRISES
  MINUS { ?item (wdt:P31/wdt:P279*) wd:Q15893266. }              # exclude old entities
  MINUS { ?item wdt:P576 _:b2. }                                # remove items with P576 (dissolved, abolished or demolished) as a main property
  FILTER( ?sLat < ?lat && ?lat < ?nLat-6 ) .
  FILTER( ?wLon < ?lon && ?lon < ?eLon ) .
}

Try it!

Max East/West/North/South for each country[edit]

SELECT distinct ?pays ?paysLabel ?coord_max_nord ?coord_max_sud ?coord_max_ouest ?coord_max_est WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?pays wdt:P31 wd:Q6256.
  OPTIONAL { ?pays wdt:P1332 ?coord_max_nord. }
  OPTIONAL { ?pays wdt:P1333 ?coord_max_sud. }
  OPTIONAL { ?pays wdt:P1335 ?coord_max_ouest. }
  OPTIONAL { ?pays wdt:P1334 ?coord_max_est. }
    MINUS { ?pays wdt:P576 _:b2. }
    MINUS { ?pays wdt:P582 _:b3. }
}order by ?paysLabel

Try it!

Elements that are close from a centroïd[edit]

#defaultView:Map
SELECT ?item ?country ?coord ?dist {
  hint:Query hint:optimizer "None" .
  VALUES ?country { wd:Q40 } .
  OPTIONAL{?country wdt:P5140 ?centerGeog .}
  OPTIONAL{?country wdt:P625 ?Coords .}
   BIND(COALESCE(?centerGeog,?Coords) as ?center)
  SERVICE wikibase:around {
    ?item wdt:P625 ?coord .
    bd:serviceParam wikibase:center ?center .
    bd:serviceParam wikibase:radius "50" .
    bd:serviceParam wikibase:distance ?dist .
    bd:serviceParam wikibase:geoGlobe ?globe . 
  } .
  BIND(COALESCE(?globe,wd:Q2) as ?Globe)
  FILTER (?Globe =wd:Q2)
  MINUS { ?item wdt:P17 [] } .
MINUS { ?item (wdt:P31/wdt:P279*) wd:Q4830453. }              # exclude ENTREPRISES
MINUS { ?item (wdt:P31/wdt:P279*) wd:Q15893266. }              # exclude old entities
MINUS { ?item wdt:P576 _:b2. } # remove items with P576 (dissolved, abolished or demolished) as a main property
} ORDER BY ?dist

Try it!

List of airports poorly filled[edit]

#item has no P31, search term may occur anywhere in the item record
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?sitelink
WHERE {
?item (wdt:P31/wdt:P279*) wd:Q62447.
MINUS { ?item wdt:P625 ?coord. }
    MINUS { ?item wdt:P576 _:b2. }                                # remove items with P576 (dissolved, abolished or demolished) as a main property
  MINUS { ?item wdt:P582 _:b3. }                                # remove items with P582 (end date) as a main property
  MINUS { ?item (wdt:P31/wdt:P279*) wd:Q695850. }               # exclude military airports
  MINUS { ?item (wdt:P31/wdt:P279*) wd:Q1311670. }              # exclude railways stations
  MINUS { ?item (wdt:P31/wdt:P279*) wd:Q7373622. }              # exclude Royal Air Force
  MINUS { ?item (wdt:P31/wdt:P279*) wd:Q502074. }               # exclude héliports
  MINUS { ?item wdt:P31/wdt:P279* wd:Q2265915.}                 # exclude vol à voile/gliders
  MINUS { ?item (wdt:P31/wdt:P279*) wd:Q44665966. }             # exclude  airports being build
  MINUS { ?item (wdt:P31/wdt:P279*) wd:Q782667. }               # exclude motorways where plane can land
  MINUS { ?item a wdno:P17.}                                    # exclude airports that aren't physically based in a country
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!

List all wiki elements without country but with coordinates, close to a geographic center of a country[edit]

#defaultView:List
SELECT ?place ?placeLabel ?location
WHERE
{
wd:Q940798 wdt:P625 ?centerLoc .
SERVICE wikibase:around {
?place wdt:P625 ?location .
bd:serviceParam wikibase:center ?centerLoc .
bd:serviceParam wikibase:radius "250" .
} .
MINUS { ?place wdt:P17 wd:Q142 }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
} 
}

Try it!

Number of countries in the history[edit]

select ?bound (count(?country) as ?count)
with {
 select ?country {
 ?country wdt:P31/wdt:P279* wd:Q3624078 # sovereign states, I don’t know if it’s the right item
 } 
}as %countries
with
{
 select distinct ?bound {
 ?country (wdt:P571|wdt:P576) ?bound. 
 include %countries .
 filter (year(?bound) > 1800)
 }
} as %bounds
where {
 include %bounds .
 include %countries .
 ?country wdt:P571 ?creation .
 optional { ?country wdt:P576 ?dest_maybe . }
 bind (coalesce(?dest_maybe, now()) as ?destruction)
 filter ( ?creation <= ?bound  && ?destruction > ?bound )
} group by ?bound order by ?bound

Try it!

List of countries + nature + time[edit]

select distinct ?country (group_concat(?NatureLabelFr;separator=", ") as ?NatureLabelFr) ?countryLabel  ?creationDate ?dissolutionDate
with {
select ?country (coalesce(?countryLabelFr, ?countryLabelEn,  ?country) as ?countryLabel) ?creationDate ?dissolutionDate{
VALUES ?what { 
               wd:Q3624078 # sovereign states, I don’t know if it’s the right item
               wd:Q3024240 # états historiques
             }
?country wdt:P31/wdt:P279* ?what . 
MINUS { ?country (wdt:P31/wdt:P279*) wd:Q1790360. } #empires coloniaux
MINUS { ?country (wdt:P31/wdt:P279*) wd:Q1371288. } #états vassals
MINUS { ?country (wdt:P31/wdt:P279*) wd:Q21512251. } #états autoproclamés
MINUS { ?country (wdt:P31/wdt:P279*) wd:Q1642488. } #chefferies
optional { ?country rdfs:label ?countryLabelFr filter(lang(?countryLabelFr)= "fr")} .
optional { ?country rdfs:label ?countryLabelEn filter(lang(?countryLabelEn)= "en")}
optional { ?country wdt:P571 ?creationDate }
optional { ?country wdt:P576 ?dissolutionDate }
} order by ?countryLabel
} as %datas
where {
include %datas .
optional{
?country wdt:P31/rdfs:label ?NatureLabelFr filter(lang(?NatureLabelFr)= "fr") .
}
} group by ?country ?countryLabel  ?creationDate ?dissolutionDate

Try it!

transfront[edit]

select 
  ?item ?itemLabel 
  (SAMPLE(?coor) as ?coor)
  (group_concat(DISTINCT ?natureLabel) as ?NATURE) 
  (group_concat(DISTINCT ?paysLabel; separator=", ") as ?PAYS) 
  (group_concat(DISTINCT ?partiedeLabel; separator=" // ") AS ?partiedeL)
WHERE
{  
  {  SELECT ?item ?itemLabel ?nature ?natureLabel ?coor ?pays ?paysLabel ?partiede ?partiedeLabel 
     WHERE
     {
      ?item wdt:P31/wdt:P279* wd:Q25296884 .
  MINUS { ?item (wdt:P31/wdt:P279*) wd:Q4366834. } # exclude cours d'eau
  MINUS { ?item (wdt:P31/wdt:P279*) wd:Q218719. } # exclude contr^le frontalier
  MINUS { ?item wdt:P361 wd:Q3089219. } #Remove maritime borders
  MINUS { ?item (wdt:P31/wdt:P279*) wd:Q1402443. } # exclude railway station border
  MINUS { ?item wdt:P361 wd:Q67218438. } #Remove air borders
  MINUS { ?item wdt:P576 _:b2. }
  MINUS { ?item p:P361 [ps:P361 wd:Q1292279 ; pq:P576 ?P576 ] . }
      ?item wdt:P31 ?nature.
      ?item wdt:P17 ?pays.
      OPTIONAL { ?item wdt:P361 ?partiede }
      OPTIONAL { ?item wdt:P625 ?coor }
       BIND(COALESCE(?partiede,"vide") AS ?variable).
       filter(?variable="vide")
      SERVICE wikibase:label {       bd:serviceParam wikibase:language "fr,en"   }
     } #
  } #
} group by ?item ?itemLabel

Try it!

Borders between European Union and non European countries[edit]

#defaultView:Map
SELECT distinct ?item ?itemLabel ?coord WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?item wdt:P31 wd:Q757292 .#checkpoints
  ?item wdt:P361*/wdt:P31/wdt:P279* wd:Q67147037 . #located on a UE border
  ?item wdt:P17*/wdt:P463* wd:Q458. #in a European Union country
  ?item wdt:P17*/wdt:P463* wd:Q1969730. #Belongs to Schengen zone
  MINUS { ?item wdt:P576 _:b2. } #Remove dissolved
  MINUS { ?item wdt:P361 wd:Q3089219. } #Remove maritime borders
  MINUS { ?item wdt:P361 wd:Q67457910. } #Remove municipal/cities borders
  MINUS { ?item wdt:P361 wd:Q700754. } #Remove RFA-RDA borders
  MINUS { ?item wdt:P361 wd:Q67218438. } #Remove air borders
  OPTIONAL { ?item wdt:P625 ?coord. }
}

Try it!

Borders between Schengen zone and outside Schengen[edit]

#defaultView:Map
SELECT distinct ?item ?itemLabel ?coord WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?item wdt:P31 wd:Q757292 .#checkpoints
  ?item wdt:P361*/wdt:P31/wdt:P279* wd:Q67371697 . #located on a Schengen border
MINUS { ?item wdt:P576 _:b2. } #Remove dissolved
MINUS { ?item wdt:P361 wd:Q17163396. } #Remove open borders
MINUS { ?item wdt:P361 wd:Q3089219. } #Remove maritime borders
MINUS { ?item wdt:P361 wd:Q700754. } #Remove RFA-RDA borders
MINUS { ?item wdt:P361 wd:Q67218438. } #Remove air borders
MINUS { ?item wdt:P361 wd:Q67457910. } #Remove municipal/cities borders
OPTIONAL { ?item wdt:P625 ?coord. }
}

Try it!

Border dots between North Ireland and Ireland[edit]

#defaultView:Map
SELECT ?front ?frontLabel ?nature ?natureLabel ?coord WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?front wdt:P361 wd:Q670200 .
  OPTIONAL { ?front wdt:P31 ?nature. }
  OPTIONAL { ?front wdt:P625 ?coord. }
}       
ORDER BY (?coord )

Try it!