query-bc75bf9e9fdc2bbea89f4d8ad5bb56be

rq turtle/ttl

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

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
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?item"):::projected v3("?itemLabel"):::projected v5("?type") v2("?type2"):::projected v1("?typeLabel"):::projected c3(["wd:Q62447"]):::iri f0[["?typeLabel = 'en'"]] f0 --> v1 f1[["not "]] subgraph f1e0["Exists Clause"] e0v1 --"wdt:P279"--> e0c2 e0v1("?type2"):::projected e0c2(["wd:Q62447"]):::iri end f1--EXISTS--> f1e0 f1 --> v2 f1 --> c2 f1 --> c3 v2 --"wdt:P279"--> c3 v4 --"wdt:P31"--> v5 v5 --"wdt:P279"--> c3 v4 --"wdt:P31"--> v2 v2 --"rdfs:label"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."rdfs:label".-> v3 end