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