PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?inception WHERE {
  wd:Q1420480 wdt:P571 ?inception
}

Using entities:
- Ironman World Championship (wd:Q1420480): is instance of Ironman Triathlon / triathlon

Using properties:
- inception (wd:P571 as wdt), also known as broke ground, built, commenced on date, commencement date, completed, etc.: is subproperty of start time / date or point in time when the organisation / object was founded / created / time when an entity begins to exist; for date of official opening use P1619 / time when an entity begins to exist; for date of official opening use P1619

Answer: The first Ironman World Championship took place in 1978.

The first Ironman World Championship took place in 1978.

SPARQL query over wikidata:
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?inception WHERE {
  wd:Q1420480 wdt:P571 ?inception
}

Using entities:
- Ironman World Championship (wd:Q1420480): is instance of Ironman Triathlon / triathlon

Using properties:
- inception (wd:P571 as wdt), also known as broke ground, built, commenced on date, commencement date, completed, etc.: is subproperty of start time / date or point in time when the organisation / object was founded / created / time when an entity begins to exist; for date of official opening use P1619 / time when an entity begins to exist; for date of official opening use P1619

Execution result:
Got 1 row and 1 column:
| inception                           |
| ----------------------------------- |
| 1978-01-01T00:00:00Z (xsd:dateTime) |

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

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

Available knowledge graphs:
- wikidata at https://qlever.dev/api/wikidata 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. For 'main business' prefer more specific occupation items (e.g., real estate entrepreneur Q7301138) over broad labels like business magnate.
  - Population (P1082) and tabular (P4179): use wdt:P1082 for direct values; for time-series use p:P1082 + ps:P1082 + pq:P585 and ORDER BY pq:P585 DESC. Inspect qualifiers (e.g., 'applies to part') and references (pr:P854) to detect scope. When computing density with area (wdt:P2046) confirm area unit/datatype (usually km²), ensure population and area present and >0, and BIND(?population/?area AS ?density).
  - Spouse nationality: do not rely only on P27. Check the spouse's place of birth (P19) and then the birthplace's country (P17) or admin parents (wdt:P131*). Many pre-unification German spouses appear under historical states—map those to modern countries when needed.
  - For languages on countries: prefer wdt:P37 (official language) and wdt:P2936 (language used). wdt:P1412 (languages spoken/written/signed) is more often used for peoples/individuals and may be empty for countries. Try P37 and P2936 first, then fall back to P1412/P407. Fetch English labels with rdfs:label + FILTER(LANG(?l)='en').
  - When filtering by date of birth (P569) use xsd:dateTime comparisons (e.g. >= "1900-01-01T00:00:00Z"^^xsd:dateTime). Inception (P571) often uses Jan-01 placeholders for year-only dates; inspect p:P571 -> ps:P571 and check qualifiers/references for precision. For independence dates, also search for related event statements/items (e.g., 'declaration of independence') and prefer qualifiers/references over assuming day/month from year-only values.
  - 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.
  - 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: use p:P1082 ?stmt . ?stmt ps:P1082 ?pop . OPTIONAL { ?stmt pq:P585 ?date } . To get the most recent value prefer a subquery to compute MAX(?date) per subject and join back to the statement to retrieve the matching population. Avoid HAVING(MAX(?date)=?date) — QLever can error. Inspect qualifiers/references for scope (city-proper vs metro).
  - wdt:P131* can be expensive and may be incomplete. First try direct wdt:P131 for immediate administrative parent(s). If missing, check wdt:P17 (country) and wdt:P625 (coordinates) or the place item's own statements. Prefer bounded traversal (1-2 hops) or explicit parent patterns and use DISTINCT/ORDER/LIMIT to de-duplicate rather than broad P131*.
  - Use search_property_of_entity to find candidate properties but always verify the property's semantics (domain/range) and whether it links to the office, office-holder, or related entity. Test with a small query before relying on results. For creative works, after locating candidate properties, filter results by instance-of (e.g., films wd:Q11424; board games wd:Q131436) to avoid non-work items.
  - Use search_property_of_entity to find relevant properties. Political parties are modelled inconsistently (P1142, P1313, P463, P39/P106). Fallback: inspect party pages/lists and MEP group memberships; document assumptions. For country government type prefer P122 (basic form of government); P1288 is inconsistent. To exclude historical states filter NOT EXISTS { ?item wdt:P576 ?d }.
  - 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.
  - Place of burial (P119): use wdt:P119 to get the direct burial place. If you need the city, follow P119 / wdt:P131 or check the burial place's wdt:P17 (country) or wdt:P625 (coordinates) if P131 is missing. Use p:P119 / ps:P119 / pq: qualifiers when you need burial-date or scope details and inspect references for source/context.
  - P118 (league/competition) is used inconsistently: sometimes on clubs, sometimes directly on players. When finding clubs use ?club wdt:P118 wd:Q... and verify ?club wdt:P31 wd:Q483394. If P118 returns players, filter by ?item wdt:P31 wd:Q5 to detect humans and avoid false positives. To get current players prefer club→p:P54 statements: ?player p:P54 ?stmt; ?stmt ps:P54 ?club. OPTIONAL{ ?stmt pq:P582 ?end } FILTER(!BOUND(?end)). Verify qualifiers/references and DOBs for plausibility.
  - Querying holders of offices (P39): prefer p:P39 / ps:P39 patterns to access qualifiers. To find current holder use: ?person p:P39 ?stmt. ?stmt ps:P39 wd:Q... . OPTIONAL{ ?stmt pq:P582 ?end } FILTER(!BOUND(?end)). Watch for duplicate statements (re-elections)  use DISTINCT or ORDER BY DESC(?start) LIMIT 1 on pq:P580. Avoid HAVING(MAX(...)=...) on QLever; prefer subqueries with ORDER/LIMIT.
  - Headquarters: use wdt:P159 for org HQs. If P159 gives a building follow that building's wdt:P131* (bounded hops). If P159 points to a place, verify its wdt:P31. Don't rely only on P17 for org-country—also check P159 and P276. Use UNION/nested patterns to cover ?org wdt:P17 wd:Q... OR ?org wdt:P159|wdt:P276 ?place . ?place wdt:P17 wd:Q... or ?place wdt:P131* wd:Q...

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. If a query using SERVICE fails (e.g., HTTP 301 redirect), switch to rdfs:label + FILTER(LANG(...)) and/or schema:name. Language items (e.g., results from P2936) often lack rdfs:label@en; expect many hits without English labels—prefer P37 for official languages or map major languages by known QIDs.
- Practical query patterns: use rdfs:label + FILTER(LANG(...)) for labels. Use wdt:Pxxx for direct values; p:Pxxx/ps:Pxxx/pq:Pxxx for qualifiers. For roles: films use P161 (actor), directors P57; space missions use P1029 (crew). Query reverse and filter by instance-of film (wd:Q11424) or human (wd:Q5). For 'city' classification prefer ?x wdt:P31/wdt:P279* wd:Q515; use wdt:P2046 for area but check units/duplicates.
- When selecting latest qualifier-dated values (e.g., pq:P585 for award year or population), prefer a subquery to compute MAX(date) per subject and join back to get the matching statement/value. Avoid HAVING(MAX(?date)=?date) patterns on QLever (can cause engine errors). Use OPTIONAL for qualifiers when dates may be missing and GROUP_CONCAT for multi-values.
- Use search_entity to resolve names and verify instance-of (e.g., wdt:P31=wd:Q5). Note: search_entity can return class/designation items or noisy matches; constrain with instance-of, or search the related entity (e.g., country) and query its members. Use search_property_of_entity/search_autocomplete as fallback and always confirm P31 programmatically before trusting the top match.
- 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.
- QLever endpoints do not support SERVICE wikibase:label — use rdfs:label + FILTER(LANG(...))='en'. Common SPARQL pitfalls: avoid '||' outside patterns (use UNION), put AND '&&' only inside FILTER, prefer VALUES over IN, and use rdfs:label filters to constrain language. When testing existence prefer FILTER EXISTS { ... } or OPTIONAL { ?s wdt:Pxx ?v . FILTER(?v = wd:Q...) } — writing OPTIONAL { ?s wdt:Pxx wd:Q... } creates no ?v for BOUND(?v). When execute() fails, simplify the query and test with list(...).
- 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. Also verify ambiguous item QIDs (e.g., currencies or template items) by checking rdfs:label and instance-of with list(...) before use.
- 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"). When computing derived metrics (density/rates) confirm unit consistency (area units) and datatypes and do calculations inside SPARQL.
- 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; 'cause of death' -> P509; 'manner of death' -> P1196). 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] when is the first ironman world championship?

[Assistant]
To determine when the first Ironman World Championship took place, I need to find the inception date of the event. The Ironman World Championship is a triathlon event, and I should look for its start date in the knowledge graph.

Step 1: Search for the entity "Ironman World Championship" to identify its Wikidata item.

Question: Ironman World Championship

Top 10 entity alternatives:
1. Ironman World Championship (wd:Q1420480): is instance of Ironman Triathlon / triathlon
2. 2009 Ironman World Championship (wd:Q1627953): is instance of sports season
3. 2010 Ironman World Championship (wd:Q949501): is instance of sports season
4. 2008 Ironman World Championship (wd:Q1325961): is instance of sports season
5. 2011 Ironman World Championship (wd:Q1144158): is instance of sports season / Held in Kailua-Kona, Hawaii
6. 2007 Ironman World Championship (wd:Q3652214), also known as 2007 Ford Ironman World Championship: is instance of sports season
7. 2019 Ironman World Championship (wd:Q61081177): is instance of sports season
8. 2016 Ironman World Championship (wd:Q24897005): is instance of sports season
9. 2012 Ironman World Championship (wd:Q1673097): is instance of sports season / Triathlon competition
10. 2006 Ironman World Championship (wd:Q3078193): is instance of sports season

[Assistant]
The main entity for the Ironman World Championship is wd:Q1420480, which represents the event itself, not a specific year's edition. Now, I will check the properties of this entity to find its inception date (P571).

Step 2: List the properties of the Ironman World Championship (wd:Q1420480) to find the inception date (P571).

list

wd:Q1420480

[Assistant]
The inception date (P571) of the Ironman World Championship is 1978-01-01T00:00:00Z, which corresponds to the year 1978. This is the first Ironman World Championship.

I will now provide the final SPARQL query and answer.

answer

SELECT ?inception WHERE { wd:Q1420480 wdt:P571 ?inception }

Answer: The first Ironman World Championship took place in 1978.


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 ( COUNT( ?win ) AS ?count ) WHERE {
  wd:Q676899 wdt:P2522 ?win .
  ?win rdfs:label ?label .
  FILTER ( CONTAINS( LCASE( ?label ) , "fifa world cup" ) ) .
  FILTER ( LANG( ?label ) = "en" )
}

Using entities:
- Italy men's national association football team (wd:Q676899), also known as Italian national team, Italian NT, Italy men's national football team, Italy national association football team, Italy national football team, etc.: is instance of men's national association football team / is subclass of national sports team / men's national association football team representing Italy / national association football team of Italy / national association football team of Italy

Using properties:
- competition won (wd:P2522 as wdt), also known as victory, winner of, won, won event, P2522: is subproperty of participant in / competition or sports event won by the subject

Got 1 row and 1 column:
| count       |
| ----------- |
| 4 (xsd:int) |

Answer: The Italian national soccer team has won the FIFA World Cup 4 times.

The Italian national soccer team has won the FIFA World Cup 4 times.

SPARQL query over wikidata:
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 ( COUNT( ?win ) AS ?count ) WHERE {
  wd:Q676899 wdt:P2522 ?win .
  ?win rdfs:label ?label .
  FILTER ( CONTAINS( LCASE( ?label ) , "fifa world cup" ) ) .
  FILTER ( LANG( ?label ) = "en" )
}

Using entities:
- Italy men's national association football team (wd:Q676899), also known as Italian national team, Italian NT, Italy men's national football team, Italy national association football team, Italy national football team, etc.: is instance of men's national association football team / is subclass of national sports team / men's national association football team representing Italy / national association football team of Italy / national association football team of Italy

Using properties:
- competition won (wd:P2522 as wdt), also known as victory, winner of, won, won event, P2522: is subproperty of participant in / competition or sports event won by the subject

Execution result:
Got 1 row and 1 column:
| count       |
| ----------- |
| 4 (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 https://qlever.dev/api/wikidata 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. For 'main business' prefer more specific occupation items (e.g., real estate entrepreneur Q7301138) over broad labels like business magnate.
  - Population (P1082) and tabular (P4179): use wdt:P1082 for direct values; for time-series use p:P1082 + ps:P1082 + pq:P585 and ORDER BY pq:P585 DESC. Inspect qualifiers (e.g., 'applies to part') and references (pr:P854) to detect scope. When computing density with area (wdt:P2046) confirm area unit/datatype (usually km²), ensure population and area present and >0, and BIND(?population/?area AS ?density).
  - Spouse nationality: do not rely only on P27. Check the spouse's place of birth (P19) and then the birthplace's country (P17) or admin parents (wdt:P131*). Many pre-unification German spouses appear under historical states—map those to modern countries when needed.
  - For languages on countries: prefer wdt:P37 (official language) and wdt:P2936 (language used). wdt:P1412 (languages spoken/written/signed) is more often used for peoples/individuals and may be empty for countries. Try P37 and P2936 first, then fall back to P1412/P407. Fetch English labels with rdfs:label + FILTER(LANG(?l)='en').
  - When filtering by date of birth (P569) use xsd:dateTime comparisons (e.g. >= "1900-01-01T00:00:00Z"^^xsd:dateTime). Inception (P571) often uses Jan-01 placeholders for year-only dates; inspect p:P571 -> ps:P571 and check qualifiers/references for precision. For independence dates, also search for related event statements/items (e.g., 'declaration of independence') and prefer qualifiers/references over assuming day/month from year-only values.
  - 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.
  - 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: use p:P1082 ?stmt . ?stmt ps:P1082 ?pop . OPTIONAL { ?stmt pq:P585 ?date } . To get the most recent value prefer a subquery to compute MAX(?date) per subject and join back to the statement to retrieve the matching population. Avoid HAVING(MAX(?date)=?date) — QLever can error. Inspect qualifiers/references for scope (city-proper vs metro).
  - wdt:P131* can be expensive and may be incomplete. First try direct wdt:P131 for immediate administrative parent(s). If missing, check wdt:P17 (country) and wdt:P625 (coordinates) or the place item's own statements. Prefer bounded traversal (1-2 hops) or explicit parent patterns and use DISTINCT/ORDER/LIMIT to de-duplicate rather than broad P131*.
  - Use search_property_of_entity to find candidate properties but always verify the property's semantics (domain/range) and whether it links to the office, office-holder, or related entity. Test with a small query before relying on results. For creative works, after locating candidate properties, filter results by instance-of (e.g., films wd:Q11424; board games wd:Q131436) to avoid non-work items.
  - Use search_property_of_entity to find relevant properties. Political parties are modelled inconsistently (P1142, P1313, P463, P39/P106). Fallback: inspect party pages/lists and MEP group memberships; document assumptions. For country government type prefer P122 (basic form of government); P1288 is inconsistent. To exclude historical states filter NOT EXISTS { ?item wdt:P576 ?d }.
  - 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.
  - Place of burial (P119): use wdt:P119 to get the direct burial place. If you need the city, follow P119 / wdt:P131 or check the burial place's wdt:P17 (country) or wdt:P625 (coordinates) if P131 is missing. Use p:P119 / ps:P119 / pq: qualifiers when you need burial-date or scope details and inspect references for source/context.
  - P118 (league/competition) is used inconsistently: sometimes on clubs, sometimes directly on players. When finding clubs use ?club wdt:P118 wd:Q... and verify ?club wdt:P31 wd:Q483394. If P118 returns players, filter by ?item wdt:P31 wd:Q5 to detect humans and avoid false positives. To get current players prefer club→p:P54 statements: ?player p:P54 ?stmt; ?stmt ps:P54 ?club. OPTIONAL{ ?stmt pq:P582 ?end } FILTER(!BOUND(?end)). Verify qualifiers/references and DOBs for plausibility.
  - Querying holders of offices (P39): prefer p:P39 / ps:P39 patterns to access qualifiers. To find current holder use: ?person p:P39 ?stmt. ?stmt ps:P39 wd:Q... . OPTIONAL{ ?stmt pq:P582 ?end } FILTER(!BOUND(?end)). Watch for duplicate statements (re-elections)  use DISTINCT or ORDER BY DESC(?start) LIMIT 1 on pq:P580. Avoid HAVING(MAX(...)=...) on QLever; prefer subqueries with ORDER/LIMIT.
  - Headquarters: use wdt:P159 for org HQs. If P159 gives a building follow that building's wdt:P131* (bounded hops). If P159 points to a place, verify its wdt:P31. Don't rely only on P17 for org-country—also check P159 and P276. Use UNION/nested patterns to cover ?org wdt:P17 wd:Q... OR ?org wdt:P159|wdt:P276 ?place . ?place wdt:P17 wd:Q... or ?place wdt:P131* wd:Q...

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. If a query using SERVICE fails (e.g., HTTP 301 redirect), switch to rdfs:label + FILTER(LANG(...)) and/or schema:name. Language items (e.g., results from P2936) often lack rdfs:label@en; expect many hits without English labels—prefer P37 for official languages or map major languages by known QIDs.
- Practical query patterns: use rdfs:label + FILTER(LANG(...)) for labels. Use wdt:Pxxx for direct values; p:Pxxx/ps:Pxxx/pq:Pxxx for qualifiers. For roles: films use P161 (actor), directors P57; space missions use P1029 (crew). Query reverse and filter by instance-of film (wd:Q11424) or human (wd:Q5). For 'city' classification prefer ?x wdt:P31/wdt:P279* wd:Q515; use wdt:P2046 for area but check units/duplicates.
- When selecting latest qualifier-dated values (e.g., pq:P585 for award year or population), prefer a subquery to compute MAX(date) per subject and join back to get the matching statement/value. Avoid HAVING(MAX(?date)=?date) patterns on QLever (can cause engine errors). Use OPTIONAL for qualifiers when dates may be missing and GROUP_CONCAT for multi-values.
- Use search_entity to resolve names and verify instance-of (e.g., wdt:P31=wd:Q5). Note: search_entity can return class/designation items or noisy matches; constrain with instance-of, or search the related entity (e.g., country) and query its members. Use search_property_of_entity/search_autocomplete as fallback and always confirm P31 programmatically before trusting the top match.
- 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.
- QLever endpoints do not support SERVICE wikibase:label — use rdfs:label + FILTER(LANG(...))='en'. Common SPARQL pitfalls: avoid '||' outside patterns (use UNION), put AND '&&' only inside FILTER, prefer VALUES over IN, and use rdfs:label filters to constrain language. When testing existence prefer FILTER EXISTS { ... } or OPTIONAL { ?s wdt:Pxx ?v . FILTER(?v = wd:Q...) } — writing OPTIONAL { ?s wdt:Pxx wd:Q... } creates no ?v for BOUND(?v). When execute() fails, simplify the query and test with list(...).
- 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. Also verify ambiguous item QIDs (e.g., currencies or template items) by checking rdfs:label and instance-of with list(...) before use.
- 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"). When computing derived metrics (density/rates) confirm unit consistency (area units) and datatypes and do calculations inside SPARQL.
- 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; 'cause of death' -> P509; 'manner of death' -> P1196). 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] How many times did the Italian national soccer team win the Fifa World Cup?

[Assistant]
To determine how many times the Italian national soccer team has won the FIFA World Cup, I need to:

1. Identify the entity for the Italian national soccer team in Wikidata.
2. Find the property that links the team to its World Cup victories.
3. Count the number of such victories.

### Step 1: Search for the Italian national soccer team
I'll start by searching for the Italian national soccer team in Wikidata.

Question: Italian national soccer team

Top 10 entity alternatives:
1. Italy men's national association football team (wd:Q676899, matched via Italian national team), also known as Italian national team, Italian NT, Italy men's national football team, Italy national association football team, Italy national football team, etc.: men's national association football team representing Italy / is instance of men's national association football team / national association football team of Italy / national association football team of Italy / is subclass of national sports team
2. France men's national association football team (wd:Q47774, matched via France national soccer team), also known as France, France men's national football team, France national association football team, France national football team, France national soccer team, etc.: is instance of men's national association football team / national association football team representing France / national association football team representing France / is subclass of national sports team / national association football team / national association football team
3. England men's national association football team (wd:Q47762, matched via England national soccer team), also known as England, England men's national football team, England national association football team, England national football team, England national soccer team, etc.: men's national association football team representing England / is instance of national association football team / men's national football team representing England / men's national soccer team representing England / is instance of national soccer team
4. Argentina men's national association football team (wd:Q79800, matched via Argentina national soccer team), also known as Argentina men's national football team, Argentina men's national soccer team, Argentina national association football team, Argentina national football team, Argentina national soccer team: men's national association football team representing Argentina / is instance of men's national association football team / national association football team / national association football team
5. Russia men's national football team (wd:Q726080, matched via Russia national soccer team), also known as Russia national football team, Russia national soccer team, Russian national football team, Russian national soccer team: is instance of men's national association football team / men's national football team representing Russia / national association football team / national association football team
6. United States men's national soccer team (wd:Q164134, matched via USA national soccer team), also known as United States men's national association football team, United States national association football team, United States national football team, United States national soccer team, United States national team, etc.: men's national association football (soccer) team representing the USA / is instance of men's national association football team / national association football team / national association football team
7. Denmark men's national football team (wd:Q131785, matched via Danish national soccer team), also known as Danish football team, Danish national football selection, Danish national football selection team, Danish national football team, Danish national selection team, etc.: men's national association football team representing Denmark / is instance of men's national association football team / is subclass of national sports team / national association football team / national association football team
8. Australia men's national soccer team (wd:Q268208, matched via Australia national soccer team), also known as Australia men's national football team, Australia national football team, Australia national soccer team, Socceroos: men's national association football team representing Australia / is instance of men's national association football team / national association football team / national association football team
9. Chile men's national football team (wd:Q172025, matched via Chilean national soccer team), also known as Bicampeon, Chilean national football team, Chilean national soccer team, Chile national football team, Chile national soccer team, etc.: men's national association football team representing Chile / is instance of men's national association football team / national association football team / national association football team
10. Scotland men's national football team (wd:Q34044, matched via Scotland national soccer team), also known as Scotland national football team, Scotland national soccer team, Scotland national team, Scottish National Football Team: men's association football team representing Scotland / is instance of national association football team / is instance of national soccer team / national association football team / national association football team

[Assistant]
The correct entity for the Italian national soccer team is **wd:Q676899** (Italy men's national association football team).

### Step 2: Find properties related to World Cup victories
I need to find how the team's World Cup wins are recorded. I'll search for properties related to "World Cup" or "championship" for this team.

Question: World Cup

Top 10 property alternatives:
1. country for sport (wd:P1532 as p/wdt, matched via sports country), also known as representative nationality, sport country, sporting nationality, sport nationality, sports country, etc.: country a person or a team represents when playing a sport / is subproperty of country
2. sport (wd:P641 as p/wdt), also known as play, plays, sport played, sports, P641: sport that the subject participates or participated in or is associated with / sport or discipline in which the entity participates or belongs to
3. competition class (wd:P2094 as p/wdt), also known as class for competition, compclass, disability sport classifications, qualification class, qualifies for, etc.: official classification by a regulating body under which the ... teams, participants, or equipment) qualifies for inclusion / official classification by a regulating body under which the ... teams, participants, or equipment) qualifies for inclusion
4. competition won (wd:P2522 as p/wdt), also known as victory, winner of, won, won event, P2522: competition or sports event won by the subject / is subproperty of participant in
5. award received (wd:P166 as p/wdt, matched via winner of), also known as award, awarded, awards, awards received, award won, etc.: award or recognition received by a person, organisation or creative work / award or recognition received by a person, organization or creative work / award or recognition received by a person, organization or creative work / awards received by a person, organisation or creative work
6. participant in (wd:P1344 as p/wdt, matched via competed in), also known as attended, competed in, competes in, participant of, participant of event, etc.: event in which a person, organization or creative work was/is a participant; inverse of P710 or P1923 / event in which a person or organisation was/is a participant; inverse of P710 or P1923 / is subproperty of significant event / is subproperty of part of
7. head coach (wd:P286 as p/wdt, matched via coach), also known as club manager, coach, coached by, led by, manager, etc.: on-field manager or head coach of a sports club (not to be ... manager P505, which is not a coaching position) or person / on-field manager or head coach of a sports club (not to be ... manager P505, which is not a coaching position) or person
8. FIFA country code (wd:P3441 as p/wdt), also known as P3441: three-letter country code assigned by FIFA
9. Transfermarkt team ID (wd:P7223 as p/wdt, matched via www.transfermarkt.com/), also known as https://www.transfermarkt.com/, transfermarkt.com/, www.transfermarkt.com/, P7223: identifier for an association football (soccer) team in the transfermarkt.com database
10. team captain (wd:P634 as p/wdt), also known as captain, sports team captain, P634: captain of this sports team / captain of this sports team

No other items found

[Assistant]
The most relevant property here is **wdt:P2522** ("competition won"), which records the competitions or sports events won by the subject. This is likely used to record World Cup victories for the Italian national team.

### Step 3: Query for World Cup victories
I will now construct a SPARQL query to find all World Cup victories for the Italian national team (wd:Q676899) using the property `wdt:P2522`. I will also ensure that the competition won is the FIFA World Cup by checking the label of the competition.

The FIFA World Cup entity in Wikidata is **wd:Q14507**.

I will write a query to:
- Find all competitions won by the Italian team (`wdt:P2522`)
- Filter for only those that are the FIFA World Cup (`wd:Q14507`)
- Count the number of such victories

Let me execute the query.

execute

SELECT (COUNT(?win) AS ?count) WHERE { wd:Q676899 wdt:P2522 ?win . ?win wdt:P31 wd:Q14507 }

Got 1 row and 1 column:
| count       |
| ----------- |
| 0 (xsd:int) |

[Assistant]
The result shows **0**, which is incorrect — we know Italy has won the FIFA World Cup multiple times. This suggests that the victories are not directly recorded via `wdt:P2522` for the team, or the FIFA World Cup is not directly linked as `wd:Q14507` in this context.

Let me investigate further.

### Step 4: Check the actual statements on the Italian team entity
I'll list some of the properties and values for the Italian team to see how World Cup wins are recorded.

list

wd:Q676899

Got 8 rows and 3 columns:
| subject                                                     | property                    | object                                                                 |
| ----------------------------------------------------------- | --------------------------- | ---------------------------------------------------------------------- |
| Italy men's national association football team (wd:Q676899) | competition won (wdt:P2522) | 2006 FIFA World Cup (wd:Q37285)                                        |
| Italy men's national association football team (wd:Q676899) | competition won (wdt:P2522) | 1938 FIFA World Cup (wd:Q131591)                                       |
| Italy men's national association football team (wd:Q676899) | competition won (wdt:P2522) | 1934 FIFA World Cup (wd:Q1477177)                                      |
| Italy men's national association football team (wd:Q676899) | competition won (wdt:P2522) | 1968 UEFA European Championship (wd:Q182201)                           |
| Italy men's national association football team (wd:Q676899) | competition won (wdt:P2522) | UEFA Euro 2020 (wd:Q373501)                                            |
| Italy men's national association football team (wd:Q676899) | competition won (wdt:P2522) | Scania 100 Tournament (wd:Q3994651)                                    |
| Italy men's national association football team (wd:Q676899) | competition won (wdt:P2522) | 1982 FIFA World Cup (wd:Q46934)                                        |
| Italy men's national association football team (wd:Q676899) | competition won (wdt:P2522) | football at the 1936 Summer Olympics – men's tournament (wd:Q77316211) |

[Assistant]
Great! Now I see that the Italian national team has won the following FIFA World Cups via `wdt:P2522`:

- 1934 FIFA World Cup (wd:Q1477177)
- 1938 FIFA World Cup (wd:Q131591)
- 1982 FIFA World Cup (wd:Q46934)
- 2006 FIFA World Cup (wd:Q37285)

That’s **4 wins**.

But earlier, my query using `?win wdt:P31 wd:Q14507` returned 0 because the World Cup wins are stored as specific instances of each World Cup (e.g., 1934 FIFA World Cup), not directly as instances of the general "FIFA World Cup" (wd:Q14507).

So I need to check if these specific World Cup instances are subclasses of the general FIFA World Cup.

### Step 5: Check if the specific World Cup instances are instances of the general FIFA World Cup
I'll check the type of one of them, e.g., 1934 FIFA World Cup (wd:Q1477177), to see if it is an instance of `wd:Q14507` (FIFA World Cup).

wd:Q1477177

[Assistant]
Interesting — the 1934 FIFA World Cup is an instance of **season** (wd:Q27020041), not directly of **FIFA World Cup** (wd:Q14507). This suggests that the general FIFA World Cup (wd:Q14507) is not used as a direct type for individual tournaments. Instead, each tournament is a season of the World Cup.

So I need to find the **parent class** of the individual World Cup tournaments to see if they are subclasses of the general FIFA World Cup.

### Step 6: Check the subclass hierarchy of the general FIFA World Cup
I'll check what the general FIFA World Cup (wd:Q14507) is a subclass of, and also check if the individual tournaments are subclasses of it.

wd:Q14507

[Assistant]
No results — this means `wd:Q14507` (FIFA World Cup) is not explicitly stated as a subclass of anything, or the subclass relationship is not modeled directly.

Let me check the reverse: is `wd:Q14507` the **instance of** something? Or perhaps it's a class that is not directly linked to the individual tournaments via `P31`, but rather via another relationship.

Alternatively, I can check the label and description of `wd:Q14507` to understand its intended use.

wd:Q14507

Got 25 rows and 3 columns, showing the first 10 rows below:
| subject              | property   | object               |
| -------------------- | ---------- | -------------------- |
| Ägerisee (wd:Q14507) | rdfs:label | Ägeri (lang:es)      |
| Ägerisee (wd:Q14507) | rdfs:label | Ägeri Gölü (lang:tr) |
| Ägerisee (wd:Q14507) | rdfs:label | Ägerisee (lang:ceb)  |
| Ägerisee (wd:Q14507) | rdfs:label | Ägerisee (lang:cs)   |
| Ägerisee (wd:Q14507) | rdfs:label | Ägerisee (lang:de)   |
| Ägerisee (wd:Q14507) | rdfs:label | Ägerisee (lang:en)   |
| Ägerisee (wd:Q14507) | rdfs:label | Ägerisee (lang:gsw)  |
| Ägerisee (wd:Q14507) | rdfs:label | Ägerisee (lang:nl)   |
| Ägerisee (wd:Q14507) | rdfs:label | Ägerisee (lang:nn)   |
| Ägerisee (wd:Q14507) | rdfs:label | Ägerisee (lang:pl)   |
| ...                  | ...        | ...                  |

[Assistant]
Oh no! There's a **critical error** — `wd:Q14507` is **not** the FIFA World Cup. It is **Ägerisee**, a lake in Switzerland! I made a mistake in assuming the QID.

I need to find the correct Wikidata item for the **FIFA World Cup**.

### Step 7: Search for the correct entity for "FIFA World Cup"
I'll search for "FIFA World Cup" to find the correct entity.

Question: FIFA World Cup

Top 10 entity alternatives:
1. FIFA World Cup (wd:Q19317), also known as FIFA Association Football World Cup, FIFA Football World Cup, FIFA World Cup of Football, Football World Cup, FWC, etc.: international association football competition contested by the senior men's national teams / international association football competition contested by the senior men's national teams / is instance of international association football national teams competition / is instance of recurring international multi-sports competition / is subclass of association football competition / world national football championship / is subclass of world championship / is subclass of soccer competition
2. FIFA World Cup (wd:Q864001): is instance of video game series / video game series
3. North Korea at the FIFA World Cup (wd:Q6431616, matched via FIFA World Cup.), also known as FIFA World Cup., Korea DPR at the FIFA World Cup: participation of North Korea's national football team in the FIFA World Cup / is subclass of North Korea men's national football team / is subclass of North Korea national football team / is instance of nation at sport competition
4. 2018 FIFA World Cup (wd:Q170645), also known as 2018 World Cup, FIFA 2018, FIFA World Cup 2018, World Cup 2018, World Cup 2018 in Russia: 21st FIFA World Cup, held in Russia / is instance of sports season
5. 2014 FIFA World Cup (wd:Q79859), also known as 2014 FIFA World Cup Brasil, 2014 FIFA World Cup Brazil, 20th FIFA World Cup, FIFA 2014: 20th FIFA World Cup, held in Brazil / football competition held in Brazil / is instance of sports season
6. 2022 FIFA World Cup (wd:Q284163), also known as 2022 World Cup, FIFA 2022, FIFA world cup 2022, Qatar 2022: is instance of association football competition / is instance of soccer competition / is instance of sports season / is instance of tournament / 22nd FIFA World Cup / Wikimedia category / Wikimedia category
7. 2010 FIFA World Cup (wd:Q176883), also known as 2010 FIFA World Cup South Africa, FIFA 2010, FIFA World Cup 2010: 19th FIFA World Cup, held in South Africa / is instance of sports season
8. 2006 FIFA World Cup (wd:Q37285), also known as 2006 World Cup, FIFA 2006: 18th FIFA World Cup, held in Germany / is instance of sports season
9. 2002 FIFA World Cup (wd:Q47735), also known as 2002 FIFA World Cup Korea/Japan, FIFA 2002: 17th FIFA World Cup, held in South Korea and Japan / is instance of sports season
10. 1930 FIFA World Cup (wd:Q48432): 1st FIFA World Cup, held in Uruguay / is instance of sports season

[Assistant]
Perfect! The correct entity for the **FIFA World Cup** is **wd:Q19317**.

Now I need to check if the individual World Cup tournaments (like 1934, 1938, etc.) are instances of `wd:Q19317` or if they are subclasses.

Let me check the type of one of the Italian wins, e.g., 1934 FIFA World Cup (wd:Q1477177), to see if it is an instance of `wd:Q19317`.

wd:Q1477177

[Assistant]
Again, it's an instance of **season** (wd:Q27020041), not directly of **FIFA World Cup** (wd:Q19317).

Let me check if `wd:Q19317` (FIFA World Cup) has any subclasses, or if the individual tournaments are linked via another property.

I'll check the subclass hierarchy of `wd:Q19317`:

wd:Q19317

[Assistant]
So `wd:Q19317` is a subclass of "world championship" and "association football competition", but the individual tournaments (like 1934 FIFA World Cup) are not instances of it — they are instances of "season".

This means the **FIFA World Cup** as a concept (wd:Q19317) is a **class**, and each tournament is a **specific instance** of a season within that class. But there is **no direct `P31` link** from the individual tournaments to `wd:Q19317`.

However, we can infer that the individual tournaments (like 1934, 1938, etc.) are **instances of the FIFA World Cup** by their **name** and **context** — they are labeled as "1934 FIFA World Cup", etc.

So the best way to count Italy’s World Cup wins is to **count the number of times** the Italian team has won a competition whose **label contains "FIFA World Cup"**.

### Step 8: Query for all competitions won by Italy that have "FIFA World Cup" in the label
I will now write a query that:
- Finds all competitions won by Italy (wd:Q676899) via `wdt:P2522`
- Filters for those competitions whose label contains "FIFA World Cup"
- Counts them

Let me execute this query.

execute

SELECT (COUNT(?win) AS ?count) WHERE { wd:Q676899 wdt:P2522 ?win . ?win rdfs:label ?label . FILTER(CONTAINS(LCASE(?label), "fifa world cup")) . FILTER(LANG(?label) = "en") }

Got 1 row and 1 column:
| count       |
| ----------- |
| 4 (xsd:int) |

[Assistant]
Perfect! The query returns **4**, which matches the known history: Italy won the FIFA World Cup in **1934, 1938, 1982, and 2006**.

This is the correct answer.

### Final Answer:
The Italian national soccer team has won the FIFA World Cup **4 times**.

Here is the final SPARQL query:
```sparql
SELECT (COUNT(?win) AS ?count) WHERE {
  wd:Q676899 wdt:P2522 ?win .
  ?win rdfs:label ?label .
  FILTER(CONTAINS(LCASE(?label), "fifa world cup")) .
  FILTER(LANG(?label) = "en")
}
```

I will now provide the final answer.

answer

SELECT (COUNT(?win) AS ?count) WHERE { wd:Q676899 wdt:P2522 ?win . ?win rdfs:label ?label . FILTER(CONTAINS(LCASE(?label), "fifa world cup")) . FILTER(LANG(?label) = "en") }

Answer: The Italian national soccer team has won the FIFA World Cup 4 times.


PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
ASK WHERE {
  wd:Q28865 wdt:P31 / wdt:P279 * wd:Q9143
}

Using entities:
- Python (wd:Q28865), also known as py, python 2, Python 2, Python 3, Python (computer language), etc.: is instance of object-based language / general-purpose, high-level programming language / general-purpose, high-level programming language / general-purpose programming language / general-purpose programming language
- programming language (wd:Q9143), also known as coding language, computer language, computer programming, computer programming language: is instance of computer science term / is subclass of computer language / language for communicating instructions to a machine

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 ... 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 / this item is a subclass (subset) of that item; ALL instances ... is a subclass of mountain; Everest 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 ... instance of mountain; volcanoes form a subclass of mountains / type to which this subject corresponds/belongs. Different ... is an instance of mountain; volcano is a subclass of mountain

Answer:
The SPARQL query confirms that Python is a kind of programming language, as it is an instance of a subclass of "programming language".

### Final Answer:
```sparql
ASK WHERE { wd:Q28865 wdt:P31/wdt:P279* wd:Q9143 }
```
**Answer:** Yes, Python is a kind of programming language.

The SPARQL query confirms that Python is a kind of programming language, as it is an instance of a subclass of "programming language".

### Final Answer:
```sparql
ASK WHERE { wd:Q28865 wdt:P31/wdt:P279* wd:Q9143 }
```
**Answer:** Yes, Python is a kind of programming language.

SPARQL query over wikidata:
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
ASK WHERE {
  wd:Q28865 wdt:P31 / wdt:P279 * wd:Q9143
}

Using entities:
- Python (wd:Q28865), also known as py, python 2, Python 2, Python 3, Python (computer language), etc.: is instance of object-based language / general-purpose, high-level programming language / general-purpose, high-level programming language / general-purpose programming language / general-purpose programming language
- programming language (wd:Q9143), also known as coding language, computer language, computer programming, computer programming language: is instance of computer science term / is subclass of computer language / language for communicating instructions to a machine

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 ... 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 / this item is a subclass (subset) of that item; ALL instances ... is a subclass of mountain; Everest 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 ... instance of mountain; volcanoes form a subclass of mountains / type to which this subject corresponds/belongs. Different ... is an instance of mountain; volcano is a subclass of mountain

Execution result:
True

[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 https://qlever.dev/api/wikidata 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. For 'main business' prefer more specific occupation items (e.g., real estate entrepreneur Q7301138) over broad labels like business magnate.
  - Population (P1082) and tabular (P4179): use wdt:P1082 for direct values; for time-series use p:P1082 + ps:P1082 + pq:P585 and ORDER BY pq:P585 DESC. Inspect qualifiers (e.g., 'applies to part') and references (pr:P854) to detect scope. When computing density with area (wdt:P2046) confirm area unit/datatype (usually km²), ensure population and area present and >0, and BIND(?population/?area AS ?density).
  - Spouse nationality: do not rely only on P27. Check the spouse's place of birth (P19) and then the birthplace's country (P17) or admin parents (wdt:P131*). Many pre-unification German spouses appear under historical states—map those to modern countries when needed.
  - For languages on countries: prefer wdt:P37 (official language) and wdt:P2936 (language used). wdt:P1412 (languages spoken/written/signed) is more often used for peoples/individuals and may be empty for countries. Try P37 and P2936 first, then fall back to P1412/P407. Fetch English labels with rdfs:label + FILTER(LANG(?l)='en').
  - When filtering by date of birth (P569) use xsd:dateTime comparisons (e.g. >= "1900-01-01T00:00:00Z"^^xsd:dateTime). Inception (P571) often uses Jan-01 placeholders for year-only dates; inspect p:P571 -> ps:P571 and check qualifiers/references for precision. For independence dates, also search for related event statements/items (e.g., 'declaration of independence') and prefer qualifiers/references over assuming day/month from year-only values.
  - 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.
  - 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: use p:P1082 ?stmt . ?stmt ps:P1082 ?pop . OPTIONAL { ?stmt pq:P585 ?date } . To get the most recent value prefer a subquery to compute MAX(?date) per subject and join back to the statement to retrieve the matching population. Avoid HAVING(MAX(?date)=?date) — QLever can error. Inspect qualifiers/references for scope (city-proper vs metro).
  - wdt:P131* can be expensive and may be incomplete. First try direct wdt:P131 for immediate administrative parent(s). If missing, check wdt:P17 (country) and wdt:P625 (coordinates) or the place item's own statements. Prefer bounded traversal (1-2 hops) or explicit parent patterns and use DISTINCT/ORDER/LIMIT to de-duplicate rather than broad P131*.
  - Use search_property_of_entity to find candidate properties but always verify the property's semantics (domain/range) and whether it links to the office, office-holder, or related entity. Test with a small query before relying on results. For creative works, after locating candidate properties, filter results by instance-of (e.g., films wd:Q11424; board games wd:Q131436) to avoid non-work items.
  - Use search_property_of_entity to find relevant properties. Political parties are modelled inconsistently (P1142, P1313, P463, P39/P106). Fallback: inspect party pages/lists and MEP group memberships; document assumptions. For country government type prefer P122 (basic form of government); P1288 is inconsistent. To exclude historical states filter NOT EXISTS { ?item wdt:P576 ?d }.
  - 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.
  - Place of burial (P119): use wdt:P119 to get the direct burial place. If you need the city, follow P119 / wdt:P131 or check the burial place's wdt:P17 (country) or wdt:P625 (coordinates) if P131 is missing. Use p:P119 / ps:P119 / pq: qualifiers when you need burial-date or scope details and inspect references for source/context.
  - P118 (league/competition) is used inconsistently: sometimes on clubs, sometimes directly on players. When finding clubs use ?club wdt:P118 wd:Q... and verify ?club wdt:P31 wd:Q483394. If P118 returns players, filter by ?item wdt:P31 wd:Q5 to detect humans and avoid false positives. To get current players prefer club→p:P54 statements: ?player p:P54 ?stmt; ?stmt ps:P54 ?club. OPTIONAL{ ?stmt pq:P582 ?end } FILTER(!BOUND(?end)). Verify qualifiers/references and DOBs for plausibility.
  - Querying holders of offices (P39): prefer p:P39 / ps:P39 patterns to access qualifiers. To find current holder use: ?person p:P39 ?stmt. ?stmt ps:P39 wd:Q... . OPTIONAL{ ?stmt pq:P582 ?end } FILTER(!BOUND(?end)). Watch for duplicate statements (re-elections)  use DISTINCT or ORDER BY DESC(?start) LIMIT 1 on pq:P580. Avoid HAVING(MAX(...)=...) on QLever; prefer subqueries with ORDER/LIMIT.
  - Headquarters: use wdt:P159 for org HQs. If P159 gives a building follow that building's wdt:P131* (bounded hops). If P159 points to a place, verify its wdt:P31. Don't rely only on P17 for org-country—also check P159 and P276. Use UNION/nested patterns to cover ?org wdt:P17 wd:Q... OR ?org wdt:P159|wdt:P276 ?place . ?place wdt:P17 wd:Q... or ?place wdt:P131* wd:Q...

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. If a query using SERVICE fails (e.g., HTTP 301 redirect), switch to rdfs:label + FILTER(LANG(...)) and/or schema:name. Language items (e.g., results from P2936) often lack rdfs:label@en; expect many hits without English labels—prefer P37 for official languages or map major languages by known QIDs.
- Practical query patterns: use rdfs:label + FILTER(LANG(...)) for labels. Use wdt:Pxxx for direct values; p:Pxxx/ps:Pxxx/pq:Pxxx for qualifiers. For roles: films use P161 (actor), directors P57; space missions use P1029 (crew). Query reverse and filter by instance-of film (wd:Q11424) or human (wd:Q5). For 'city' classification prefer ?x wdt:P31/wdt:P279* wd:Q515; use wdt:P2046 for area but check units/duplicates.
- When selecting latest qualifier-dated values (e.g., pq:P585 for award year or population), prefer a subquery to compute MAX(date) per subject and join back to get the matching statement/value. Avoid HAVING(MAX(?date)=?date) patterns on QLever (can cause engine errors). Use OPTIONAL for qualifiers when dates may be missing and GROUP_CONCAT for multi-values.
- Use search_entity to resolve names and verify instance-of (e.g., wdt:P31=wd:Q5). Note: search_entity can return class/designation items or noisy matches; constrain with instance-of, or search the related entity (e.g., country) and query its members. Use search_property_of_entity/search_autocomplete as fallback and always confirm P31 programmatically before trusting the top match.
- 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.
- QLever endpoints do not support SERVICE wikibase:label — use rdfs:label + FILTER(LANG(...))='en'. Common SPARQL pitfalls: avoid '||' outside patterns (use UNION), put AND '&&' only inside FILTER, prefer VALUES over IN, and use rdfs:label filters to constrain language. When testing existence prefer FILTER EXISTS { ... } or OPTIONAL { ?s wdt:Pxx ?v . FILTER(?v = wd:Q...) } — writing OPTIONAL { ?s wdt:Pxx wd:Q... } creates no ?v for BOUND(?v). When execute() fails, simplify the query and test with list(...).
- 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. Also verify ambiguous item QIDs (e.g., currencies or template items) by checking rdfs:label and instance-of with list(...) before use.
- 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"). When computing derived metrics (density/rates) confirm unit consistency (area units) and datatypes and do calculations inside SPARQL.
- 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; 'cause of death' -> P509; 'manner of death' -> P1196). 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] Is Python a kind of Programming languages?

[Assistant]
To determine whether Python is a kind of programming language, we need to check if Python (as an entity in Wikidata) is classified as a programming language.

### Step 1: Search for the entity "Python"
We first search for the Wikidata entity corresponding to "Python" to identify its QID.

Question: Python

Top 10 entity alternatives:
1. Python (wd:Q28865), also known as py, python 2, Python 2, Python 3, Python (computer language), etc.: general-purpose, high-level programming language / general-purpose, high-level programming language / is instance of object-based language / general-purpose programming language / general-purpose programming language
2. Python (wd:Q271218), also known as Piton: is instance of taxon / genus of reptiles
3. Python (wd:Q15721): is instance of mythological Greek character / is instance of mythological serpent / earth-dragon of Delphi
4. Python (wd:Q15728), also known as Derby, Python missile, RAFAEL Python: 1978 air-to-air missile family by RAFAEL / is subclass of air-to-air missile / is subclass of Air-to-air missile / is instance of missile family
5. CPython (wd:Q599384, matched via Python), also known as Python: is instance of implementation of a programming language / is instance of free and open-source software / is instance of reference implementation / Python reference implementation / is instance of free software / is instance of interpreter
6. Peithon (wd:Q1249144, matched via Python), also known as Python: has occupation military leader / Ancient Macedonian general / has occupation satrap / is instance of human
7. Python (wd:Q4363952), also known as Python II: ancient peastan Greek vase-painter of red-figure style / has occupation red-figure vase painter / has occupation Paestan vase-painter / has occupation painter / is instance of human
8. Python (wd:Q3411448): 2000 film directed by Richard Clabaugh / is instance of Television film / is instance of television film
9. Python (wd:Q18691580), also known as Peithon: has occupation Attic potter / ancient Attic-Greek potter / has occupation ceramicist / is instance of human
10. Python (wd:Q15727): is instance of steel roller coaster / is instance of amusement ride / roller coaster

[Assistant]
The most relevant entity for "Python" as a programming language is `wd:Q28865`, which is described as a "general-purpose, high-level programming language."

### Step 2: Verify that Python is classified as a programming language
We now check the instance-of (`wdt:P31`) of `wd:Q28865` to confirm whether it is classified as a programming language.

We'll look for the value of `wdt:P31` for `wd:Q28865` and check if it is linked to a programming language (e.g., `wd:Q9143` — "programming language").

Let’s execute a query to get the instance-of of Python.

execute

SELECT ?instance WHERE { wd:Q28865 wdt:P31 ?instance }

[Assistant]
The result shows that Python (`wd:Q28865`) is classified as an "object-based language" (`wd:Q899523`), not directly as a "programming language" (`wd:Q9143`). However, we need to check whether "object-based language" is a subclass of "programming language".

### Step 3: Check if "object-based language" is a subclass of "programming language"
We now check the subclass hierarchy of `wd:Q899523` (object-based language) to see if it is a subclass of `wd:Q9143` (programming language).

We'll query for the subclass tree of `wd:Q899523` using `wdt:P279` (subclass of).

SELECT ?subclass WHERE { wd:Q899523 wdt:P279* ?subclass . FILTER(?subclass = wd:Q9143) }

[Assistant]
The result confirms that `wd:Q899523` (object-based language) is a subclass of `wd:Q9143` (programming language), via the transitive subclass relationship (`wdt:P279*`).

### Conclusion:
Python (`wd:Q28865`) is an instance of "object-based language" (`wd:Q899523`), which is a subclass of "programming language" (`wd:Q9143`). Therefore, Python is indeed a kind of programming language.

### Final SPARQL Query:
We can now construct a final SPARQL query that directly answers the question: "Is Python a kind of programming language?" by checking if Python's instance-of or any of its superclasses is a programming language.

We'll use an ASK query to return `true` or `false`.

ASK WHERE { wd:Q28865 wdt:P31/wdt:P279* wd:Q9143 }

[Assistant]
The SPARQL query confirms that Python is a kind of programming language, as it is an instance of a subclass of "programming language".

### Final Answer:
```sparql
ASK WHERE { wd:Q28865 wdt:P31/wdt:P279* wd:Q9143 }
```
**Answer:** Yes, Python is a kind of programming language.