query-ab251b50b07e7afb66bf7c8c7982c676
Dédoublonnage USA v2
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX bd: <http://www.bigdata.com/rdf#>
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
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?IATA"):::projected
v8("?ICAO"):::projected
v15("?Local_Code"):::projected
v5("?_coord")
v7("?_lat")
v6("?_long")
v2("?airport"):::projected
v3("?airportLabel"):::projected
v12("?coord"):::projected
v16("?dist"):::projected
v14("?lat"):::projected
v11("?loc")
v1("?locLabel"):::projected
v13("?long"):::projected
v15("?pole")
a2((" "))
a3((" "))
a1((" "))
a4((" "))
a5((" "))
a6((" "))
a7((" "))
a8((" "))
a9((" "))
a10((" "))
a11((" "))
c9(["wd:Q7373622"]):::iri
c10(["wd:Q2265915"]):::iri
c5(["wd:Q30"]):::iri
c14(["p:novalue/P17"]):::iri
c25(["wd:Q10864048"]):::iri
c3(["wd:Q62447"]):::iri
c29(["bd:serviceParam"]):::iri
c26(["wd:Q934"]):::iri
c8(["wd:Q1311670"]):::iri
c31(["en,fr,#91;AUTO_LANGUAGE#93;"]):::literal
c12(["wd:Q782667"]):::iri
c15(["wikibase:BestRank"]):::iri
c11(["wd:Q44665966"]):::iri
v2 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c3
v2 --"p:direct/P17"--> c5
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P576"--> a2
end
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P582"--> a3
end
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P31"--> a4
a4 --"p:direct/P279"--> c8
end
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P31"--> a5
a5 --"p:direct/P279"--> c9
end
subgraph minus4["MINUS"]
style minus4 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P31"--> a6
a6 --"p:direct/P279"--> c10
end
subgraph minus5["MINUS"]
style minus5 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P31"--> a7
a7 --"p:direct/P279"--> c11
end
subgraph minus6["MINUS"]
style minus6 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P31"--> a8
a8 --"p:direct/P279"--> c12
end
subgraph minus7["MINUS"]
style minus7 stroke-width:6px,fill:pink,stroke:red;
v2 --"a"--> c14
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
a9 -."a".-> c15
a9 --"p:statement/P625"--> v5
a10 --"wikibase:geoLongitude"--> v6
a10 --"wikibase:geoLatitude"--> v7
a9 --"p:statement/value/P625"--> a10
v2 --"p:P625"--> a9
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P239".-> v8
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P238".-> v9
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P240".-> v15
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P131".-> v11
v11 --"p:direct/P31"--> a11
a11 --"p:direct/P279"--> c25
end
bind12[/"sample(?_coord)"/]
v5 --o bind12
bind12 --as--o v12
bind13[/"sample(?_long)"/]
v6 --o bind13
bind13 --as--o v13
bind14[/"sample(?_lat)"/]
v7 --o bind14
bind14 --as--o v14
bind15[/"sample(?Local_Code)"/]
v15 --o bind15
bind15 --as--o v15
c26 --"p:direct/P625"--> v15
bind16[/"http://www.opengis.net/def/function/geosparql/distance(?pole,?coord)"/]
v15 --o bind16
v12 --o bind16
bind16 --as--o v16
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c29 --"wikibase:language"--> c31
end