query-bc75bf9e9fdc2bbea89f4d8ad5bb56be
16:48, 8 August 2018 (UTC)) talk (Andrew Gray probably shouldn't be on there, as it's the overall organisation and things can't really be an instance of it. (Q165862)Royal Air Force There are also a couple of false positives - - possibly an omission, or maybe deliberate because not all RAF installations are actually airbases? There may well be others - as Matěj mentions, if it's not in that class hierarchy, it's hard for us to run a query that knows it's an airport.(Q20977775)air transport infrastructure does not show up as it's not a subclass of (Q7373622)Royal Air Force station Note that any and counts how many of each type there are (there may be some double-counting if things have two P31s).(Q20977775)air transport infrastructure This one gets everything that is an instance of anything which is a subclass of To take a different tack, here are the P31s associated with aerodromes, which are not subclasses of aerodrome.
Use at
- https://query.wikidata.org/sparql
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#>
SELECT distinct ?item ?itemLabel ?type2 ?typeLabel WHERE {
?item wdt:P31 ?type. # ?item must be an instance of an airport, or an instance that is a subclass of an airport
?type wdt:P279* wd:Q62447.
?item wdt:P31 ?type2
filter not exists {?type2 wdt:P279* wd:Q62447.}
?type2 rdfs:label ?typeLabel. filter(lang(?typeLabel)="en") #get type label in EN
optional {?item rdfs:label ?itemLabel. filter(lang(?itemLabel)="en")} #get item label in EN
}