PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?item ?label WHERE {
  ?item wdt:P279 wd:Q13442814 .
  ?item rdfs:label ?label .
  FILTER ( LANG( ?label ) = "en" )
}
ORDER BY ?label

Using entities:
- scholarly article (wd:Q13442814), also known as academic article, academic paper, academic papers, article, article in science, etc.: is subclass of academic work / is subclass of scientific literature / is subclass of Scientific literature / is subclass of article / is subclass of magazine article / is subclass of research / is subclass of scientific publication / article in an academic publication, usually peer reviewed / article in an academic publication, usually peer reviewed

Using properties:
- subclass of (wd:P279 as wdt), also known as all members of this class also belong to, category of, form of, has superclass, is a class of, etc.: this item is a subclass (subset) of that item; ALL instances ... of volcanic landform); Everest is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain

Got 30 rows and 2 columns, showing the first 5 and last 5 rows below:
| item                                     | label                               |
| ---------------------------------------- | ----------------------------------- |
| academic conference paper (wd:Q10885494) | academic conference paper (lang:en) |
| academic journal article (wd:Q18918145)  | academic journal article (lang:en)  |
| Annus Mirabilis papers (wd:Q51497)       | Annus Mirabilis papers (lang:en)    |
| A-publication (wd:Q2774197)              | A-publication (lang:en)             |
| classic article (wd:Q58898396)           | classic article (lang:en)           |
| ...                                      | ...                                 |
| sleeping beauty (wd:Q115528532)          | sleeping beauty (lang:en)           |
| survey article (wd:Q60535861)            | survey article (lang:en)            |
| systematic review (wd:Q1504425)          | systematic review (lang:en)         |
| type catalogue (wd:Q121763407)           | type catalogue (lang:en)            |
| working paper (wd:Q1228945)              | working paper (lang:en)             |

Answer: I searched Wikidata and confirmed the item scholarly article is wd:Q13442814 and the property 'subclass of' is P279. I executed the query above and it returned 30 items that are subclasses of scholarly article, ordered by their English labels. If you would like the full list pasted here as a plain enumerated list (label — IRI) or as CSV, tell me which format you prefer and I will provide it immediately.

I searched Wikidata and confirmed the item scholarly article is wd:Q13442814 and the property 'subclass of' is P279. I executed the query above and it returned 30 items that are subclasses of scholarly article, ordered by their English labels. If you would like the full list pasted here as a plain enumerated list (label — IRI) or as CSV, tell me which format you prefer and I will provide it immediately.

SPARQL query over wikidata:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?item ?label WHERE {
  ?item wdt:P279 wd:Q13442814 .
  ?item rdfs:label ?label .
  FILTER ( LANG( ?label ) = "en" )
}
ORDER BY ?label

Using entities:
- scholarly article (wd:Q13442814), also known as academic article, academic paper, academic papers, article, article in science, etc.: is subclass of academic work / is subclass of scientific literature / is subclass of Scientific literature / is subclass of article / is subclass of magazine article / is subclass of research / is subclass of scientific publication / article in an academic publication, usually peer reviewed / article in an academic publication, usually peer reviewed

Using properties:
- subclass of (wd:P279 as wdt), also known as all members of this class also belong to, category of, form of, has superclass, is a class of, etc.: this item is a subclass (subset) of that item; ALL instances ... of volcanic landform); Everest is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain

Execution result:
Got 30 rows and 2 columns, showing the first 5 and last 5 rows below:
| item                                     | label                               |
| ---------------------------------------- | ----------------------------------- |
| academic conference paper (wd:Q10885494) | academic conference paper (lang:en) |
| academic journal article (wd:Q18918145)  | academic journal article (lang:en)  |
| Annus Mirabilis papers (wd:Q51497)       | Annus Mirabilis papers (lang:en)    |
| A-publication (wd:Q2774197)              | A-publication (lang:en)             |
| classic article (wd:Q58898396)           | classic article (lang:en)           |
| ...                                      | ...                                 |
| sleeping beauty (wd:Q115528532)          | sleeping beauty (lang:en)           |
| survey article (wd:Q60535861)            | survey article (lang:en)            |
| systematic review (wd:Q1504425)          | systematic review (lang:en)         |
| type catalogue (wd:Q121763407)           | type catalogue (lang:en)            |
| working paper (wd:Q1228945)              | working paper (lang:en)             |

[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 items that are subclasses of scholarly articles, ordered by their labels?

[Assistant]
Step 1 — find the Wikidata item for "scholarly article". I'll search for entities matching that label. I'll call the entity search function and then inspect the returned candidates to pick the correct item.

Question: scholarly article

Top 10 entity alternatives:
1. scholarly article (wd:Q13442814), also known as academic article, academic paper, academic papers, article, article in science, etc.: article in an academic publication, usually peer reviewed / article in an academic publication, usually peer reviewed / is subclass of scientific publication / is subclass of scientific literature / is subclass of Scientific literature / is subclass of magazine article / is subclass of academic work / is subclass of research / is subclass of article
2. Nine axes of merit for technosignature searches (wd:Q122939269, matched via scholarly article), also known as scholarly article: scientific article published on 19 November 2019 / scientific article published on 19 November 2019 / scientific article published on 19 November 2019 / is instance of scholarly article / is instance of academic article
3. The importance of peer group ("crowd") affiliation in adolescence (wd:Q126361512, matched via scholarly article), also known as scholarly article: is instance of academic journal article / is instance of مقال  في مجلة اكاديمية
4. News censorship in online social networks: A study of circumvention in the commentsphere (wd:Q116784910, matched via scholarly article), also known as scholarly article: scientific article published on 3 June 2016 / scientific article published on 3 June 2016 / scientific article published on 3 June 2016 / is instance of scholarly article / is instance of academic article
5. On the Riemann hypothesis for self-dual weight enumerators of genera three and four (wd:Q114014395, matched via scholarly article), also known as scholarly article: scientific article published in June 2021 / scientific article published in June 2021 / scientific article published in 2021 / scientific article published in 2021 / is instance of scholarly article / is instance of academic article
6. academic journal article (wd:Q18918145, matched via scholarly article), also known as academic article, academic paper, journal article, scholarly article: article published in an academic journal / is instance of type of publication / is subclass of scholarly article / is subclass of academic article / is subclass of academic work / مقال منشور في مجلة اكاديمية
7. More rain, more virus (wd:Q60067355, matched via Scholarly article), also known as Scholarly article: scientific article published in Nature / is instance of scholarly article / is instance of academic article
8. The possibility of converting lipids into carbohydrates in man. (wd:Q78576861, matched via scholarly article), also known as scholarly article: scientific article published on 01 June 1954 / scientific article published in June 1954 / scientific article published in June 1954 / is instance of scholarly article / is instance of academic article
9. fictional scholarly article (wd:Q116527851), also known as fictional scientific article: scientific article in a work of fiction / is subclass of fictional creative work
10. medical scholarly article (wd:Q82969330), also known as medical journal article: scholarly article in the field of medicine, often published in a medical journal / is subclass of scholarly article / is subclass of academic article

[Assistant]
Next I will find the property for "subclass of" to use in the query (likely P279). I'll search properties for "subclass".

Question: subclass

Top 10 property alternatives:
1. subclass of (wd:P279 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as all members of this class also belong to, category of, form of, has superclass, is a class of, etc.: this item is a subclass (subset) of that item; ALL instances ... of volcanic landform); Everest is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain
2. number of subscribers (wd:P3744 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via subs), also known as follow count, follower count, followers, number of followers, number of follows, etc.: number of subscribers for subscription-based companies, e.g. ... companies, newspapers, pay-TV channels, software, etc. / number of subscribers for subscription-based companies, e.g. ... companies, newspapers, pay-TV channels, software, etc. / number of subscribers for subscription-based companies, e.g. ... companies, newspapers, pay-TV channels, software, etc.
3. school class (wd:P7174 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via class), also known as class, cohort, grade, school cohort, stage, etc.: (qualifier) class of a given year/time period to which the person belonged in an educational institution
4. class (wd:P2308 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as type, P2308: qualifier to define a property constraint in combination with "property constraint" (P2302) / qualifier to define a property constraint in combination with "property constraint" (P2302)
5. narrower external class (wd:P3950 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via external subclass), also known as external subclass, P3950: more specific subclass included in other ontology but not in Wikidata
6. subproperty of (wd:P1647 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via subPropertyOf), also known as has parent property, instance of property, parent property, rdfs:subPropertyOf, subclass of property, etc.: all resources related by this property are also related by that property / is subproperty of related property / is subproperty of see also
7. combines lexemes (wd:P5238 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via suffix), also known as combined lexeme, combines, compound lexeme, compound of, conflation, etc.: is subproperty of derived from lexeme / lexemes combined in this lexeme / is subproperty of derived from
8. subtitle (wd:P1680 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as P1680: for works, when the title is followed by a subtitle / for works, when the title is followed by a subtitle / is subproperty of title
9. word stem (wd:P5187 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via stem), also known as stem, wordstem, P5187: word stem of the subject lexeme
10. metasubclass of (wd:P2445 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as metaclass of, P2445: relation between two metaclasses: instances of this metaclass ... of classes that are instances of the target metaclass

[Assistant]
I will run a SPARQL SELECT query that finds all items with wdt:P279 (subclass of) pointing to the scholarly article item (wd:Q13442814), retrieving their English labels and ordering the results by label. I'll execute the query to verify the results.

execute

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?item ?label WHERE {
  ?item wdt:P279 wd:Q13442814 .
  ?item rdfs:label ?label .
  FILTER(LANG(?label) = "en")
}
ORDER BY ?label

Got 30 rows and 2 columns, showing the first 5 and last 5 rows below:
| item                                     | label                               |
| ---------------------------------------- | ----------------------------------- |
| academic conference paper (wd:Q10885494) | academic conference paper (lang:en) |
| academic journal article (wd:Q18918145)  | academic journal article (lang:en)  |
| Annus Mirabilis papers (wd:Q51497)       | Annus Mirabilis papers (lang:en)    |
| A-publication (wd:Q2774197)              | A-publication (lang:en)             |
| classic article (wd:Q58898396)           | classic article (lang:en)           |
| ...                                      | ...                                 |
| sleeping beauty (wd:Q115528532)          | sleeping beauty (lang:en)           |
| survey article (wd:Q60535861)            | survey article (lang:en)            |
| systematic review (wd:Q1504425)          | systematic review (lang:en)         |
| type catalogue (wd:Q121763407)           | type catalogue (lang:en)            |
| working paper (wd:Q1228945)              | working paper (lang:en)             |

[Assistant]
I'll run a grouped query that concatenates all (label + IRI) entries into a single string ordered by label, so I can present the full ordered list reliably.

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT (GROUP_CONCAT(CONCAT(?label, " (", STR(?item), ")"); separator="; ") AS ?items) WHERE {
  {
    SELECT ?item ?label WHERE {
      ?item wdt:P279 wd:Q13442814 .
      ?item rdfs:label ?label .
      FILTER(LANG(?label) = "en")
    }
    ORDER BY ?label
  }
}

[Assistant]
answer

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?item ?label WHERE {
  ?item wdt:P279 wd:Q13442814 .
  ?item rdfs:label ?label .
  FILTER(LANG(?label) = "en")
}
ORDER BY ?label

Answer: I searched Wikidata and confirmed the item scholarly article is wd:Q13442814 and the property 'subclass of' is P279. I executed the query above and it returned 30 items that are subclasses of scholarly article, ordered by their English labels. If you would like the full list pasted here as a plain enumerated list (label — IRI) or as CSV, tell me which format you prefer and I will provide it immediately.


PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?airport ?airportLabel ( COUNT( DISTINCT ?runway ) AS ?runwayCount ) WHERE {
  ?airport wdt:P31 ?type .
  ?type wdt:P279 * wd:Q644371 .
  OPTIONAL {
    ?airport wdt:P529 ?runway .
  }
  ?airport rdfs:label ?airportLabel .
  FILTER ( LANG( ?airportLabel ) = "en" )
}
GROUP BY ?airport ?airportLabel
HAVING ( COUNT( DISTINCT ?runway ) = 1 )
ORDER BY ?airportLabel

Using entities:
- international airport (wd:Q644371): is subclass of airport / airport serving international destinations / airport serving international destinations / airport serving international destinations

Using properties:
- subclass of (wd:P279 as wdt), also known as all members of this class also belong to, category of, form of, has superclass, is a class of, etc.: this item is a subclass (subset) of that item; ALL instances ... of volcanic landform); Everest is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain
- instance of (wd:P31 as 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
- runway (wd:P529 as wdt), also known as RWY, P529: name (direction) of runway at airport/airfield/airstrip / name (direction) of runway at airport/airfield/airstrip

Got 594 rows and 3 columns, showing the first 5 and last 5 rows below:
| airport                                            | airportLabel                                     | runwayCount |
| -------------------------------------------------- | ------------------------------------------------ | ----------- |
| Abakan International Airport (wd:Q558204)          | Abakan International Airport (lang:en)           | 1 (xsd:int) |
| Abel Santamaría Airport (wd:Q3496664)              | Abel Santamaría Airport (lang:en)                | 1 (xsd:int) |
| Abraham González Airport (wd:Q2233076)             | Abraham González Airport (lang:en)               | 1 (xsd:int) |
| Adana Şakirpaşa Airport (wd:Q1430728)              | Adana Şakirpaşa Airport (lang:en)                | 1 (xsd:int) |
| Addis Ababa Bole International Airport (wd:Q44923) | Addis Ababa Bole International Airport (lang:en) | 1 (xsd:int) |
| ...                                                | ...                                              | ...         |
| Zamboanga International Airport (wd:Q1200033)      | Zamboanga International Airport (lang:en)        | 1 (xsd:int) |
| Zaporizhzhia International Airport (wd:Q1432786)   | Zaporizhzhia International Airport (lang:en)     | 1 (xsd:int) |
| Zenata – Messali El Hadj Airport (wd:Q2875969)     | Zenata – Messali El Hadj Airport (lang:en)       | 1 (xsd:int) |
| Zhukovsky International Airport (wd:Q2388744)      | Zhukovsky International Airport (lang:en)        | 1 (xsd:int) |
| Zvartnots International Airport (wd:Q1124922)      | Zvartnots International Airport (lang:en)        | 1 (xsd:int) |

Answer:
I ran the SPARQL query above. It returns international airports (items whose instance-of type is or is a subclass of wd:Q644371) that have exactly one runway recorded via property wdt:P529. The query returned 594 results. Example entries (airport label — number of runways):
- Abakan International Airport — 1
- Abel Santamaría Airport — 1
- Abraham González Airport — 1
- Adana Şakirpaşa Airport — 1
- Addis Ababa Bole International Airport — 1
...
- Zamboanga International Airport — 1
- Zaporizhzhia International Airport — 1
- Zenata – Messali El Hadj Airport — 1
- Zhukovsky International Airport — 1
- Zvartnots International Airport — 1

Notes / caveats:
- The query counts distinct runways linked by property P529 (runway). If an airport's runways are recorded using different properties or described only in text, the airport will not appear.
- The classification "international airport" is taken via items whose instance-of type is, or whose instance-of type is a (transitive) subclass of, wd:Q644371.

If you would like the full 594-row table (IRI, English label, runway count) as CSV or pasted here, I can provide it.

I ran the SPARQL query above. It returns international airports (items whose instance-of type is or is a subclass of wd:Q644371) that have exactly one runway recorded via property wdt:P529. The query returned 594 results. Example entries (airport label — number of runways):
- Abakan International Airport — 1
- Abel Santamaría Airport — 1
- Abraham González Airport — 1
- Adana Şakirpaşa Airport — 1
- Addis Ababa Bole International Airport — 1
...
- Zamboanga International Airport — 1
- Zaporizhzhia International Airport — 1
- Zenata – Messali El Hadj Airport — 1
- Zhukovsky International Airport — 1
- Zvartnots International Airport — 1

Notes / caveats:
- The query counts distinct runways linked by property P529 (runway). If an airport's runways are recorded using different properties or described only in text, the airport will not appear.
- The classification "international airport" is taken via items whose instance-of type is, or whose instance-of type is a (transitive) subclass of, wd:Q644371.

If you would like the full 594-row table (IRI, English label, runway count) as CSV or pasted here, I can provide it.

SPARQL query over wikidata:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?airport ?airportLabel ( COUNT( DISTINCT ?runway ) AS ?runwayCount ) WHERE {
  ?airport wdt:P31 ?type .
  ?type wdt:P279 * wd:Q644371 .
  OPTIONAL {
    ?airport wdt:P529 ?runway .
  }
  ?airport rdfs:label ?airportLabel .
  FILTER ( LANG( ?airportLabel ) = "en" )
}
GROUP BY ?airport ?airportLabel
HAVING ( COUNT( DISTINCT ?runway ) = 1 )
ORDER BY ?airportLabel

Using entities:
- international airport (wd:Q644371): is subclass of airport / airport serving international destinations / airport serving international destinations / airport serving international destinations

Using properties:
- subclass of (wd:P279 as wdt), also known as all members of this class also belong to, category of, form of, has superclass, is a class of, etc.: this item is a subclass (subset) of that item; ALL instances ... of volcanic landform); Everest is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain
- instance of (wd:P31 as 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
- runway (wd:P529 as wdt), also known as RWY, P529: name (direction) of runway at airport/airfield/airstrip / name (direction) of runway at airport/airfield/airstrip

Execution result:
Got 594 rows and 3 columns, showing the first 5 and last 5 rows below:
| airport                                            | airportLabel                                     | runwayCount |
| -------------------------------------------------- | ------------------------------------------------ | ----------- |
| Abakan International Airport (wd:Q558204)          | Abakan International Airport (lang:en)           | 1 (xsd:int) |
| Abel Santamaría Airport (wd:Q3496664)              | Abel Santamaría Airport (lang:en)                | 1 (xsd:int) |
| Abraham González Airport (wd:Q2233076)             | Abraham González Airport (lang:en)               | 1 (xsd:int) |
| Adana Şakirpaşa Airport (wd:Q1430728)              | Adana Şakirpaşa Airport (lang:en)                | 1 (xsd:int) |
| Addis Ababa Bole International Airport (wd:Q44923) | Addis Ababa Bole International Airport (lang:en) | 1 (xsd:int) |
| ...                                                | ...                                              | ...         |
| Zamboanga International Airport (wd:Q1200033)      | Zamboanga International Airport (lang:en)        | 1 (xsd:int) |
| Zaporizhzhia International Airport (wd:Q1432786)   | Zaporizhzhia International Airport (lang:en)     | 1 (xsd:int) |
| Zenata – Messali El Hadj Airport (wd:Q2875969)     | Zenata – Messali El Hadj Airport (lang:en)       | 1 (xsd:int) |
| Zhukovsky International Airport (wd:Q2388744)      | Zhukovsky International Airport (lang:en)        | 1 (xsd:int) |
| Zvartnots International Airport (wd:Q1124922)      | Zvartnots International Airport (lang:en)        | 1 (xsd:int) |

[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] Which international airports have exactly one runway? Please provide their labels and the number of runways, and order by the airport label.

[Assistant]
Step 1: I'll search Wikidata for the entity "international airport" to get its Q-id and confirm how international airports are modeled (instance of vs subclass). Then I'll search for the property that records number of runways (likely something like "number of runways"). I'll explain each step and the reasoning, and adapt based on results. I'll start by searching for the entity "international airport".

Question: international airport

Top 10 entity alternatives:
1. international airport (wd:Q644371): airport serving international destinations / airport serving international destinations / airport serving international destinations / is subclass of airport
2. International Airport (wd:Q55614529): 1985 film directed by Don Chaffey / is instance of film
3. Domodedovo International Airport (wd:Q186614), also known as DME, Domodedovo Airport, Moscow Airport, Moscow Domodedovo Airport, Moscow-Domodedovo Airport, etc.: international airport serving Moscow, Russia / is instance of commercial traffic aerodrome / is instance of international airport / is instance of federal aeroport / airport in Russia / airport in Russia
4. John F. Kennedy International Airport (wd:Q8685, matched via Idlewild International Airport), also known as Idlewild Airport, Idlewild International Airport, JFK, JFK Airport, JFK International Airport, etc.: international airport in New York, United States / international airport in New York, United States / international airport in New York, United States / is instance of commercial traffic aerodrome / is instance of international airport
5. Sheremetyevo International Airport (wd:Q192733), also known as Moscow Airport, Moscow International Airport, Sheremetyevo Airport, SVO, UUEE: international airport serving Moscow, Russia / is instance of commercial traffic aerodrome / is instance of international airport / is instance of federal aeroport / is instance of airport
6. Istanbul-Atatürk (wd:Q86473, matched via Atatürk International Airport), also known as Atatürk International Airport, ISL, İstanbul Atatürk, Istanbul Ataturk Airport, Istanbul Atatürk Airport, etc.: is instance of commercial traffic aerodrome / international airport in Istanbul, Turkey / is instance of international airport
7. Singapore Changi Airport (wd:Q32159, matched via Changi International Airport), also known as Changi Airport, Changi Airport Singapore, Changi International Airport, SIN, WSSS: is instance of commercial traffic aerodrome / is instance of international airport / international airport in Singapore / international airport in Singapore / main airport in Singapore / main airport in Singapore / is instance of airport
8. Dubai International Airport (wd:Q193439), also known as DXB, OMDB: international airport in Dubai, United Arab Emirates / is instance of commercial traffic aerodrome / is instance of international airport / airport in United Arab Emirates / airport in United Arab Emirates
9. Tokyo International Airport (wd:Q204853), also known as Haneda Airport, HND, RJTT: is instance of commercial traffic aerodrome / international airport serving Tokyo, Japan / is instance of international airport / is instance of airport
10. O'Hare International Airport (wd:Q213717), also known as Chicago Airport, Chicago International Airport, Chicago O'Hare Field, Chicago O'Hare International Airport, Chicago Orchard Airport, etc.: is instance of commercial traffic aerodrome / airport in Chicago, Illinois, United States / is instance of international airport / airport in Chicago, IL, US / airport in Chicago, IL, US / is instance of airport

[Assistant]
Now I'll search for a property corresponding to "number of runways" so I can filter airports with exactly one runway. I'll look for property names like "number of runways", "runways", or similar.

Question: number of runways

Top 10 property alternatives:
1. runway (wd:P529 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as RWY, P529: name (direction) of runway at airport/airfield/airstrip / name (direction) of runway at airport/airfield/airstrip
2. number of lanes (wd:P10367 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as lanes number, number of lanes of that road in a direction, P10367: number of lanes on this road in a given direction
3. ICAO airport code (wd:P239 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via ICAO aerodrome code), 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)
4. takeoff and landing capability (wd:P1956 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as P1956: type of takeoff and landing the aircraft is designed to operate
5. airline hub (wd:P113 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as hub, hub airport, P113: airport that serves as a hub for an airline / airport that serves as a hub for an airline / airport that serves as a hub for an airline
6. number of seats in assembly (wd:P1410 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via seats), also known as number of delegates, number of representatives, number of seats, seats, P1410: number of seats a political party, faction, or group has in a given assembly
7. maximum capacity (wd:P1083 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via seats), also known as capacity, complement, crew, number of seats, seating capacity, etc.: number of people allowed for a venue or vehicle / number of people allowed for a venue or vehicle
8. item operated (wd:P121 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via aircraft carried), 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
9. FAA airport code (wd:P240 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), 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
10. image of design plans (wd:P3311 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via airport diagram), also known as airport diagram, architectural plan image, blue print, design plan, floor plan, etc.: image representing the plan of a building or place / is subproperty of detail map

[Assistant]
I'll run a SPARQL SELECT that:
- finds items whose instance-of type is (or is a subclass of) Q644371 (international airport),
- counts distinct runways connected via property P529 (runway),
- filters to those with count = 1,
- returns the airport IRI, its English label, and the runway count, ordered by label.

I'll execute the query now to get the actual results.

execute

SELECT ?airport ?airportLabel (COUNT(DISTINCT ?runway) AS ?runwayCount) WHERE {
  ?airport wdt:P31 ?type .
  ?type wdt:P279* wd:Q644371 .
  OPTIONAL { ?airport wdt:P529 ?runway . }
  ?airport rdfs:label ?airportLabel . FILTER(LANG(?airportLabel) = "en")
}
GROUP BY ?airport ?airportLabel
HAVING (COUNT(DISTINCT ?runway) = 1)
ORDER BY ?airportLabel

Got 594 rows and 3 columns, showing the first 5 and last 5 rows below:
| airport                                            | airportLabel                                     | runwayCount |
| -------------------------------------------------- | ------------------------------------------------ | ----------- |
| Abakan International Airport (wd:Q558204)          | Abakan International Airport (lang:en)           | 1 (xsd:int) |
| Abel Santamaría Airport (wd:Q3496664)              | Abel Santamaría Airport (lang:en)                | 1 (xsd:int) |
| Abraham González Airport (wd:Q2233076)             | Abraham González Airport (lang:en)               | 1 (xsd:int) |
| Adana Şakirpaşa Airport (wd:Q1430728)              | Adana Şakirpaşa Airport (lang:en)                | 1 (xsd:int) |
| Addis Ababa Bole International Airport (wd:Q44923) | Addis Ababa Bole International Airport (lang:en) | 1 (xsd:int) |
| ...                                                | ...                                              | ...         |
| Zamboanga International Airport (wd:Q1200033)      | Zamboanga International Airport (lang:en)        | 1 (xsd:int) |
| Zaporizhzhia International Airport (wd:Q1432786)   | Zaporizhzhia International Airport (lang:en)     | 1 (xsd:int) |
| Zenata – Messali El Hadj Airport (wd:Q2875969)     | Zenata – Messali El Hadj Airport (lang:en)       | 1 (xsd:int) |
| Zhukovsky International Airport (wd:Q2388744)      | Zhukovsky International Airport (lang:en)        | 1 (xsd:int) |
| Zvartnots International Airport (wd:Q1124922)      | Zvartnots International Airport (lang:en)        | 1 (xsd:int) |

[Assistant]
Explanation after running the query:
- The query finds items whose instance-of type is (or is a subclass of) Q644371 (international airport).
- It counts distinct runways linked via P529 (runway) and filters for count = 1.
- The query returned 594 results (examples shown earlier). Caveats: this relies on runways being recorded with P529; some airports may record runway information differently (or not at all), so they won't appear. Also the "international airport" classification depends on instance-of/subclass modeling in Wikidata.

I'll now provide the final SPARQL query and a concise answer summarizing the results.

answer

SELECT ?airport ?airportLabel (COUNT(DISTINCT ?runway) AS ?runwayCount) WHERE {
  ?airport wdt:P31 ?type .
  ?type wdt:P279* wd:Q644371 .
  OPTIONAL { ?airport wdt:P529 ?runway . }
  ?airport rdfs:label ?airportLabel . FILTER(LANG(?airportLabel) = "en")
}
GROUP BY ?airport ?airportLabel
HAVING (COUNT(DISTINCT ?runway) = 1)
ORDER BY ?airportLabel

Answer:
I ran the SPARQL query above. It returns international airports (items whose instance-of type is or is a subclass of wd:Q644371) that have exactly one runway recorded via property wdt:P529. The query returned 594 results. Example entries (airport label — number of runways):
- Abakan International Airport — 1
- Abel Santamaría Airport — 1
- Abraham González Airport — 1
- Adana Şakirpaşa Airport — 1
- Addis Ababa Bole International Airport — 1
...
- Zamboanga International Airport — 1
- Zaporizhzhia International Airport — 1
- Zenata – Messali El Hadj Airport — 1
- Zhukovsky International Airport — 1
- Zvartnots International Airport — 1

Notes / caveats:
- The query counts distinct runways linked by property P529 (runway). If an airport's runways are recorded using different properties or described only in text, the airport will not appear.
- The classification "international airport" is taken via items whose instance-of type is, or whose instance-of type is a (transitive) subclass of, wd:Q644371.

If you would like the full 594-row table (IRI, English label, runway count) as CSV or pasted here, I can provide it.


PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?company ( COUNT( DISTINCT ?item ) AS ?count ) ?companyLabel WHERE {
  ?item wdt:P272 ?company .
  OPTIONAL {
    ?company rdfs:label ?companyLabel .
    FILTER ( LANG( ?companyLabel ) = "en" )
  }
}
GROUP BY ?company ?companyLabel
HAVING ( COUNT( DISTINCT ?item ) > 100 )
ORDER BY DESC ( ?count )

Using properties:
- production company (wd:P272 as wdt), also known as ballet company, broadcasting company, film studio, motion picture studio, movie studio, etc.: company that produced this film, audio or performing arts work / company that produced this film, audio or performing arts work

Got 219 rows and 3 columns, showing the first 5 and last 5 rows below:
| company                                   | count          | companyLabel                          |
| ----------------------------------------- | -------------- | ------------------------------------- |
| Theater Basel (wd:Q391991)                | 7865 (xsd:int) | Theater Basel (lang:en)               |
| Schauspielhaus Zürich (wd:Q40313234)      | 3203 (xsd:int) | Schauspielhaus Zürich (lang:en)       |
| Vitagraph Studios (wd:Q1418400)           | 2551 (xsd:int) | Vitagraph Studios (lang:en)           |
| Essanay Studios (wd:Q1368540)             | 1974 (xsd:int) | Essanay Studios (lang:en)             |
| Universal Pictures (wd:Q168383)           | 1625 (xsd:int) | Universal Pictures (lang:en)          |
| ...                                       | ...            | ...                                   |
| Laika (wd:Q54805138)                      | 103 (xsd:int)  | Laika (lang:en)                       |
| C-mine Cultuurcentrum Genk (wd:Q33100443) | 103 (xsd:int)  | C-mine Cultuurcentrum Genk (lang:en)  |
| TriStar Pictures (wd:Q651454)             | 102 (xsd:int)  | TriStar Pictures (lang:en)            |
| Disney Television Animation (wd:Q1392453) | 102 (xsd:int)  | Disney Television Animation (lang:en) |
| Pixar (wd:Q127552)                        | 101 (xsd:int)  | Pixar (lang:en)                       |

Answer:
I executed a SPARQL query that counts distinct items having the property production company (wdt:P272), groups by the company IRI, filters to counts > 100, and orders descending.

Summary of results:
- Total companies returned: 219 (companies with more than 100 items produced).

Top 10 companies (by number of items produced), showing the company IRI, the count, and the English label:
1. wd:Q391991 — 7865 — Theater Basel
2. wd:Q40313234 — 3203 — Schauspielhaus Zürich
3. wd:Q1418400 — 2551 — Vitagraph Studios
4. wd:Q1368540 — 1974 — Essanay Studios
5. wd:Q168383 — 1625 — Universal Pictures
6. wd:Q179200 — 1590 — Metro-Goldwyn-Mayer
7. wd:Q141336 — 1477 — Mosfilm
8. wd:Q126399 — 1450 — Warner Bros.
9. wd:Q606359 — 1345 — Edison Studios
10. wd:Q112897980 — 1326 — Stadttheater Bern

If you want the complete ordered list of all 219 companies, run the provided SPARQL query against Wikidata — it returns each company IRI, the production count, and optional English label.

Notes on methodology and verification:
- I first confirmed the correct property for "production company" is P272 using the property search.
- The SPARQL uses wdt:P272 to get normalized direct links from items to production companies and COUNT(DISTINCT ?item) to avoid double-counting the same item if it appears multiple times.
- I constrained nothing further (e.g., instance-of) so the query counts any Wikidata item that lists a production company via P272; this matches the wording of your question. If you want to restrict to a particular type of work (e.g., films only), I can refine the query to restrict ?item to instance of film (wdt:P31 wd:Q11424) or similar.

I executed a SPARQL query that counts distinct items having the property production company (wdt:P272), groups by the company IRI, filters to counts > 100, and orders descending.

Summary of results:
- Total companies returned: 219 (companies with more than 100 items produced).

Top 10 companies (by number of items produced), showing the company IRI, the count, and the English label:
1. wd:Q391991 — 7865 — Theater Basel
2. wd:Q40313234 — 3203 — Schauspielhaus Zürich
3. wd:Q1418400 — 2551 — Vitagraph Studios
4. wd:Q1368540 — 1974 — Essanay Studios
5. wd:Q168383 — 1625 — Universal Pictures
6. wd:Q179200 — 1590 — Metro-Goldwyn-Mayer
7. wd:Q141336 — 1477 — Mosfilm
8. wd:Q126399 — 1450 — Warner Bros.
9. wd:Q606359 — 1345 — Edison Studios
10. wd:Q112897980 — 1326 — Stadttheater Bern

If you want the complete ordered list of all 219 companies, run the provided SPARQL query against Wikidata — it returns each company IRI, the production count, and optional English label.

Notes on methodology and verification:
- I first confirmed the correct property for "production company" is P272 using the property search.
- The SPARQL uses wdt:P272 to get normalized direct links from items to production companies and COUNT(DISTINCT ?item) to avoid double-counting the same item if it appears multiple times.
- I constrained nothing further (e.g., instance-of) so the query counts any Wikidata item that lists a production company via P272; this matches the wording of your question. If you want to restrict to a particular type of work (e.g., films only), I can refine the query to restrict ?item to instance of film (wdt:P31 wd:Q11424) or similar.

SPARQL query over wikidata:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?company ( COUNT( DISTINCT ?item ) AS ?count ) ?companyLabel WHERE {
  ?item wdt:P272 ?company .
  OPTIONAL {
    ?company rdfs:label ?companyLabel .
    FILTER ( LANG( ?companyLabel ) = "en" )
  }
}
GROUP BY ?company ?companyLabel
HAVING ( COUNT( DISTINCT ?item ) > 100 )
ORDER BY DESC ( ?count )

Using properties:
- production company (wd:P272 as wdt), also known as ballet company, broadcasting company, film studio, motion picture studio, movie studio, etc.: company that produced this film, audio or performing arts work / company that produced this film, audio or performing arts work

Execution result:
Got 219 rows and 3 columns, showing the first 5 and last 5 rows below:
| company                                   | count          | companyLabel                          |
| ----------------------------------------- | -------------- | ------------------------------------- |
| Theater Basel (wd:Q391991)                | 7865 (xsd:int) | Theater Basel (lang:en)               |
| Schauspielhaus Zürich (wd:Q40313234)      | 3203 (xsd:int) | Schauspielhaus Zürich (lang:en)       |
| Vitagraph Studios (wd:Q1418400)           | 2551 (xsd:int) | Vitagraph Studios (lang:en)           |
| Essanay Studios (wd:Q1368540)             | 1974 (xsd:int) | Essanay Studios (lang:en)             |
| Universal Pictures (wd:Q168383)           | 1625 (xsd:int) | Universal Pictures (lang:en)          |
| ...                                       | ...            | ...                                   |
| Laika (wd:Q54805138)                      | 103 (xsd:int)  | Laika (lang:en)                       |
| C-mine Cultuurcentrum Genk (wd:Q33100443) | 103 (xsd:int)  | C-mine Cultuurcentrum Genk (lang:en)  |
| TriStar Pictures (wd:Q651454)             | 102 (xsd:int)  | TriStar Pictures (lang:en)            |
| Disney Television Animation (wd:Q1392453) | 102 (xsd:int)  | Disney Television Animation (lang:en) |
| Pixar (wd:Q127552)                        | 101 (xsd:int)  | Pixar (lang:en)                       |

[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] Which production companies have produced more than 100 items, ordered by the number of items produced in descending order?

[Assistant]
Plan:
1. Search for the property in Wikidata that corresponds to "production company".
2. Once found, write a SPARQL query that counts items with that property (wdt:Pxxx), groups by the company item, filters counts > 100, returns the company IRI and count, and orders descending.
3. Execute the query and return results.

I'll start by searching for the property "production company". I'll explain my reasoning and show the function calls.

Question: production company

Top 10 property alternatives:
1. production company (wd:P272 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as ballet company, broadcasting company, film studio, motion picture studio, movie studio, etc.: company that produced this film, audio or performing arts work / company that produced this film, audio or performing arts work
2. manufacturer (wd:P176 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via producer), also known as assembled by, assembler, brewed by, brewer, builder, etc.: (main or final) manufacturer or producer of this product / manufacturer or producer of this product
3. producer (wd:P162 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as creative producer, film producer, musical producer, music producer, produced by, etc.: person(s) who produced the film, musical work, theatrical ... [for production company, use P272, video games - use P178] / producer(s) of this film or music work (film: not executive producers, associate producers, etc.)
4. product or material produced (wd:P1056 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via producer of), 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. production manager (wd:P12324 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as unit production manager, P12324: manager that is responsible for the administration of a feature film or television production
6. working title (wd:P1638 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via production title), also known as code name, codename, production name, production title, working name, etc.: temporary name of a product or project used during its development
7. produced by (wd:P2849 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as secreted by, P2849: links a class of biological features (such as a biochemical ... with another class of biological entities known to produce it / is subproperty of has immediate cause
8. fabrication method (wd:P2079 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via produced by), also known as assembly method, assembly process, building technique, by means, by method, etc.: method, process or technique used to grow, cook, weave, build, assemble, manufacture the item / method, process or technique used to grow, cook, weave, build, assemble, manufacture the item / is subproperty of uses
9. executive producer (wd:P1431 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as P1431: executive producer of a movie, TV show, or other piece of media or entertainment
10. created for (wd:P9883 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via produced for), also known as cause of creation, commissioned for, made for, occasion, on the occasion of, etc.: a work, event, etc. for which the subject work was created ... was created for; a film that a screenplay was written for)

[Assistant]
I'll run a SPARQL query that counts distinct items having the property production company (wdt:P272), groups by the company IRI, filters counts > 100, and orders descending. The query will also optionally return English labels for readability. Now I'll execute that query.

execute

SELECT ?company (COUNT(DISTINCT ?item) AS ?count) ?companyLabel WHERE {
  ?item wdt:P272 ?company .
  OPTIONAL { ?company rdfs:label ?companyLabel . FILTER(LANG(?companyLabel) = "en") }
}
GROUP BY ?company ?companyLabel
HAVING (COUNT(DISTINCT ?item) > 100)
ORDER BY DESC(?count)
LIMIT 200

Got 200 rows and 3 columns, showing the first 5 and last 5 rows below:
| company                                | count          | companyLabel                        |
| -------------------------------------- | -------------- | ----------------------------------- |
| Theater Basel (wd:Q391991)             | 7865 (xsd:int) | Theater Basel (lang:en)             |
| Schauspielhaus Zürich (wd:Q40313234)   | 3203 (xsd:int) | Schauspielhaus Zürich (lang:en)     |
| Vitagraph Studios (wd:Q1418400)        | 2551 (xsd:int) | Vitagraph Studios (lang:en)         |
| Essanay Studios (wd:Q1368540)          | 1974 (xsd:int) | Essanay Studios (lang:en)           |
| Universal Pictures (wd:Q168383)        | 1625 (xsd:int) | Universal Pictures (lang:en)        |
| ...                                    | ...            | ...                                 |
| Sony Pictures (wd:Q822314)             | 113 (xsd:int)  | Sony Pictures (lang:en)             |
| Village Roadshow Pictures (wd:Q622668) | 112 (xsd:int)  | Village Roadshow Pictures (lang:en) |
| Nea Skini Technis (wd:Q60929381)       | 112 (xsd:int)  | Nea Skini Technis (lang:en)         |
| Finos Film (wd:Q1418294)               | 112 (xsd:int)  | Finos Film (lang:en)                |
| Concertgebouw (wd:Q1867854)            | 111 (xsd:int)  | Concertgebouw (lang:en)             |

[Assistant]
I'll re-run the same query without a LIMIT so it returns all companies with more than 100 items. I explain: removing LIMIT ensures we don't truncate results. Now executing the full query.

SELECT ?company (COUNT(DISTINCT ?item) AS ?count) ?companyLabel WHERE {
  ?item wdt:P272 ?company .
  OPTIONAL { ?company rdfs:label ?companyLabel . FILTER(LANG(?companyLabel) = "en") }
}
GROUP BY ?company ?companyLabel
HAVING (COUNT(DISTINCT ?item) > 100)
ORDER BY DESC(?count)

Got 219 rows and 3 columns, showing the first 5 and last 5 rows below:
| company                                   | count          | companyLabel                          |
| ----------------------------------------- | -------------- | ------------------------------------- |
| Theater Basel (wd:Q391991)                | 7865 (xsd:int) | Theater Basel (lang:en)               |
| Schauspielhaus Zürich (wd:Q40313234)      | 3203 (xsd:int) | Schauspielhaus Zürich (lang:en)       |
| Vitagraph Studios (wd:Q1418400)           | 2551 (xsd:int) | Vitagraph Studios (lang:en)           |
| Essanay Studios (wd:Q1368540)             | 1974 (xsd:int) | Essanay Studios (lang:en)             |
| Universal Pictures (wd:Q168383)           | 1625 (xsd:int) | Universal Pictures (lang:en)          |
| ...                                       | ...            | ...                                   |
| Laika (wd:Q54805138)                      | 103 (xsd:int)  | Laika (lang:en)                       |
| C-mine Cultuurcentrum Genk (wd:Q33100443) | 103 (xsd:int)  | C-mine Cultuurcentrum Genk (lang:en)  |
| TriStar Pictures (wd:Q651454)             | 102 (xsd:int)  | TriStar Pictures (lang:en)            |
| Disney Television Animation (wd:Q1392453) | 102 (xsd:int)  | Disney Television Animation (lang:en) |
| Pixar (wd:Q127552)                        | 101 (xsd:int)  | Pixar (lang:en)                       |

[Assistant]
I'll fetch the top 20 results explicitly to list them in the final answer. I'll run the query again with LIMIT 20.

SELECT ?company (COUNT(DISTINCT ?item) AS ?count) ?companyLabel WHERE {
  ?item wdt:P272 ?company .
  OPTIONAL { ?company rdfs:label ?companyLabel . FILTER(LANG(?companyLabel) = "en") }
}
GROUP BY ?company ?companyLabel
HAVING (COUNT(DISTINCT ?item) > 100)
ORDER BY DESC(?count)
LIMIT 20

Got 20 rows and 3 columns, showing the first 5 and last 5 rows below:
| company                                  | count          | companyLabel                          |
| ---------------------------------------- | -------------- | ------------------------------------- |
| Theater Basel (wd:Q391991)               | 7865 (xsd:int) | Theater Basel (lang:en)               |
| Schauspielhaus Zürich (wd:Q40313234)     | 3203 (xsd:int) | Schauspielhaus Zürich (lang:en)       |
| Vitagraph Studios (wd:Q1418400)          | 2551 (xsd:int) | Vitagraph Studios (lang:en)           |
| Essanay Studios (wd:Q1368540)            | 1974 (xsd:int) | Essanay Studios (lang:en)             |
| Universal Pictures (wd:Q168383)          | 1625 (xsd:int) | Universal Pictures (lang:en)          |
| ...                                      | ...            | ...                                   |
| RKO Pictures (wd:Q267282)                | 937 (xsd:int)  | RKO Pictures (lang:en)                |
| Lubin Manufacturing Company (wd:Q116439) | 922 (xsd:int)  | Lubin Manufacturing Company (lang:en) |
| Lenfilm (wd:Q158478)                     | 917 (xsd:int)  | Lenfilm (lang:en)                     |
| Nestor Film Company (wd:Q3338476)        | 903 (xsd:int)  | Nestor Film Company (lang:en)         |
| Biograph Company (wd:Q465832)            | 874 (xsd:int)  | Biograph Company (lang:en)            |

[Assistant]
I'll fetch the top 10 companies explicitly (LIMIT 10) so I can list them clearly in the final answer.

SELECT ?company (COUNT(DISTINCT ?item) AS ?count) ?companyLabel WHERE {
  ?item wdt:P272 ?company .
  OPTIONAL { ?company rdfs:label ?companyLabel . FILTER(LANG(?companyLabel) = "en") }
}
GROUP BY ?company ?companyLabel
HAVING (COUNT(DISTINCT ?item) > 100)
ORDER BY DESC(?count)
LIMIT 10

Got 10 rows and 3 columns:
| company                              | count          | companyLabel                    |
| ------------------------------------ | -------------- | ------------------------------- |
| Theater Basel (wd:Q391991)           | 7865 (xsd:int) | Theater Basel (lang:en)         |
| Schauspielhaus Zürich (wd:Q40313234) | 3203 (xsd:int) | Schauspielhaus Zürich (lang:en) |
| Vitagraph Studios (wd:Q1418400)      | 2551 (xsd:int) | Vitagraph Studios (lang:en)     |
| Essanay Studios (wd:Q1368540)        | 1974 (xsd:int) | Essanay Studios (lang:en)       |
| Universal Pictures (wd:Q168383)      | 1625 (xsd:int) | Universal Pictures (lang:en)    |
| Metro-Goldwyn-Mayer (wd:Q179200)     | 1590 (xsd:int) | Metro-Goldwyn-Mayer (lang:en)   |
| Mosfilm (wd:Q141336)                 | 1477 (xsd:int) | Mosfilm (lang:en)               |
| Warner Bros. (wd:Q126399)            | 1450 (xsd:int) | Warner Bros. (lang:en)          |
| Edison Studios (wd:Q606359)          | 1345 (xsd:int) | Edison Studios (lang:en)        |
| Stadttheater Bern (wd:Q112897980)    | 1326 (xsd:int) | Stadttheater Bern (lang:en)     |

[Assistant]
answer

SELECT ?company (COUNT(DISTINCT ?item) AS ?count) ?companyLabel WHERE {
  ?item wdt:P272 ?company .
  OPTIONAL { ?company rdfs:label ?companyLabel . FILTER(LANG(?companyLabel) = "en") }
}
GROUP BY ?company ?companyLabel
HAVING (COUNT(DISTINCT ?item) > 100)
ORDER BY DESC(?count)

Answer:
I executed a SPARQL query that counts distinct items having the property production company (wdt:P272), groups by the company IRI, filters to counts > 100, and orders descending.

Summary of results:
- Total companies returned: 219 (companies with more than 100 items produced).

Top 10 companies (by number of items produced), showing the company IRI, the count, and the English label:
1. wd:Q391991 — 7865 — Theater Basel
2. wd:Q40313234 — 3203 — Schauspielhaus Zürich
3. wd:Q1418400 — 2551 — Vitagraph Studios
4. wd:Q1368540 — 1974 — Essanay Studios
5. wd:Q168383 — 1625 — Universal Pictures
6. wd:Q179200 — 1590 — Metro-Goldwyn-Mayer
7. wd:Q141336 — 1477 — Mosfilm
8. wd:Q126399 — 1450 — Warner Bros.
9. wd:Q606359 — 1345 — Edison Studios
10. wd:Q112897980 — 1326 — Stadttheater Bern

If you want the complete ordered list of all 219 companies, run the provided SPARQL query against Wikidata — it returns each company IRI, the production count, and optional English label.

Notes on methodology and verification:
- I first confirmed the correct property for "production company" is P272 using the property search.
- The SPARQL uses wdt:P272 to get normalized direct links from items to production companies and COUNT(DISTINCT ?item) to avoid double-counting the same item if it appears multiple times.
- I constrained nothing further (e.g., instance-of) so the query counts any Wikidata item that lists a production company via P272; this matches the wording of your question. If you want to restrict to a particular type of work (e.g., films only), I can refine the query to restrict ?item to instance of film (wdt:P31 wd:Q11424) or similar.