query-cdb014d4ef5ed9deda054c867fc3dddf
Units. Q2029174I'm trying to get the qualifier unit labels for the length and width like I am doing with the elavation. I got this far with my query and any other options I tried to move forward I failed to get the length and width unit. I could be using the elevation unit but some airports have elevation in foot and length and width in meters like this one for example
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT
?airportName ?pageBanner ?logo ?icao ?iata ?faa ?website ?operator ?opening ?status ?elevation ?elevationUnitLabel ?image
?runway ?runwayLabel ?lengthValue ?lengthUnitLabel ?widthValue ?widthUnitLabel ?materialLabel
WHERE {
BIND(wd:Q8685 AS ?airport) # JFK International Airport's Wikidata ID
# Fetching general airport information
OPTIONAL { ?airport wdt:P373 ?airportName. }
OPTIONAL { ?airport wdt:P948 ?pageBanner. }
OPTIONAL { ?airport wdt:P154 ?logo. }
OPTIONAL { ?airport wdt:P239 ?icao. }
OPTIONAL { ?airport wdt:P238 ?iata. }
OPTIONAL { ?airport wdt:P240 ?faa. }
OPTIONAL { ?airport wdt:P856 ?website. }
OPTIONAL { ?airport wdt:P137 ?operator. }
OPTIONAL { ?airport wdt:P571 ?opening. }
OPTIONAL { ?airport wdt:P5817 ?status. }
OPTIONAL {
?airport p:P2044 ?elevationStatement.
?elevationStatement psv:P2044 ?elevationValueNode.
?elevationValueNode wikibase:quantityAmount ?elevation.
OPTIONAL {
?elevationValueNode wikibase:quantityUnit ?elevationUnit.
?elevationUnit rdfs:label ?elevationUnitLabel FILTER(LANG(?elevationUnitLabel) = "en")
}
}
OPTIONAL { ?airport wdt:P18 ?image. }
# Fetching runway specific information
OPTIONAL {
?airport p:P529 ?runwayStatement.
?runwayStatement ps:P529 ?runway.
# Accessing the runway label
OPTIONAL {
?runway wdt:P1813 ?runwayLabel.
}
# Accessing the length qualifier
OPTIONAL {
?runwayStatement pq:P2043 ?lengthValue.
}
# Accessing the width qualifier
OPTIONAL {
?runwayStatement pq:P2049 ?widthValue.
}
# Accessing the material qualifier
OPTIONAL {
?runwayStatement pq:P186 ?material.
OPTIONAL { ?material rdfs:label ?materialLabel FILTER(LANG(?materialLabel) = "en") }
}
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?airport")
v2("?airportName"):::projected
v15("?elevation"):::projected
v13("?elevationStatement")
v16("?elevationUnit")
v12("?elevationUnitLabel"):::projected
v14("?elevationValueNode")
v7("?faa"):::projected
v6("?iata"):::projected
v5("?icao"):::projected
v17("?image"):::projected
v21("?lengthValue"):::projected
v4("?logo"):::projected
v24("?material")
v23("?materialLabel"):::projected
v10("?opening"):::projected
v9("?operator"):::projected
v3("?pageBanner"):::projected
v19("?runway"):::projected
v20("?runwayLabel"):::projected
v18("?runwayStatement")
v11("?status"):::projected
v8("?website"):::projected
v22("?widthValue"):::projected
bind0[/"'wd:Q8685'"/]
bind0 --as--o v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P373".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P948".-> v3
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P154".-> v4
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P239".-> v5
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P238".-> v6
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P240".-> v7
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P856".-> v8
end
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P137".-> v9
end
subgraph optional8["(optional)"]
style optional8 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P571".-> v10
end
subgraph optional9["(optional)"]
style optional9 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P5817".-> v11
end
subgraph optional10["(optional)"]
style optional10 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P2044".-> v13
v13 --"p:statement/value/P2044"--> v14
v14 --"wikibase:quantityAmount"--> v15
subgraph optional11["(optional)"]
style optional11 fill:#bbf,stroke-dasharray: 5 5;
v14 -."wikibase:quantityUnit".-> v16
v16 --"rdfs:label"--> v12
end
end
subgraph optional12["(optional)"]
style optional12 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P18".-> v17
end
subgraph optional13["(optional)"]
style optional13 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P529".-> v18
v18 --"p:statement/P529"--> v19
subgraph optional14["(optional)"]
style optional14 fill:#bbf,stroke-dasharray: 5 5;
v19 -."p:direct/P1813".-> v20
end
subgraph optional15["(optional)"]
style optional15 fill:#bbf,stroke-dasharray: 5 5;
v18 -."p:qualifier/P2043".-> v21
end
subgraph optional16["(optional)"]
style optional16 fill:#bbf,stroke-dasharray: 5 5;
v18 -."p:qualifier/P2049".-> v22
end
subgraph optional17["(optional)"]
style optional17 fill:#bbf,stroke-dasharray: 5 5;
v18 -."p:qualifier/P186".-> v24
subgraph optional18["(optional)"]
style optional18 fill:#bbf,stroke-dasharray: 5 5;
v24 -."rdfs:label".-> v23
end
end
end