PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?item ?itemLabel ?place ?placeLabel ?iata ?icao ?endDate WHERE {
  VALUES ?class {
    wd:Q1248784 wd:Q62447 wd:Q695850
  }
  ?item wdt:P31 ?class .
  OPTIONAL {
    ?item wdt:P931 ?place .
    ?place rdfs:label ?placeLabel
    FILTER ( LANG( ?placeLabel ) = "en" )
  }
  OPTIONAL {
    ?item wdt:P238 ?iata
  }
  OPTIONAL {
    ?item wdt:P239 ?icao
  }
  OPTIONAL {
    ?item wdt:P582 ?endTimeDirect .
    FILTER ( isLiteral( ?endTimeDirect ) )
  }
  OPTIONAL {
    ?item p:P31 ?p31stmt .
    ?p31stmt pq:P582 ?endTimeQualVal .
    FILTER ( isLiteral( ?endTimeQualVal ) )
  }
  OPTIONAL {
    ?item p:P576 ?dstmt .
    ?dstmt ps:P576 ?dissolvedVal .
    FILTER ( isLiteral( ?dissolvedVal ) )
  }
  OPTIONAL {
    ?item p:P3999 ?cstmt .
    ?cstmt ps:P3999 ?closedVal .
    FILTER ( isLiteral( ?closedVal ) )
  }
  FILTER ( BOUND( ?endTimeDirect ) || BOUND( ?endTimeQualVal ) || BOUND( ?dissolvedVal ) || BOUND( ?closedVal ) ) BIND( COALESCE ( ?endTimeDirect , ?endTimeQualVal , ?dissolvedVal , ?closedVal ) AS ?endDate ) OPTIONAL {
    ?item rdfs:label ?itemLabel FILTER ( LANG( ?itemLabel ) = "en" )
  }
}
ORDER BY DESC ( ?endDate )
LIMIT 1000

Using entities:
- airport (wd:Q1248784), also known as aerodrome, air port, airports: is subclass of station / is subclass of Aerodrome / is subclass of aerodrome / is subclass of organization / is subclass of organisation / location where aircraft take off and land / location where aircraft take off and land / location where aircraft take off and land with extended support facilities, mostly for commercial air transport
- aerodrome (wd:Q62447), also known as airdrome, airfield, air navigation feature: is subclass of air transport infrastructure / is subclass of station / is subclass of architectural structure / is subclass of Architectural structure / is subclass of built structure / location from which aircraft flight operations take place
- air base (wd:Q695850), also known as airbase, air force base, air force station, military air base, military airbase, etc.: is subclass of military base / is subclass of aerodrome / is subclass of Aerodrome / aerodrome used by a military force for the operation of military aircraft

Using properties:
- IATA airport code (wd:P238 as wdt), also known as IATA location identifier, IATA station code, International Air Transport Association airport code, uio, P238: three-letter code for designating airports (for airlines, see P229) / three-letter code for designating airports (for airlines, see P229) / three-letter identifier for designating airports, railway stations or cities (for airlines, see P229)
- ICAO airport code (wd:P239 as wdt), also known as ICAO aerodrome code, ICAO airfield code, International Civil Aviation Organization airport code, P239: four-character alphanumeric code for designating airports (for airlines, see P:230) / four-character alphanumeric code for designating airports (for airlines, see P:230) / four-character alphanumeric identifier for designating airports (for airlines, see P230)
- instance of (wd:P31 as p/wdt), also known as example of, has type, is a, is an, is of type, etc.: that class of which this subject is a particular example and ... a subclass of mountain (and an instance of volcanic landform) / type to which this subject corresponds/belongs. Different ... and the volcano is a type (instance) of volcanic landform
- date of official closure (wd:P3999 as p/ps), also known as closed, closed date, closed on, closing date, closure date, etc.: is subproperty of end time / date of official closure of a building or event / date of official closure of a building or event
- dissolved, abolished or demolished date (wd:P576 as p/ps), also known as abolished, abolishment date, ceased date, ceased on, ceased publication, etc.: is subproperty of end time / date or point in time on which the organisation was dissolved/disappeared or the building demolished / point in time at which the subject (organisation, building) ...  "discontinued date" (P2669) for stopping a product
- end time (wd:P582 as pq/wdt), also known as abolished, cease date, cease operation, cease time, closed, etc.: is subproperty of point in time / indicates the time an item ceases to exist or a statement stops being valid / indicates the time an item ceases to exist or a statement stops being valid / moment when an entity ceases to exist and a statement stops being entirely valid or no longer be true
- place served by transport hub (wd:P931 as wdt), also known as area served by transport hub, city served, served by transport hub, serves city, train station serves, etc.: is subproperty of significant place / territorial entity or entities served by this transport hub (airport, train station, etc.) / territorial entity or entities served by this transport hub (airport, train station, etc.) / territorial entity or entities served by this transport hub (airport, train station, etc.)

Got 1,000 rows and 7 columns, showing the first 5 and last 5 rows below:
| item                                        | itemLabel                               | place                    | placeLabel           | iata | icao | endDate                             |
| ------------------------------------------- | --------------------------------------- | ------------------------ | -------------------- | ---- | ---- | ----------------------------------- |
| Long Xuyên airport (wd:Q2553839)            | Long Xuyên airport (lang:en)            |                          |                      |      |      | 2100-01-01T00:00:00Z (xsd:dateTime) |
| Codrington Airport (wd:Q924102)             | Codrington Airport (lang:en)            | Codrington (wd:Q1024679) | Codrington (lang:en) | BBQ  | TAPH | 2024-10-02T00:00:00Z (xsd:dateTime) |
| Pittsburgh Northeast Airport (wd:Q7354273)  | Pittsburgh Northeast Airport (lang:en)  | Pittsburgh (wd:Q1342)    | Pittsburgh (lang:en) |      |      | 2024-01-01T00:00:00Z (xsd:dateTime) |
| Buttonville Municipal Airport (wd:Q2928993) | Buttonville Municipal Airport (lang:en) | Markham (wd:Q44016)      | Markham (lang:en)    | YKZ  | CYKZ | 2023-11-30T00:00:00Z (xsd:dateTime) |
| wd:Q62186694                                |                                         |                          |                      |      | UHHM | 2023-10-31T00:00:00Z (xsd:dateTime) |
| ...                                         | ...                                     | ...                      | ...                  | ...  | ...  | ...                                 |
| RAF Membury (wd:Q7275470)                   | RAF Membury (lang:en)                   |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| Little Staughton Airfield (wd:Q7275444)     | Little Staughton Airfield (lang:en)     |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| RAF Ibsley (wd:Q7275401)                    | RAF Ibsley (lang:en)                    |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| RAF Ballyhalbert (wd:Q7275152)              | RAF Ballyhalbert (lang:en)              |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| RAF Broadwell (wd:Q7275203)                 | RAF Broadwell (lang:en)                 |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |

Answer:
I executed the query above on Wikidata. It returns airport / aerodrome / air base items that have an end date recorded (from P582, a pq:P582 qualifier on P31, P576, or P3999). The query returns up to 1000 items (LIMIT 1000) and includes for each: the item IRI, English label, place served (P931) with English label if available, IATA (P238), ICAO (P239), and the end date literal (?endDate).

Execution result: the query returned 1,000 rows (the result set hit the LIMIT). Examples from the top of the result set include items such as:
- wd:Q2553839 — Long Xuyên airport — endDate 2100-01-01T00:00:00Z (note: some records use placeholder/future dates)
- wd:Q924102 — Codrington Airport — place served: wd:Q1024679 (Codrington) — IATA: BBQ — ICAO: TAPH — endDate 2024-10-02T00:00:00Z
- wd:Q7354273 — Pittsburgh Northeast Airport — place served: wd:Q1342 (Pittsburgh) — endDate 2024-01-01T00:00:00Z
- wd:Q2928993 — Buttonville Municipal Airport — place served: wd:Q44016 (Markham) — IATA: YKZ — ICAO: CYKZ — endDate 2023-11-30T00:00:00Z
- several WWII RAF airfields from 1947 (e.g., wd:Q7275470 RAF Membury — endDate 1947-01-01T00:00:00Z)

Notes and limitations:
- The query looks for end dates recorded in common ways on Wikidata: direct end time (P582), a pq:P582 qualifier on the instance-of (P31) statement, dissolved/abolished date (P576) or official closure date (P3999). Some items encode closure dates differently (e.g., in references or as non-literal nodes), so they may not appear.
- I filtered to only accept literal date values (isLiteral) to avoid blank-node time objects; that excludes some items whose end dates are encoded as complex value nodes. If you want to include those as well I can adjust the query to extract time values from those nodes.
- The result set is large; I returned up to 1000 rows. If you want the full set or to restrict by country, year range, or type (only military bases, only civil airports, etc.), tell me how to filter and I will refine the query.

If you want, I can:
- return the full result set (increase or remove LIMIT),
- restrict to a specific country or time range,
- include additional properties (coordinates, status statements, references), or
- export the results in CSV/JSON.

I executed the query above on Wikidata. It returns airport / aerodrome / air base items that have an end date recorded (from P582, a pq:P582 qualifier on P31, P576, or P3999). The query returns up to 1000 items (LIMIT 1000) and includes for each: the item IRI, English label, place served (P931) with English label if available, IATA (P238), ICAO (P239), and the end date literal (?endDate).

Execution result: the query returned 1,000 rows (the result set hit the LIMIT). Examples from the top of the result set include items such as:
- wd:Q2553839 — Long Xuyên airport — endDate 2100-01-01T00:00:00Z (note: some records use placeholder/future dates)
- wd:Q924102 — Codrington Airport — place served: wd:Q1024679 (Codrington) — IATA: BBQ — ICAO: TAPH — endDate 2024-10-02T00:00:00Z
- wd:Q7354273 — Pittsburgh Northeast Airport — place served: wd:Q1342 (Pittsburgh) — endDate 2024-01-01T00:00:00Z
- wd:Q2928993 — Buttonville Municipal Airport — place served: wd:Q44016 (Markham) — IATA: YKZ — ICAO: CYKZ — endDate 2023-11-30T00:00:00Z
- several WWII RAF airfields from 1947 (e.g., wd:Q7275470 RAF Membury — endDate 1947-01-01T00:00:00Z)

Notes and limitations:
- The query looks for end dates recorded in common ways on Wikidata: direct end time (P582), a pq:P582 qualifier on the instance-of (P31) statement, dissolved/abolished date (P576) or official closure date (P3999). Some items encode closure dates differently (e.g., in references or as non-literal nodes), so they may not appear.
- I filtered to only accept literal date values (isLiteral) to avoid blank-node time objects; that excludes some items whose end dates are encoded as complex value nodes. If you want to include those as well I can adjust the query to extract time values from those nodes.
- The result set is large; I returned up to 1000 rows. If you want the full set or to restrict by country, year range, or type (only military bases, only civil airports, etc.), tell me how to filter and I will refine the query.

If you want, I can:
- return the full result set (increase or remove LIMIT),
- restrict to a specific country or time range,
- include additional properties (coordinates, status statements, references), or
- export the results in CSV/JSON.

SPARQL query over wikidata:
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?item ?itemLabel ?place ?placeLabel ?iata ?icao ?endDate WHERE {
  VALUES ?class {
    wd:Q1248784 wd:Q62447 wd:Q695850
  }
  ?item wdt:P31 ?class .
  OPTIONAL {
    ?item wdt:P931 ?place .
    ?place rdfs:label ?placeLabel
    FILTER ( LANG( ?placeLabel ) = "en" )
  }
  OPTIONAL {
    ?item wdt:P238 ?iata
  }
  OPTIONAL {
    ?item wdt:P239 ?icao
  }
  OPTIONAL {
    ?item wdt:P582 ?endTimeDirect .
    FILTER ( isLiteral( ?endTimeDirect ) )
  }
  OPTIONAL {
    ?item p:P31 ?p31stmt .
    ?p31stmt pq:P582 ?endTimeQualVal .
    FILTER ( isLiteral( ?endTimeQualVal ) )
  }
  OPTIONAL {
    ?item p:P576 ?dstmt .
    ?dstmt ps:P576 ?dissolvedVal .
    FILTER ( isLiteral( ?dissolvedVal ) )
  }
  OPTIONAL {
    ?item p:P3999 ?cstmt .
    ?cstmt ps:P3999 ?closedVal .
    FILTER ( isLiteral( ?closedVal ) )
  }
  FILTER ( BOUND( ?endTimeDirect ) || BOUND( ?endTimeQualVal ) || BOUND( ?dissolvedVal ) || BOUND( ?closedVal ) ) BIND( COALESCE ( ?endTimeDirect , ?endTimeQualVal , ?dissolvedVal , ?closedVal ) AS ?endDate ) OPTIONAL {
    ?item rdfs:label ?itemLabel FILTER ( LANG( ?itemLabel ) = "en" )
  }
}
ORDER BY DESC ( ?endDate )
LIMIT 1000

Using entities:
- airport (wd:Q1248784), also known as aerodrome, air port, airports: is subclass of station / is subclass of Aerodrome / is subclass of aerodrome / is subclass of organization / is subclass of organisation / location where aircraft take off and land / location where aircraft take off and land / location where aircraft take off and land with extended support facilities, mostly for commercial air transport
- aerodrome (wd:Q62447), also known as airdrome, airfield, air navigation feature: is subclass of air transport infrastructure / is subclass of station / is subclass of architectural structure / is subclass of Architectural structure / is subclass of built structure / location from which aircraft flight operations take place
- air base (wd:Q695850), also known as airbase, air force base, air force station, military air base, military airbase, etc.: is subclass of military base / is subclass of aerodrome / is subclass of Aerodrome / aerodrome used by a military force for the operation of military aircraft

Using properties:
- IATA airport code (wd:P238 as wdt), also known as IATA location identifier, IATA station code, International Air Transport Association airport code, uio, P238: three-letter code for designating airports (for airlines, see P229) / three-letter code for designating airports (for airlines, see P229) / three-letter identifier for designating airports, railway stations or cities (for airlines, see P229)
- ICAO airport code (wd:P239 as wdt), also known as ICAO aerodrome code, ICAO airfield code, International Civil Aviation Organization airport code, P239: four-character alphanumeric code for designating airports (for airlines, see P:230) / four-character alphanumeric code for designating airports (for airlines, see P:230) / four-character alphanumeric identifier for designating airports (for airlines, see P230)
- instance of (wd:P31 as p/wdt), also known as example of, has type, is a, is an, is of type, etc.: that class of which this subject is a particular example and ... a subclass of mountain (and an instance of volcanic landform) / type to which this subject corresponds/belongs. Different ... and the volcano is a type (instance) of volcanic landform
- date of official closure (wd:P3999 as p/ps), also known as closed, closed date, closed on, closing date, closure date, etc.: is subproperty of end time / date of official closure of a building or event / date of official closure of a building or event
- dissolved, abolished or demolished date (wd:P576 as p/ps), also known as abolished, abolishment date, ceased date, ceased on, ceased publication, etc.: is subproperty of end time / date or point in time on which the organisation was dissolved/disappeared or the building demolished / point in time at which the subject (organisation, building) ...  "discontinued date" (P2669) for stopping a product
- end time (wd:P582 as pq/wdt), also known as abolished, cease date, cease operation, cease time, closed, etc.: is subproperty of point in time / indicates the time an item ceases to exist or a statement stops being valid / indicates the time an item ceases to exist or a statement stops being valid / moment when an entity ceases to exist and a statement stops being entirely valid or no longer be true
- place served by transport hub (wd:P931 as wdt), also known as area served by transport hub, city served, served by transport hub, serves city, train station serves, etc.: is subproperty of significant place / territorial entity or entities served by this transport hub (airport, train station, etc.) / territorial entity or entities served by this transport hub (airport, train station, etc.) / territorial entity or entities served by this transport hub (airport, train station, etc.)

Execution result:
Got 1,000 rows and 7 columns, showing the first 5 and last 5 rows below:
| item                                        | itemLabel                               | place                    | placeLabel           | iata | icao | endDate                             |
| ------------------------------------------- | --------------------------------------- | ------------------------ | -------------------- | ---- | ---- | ----------------------------------- |
| Long Xuyên airport (wd:Q2553839)            | Long Xuyên airport (lang:en)            |                          |                      |      |      | 2100-01-01T00:00:00Z (xsd:dateTime) |
| Codrington Airport (wd:Q924102)             | Codrington Airport (lang:en)            | Codrington (wd:Q1024679) | Codrington (lang:en) | BBQ  | TAPH | 2024-10-02T00:00:00Z (xsd:dateTime) |
| Pittsburgh Northeast Airport (wd:Q7354273)  | Pittsburgh Northeast Airport (lang:en)  | Pittsburgh (wd:Q1342)    | Pittsburgh (lang:en) |      |      | 2024-01-01T00:00:00Z (xsd:dateTime) |
| Buttonville Municipal Airport (wd:Q2928993) | Buttonville Municipal Airport (lang:en) | Markham (wd:Q44016)      | Markham (lang:en)    | YKZ  | CYKZ | 2023-11-30T00:00:00Z (xsd:dateTime) |
| wd:Q62186694                                |                                         |                          |                      |      | UHHM | 2023-10-31T00:00:00Z (xsd:dateTime) |
| ...                                         | ...                                     | ...                      | ...                  | ...  | ...  | ...                                 |
| RAF Membury (wd:Q7275470)                   | RAF Membury (lang:en)                   |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| Little Staughton Airfield (wd:Q7275444)     | Little Staughton Airfield (lang:en)     |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| RAF Ibsley (wd:Q7275401)                    | RAF Ibsley (lang:en)                    |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| RAF Ballyhalbert (wd:Q7275152)              | RAF Ballyhalbert (lang:en)              |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| RAF Broadwell (wd:Q7275203)                 | RAF Broadwell (lang:en)                 |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |

[System]
You are a question answering assistant. Your job is to generate a SPARQL query to answer a given user question.

You should follow a step-by-step approach to generate the SPARQL query:
1. Determine possible entities and properties implied by the user question.
2. Search for the entities and properties in the knowledge graphs. Where applicable, constrain the searches with already identified entities and properties.
3. Gradually build up the SPARQL query using the identified entities and properties. Start with simple queries and add more complexity as needed. Execute intermediate queries to get feedback and to verify your assumptions. You may need to refine or rethink your current plan based on the query results and go back to step 2 if needed, possibly multiple times.
4. Use the answer or cancel function to finalize your answer and stop the generation process.

Available knowledge graphs:
- wikidata at http://localhost:7001 with prefix index for entities and similarity index for properties, and notes:
  - P106 = occupation. Use wdt:P106 to get occupations and fetch English labels with rdfs:label + FILTER(LANG(?label)="en"). When returning human occupations confirm the subject is human (wdt:P31 wd:Q5) to avoid non-human items.
  - Population (P1082) and tabular (P4179): use wdt:P1082 for quick/direct values; for time-series/point-in-time use p:P1082 + ps:P1082 + pq:P585 and ORDER BY pq:P585 DESC. Inspect statement qualifiers (e.g., 'applies to part') and prov:wasDerivedFrom references (pr:P854 etc.) to detect city-proper vs metro/prefecture scopes before using values.
  - Common person properties: P31 (instance of human Q5), P106 (occupation), P569 (date of birth), P19 (place of birth), P27 (country of citizenship), P21 (sex/gender), P166 (award received). Use wdt: for direct values when possible.
  - P17 (country) can be incomplete/misleading for places (historical/overseas tags). To get modern cities in a country combine: instance-of city (P31=Q515) + wdt:P17 OR use wdt:P131* to find an admin parent whose wdt:P17 = the country. Also cross-check coordinates (P625) or admin hierarchy to spot outliers.
  - When filtering by date of birth (P569) use xsd:dateTime comparisons (e.g. >= "1900-01-01T00:00:00Z"^^xsd:dateTime). Be aware many items have year-only or imprecise dates and coverage is biased toward notable/public figures (sportspeople, politicians, artists).
  - To retrieve qualifiers (e.g., award year) use the statement/qualifier pattern: p:Pxxx / ps:Pxxx / pq:P585. Use wdt:Pxxx for normalized/direct values when you don't need qualifiers. Example: p:P166 + pq:P585 gives award year.
  - To get a person's occupations: use wdt:P106 for direct/normalized values and rdfs:label for human-readable names (FILTER(LANG(...))). Example: wd:Q... wdt:P106 ?occ . ?occ rdfs:label ?occLabel . FILTER(LANG(?occLabel)="en").
  - P166 = award received. Use wdt:P166 for normalized/direct values when you only need award items. To get award years or qualifiers use p:P166 / ps:P166 / pq:P585. Many statements lack pq:P585 — use OPTIONAL { ?stmt pq:P585 ?date } and ORDER BY DESC(?date). When listing award winners, filter ?person wdt:P31 wd:Q5 to ensure humans.
  - Population time-series pattern: wd:Q... p:P1082 ?stmt . ?stmt ps:P1082 ?pop . OPTIONAL { ?stmt pq:P585 ?date } . ORDER BY DESC(?date). pq:P585 is the point-in-time qualifier. IMPORTANT: time-series may mix scopes (city proper vs metro) — e.g., Tokyo has a 2016 entry ~38,140,000 likely metro vs smaller city figures. Inspect qualifiers/references for scope before use.
  - Use wdt:P131* to traverse the admin hierarchy and compare wdt:P17 on the place vs an admin parent to detect historical/colonial country assignments. When mismatches appear, inspect the admin parent's instance-of (P31), labels, qualifiers and references to interpret the historical scope.
  - wdt:P106 often yields multiple occupations for a person. Use GROUP_CONCAT(DISTINCT ?occLabel; separator=", ") or return multiple rows. Always fetch labels with rdfs:label + FILTER(LANG(?label)="en") to get readable occupation names.
  - When a search_entity returns multiple hits (person vs sculpture vs memorial), confirm you selected the human/statements by checking wdt:P31 (instance of) and relevant wdt: properties (e.g., wdt:P106). This avoids using a non-human QID by mistake.
  - search_autocomplete can be constrained with a SPARQL pattern containing ?search (e.g., SELECT * WHERE { ?search wdt:P31 wd:Q5 }). Use constraints to focus results (e.g., humans) and avoid ambiguous fallbacks; if it returns no results, fallback to search_entity and verify wdt:P31.
  - Use search_property_of_entity to find relevant properties for an entity (e.g., 'award' -> P166) and search_object_of_property to discover candidate objects (e.g., 'physicist' for P106). This reduces guessing P/Q ids and surfaces qualifiers.
  - Inspect statement references and qualifiers: use prov:wasDerivedFrom on p: statements to find sources, and check qualifiers (e.g., 'applies to part' or other scope qualifiers) to disambiguate city vs metro vs admin area. Reference labels can be empty; inspect reference node properties for URLs or publication dates.

Index types used for entities and properties:
- Prefix index: Retrieves items by overlap between query keywords and item words. The query keywords can match item words exactly or as prefixes.
- Similarity index: Retrieves items by cosine similarity between their embeddings and the query embedding.

General notes across knowledge graphs:
- Use rdfs:label + FILTER(LANG(?label)="en") for labels; avoid SERVICE wikibase:label. Use wdt:Pxxx for normalized/direct values when qualifiers aren't needed. Use p:Pxxx / ps:Pxxx / pq:Pxxx to access statement qualifiers (e.g., award year via pq:P585). When dates matter, prefer xsd:dateTime and watch for year-only precision.
- Practical query patterns: use rdfs:label + FILTER(LANG(...)) for labels. Use wdt:Pxxx for direct/normalized values when qualifiers aren't needed. Use p:Pxxx / ps:Pxxx / pq:Pxxx to access qualifiers (dates via pq:P585). For dates use xsd:dateTime and expect year-only precision. For places: combine P17 with P131 or coordinate (P625) filters to avoid historical/overseas mismatches.
- Use OPTIONAL for pq: qualifiers (e.g., pq:P585), sort by qualifier (ORDER BY pq:P585 DESC) to prefer recent values. Use GROUP_CONCAT to combine multiple labels/values in one row. Watch for typed literals (xsd:dateTime, xsd:decimal) when filtering or sorting.
- Before querying, use search_entity to resolve human-friendly names to wd:Q identifiers and verify instance-of (e.g., check wdt:P31 = wd:Q5 for humans) to avoid ambiguous matches. Prefer the top match but programmatically confirm P31 before using its data.
- Use search_property to confirm property identifiers (e.g., "country" -> P17) before embedding them in queries. This prevents mistakes from assuming an ID and helps pick the best property if multiple choices exist.
- search_autocomplete can fall back to an unconstrained search or error when there are too many candidates. If this happens (e.g., "more than the maximum supported number of subject candidates"), retry with narrower constraints such as instance-of (wdt:P31), additional type filters, or short prefixes to reduce the candidate set; otherwise fallback to search_entity and verify wdt:P31.
- Use list(...) to inspect all triples on an entity for exploration, but expect large results for notable items. Prefer wdt: properties or targeted p:/ps:/pq: patterns in SPARQL when you need normalized values or qualifiers, respectively.
- Before embedding property or item IDs in SPARQL, use search_property, search_property_of_entity, and search_object_of_property to discover the appropriate P/PID or object QIDs. This reduces errors from guessing IDs and surfaces better property alternatives and qualifiers.
- search_constrained and search_autocomplete can return no results for constrained queries or when the index is large. If they fail, fallback to search_entity + verify P31 (or use search_property_of_entity). Constrain with instance-of (wdt:P31) or other properties in the SPARQL to improve matches.
- When selecting awards by year, prefer xsd:dateTime range filters (e.g., >= "2001-01-01T00:00:00Z"^^xsd:dateTime && < "2002-01-01T00:00:00Z"^^xsd:dateTime) instead of YEAR() for portability and precision.
- When selecting award winners via wdt:P166, filter ?person wdt:P31 wd:Q5 to ensure humans — fictional characters or non-humans may have award claims. If you need award years use p:P166 / ps:P166 / pq:P585 and OPTIONAL { ?stmt pq:P585 ?year } to retrieve qualifier years.
- Use wdt:P625 (coordinates) together with wdt:P131* and wdt:P17 checks to validate a place's modern country or to filter by geography. When country labels mismatch historically, inspect admin parents and coordinates to resolve whether the item refers to historical/colonial scope or current boundaries.
- Prefer wdt:Pxxx for normalized/direct values when qualifiers aren't needed. Use p:Pxxx / ps:Pxxx / pq:Pxxx to access qualifiers (e.g., pq:P585 for award year). Always fetch labels with rdfs:label + FILTER(LANG(?label) = "en").
- If search_autocomplete returns too many candidates or errors, retry with constraints (e.g., SELECT * WHERE { ?search wdt:P31 wd:Q5 }) or narrower query text. If still failing, fallback to search_entity and verify wdt:P31 for type checks.
- For award-year queries use p:P166 / ps:P166 / pq:P585 to access award statements and year qualifiers. Filter by xsd:dateTime ranges (e.g., >= "2020-01-01T00:00:00Z"^^xsd:dateTime && < "2021-01-01T00:00:00Z"^^xsd:dateTime) instead of YEAR() for robustness.
- Use search_property_of_entity to surface relevant properties for an entity (e.g., 'birth' -> P569/P19). list(...) can inspect triples but may return large results for notable items—prefer targeted wdt: patterns (wdt:Pxxx) or p:/ps:/pq: patterns when you need qualifiers.

SPARQL prefixes for use in function calls:
- bd: <http://www.bigdata.com/rdf#
- cc: <http://creativecommons.org/ns#
- data: <https://www.wikidata.org/wiki/Special:EntityData/
- dc: <http://purl.org/dc/elements/1.1/
- dct: <http://purl.org/dc/terms/
- foaf: <http://xmlns.com/foaf/0.1/
- geo: <http://www.opengis.net/ont/geosparql#
- geof: <http://www.opengis.net/def/function/geosparql/
- gn: <http://www.geonames.org/ontology#
- hint: <http://www.bigdata.com/queryHints#
- imdb: <https://www.imdb.com/
- math: <http://www.w3.org/2005/xpath-functions/math#
- ontolex: <http://www.w3.org/ns/lemon/ontolex#
- owl: <http://www.w3.org/2002/07/owl#
- p: <http://www.wikidata.org/prop/
- pq: <http://www.wikidata.org/prop/qualifier/
- pqn: <http://www.wikidata.org/prop/qualifier/value-normalized/
- pqv: <http://www.wikidata.org/prop/qualifier/value/
- pr: <http://www.wikidata.org/prop/reference/
- prn: <http://www.wikidata.org/prop/reference/value-normalized/
- prov: <http://www.w3.org/ns/prov#
- prv: <http://www.wikidata.org/prop/reference/value/
- ps: <http://www.wikidata.org/prop/statement/
- psn: <http://www.wikidata.org/prop/statement/value-normalized/
- psv: <http://www.wikidata.org/prop/statement/value/
- qb: <http://purl.org/linked-data/cube#
- qfn: <http://qlever.cs.uni-freiburg.de/function#
- ql: <http://qlever.cs.uni-freiburg.de/builtin-functions/
- qlss: <https://qlever.cs.uni-freiburg.de/spatialSearch/
- rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
- rdfs: <http://www.w3.org/2000/01/rdf-schema#
- ref: <http://www.wikidata.org/reference/
- s: <http://www.wikidata.org/entity/statement/
- schema: <http://schema.org/
- skos: <http://www.w3.org/2004/02/skos/core#
- v: <http://www.wikidata.org/value/
- void: <http://rdfs.org/ns/void#
- wd: <http://www.wikidata.org/entity/
- wdno: <http://www.wikidata.org/prop/novalue/
- wdt: <http://www.wikidata.org/prop/direct/
- wdtn: <http://www.wikidata.org/prop/direct-normalized/
- wikibase: <http://wikiba.se/ontology#
- xsd: <http://www.w3.org/2001/XMLSchema#

Additional rules to follow:
- Explain your thought process before and after each step and function call.
- Do not just use or make up entity or property identifiers without verifying their existence in the knowledge graphs first.
- Do not ask the user for clarifications without first attempting to complete the task. If the task input is incomplete or ambiguous, try to make reasonable assumptions and document them.
- Do not use "SERVICE wikibase:label { bd:serviceParam wikibase:language ..." in SPARQL queries. It is not SPARQL standard and unsupported by the used QLever SPARQL endpoints. Use rdfs:label or similar properties to get labels instead.
- Always execute your final SPARQL query before giving an answer to make sure it returns the expected results.
- The SPARQL query should always return the actual identifiers / IRIs of the items in its result. It additionally may return labels or other human-readable information, but they are optional and should be put within optional clauses unless explicitly requested by the user.
- Do not stop early if there are still obvious improvements to be made to the SPARQL query. For example, keep refining your SPARQL query if its result contains irrelevant items or is missing items you expected.
- Do not perform additional computation (e.g. filtering, sorting, calculations) on the result of the SPARQL query to determine the answer. All computation should be done solely within SPARQL.
- For questions with a "True" or "False" answer the SPARQL query should be an ASK query.

[User] What are the airports, military airbases, or aerodromes that have ceased to exist or stopped being valid? Please provide their item IDs, names, item IDs and labels places they serve (if available), IATA codes (if available), ICAO codes (if available), and end dates.

[Assistant]
I'll search Wikidata for possible entity Q-IDs for "airport", "aerodrome", and "military airbase" so I can use them as instance-of (P31) constraints. I'll first look up "airport".

Question: airport

Top 10 entity alternatives:
1. airport (wd:Q1248784), also known as aerodrome, air port, airports: location where aircraft take off and land with extended support facilities, mostly for commercial air transport / location where aircraft take off and land / location where aircraft take off and land / is subclass of organisation / is subclass of organization / is subclass of aerodrome / is subclass of Aerodrome / is subclass of station
2. Airport (wd:Q409022): 1970 film directed by George Seaton / is instance of film
3. AirPort (wd:Q697292), also known as Apple AirPort: brand of wifi router equipment made by Apple Inc. / is instance of brand / Apple AirPort
4. Airport (wd:Q4698872), also known as Airport, CA, Airport, California: census-designated place in Stanislaus County, California, USA / is instance of census-designated place in the United States / is instance of census-designated place
5. Airport (wd:Q2604087): is instance of literary work / 1968 novel by Arthur Hailey
6. Kasese Airport (wd:Q6374123, matched via Airport), also known as Airport, HUKS, KSE: is instance of commercial traffic aerodrome / is instance of airport / airport in Uganda
7. Basongo Airport (wd:Q3339360, matched via airport), also known as airport, BAN, FZVR: airport in Democratic Republic of the Congo / is instance of airport
8. Airport (wd:Q11289474), also known as Rapid Airport: is instance of passenger train service / is instance of airport rail link / Rapid trains in Hokkaido, Japan / is instance of train service / is instance of rapid train
9. Bambili-Dingila Airport (wd:Q3206837, matched via airport), also known as Aéroport de Bambili-Dingila, airport, FZKB: airport in Democratic Republic of the Congo / is instance of aerodrome / is instance of Aerodrome
10. Airport (wd:Q4073688), also known as Airport Station: station on the RTA Red Line in Cleveland, Ohio, United States / is instance of airport railway station / is instance of underground station / is instance of metro station

[Assistant]
I'll look up "aerodrome" next to confirm its QID and relation to airport.

Question: aerodrome

Top 10 entity alternatives:
1. airport (wd:Q1248784, matched via aerodrome), also known as aerodrome, air port, airports: location where aircraft take off and land with extended support facilities, mostly for commercial air transport / location where aircraft take off and land / location where aircraft take off and land / is subclass of organization / is subclass of organisation / is subclass of Aerodrome / is subclass of aerodrome / is subclass of station
2. aerodrome (wd:Q62447), also known as airdrome, airfield, air navigation feature: location from which aircraft flight operations take place / is subclass of air transport infrastructure / is subclass of architectural structure / is subclass of Architectural structure / is subclass of built structure / is subclass of station
3. Aerodrome (wd:Q381424), also known as Aerodrome (Austria), Aerodrome (music festival): music festival in Wiener Neustadt, Austria / is instance of music festival
4. Aerodrome (wd:Q108080429): is instance of protected area / protected area in France
5. Aerodrome (wd:Q116446160): map in the 2018 video game Battlefield V / is instance of level
6. Perth Airport (wd:Q45935, matched via Guildford Aerodrome), also known as Guildford Aerodrome, PER, PERTH, Perth Domestic Airport, Perth International Airport: international airport in Perth, Western Australia / is instance of commercial traffic aerodrome / is instance of international airport
7. Oulu Airport (wd:Q1131604, matched via Oulu Aerodrome), also known as EFOU, OUL, Oulu Aerodrome, Oulu Airfield, OULU airport, etc.: is instance of commercial traffic aerodrome / is instance of international airport / airport in Oulu, Finland / is instance of airport
8. Naha Airport (wd:Q1197455, matched via Oroku Aerodrome), also known as OKA, Oroku Aerodrome, ROAH, 那　覇, 那覇: is instance of commercial traffic aerodrome / airport serving Okinawa, Japan / is instance of airport
9. Kemi-Tornio Airport (wd:Q1413172, matched via Kemi-Tornio Aerodrome), also known as EFKE, KEM, Kemi Airport, Kemi-Tornio Aerodrome, KEMI-TORNIO airport, etc.: is instance of commercial traffic aerodrome / airport in Kemi, Finland / is instance of airport
10. Kajaani Airport (wd:Q739238, matched via Kajaani Aerodrome), also known as EFKI, KAJ, Kajaani Aerodrome, KAJAANI airport, Paltaniemi Airport: is instance of commercial traffic aerodrome / airport in Kajaani, Finland / is instance of airport

[Assistant]
I'll search for "military airbase" (and variations like "military airfield" / "air force base") to find the relevant Wikidata class identifiers.

Question: military airbase

Top 10 entity alternatives:
1. air base (wd:Q695850, matched via military airbase), also known as airbase, air force base, air force station, military air base, military airbase, etc.: aerodrome used by a military force for the operation of military aircraft / is subclass of military base / is subclass of aerodrome / is subclass of Aerodrome
2. Tiyas Military Airbase (wd:Q21663059), also known as T-4 Airbase: Syrian Arab Air Force base in Homs Governorate, Syria / is instance of air base / is instance of airbase
3. Kuweires Military Airbase (wd:Q12694665), also known as Kuweires Airbase: airbase and military aviation institute in Aleppo Governorate, Syria / is instance of air base / is instance of airbase
4. Tabqa Military Airbase (wd:Q21592797), also known as Al-Thawrah airdrome: Syrian Air Force base in Tabqa, Syria / is instance of aerodrome / is instance of Aerodrome / is instance of air base / is instance of airbase
5. Jirah Military Airbase (wd:Q29051268): is instance of air base / is instance of airbase
6. Alcantarilla Military Airbase (wd:Q3207184), also known as Alcantarilla Airbase, LERI: is instance of air base / is instance of airbase
7. Ovar Military Airbase (wd:Q9586748), also known as LPOV, Ovar AB Airport, Ovar Mil.: is instance of cultural heritage / military airbase in Portugal / is instance of air base / is instance of airbase / airport in Portugal / airport in Portugal
8. Sitalchay Military Airbase (wd:Q7531621): military airbase in Azerbaijan / is instance of air base / is instance of airbase
9. Al-Qusayr Military Airbase (wd:Q11824206): Wikimedia disambiguation page / Wikimedia disambiguation page / is instance of air base / is instance of airbase / airport in Syria
10. Tiiksjärvi Airfield (wd:Q18691466, matched via Tiiksjärvi Military Airbase), also known as Tiiksjärvi Military Airbase, Tiiksjärvi Military Airfield: Finnish Air Force base in Eastern Karelia during the Continuation War / is instance of air base / is instance of airbase

[Assistant]
Next I'll search for relevant properties for "end date" or "end time" (e.g., P582, P576) and for identifying the instance-of property (P31) so I can build the query.

Question: end time

Top 10 property alternatives:
1. end time (wd:P582 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as abolished, cease date, cease operation, cease time, closed, etc.: moment when an entity ceases to exist and a statement stops being entirely valid or no longer be true / indicates the time an item ceases to exist or a statement stops being valid / indicates the time an item ceases to exist or a statement stops being valid / is subproperty of point in time
2. start time (wd:P580 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as began, beginning, building date, effective, effectivity, etc.: indicates the time an item begins to exist or a statement starts being valid / indicates the time an item begins to exist or a statement starts being valid / time an entity begins to exist or a statement starts being valid / is subproperty of point in time
3. work period (end) (wd:P2032 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via end time for work), also known as active until, date of activity (end), end date of activity, end time for work, fl. (end), etc.: end of period during which a person or group flourished (fl. = "floruit") in their professional activity / end of period during which a person or group flourished (fl. = "floruit") in their professional activity / is subproperty of end time / is subproperty of floruit
4. duration (wd:P2047 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via time interval), also known as cook time, era, interval, length, length of time, etc.: length of time of an event or process / length of time of an event or process / length of time of an event or process
5. time played (wd:P9140 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as minutes played, P9140: time (usually minutes) played by a participant in a sporting event
6. dissolved, abolished or demolished date (wd:P576 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via time abolished), also known as abolished, abolishment date, ceased date, ceased on, ceased publication, etc.: point in time at which the subject (organisation, building) ...  "discontinued date" (P2669) for stopping a product / date or point in time on which the organisation was dissolved/disappeared or the building demolished / is subproperty of end time
7. end period (wd:P3416 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as until period, P3416: last period in which the statement is still valid (including the period-value)
8. point in time (wd:P585 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via at time), also known as as of, at time, by date, date, during, etc.: date something took place, existed or a statement was true; for providing time use the "refine date" property (P4241) / time and date something took place, existed or a statement was true / time and date something took place, existed or a statement was true / time and date something took place, existed or a statement was true
9. refine date (wd:P4241 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via specific time), also known as date refinement, exact time, hour, local time, quarter, etc.: qualifier to narrow down the precision of a date not fully specified by the Wikidata time datatype precision field / qualifier to narrow down the precision of a date not fully specified by the Wikidata time datatype precision field
10. time gap (wd:P2911 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as gap, P2911: time gap to winner time (P2781)

[Assistant]
I'll search for the property "operational status" to see if airports use it to indicate closure. Then I'll craft a query that selects items that are instance-of airport/aerodrome/air base and have P582 (end time) or P576 (dissolved) or a non-active operational status. I'll first look up "operational status".

Question: operational status

Top 10 property alternatives:
1. state of use (wd:P5817 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via use status), also known as use status, P5817: to indicate state of use of a building, monument, etc. It is ... of use. Ex.: abandoned, in use, temporarily closed, etc. / to indicate state of use of a building, monument, etc. It is ... state of use. Ex.: reformed, in use, temporarily closed, etc.
2. item operated (wd:P121 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via operated), also known as acop, aircraft carried, aircraft in fleet, aircraft operated, controls, etc.: equipment, installation or service operated by the subject / equipment, installation or service operated by the subject / equipment, installation or service operated by the subject / is subproperty of uses
3. service status information URL (wd:P9138 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via status page), also known as status information URL, status page, status URI, status URL, system status URL, etc.: URI with information about the status of the service / is subproperty of URL
4. online access status (wd:P6954 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via status of website), also known as access status, archive access status, article access status, collection access status, online access state, etc.: property or qualifier for an ID property indicating whether linked content is directly readable online / is subproperty of access restriction status / is subproperty of has characteristic / is subproperty of has quality
5. heritage designation (wd:P1435 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via listed status), also known as designation, heritage status, legal protection, listed status, listing, etc.: heritage designation of a cultural or natural site / the heritage status of a historical site / the heritage status of a historical site / is subproperty of has part(s) / is subproperty of instance of / is subproperty of has part
6. acquisition transaction (wd:P1642 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via contract status), also known as contract status, loan, P1642: how the player was acquired; qualifier for P54 (member of sports team) / how the player was acquired; qualifier for P54 (member of sports team)
7. Operational Requirement of the UK Air Ministry (wd:P862 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via operational requirement), also known as operational requirement, OR, P862: specification for future military aircraft by the UK Air Ministry
8. UNESCO language status (wd:P1999 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via AWLD status), also known as AWLD status, P1999: degree of endangerment of a language conferred by the UNESCO Atlas of World Languages in Danger
9. operating area (wd:P2541 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as area of operations, area of responsibility, area operated, area served, areas served, etc.: geographic area or jurisdiction an organisation or industry operates in, serves, or has responsibility for / geographic area or jurisdiction an organisation or industry operates in, serves, or has responsibility for / geographic area or jurisdiction an organization or industry operates in, serves, or has responsibility for / is subproperty of location
10. service retirement (wd:P730 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via out of service), also known as date of service retirement, decommissioned, out of service, retired, retirement, etc.: date or point in time on which a piece or class of equipment ... operational service ; use P2669 for end of a public service / date or point in time on which a piece or class of equipment was retired from operational service / is subproperty of end time

[Assistant]
I'll search for properties related to "closed", "closed on", "disused" to capture different ways closure may be recorded.

Question: closed

Top 10 property alternatives:
1. date of official closure (wd:P3999 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via closed), also known as closed, closed date, closed on, closing date, closure date, etc.: date of official closure of a building or event / date of official closure of a building or event / is subproperty of end time
2. end time (wd:P582 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via closed), also known as abolished, cease date, cease operation, cease time, closed, etc.: moment when an entity ceases to exist and a statement stops being entirely valid or no longer be true / indicates the time an item ceases to exist or a statement stops being valid / indicates the time an item ceases to exist or a statement stops being valid / is subproperty of point in time
3. closed on (wd:P3026 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as closed days, days not open, except, P3026: exceptions to open days (P3025), usually special dates. Qualifier with P3025 / exceptions to open days (P3025), usually special dates
4. dissolved, abolished or demolished date (wd:P576 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via closed on), also known as abolished, abolishment date, ceased date, ceased on, ceased publication, etc.: point in time at which the subject (organisation, building) ...  "discontinued date" (P2669) for stopping a product / date or point in time on which the organisation was dissolved/disappeared or the building demolished / is subproperty of end time
5. date of official opening (wd:P1619 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via opened), also known as date of opening, date opened, grand opening, inaugurated, inauguration, etc.: date or point in time a place, organization, or event officially opened / date or point in time an event, museum, theatre etc. officially opened / is subproperty of date of foundation or creation / is subproperty of start time / is subproperty of inception
6. participant in (wd:P1344 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via attended), also known as attended, competed in, competes in, participant of, participant of event, etc.: event in which a person or organisation was/is a participant; inverse of P710 or P1923 / event in which a person or organization was/is a participant; inverse of P710 or P1923 / is subproperty of significant event / is subproperty of part of
7. educated at (wd:P69 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via attended), also known as alma mater, alumna of, alumni of, alumnus of, attended, etc.: educational institution attended by the subject / educational institution attended by the subject / educational institution attended by subject / is subproperty of affiliation
8. last line (wd:P3132 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via ending), also known as closing line, ending, excipit, final line, final sentence, etc.: last line (excipit) of a poem, last sentence of a novel, etc. / last line (excipit) of a poem, last sentence of a novel, etc.
9. list item (wd:P11260 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via of), also known as list entry, list value, of, one of class, P11260: qualifier for "union of" (P2737) and "disjoint union of" (P2738) to identify constituent entities
10. characteristic of (wd:P13044 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via of), also known as inheres in, of, property of, quality of, P13044: (qualifier only) statement value is a characteristic, quality, property, or state of this qualifier value

[Assistant]
I'll search for the property identifiers for IATA and ICAO codes and for "serves" (the place served property) so I can include them in the query. Then I'll build an initial SPARQL query selecting airports/airbases/aerodromes with end dates (P582/P576/P3999) and retrieving the requested fields. I'll explain the plan and then run the query.

Question: IATA code

Top 10 property alternatives:
1. IATA airline designator (wd:P229 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as IATA reservation code, International Air Transport Association airline designator, P229: two-character code for identifying airlines (for airports, see P:238) / two-character identifier for an airline
2. IATA airport code (wd:P238 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as IATA location identifier, IATA station code, International Air Transport Association airport code, uio, P238: three-letter identifier for designating airports, railway stations or cities (for airlines, see P229) / three-letter code for designating airports (for airlines, see P229) / three-letter code for designating airports (for airlines, see P229)
3. airline accounting code (wd:P5703 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via IATA airline numeric code), also known as airline prefix code, IATA airline numeric code, P5703: number, referenced by IATA and unique among all the airlines, ... airline in various accounting activities such as ticketing
4. ICAO airport code (wd:P239 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as ICAO aerodrome code, ICAO airfield code, International Civil Aviation Organization airport code, P239: four-character alphanumeric identifier for designating airports (for airlines, see P230) / four-character alphanumeric code for designating airports (for airlines, see P:230) / four-character alphanumeric code for designating airports (for airlines, see P:230)
5. ICAO airline designator (wd:P230 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as International Civil Aviation Organization airline designator, P230: three letter identifier for an airline (two letters only until 1982) (for airports, see P239) / three letter code for identifying airlines (for airports, see P239)
6. FAA airport code (wd:P240 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as FAA LID, P240: three-letter or four-letter alphanumeric code identifying United States airports / three-letter or four-letter alphanumeric code identifying United States airports / three-letter or four-letter alphanumeric code identifying United States airports
7. ATC code (wd:P267 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as ATCC, P267: therapeutic chemical identification code per ATC
8. flight-report.com Airline ID (wd:P5579 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via flight-report.com Airline identifier), also known as flight-report.com Airline identifier, P5579
9. WMO code (wd:P9737 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as P9737: unique identifier for weather station
10. callsign of airline (wd:P432 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via airline callsign), also known as airl aéronefine code, airline call sign, airline callsign, P432: identifier used in radio transmissions to refer to the subject airline / identifier used in radio transmissions to refer to the subject airline / is subproperty of call sign

[Assistant]
I'll search for the property for "serves" or "serves the following place" used by airports (commonly "serves" or "serves city").

Question: serves

Top 10 property alternatives:
1. intended public (wd:P2360 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via serving), also known as audience of, created for, designed for, for, for audience of, etc.: intended audience or user of this work, product, object, or event
2. operating area (wd:P2541 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via serves place), also known as area of operations, area of responsibility, area operated, area served, areas served, etc.: geographic area or jurisdiction an organisation or industry operates in, serves, or has responsibility for / geographic area or jurisdiction an organisation or industry operates in, serves, or has responsibility for / geographic area or jurisdiction an organization or industry operates in, serves, or has responsibility for / is subproperty of location
3. place served by transport hub (wd:P931 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via serves city), also known as area served by transport hub, city served, served by transport hub, serves city, train station serves, etc.: territorial entity or entities served by this transport hub (airport, train station, etc.) / territorial entity or entities served by this transport hub (airport, train station, etc.) / territorial entity or entities served by this transport hub (airport, train station, etc.) / is subproperty of significant place
4. product or material produced (wd:P1056 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via provides service), also known as commodity, creates, has product, maker of, makes, etc.: material or product produced by an organization, industry, facility, or process / material or product produced by a business or industry / is subproperty of immediate cause of
5. service entry (wd:P729 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via in service), also known as commissioned, date of service entry, deployment date, entered service, entry to service, etc.: date or point in time on which a piece or class of equipment entered operational service / date on which a piece or class of equipment entered operational service / is subproperty of start time
6. serving temperature (wd:P7767 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as P7767: serving temperature of a food dish
7. main food source (wd:P1034 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via eats), also known as diet, eats, ecology (Fossilworks field  name), food plant, food source, etc.: species, genus or family that an organism depends on for nutrition
8. cuisine (wd:P2012 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as P2012: type of food served by a restaurant or restaurant chain or national food culture / is subproperty of field of work
9. course (wd:P8431 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via meal course), also known as meal course, P8431: course type of a food dish (appetizer, dessert, drink, main course, salad, side dish)
10. member of the crew of (wd:P5096 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via served aboard), also known as crewmember of, crew of, member of crew, served aboard, ship appointments, etc.: person who has been a member of a crew associated with the ... crew member (P1029), backup or reserve team or crew (P3015) / person who has been a member of a crew associated with the ... crew member (P1029), backup or reserve team or crew (P3015) / is subproperty of member of

[Assistant]
I'll run a SPARQL SELECT query that finds items that are instances of airport (Q1248784), aerodrome (Q62447), or air base (Q695850) and that have an end date recorded via P582, P576, or P3999. The query will return the item IRI, English label, place served (P931) with label, IATA (P238), ICAO (P239), and a combined end date (the first of P582, P576, P3999 found). I'll order results by end date (most recent first) and limit to 1000. Now I'll execute the query.

execute

SELECT DISTINCT ?item ?itemLabel ?place ?placeLabel ?iata ?icao ?endDate WHERE {
  VALUES ?class { wd:Q1248784 wd:Q62447 wd:Q695850 }
  ?item wdt:P31 ?class .
  OPTIONAL { ?item wdt:P931 ?place . ?place rdfs:label ?placeLabel FILTER(LANG(?placeLabel)="en") }
  OPTIONAL { ?item wdt:P238 ?iata }
  OPTIONAL { ?item wdt:P239 ?icao }
  OPTIONAL { ?item wdt:P582 ?endTime }
  OPTIONAL { ?item wdt:P576 ?dissolved }
  OPTIONAL { ?item wdt:P3999 ?closed }
  FILTER( BOUND(?endTime) || BOUND(?dissolved) || BOUND(?closed) )
  BIND(COALESCE(?endTime, ?dissolved, ?closed) AS ?endDate)
  OPTIONAL { ?item rdfs:label ?itemLabel FILTER(LANG(?itemLabel)="en") }
}
ORDER BY DESC(?endDate)
LIMIT 1000

Got 1,000 rows and 7 columns, showing the first 5 and last 5 rows below:
| item                                        | itemLabel                              | place                          | placeLabel                 | iata | icao | endDate     |
| ------------------------------------------- | -------------------------------------- | ------------------------------ | -------------------------- | ---- | ---- | ----------- |
| Alexander Field Aerodrome (wd:Q61672127)    | Alexander Field Aerodrome (lang:en)    |                                |                            |      |      | _:bn1579788 |
| Larkins Farm Airport (wd:Q49747388)         | Larkins Farm Airport (lang:en)         |                                |                            |      |      | _:bn1579533 |
| Amherst Airport (wd:Q4746014)               | Amherst Airport (lang:en)              |                                |                            |      |      | _:bn1578738 |
| Anderson Airport (wd:Q34958440)             | Anderson Airport (lang:en)             |                                |                            |      |      | _:bn1578273 |
| Orange Hill Airport (wd:Q35286319)          | Orange Hill Airport (lang:en)          |                                |                            |      |      | _:bn1578141 |
| ...                                         | ...                                    | ...                            | ...                        | ...  | ...  | ...         |
| Marsden Park Aerodrome (wd:Q6773239)        | Marsden Park Aerodrome (lang:en)       |                                |                            |      |      | _:bn801447  |
| Duford Field (wd:Q5312413)                  | Duford Field (lang:en)                 | Genesee Township (wd:Q5532749) | Genesee Township (lang:en) |      |      | _:bn800104  |
| Charlie Wilkes Airport (wd:Q35249096)       | Charlie Wilkes Airport (lang:en)       |                                |                            |      |      | _:bn798755  |
| Wilder/natwick Llc Aerodrome (wd:Q61671129) | Wilder/natwick Llc Aerodrome (lang:en) |                                |                            |      |      | _:bn798561  |
| Chippelle Airfield (wd:Q5101637)            | Chippelle Airfield (lang:en)           |                                |                            |      |      | _:bn797741  |

[Assistant]
I refined the query because many airports record closure/end dates as qualifiers on the instance-of statement (p:P31 with pq:P582) rather than as a direct wdt:P582 claim. I'll include both direct properties (wdt:P582, wdt:P576, wdt:P3999) and qualifiers on the p:P31 statement (pq:P582) so we capture those end dates as literals. I'll run this improved query now.

SELECT DISTINCT ?item ?itemLabel ?place ?placeLabel ?iata ?icao ?endDate WHERE {
  VALUES ?class { wd:Q1248784 wd:Q62447 wd:Q695850 }
  ?item wdt:P31 ?class .
  OPTIONAL { ?item wdt:P931 ?place . ?place rdfs:label ?placeLabel FILTER(LANG(?placeLabel)="en") }
  OPTIONAL { ?item wdt:P238 ?iata }
  OPTIONAL { ?item wdt:P239 ?icao }

  # direct end properties
  OPTIONAL { ?item wdt:P582 ?endTime }
  OPTIONAL { ?item wdt:P576 ?dissolved }
  OPTIONAL { ?item wdt:P3999 ?closed }

  # end time as qualifier on the instance-of statement
  OPTIONAL {
    ?item p:P31 ?p31stmt .
    ?p31stmt pq:P582 ?endTimeQual .
  }

  FILTER( BOUND(?endTime) || BOUND(?dissolved) || BOUND(?closed) || BOUND(?endTimeQual) )
  BIND(COALESCE(?endTime, ?dissolved, ?closed, ?endTimeQual) AS ?endDate)
  OPTIONAL { ?item rdfs:label ?itemLabel FILTER(LANG(?itemLabel)="en") }
}
ORDER BY DESC(?endDate)
LIMIT 1000

Got 1,000 rows and 7 columns, showing the first 5 and last 5 rows below:
| item                                     | itemLabel                           | place              | placeLabel      | iata | icao | endDate     |
| ---------------------------------------- | ----------------------------------- | ------------------ | --------------- | ---- | ---- | ----------- |
| Alexander Field Aerodrome (wd:Q61672127) | Alexander Field Aerodrome (lang:en) |                    |                 |      |      | _:bn1579788 |
| Larkins Farm Airport (wd:Q49747388)      | Larkins Farm Airport (lang:en)      |                    |                 |      |      | _:bn1579533 |
| Amherst Airport (wd:Q4746014)            | Amherst Airport (lang:en)           |                    |                 |      |      | _:bn1578738 |
| Anderson Airport (wd:Q34958440)          | Anderson Airport (lang:en)          |                    |                 |      |      | _:bn1578273 |
| Orange Hill Airport (wd:Q35286319)       | Orange Hill Airport (lang:en)       |                    |                 |      |      | _:bn1578141 |
| ...                                      | ...                                 | ...                | ...             | ...  | ...  | ...         |
| Tantonville Airfield (wd:Q7683854)       | Tantonville Airfield (lang:en)      |                    |                 |      |      | _:bn809512  |
| Hamilton Field (wd:Q3888013)             | Hamilton Field (lang:en)            | Derby (wd:Q137775) | Derby (lang:en) |      |      | _:bn809432  |
| wd:Q11824525                             |                                     |                    |                 |      |      | _:bn808376  |
| El Assa Airfield (wd:Q5350783)           | El Assa Airfield (lang:en)          |                    |                 |      |      | _:bn808289  |
| Hughes Airfield (wd:Q5933308)            | Hughes Airfield (lang:en)           |                    |                 |      |      | _:bn806208  |

[Assistant]
I'll inspect the full property triples for one example item (Chippelle Airfield, wd:Q5101637) to see how the end date is represented (direct property vs qualifier node) so I can extract the literal date correctly. I'll list triples with that subject.

list

wd:Q5101637

Got 20 rows and 3 columns, showing the first 10 rows below:
| subject                          | property                                           | object                                                                                |
| -------------------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
| Chippelle Airfield (wd:Q5101637) | instance of (wdt:P31)                              | aerodrome (wd:Q62447)                                                                  |
| Chippelle Airfield (wd:Q5101637) | country (wdt:P17)                                  | France (wd:Q142)                                                                       |
| Chippelle Airfield (wd:Q5101637) | coordinate location (wdt:P625)                     | POINT(-0.983056 49.236667) (geo:wktLiteral)                                            |
| Chippelle Airfield (wd:Q5101637) | Commons category (wdt:P373)                        | Chippelle Airfield                                                                     |
| Chippelle Airfield (wd:Q5101637) | image (wdt:P18)                                    | <http://commons.wikimedia.org/wiki/Special:FilePath/Chippelle%20Airfield%20-%20A5.jpg> |
| Chippelle Airfield (wd:Q5101637) | Freebase ID (wdt:P646)                             | /m/07s42t_                                                                             |
| Chippelle Airfield (wd:Q5101637) | dissolved, abolished or demolished date (wdt:P576) | _:bn797741                                                                             |
| Chippelle Airfield (wd:Q5101637) | wdt:P31279                                         | aerodrome (wd:Q62447)                                                                  |
| Chippelle Airfield (wd:Q5101637) | schema:description                                 | منشأة جوية في فرنسا (lang:ar)                                                          |
| Chippelle Airfield (wd:Q5101637) | schema:name                                        | Chippelle Airfield (lang:en)                                                           |
| ...                              | ...                                                | ...                                                                                |

[Assistant]
I'll try listing triples for the blank node used as the P576 value (_:bn797741) so we can see how the date is encoded. I'll request triples with that blank node as the subject.

_:bn797741

Call to function list returned an error:
Constraint "_:bn797741" for subject position is not a valid IRI. IRIs can be given in prefixed form, like "wd:Q937", as URIs, like "http://www.wikidata.org/entity/Q937", or in full form, like "<http://www.wikidata.org/entity/Q937>".

[Assistant]
I'll list the statement-level triples for wd:Q5101637 with property p:P576 to inspect the statement node and its qualifiers/values.

wd:Q5101637

[Assistant] I'll list triples for the statement node s:Q5101637-c899a654-4848-ffc1-bb63-4100cdbd6432 to see the ps:P576 value (the actual date literal) and any qualifiers/references.

[Assistant] I'll list some triples having property ps:P576 to inspect how time values are represented in statements (they may be blank nodes with nested properties).

[Assistant]
I'll run a final query that explicitly extracts end dates from:
- direct end time (wdt:P582),
- qualifiers on the instance-of statement (p:P31 pq:P582),
- dissolved statements (p:P576 ps:P576),
- and date-of-official-closure statements (p:P3999 ps:P3999).

This should return a literal end date for each item when available. I'll execute that query now.

execute

SELECT DISTINCT ?item ?itemLabel ?place ?placeLabel ?iata ?icao ?endDate WHERE {
  VALUES ?class { wd:Q1248784 wd:Q62447 wd:Q695850 }
  ?item wdt:P31 ?class .
  OPTIONAL { ?item wdt:P931 ?place . ?place rdfs:label ?placeLabel FILTER(LANG(?placeLabel)="en") }
  OPTIONAL { ?item wdt:P238 ?iata }
  OPTIONAL { ?item wdt:P239 ?icao }

  # direct end time
  OPTIONAL { ?item wdt:P582 ?endTimeDirect }

  # end time as qualifier on instance-of
  OPTIONAL {
    ?item p:P31 ?p31stmt .
    ?p31stmt pq:P582 ?endTimeQualVal .
  }

  # dissolved/abolished date as ps:P576 on p:P576 statement
  OPTIONAL {
    ?item p:P576 ?dstmt .
    ?dstmt ps:P576 ?dissolvedVal .
  }

  # date of official closure as ps:P3999 on p:P3999 statement
  OPTIONAL {
    ?item p:P3999 ?cstmt .
    ?cstmt ps:P3999 ?closedVal .
  }

  FILTER( BOUND(?endTimeDirect) || BOUND(?endTimeQualVal) || BOUND(?dissolvedVal) || BOUND(?closedVal) )
  BIND(COALESCE(?endTimeDirect, ?endTimeQualVal, ?dissolvedVal, ?closedVal) AS ?endDate)
  OPTIONAL { ?item rdfs:label ?itemLabel FILTER(LANG(?itemLabel)="en") }
}
ORDER BY DESC(?endDate)
LIMIT 1000

[Assistant]
I'll run a focused query for one item (Chippelle Airfield wd:Q5101637) to directly show the values of each of the candidate end-date sources (wdt:P582, p:P31 pq:P582, p:P576 ps:P576, p:P3999 ps:P3999) so we can see which one binds to an actual literal.

SELECT ?item ?itemLabel ?endTimeDirect ?endTimeQualVal ?dissolvedVal ?closedVal WHERE {
  BIND(wd:Q5101637 AS ?item)
  OPTIONAL { ?item wdt:P582 ?endTimeDirect }
  OPTIONAL { ?item p:P31 ?p31stmt . ?p31stmt pq:P582 ?endTimeQualVal }
  OPTIONAL { ?item p:P576 ?dstmt . ?dstmt ps:P576 ?dissolvedVal }
  OPTIONAL { ?item p:P3999 ?cstmt . ?cstmt ps:P3999 ?closedVal }
  OPTIONAL { ?item rdfs:label ?itemLabel FILTER(LANG(?itemLabel)="en") }
}

[Assistant]
I'll try extracting the statement value using the psv: (statement value) predicate for P576 for the same item to see if that yields a literal date.

SELECT ?item ?dstmt ?dissolvedVal ?dissolvedRaw WHERE {
  BIND(wd:Q5101637 AS ?item)
  ?item p:P576 ?dstmt .
  OPTIONAL { ?dstmt ps:P576 ?dissolvedVal }
  OPTIONAL { ?dstmt psv:P576 ?dissolvedRaw }
}

[Assistant]
I'll filter so we only accept literal date values (isLiteral). This avoids blank-node time representations and returns rows where a concrete date literal is available. I'll run that query now.

SELECT DISTINCT ?item ?itemLabel ?place ?placeLabel ?iata ?icao ?endDate WHERE {
  VALUES ?class { wd:Q1248784 wd:Q62447 wd:Q695850 }
  ?item wdt:P31 ?class .
  OPTIONAL { ?item wdt:P931 ?place . ?place rdfs:label ?placeLabel FILTER(LANG(?placeLabel)="en") }
  OPTIONAL { ?item wdt:P238 ?iata }
  OPTIONAL { ?item wdt:P239 ?icao }

  OPTIONAL { ?item wdt:P582 ?endTimeDirect . FILTER(isLiteral(?endTimeDirect)) }
  OPTIONAL { ?item p:P31 ?p31stmt . ?p31stmt pq:P582 ?endTimeQualVal . FILTER(isLiteral(?endTimeQualVal)) }
  OPTIONAL { ?item p:P576 ?dstmt . ?dstmt ps:P576 ?dissolvedVal . FILTER(isLiteral(?dissolvedVal)) }
  OPTIONAL { ?item p:P3999 ?cstmt . ?cstmt ps:P3999 ?closedVal . FILTER(isLiteral(?closedVal)) }

  FILTER( BOUND(?endTimeDirect) || BOUND(?endTimeQualVal) || BOUND(?dissolvedVal) || BOUND(?closedVal) )
  BIND(COALESCE(?endTimeDirect, ?endTimeQualVal, ?dissolvedVal, ?closedVal) AS ?endDate)
  OPTIONAL { ?item rdfs:label ?itemLabel FILTER(LANG(?itemLabel)="en") }
}
ORDER BY DESC(?endDate)
LIMIT 1000

Got 1,000 rows and 7 columns, showing the first 5 and last 5 rows below:
| item                                        | itemLabel                               | place                    | placeLabel           | iata | icao | endDate                             |
| ------------------------------------------- | --------------------------------------- | ------------------------ | -------------------- | ---- | ---- | ----------------------------------- |
| Long Xuyên airport (wd:Q2553839)            | Long Xuyên airport (lang:en)            |                          |                      |      |      | 2100-01-01T00:00:00Z (xsd:dateTime) |
| Codrington Airport (wd:Q924102)             | Codrington Airport (lang:en)            | Codrington (wd:Q1024679) | Codrington (lang:en) | BBQ  | TAPH | 2024-10-02T00:00:00Z (xsd:dateTime) |
| Pittsburgh Northeast Airport (wd:Q7354273)  | Pittsburgh Northeast Airport (lang:en)  | Pittsburgh (wd:Q1342)    | Pittsburgh (lang:en) |      |      | 2024-01-01T00:00:00Z (xsd:dateTime) |
| Buttonville Municipal Airport (wd:Q2928993) | Buttonville Municipal Airport (lang:en) | Markham (wd:Q44016)      | Markham (lang:en)    | YKZ  | CYKZ | 2023-11-30T00:00:00Z (xsd:dateTime) |
| wd:Q62186694                                |                                         |                          |                      |      | UHHM | 2023-10-31T00:00:00Z (xsd:dateTime) |
| ...                                         | ...                                     | ...                      | ...                  | ...  | ...  | ...                                 |
| RAF Membury (wd:Q7275470)                   | RAF Membury (lang:en)                   |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| Little Staughton Airfield (wd:Q7275444)     | Little Staughton Airfield (lang:en)     |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| RAF Ibsley (wd:Q7275401)                    | RAF Ibsley (lang:en)                    |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| RAF Ballyhalbert (wd:Q7275152)              | RAF Ballyhalbert (lang:en)              |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |
| RAF Broadwell (wd:Q7275203)                 | RAF Broadwell (lang:en)                 |                          |                      |      |      | 1947-01-01T00:00:00Z (xsd:dateTime) |

[Assistant]
I'll now provide the final SPARQL query (the one I executed) and summarize the results (noting the query returned 1,000 rows; you can increase the LIMIT or add filters to narrow results).

answer

SELECT DISTINCT ?item ?itemLabel ?place ?placeLabel ?iata ?icao ?endDate WHERE {
  VALUES ?class { wd:Q1248784 wd:Q62447 wd:Q695850 }
  ?item wdt:P31 ?class .
  OPTIONAL { ?item wdt:P931 ?place . ?place rdfs:label ?placeLabel FILTER(LANG(?placeLabel)="en") }
  OPTIONAL { ?item wdt:P238 ?iata }
  OPTIONAL { ?item wdt:P239 ?icao }

  OPTIONAL { ?item wdt:P582 ?endTimeDirect . FILTER(isLiteral(?endTimeDirect)) }
  OPTIONAL { ?item p:P31 ?p31stmt . ?p31stmt pq:P582 ?endTimeQualVal . FILTER(isLiteral(?endTimeQualVal)) }
  OPTIONAL { ?item p:P576 ?dstmt . ?dstmt ps:P576 ?dissolvedVal . FILTER(isLiteral(?dissolvedVal)) }
  OPTIONAL { ?item p:P3999 ?cstmt . ?cstmt ps:P3999 ?closedVal . FILTER(isLiteral(?closedVal)) }

  FILTER( BOUND(?endTimeDirect) || BOUND(?endTimeQualVal) || BOUND(?dissolvedVal) || BOUND(?closedVal) )
  BIND(COALESCE(?endTimeDirect, ?endTimeQualVal, ?dissolvedVal, ?closedVal) AS ?endDate)
  OPTIONAL { ?item rdfs:label ?itemLabel FILTER(LANG(?itemLabel)="en") }
}
ORDER BY DESC(?endDate)
LIMIT 1000

Answer:
I executed the query above on Wikidata. It returns airport / aerodrome / air base items that have an end date recorded (from P582, a pq:P582 qualifier on P31, P576, or P3999). The query returns up to 1000 items (LIMIT 1000) and includes for each: the item IRI, English label, place served (P931) with English label if available, IATA (P238), ICAO (P239), and the end date literal (?endDate).

Execution result: the query returned 1,000 rows (the result set hit the LIMIT). Examples from the top of the result set include items such as:
- wd:Q2553839 — Long Xuyên airport — endDate 2100-01-01T00:00:00Z (note: some records use placeholder/future dates)
- wd:Q924102 — Codrington Airport — place served: wd:Q1024679 (Codrington) — IATA: BBQ — ICAO: TAPH — endDate 2024-10-02T00:00:00Z
- wd:Q7354273 — Pittsburgh Northeast Airport — place served: wd:Q1342 (Pittsburgh) — endDate 2024-01-01T00:00:00Z
- wd:Q2928993 — Buttonville Municipal Airport — place served: wd:Q44016 (Markham) — IATA: YKZ — ICAO: CYKZ — endDate 2023-11-30T00:00:00Z
- several WWII RAF airfields from 1947 (e.g., wd:Q7275470 RAF Membury — endDate 1947-01-01T00:00:00Z)

Notes and limitations:
- The query looks for end dates recorded in common ways on Wikidata: direct end time (P582), a pq:P582 qualifier on the instance-of (P31) statement, dissolved/abolished date (P576) or official closure date (P3999). Some items encode closure dates differently (e.g., in references or as non-literal nodes), so they may not appear.
- I filtered to only accept literal date values (isLiteral) to avoid blank-node time objects; that excludes some items whose end dates are encoded as complex value nodes. If you want to include those as well I can adjust the query to extract time values from those nodes.
- The result set is large; I returned up to 1000 rows. If you want the full set or to restrict by country, year range, or type (only military bases, only civil airports, etc.), tell me how to filter and I will refine the query.

If you want, I can:
- return the full result set (increase or remove LIMIT),
- restrict to a specific country or time range,
- include additional properties (coordinates, status statements, references), or
- export the results in CSV/JSON.