PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?nativeName WHERE {
  wd:Q81534 wdt:P86 ?composer .
  ?composer wdt:P1559 ?nativeName .
}

Using entities:
- Kimigayo (wd:Q81534), also known as national anthem of Japan: is instance of national anthem / is instance of national Symbols of Japan / national anthem of Japan

Using properties:
- name in native language (wd:P1559 as wdt), also known as native name, P1559: is subproperty of name / name of a person in their native language / name of a person in their native language / name of a person in their native language / name of a person in their native language
- composer (wd:P86 as wdt), also known as composed by, film score by, musical score by, music by, songwriter, etc.: is subproperty of creator / person(s) who wrote the music; also use P676 for lyricist / person(s) who wrote the music; also use P676 for lyricist / person(s) who wrote the music [for lyricist, use "lyrics by" (P676)]

Got 1 row and 1 column:
| nativeName    |
| ------------- |
| 林廣守 (lang:ja) |

Answer: 林廣守

林廣守

SPARQL query over wikidata:
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?nativeName WHERE {
  wd:Q81534 wdt:P86 ?composer .
  ?composer wdt:P1559 ?nativeName .
}

Using entities:
- Kimigayo (wd:Q81534), also known as national anthem of Japan: is instance of national anthem / is instance of national Symbols of Japan / national anthem of Japan

Using properties:
- name in native language (wd:P1559 as wdt), also known as native name, P1559: is subproperty of name / name of a person in their native language / name of a person in their native language / name of a person in their native language / name of a person in their native language
- composer (wd:P86 as wdt), also known as composed by, film score by, musical score by, music by, songwriter, etc.: is subproperty of creator / person(s) who wrote the music; also use P676 for lyricist / person(s) who wrote the music; also use P676 for lyricist / person(s) who wrote the music [for lyricist, use "lyrics by" (P676)]

Execution result:
Got 1 row and 1 column:
| nativeName    |
| ------------- |
| 林廣守 (lang:ja) |

[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] What is native name of the composer of the Japanese national anthem?

[Assistant]
To find the native name of the composer of the Japanese national anthem, we need to:

1. Identify the composer of the Japanese national anthem ("Kimigayo").
2. Find the native name (i.e., the name in the native language, typically Japanese) of that composer.

### Step 1: Identify the composer of the Japanese national anthem

The Japanese national anthem is "Kimigayo". We need to find who composed its music.

Let’s first search for the Japanese national anthem in Wikidata.

Question: Japanese national anthem

Top 10 entity alternatives:
1. national anthem (wd:Q23691), also known as national hymn, state anthem: song that represents a country or sovereign state / is subclass of national symbol / is subclass of patriotic song / is subclass of secular hymn / is instance of song type
2. La Marseillaise (wd:Q41180, matched via French national anthem), also known as French national anthem, Marseillaise, National anthem of France, The Marseillaise: is instance of national anthem / national anthem of France / national anthem of France
3. National Anthem of Chile (wd:Q484161, matched via National Anthem), also known as Canción Nacional, National Anthem: is instance of national anthem / National Anthem of Chile
4. Advance Australia Fair (wd:Q170601, matched via Australia's national anthem), also known as Australia's national anthem, national anthem of Australia: is instance of musical work/composition / song, and Australian national anthem / is instance of national anthem
5. Poland Is Not Yet Lost (wd:Q482988, matched via Polish national anthem), also known as Dąbrowski's Mazurka, Polish national anthem, Song of the Polish Legions in Italy: is instance of musical work/composition / is instance of national anthem / national anthem of Poland
6. State Anthem of the Soviet Union (wd:Q251918, matched via Soviet National Anthem), also known as Anthem of USSR, Soviet Anthem, Soviet National Anthem, USSR anthem: national anthem of the USSR, 1944 to 1991 / is instance of national anthem
7. Brazilian National Anthem (wd:Q134654), also known as Hino Nacional Brasileiro, Joaquim Osório Duque-Estrada, Osório Duque Estrada: 1831 national anthem composed by Francisco Manuel da Silva with lyrics by Osório Duque-Estrada / is instance of national anthem
8. Argentine National Anthem (wd:Q172495): is instance of national anthem / national anthem of Argentina
9. Marcha Real (wd:Q130940, matched via Spanish national anthem), also known as national anthem of Spain, Royal March, Spanish national anthem: is instance of national anthem / is instance of hymn tune / national anthem of Spain
10. Deșteaptă-te, române! (wd:Q184540, matched via Romanian national anthem), also known as anthem of Romania, Romanian anthem, Romanian national anthem: Romanian national anthem since 1989 / is instance of national anthem

[Assistant]
The Japanese national anthem is "Kimigayo". From the search results, we don't see an explicit entry for "Kimigayo", but we can infer that it should be an item with the label "Japanese national anthem". Let’s search for it more precisely using a constrained search to find the item with the exact label.

Let’s try searching for "Kimigayo" directly.

Question: Kimigayo

Top 10 entity alternatives:
1. Kimigayo (wd:Q81534), also known as national anthem of Japan: is instance of national Symbols of Japan / is instance of national anthem / national anthem of Japan
2. Kimigayo (wd:Q130240831): edition in ''The National Anthems of the Allies'' (1917) / is instance of version, edition or translation
3. Kimigayo boy (wd:Q10926866): is instance of human
4. Kimigayo March (wd:Q24887361), also known as Kimigayo Kōshinkyoku: is instance of musical work/composition
5. National Anthem,  Kimigayo (wd:Q106398988, matched via Kokka Kimigayo), also known as Kokka Kimigayo: short film by Noburo Ofuji / is instance of short film
6. Music and Politics: Japanese Composer Mayuzumi Toshiro and Kimigayo (wd:Q127824960): is instance of scholarly article / is instance of academic article / scholarly article

[Assistant]
Great! We found the correct item: **Kimigayo (wd:Q81534)**, which is the Japanese national anthem.

Now, we need to find the composer of this anthem. Let’s look at the properties of this item to find the composer.

list

wd:Q81534

[Assistant]
The property `wdt:P170` (creator) didn't return any results. Let's try other common properties related to composition, such as `wdt:P58` (composer) or `wdt:P497` (lyricist). Let's check for any property that might link to a composer.

Let’s list all properties of Kimigayo to find the composer.

wd:Q81534

Got 498 rows and 3 columns, showing the first 10 rows below:
| subject              | property                            | object                                                                  |
| -------------------- | ----------------------------------- | ----------------------------------------------------------------------- |
| Kimigayo (wd:Q81534) | instance of (wdt:P31)               | national anthem (wd:Q23691)                                             |
| Kimigayo (wd:Q81534) | title (wdt:P1476)                   | 君が代 (lang:ja)                                                           |
| Kimigayo (wd:Q81534) | language of work or name (wdt:P407) | Early Middle Japanese (wd:Q182695)                                      |
| Kimigayo (wd:Q81534) | country (wdt:P17)                   | Japan (wd:Q17)                                                          |
| Kimigayo (wd:Q81534) | Commons category (wdt:P373)         | National anthem of Japan                                                |
| Kimigayo (wd:Q81534) | image (wdt:P18)                     | <http://commons.wikimedia.org/wiki/Special:FilePath/Kimigayo.score.svg> |
| Kimigayo (wd:Q81534) | Freebase ID (wdt:P646)              | /m/012x7q                                                               |
| Kimigayo (wd:Q81534) | copyright status (wdt:P6216)        | public domain (wd:Q19652)                                               |
| Kimigayo (wd:Q81534) | inception (wdt:P571)                | 1880-10-26T00:00:00Z (xsd:dateTime)                                     |
| Kimigayo (wd:Q81534) | depicts (wdt:P180)                  | sazare-ishi (wd:Q11267921)                                              |
| ...                  | ...                                 | ...                                                                     |

[Assistant]
We see that the anthem was composed in 1880. We need to find the composer. Let's check for properties related to music composition, such as:

- `wdt:P58` (composer)
- `wdt:P170` (creator) — already checked
- `wdt:P178` (composer) — sometimes used for music

Let’s try searching for properties related to "composer" using `search_property_of_entity`.

Question: composer

Top 10 property alternatives:
1. composer (wd:P86 as p/wdt), also known as composed by, film score by, musical score by, music by, songwriter, etc.: person(s) who wrote the music [for lyricist, use "lyrics by" (P676)] / person(s) who wrote the music; also use P676 for lyricist / person(s) who wrote the music; also use P676 for lyricist / is subproperty of creator
2. inception (wd:P571 as p/wdt, matched via composed), also known as broke ground, built, commenced on date, commencement date, completed, etc.: 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 / date or point in time when the organisation / object was founded / created / is subproperty of start time
3. audio (wd:P51 as p/wdt), also known as audio file, audio recording, audio sample, recording, song, etc.: relevant sound. If available, use a more specific property. Samples: "spoken text audio" (P989), "pronunciation audio" (P443) / relevant sound / relevant sound
4. sheet music (wd:P3030 as p/wdt), also known as musical score, P3030: media file containing the musical score (sheet music) for this item / media file containing the musical score (sheet music) for this item
5. tonality (wd:P826 as p/wdt, matched via key of musical composition), also known as in key, key, key of musical composition, key used, musical key, etc.: key of a musical composition / key of a musical composition
6. derivative work (wd:P4969 as p/wdt, matched via remix), also known as adaptation, adapted as, cover, derived work, has adaptation, etc.: work created from major part of this artwork; work created from major part of this software / new work of art (film, book, software, etc.) derived from major part of this work
7. MusicBrainz work ID (wd:P435 as p/wdtn/wdt, matched via MusicBrainz composition ID), also known as composition ID (MusicBrainz), MBID work, MBW, MB work ID, MusicBrainz composition ID, etc.: identifier for a work per the MusicBrainz open music encyclopedia
8. image (wd:P18 as p/wdt, matched via photo), also known as camera picture, Commons image, drawing, File:, graph, etc.: image of relevant illustration of the subject; if available, ... only images which exist on Wikimedia Commons are acceptable / image of relevant illustration of the subject; if available, ... only images which exist on Wikimedia Commons are acceptable / image of relevant illustration of the subject; if available, ... map, flag image, signature image, logo image, collage image) / image of relevant illustration of the subject; if available, ... map, flag image, signature image, logo image, collage image)
9. depicts (wd:P180 as p/wdt, matched via sounds like), also known as conveys, depicting, depiction of, displays, features, etc.: entity visually depicted in an image, literarily described in ... an audiovisual or other medium; see also P921, 'main subject' / is subproperty of has part(s) / is subproperty of has part
10. lyricist (wd:P676 as p/wdt), also known as author, lyrics by, songwriter, text author, text by, etc.: author of song lyrics; also use P86 for music composer / is subproperty of author / author of song lyrics

No other items found

[Assistant]
Perfect! We found the property **`wdt:P86`** (composer). Now we can query for the composer of Kimigayo using this property.

Let’s execute a query to find the composer of Kimigayo.

execute

SELECT ?composer WHERE { wd:Q81534 wdt:P86 ?composer }

[Assistant]
The composer of the Japanese national anthem "Kimigayo" is **Hiromori Hayashi** (wd:Q3783782).

Now, we need to find the **native name** of Hiromori Hayashi. In Japanese, the native name is typically stored in the `wdt:P1476` property (title in native language) or sometimes as a label in Japanese.

Let’s check the labels of Hiromori Hayashi in Japanese.

list

wd:Q3783782

[Assistant]
The `wdt:P1476` property didn't return anything. Let’s check the labels in Japanese directly using `rdfs:label` with language filter `ja`.

wd:Q3783782

Got 24 rows and 3 columns, showing the first 10 rows below:
| subject                        | property   | object                     |
| ------------------------------ | ---------- | -------------------------- |
| Hiromori Hayashi (wd:Q3783782) | rdfs:label | Hayashi Hiromori (lang:it) |
| Hiromori Hayashi (wd:Q3783782) | rdfs:label | Hiromori Hayashi (lang:ca) |
| Hiromori Hayashi (wd:Q3783782) | rdfs:label | Hiromori Hayashi (lang:da) |
| Hiromori Hayashi (wd:Q3783782) | rdfs:label | Hiromori Hayashi (lang:de) |
| Hiromori Hayashi (wd:Q3783782) | rdfs:label | Hiromori Hayashi (lang:en) |
| Hiromori Hayashi (wd:Q3783782) | rdfs:label | Hiromori Hayashi (lang:es) |
| Hiromori Hayashi (wd:Q3783782) | rdfs:label | Hiromori Hayashi (lang:fr) |
| Hiromori Hayashi (wd:Q3783782) | rdfs:label | Hiromori Hayashi (lang:la) |
| Hiromori Hayashi (wd:Q3783782) | rdfs:label | Hiromori Hayashi (lang:nb) |
| Hiromori Hayashi (wd:Q3783782) | rdfs:label | Hiromori Hayashi (lang:nl) |
| ...                            | ...        | ...                        |

[Assistant]
We don’t see a Japanese label (`lang:ja`) in the results. This is unusual — let’s check if the item has a Japanese name stored under `wdt:P1559` (native name) or `wdt:P1545` (name in native language).

Let’s search for properties related to "native name" for Hiromori Hayashi.

Question: native name

Top 10 property alternatives:
1. name in native language (wd:P1559 as p/wdt, matched via native name), also known as native name, P1559: name of a person in their native language / name of a person in their native language / name of a person in their native language / name of a person in their native language / is subproperty of name
2. name in kana (wd:P1814 as p/wdt, matched via kana name), also known as furigana, kana, kana name, kana reading, reading in kana, etc.: is subproperty of transliteration or transcription / the reading of a Japanese name in kana / is subproperty of transliteration / is subproperty of name
3. NDL Authority ID (wd:P349 as p/wdtn/wdt, matched via ndl), also known as National Diet Library Auth ID, National Diet Library ID, National Diet Library of Japan authority control ID, National Diet Library of Japan ID, ndl, etc.: identifier for authority control per the National Diet Library of Japan
4. family name (wd:P734 as p/wdt, matched via clan name), also known as clan name, last name, surname, P734: last name or family name of a person / part of full name of person / part of full name of person / is subproperty of name
5. instance of (wd:P31 as p/wdt, matched via is a), 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
6. country of citizenship (wd:P27 as p/wdt, matched via national of), also known as citizen of, citizenship, country, (legal) nationality, nation, etc.: the object is a country that recognizes the subject as its citizen / the object is a country that recognizes the subject as its citizen / is subproperty of country
7. ISNI (wd:P213 as p/wdt, matched via International Standard Name Identifier), also known as International Standard Name Identifier, ISO 27729, P213: International Standard Name Identifier for an identity. Starting with 0000. / International Standard Name Identifier for an identity. Starting with 0000. / International Standard Name Identifier for an identity. Starting with 0000. / International Standard Name Identifier for an identity. Starting with 0000.
8. child (wd:P40 as p/wdt, matched via son), also known as children, daughter, daughters, descendants, father of, etc.: subject has object as child. Do not use for stepchildren—use "relative" (P1038), qualified with "type of kinship" (P1039) / subject has the object in their family as their offspring son or daughter (independently of their age) / subject has object as biological, foster, and/or adoptive child / is subproperty of significant person / is subproperty of relative
9. GND ID (wd:P227 as p/wdtn/wdt, matched via GND-IDN), also known as Deutschen Nationalbibliothek ID, DNB author ID, DNB authorities, Gemeinsame Normdatei ID, German National Library ID, etc.: international authority file of names, subjects, and organisations (please don't use type n = name, disambiguation) / identifier from an international authority file of names, subjects, and organizations
10. place of birth (wd:P19 as p/wdt, matched via P19), also known as birth city, birth location, birth place, birthplace, born, etc.: most specific known (e.g. city instead of country, or ... birth location of a person, animal or fictional character / most specific known (e.g. city instead of country, or ... birth location of a person, animal or fictional character / most specific known birth location of a person, animal or fictional character / is subproperty of location

No other items found

[Assistant]
We found the property **`wdt:P1559`** (name in native language), which is exactly what we need!

Now, let’s query for the native name of Hiromori Hayashi using `wdt:P1559`.

execute

SELECT ?nativeName WHERE { wd:Q3783782 wdt:P1559 ?nativeName }

Got 1 row and 1 column:
| nativeName    |
| ------------- |
| 林廣守 (lang:ja) |

[Assistant]
The native name of Hiromori Hayashi, the composer of the Japanese national anthem "Kimigayo", is **林廣守** (in Japanese).

### Final Answer:
The native name of the composer of the Japanese national anthem is **林廣守**.

Here is the final SPARQL query that retrieves this information:

```sparql
SELECT ?nativeName WHERE {
  wd:Q81534 wdt:P86 ?composer .
  ?composer wdt:P1559 ?nativeName .
}
```

This query:
1. Finds the composer of Kimigayo (`wd:Q81534`) using `wdt:P86`.
2. Then retrieves the native name (`wdt:P1559`) of that composer.

We’ll now provide the answer.

answer

SELECT ?nativeName WHERE { wd:Q81534 wdt:P86 ?composer . ?composer wdt:P1559 ?nativeName . }

Answer: 林廣守


PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?dolphinLifespan ?bearLifespan WHERE {
  wd:Q174199 wdt:P4214 ?dolphinLifespan .
  wd:Q36341 wdt:P4214 ?bearLifespan .
}

Using entities:
- common bottlenose dolphin (wd:Q174199), also known as Atlantic bottlenose dolphin, Bottle-Nosed Dolphin, bottlenose dolphin, Bottlenose dolphin, Tursiops truncatus: is instance of taxon / best-known species of the dolphin family / best-known species of the dolphin family
- Ursus arctos (wd:Q36341), also known as brown bear, grizzly bear: is instance of taxon / is subclass of bear / species of mammal / species of mammal / species of mammal / species of mammal

Using properties:
- longest observed lifespan (wd:P4214 as wdt), also known as highest observed lifespan, longest lifespan, maximum age, maximum life expectancy, maximum life span, etc.: age of the oldest specimen of a taxon for which the age can be verified

Got 1 row and 2 columns:
| dolphinLifespan    | bearLifespan       |
| ------------------ | ------------------ |
| 51.6 (xsd:decimal) | 40.0 (xsd:decimal) |

Answer: The common bottlenose dolphin has a higher observed lifespan (51.6 years) than the brown bear (40.0 years).

The common bottlenose dolphin has a higher observed lifespan (51.6 years) than the brown bear (40.0 years).

SPARQL query over wikidata:
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?dolphinLifespan ?bearLifespan WHERE {
  wd:Q174199 wdt:P4214 ?dolphinLifespan .
  wd:Q36341 wdt:P4214 ?bearLifespan .
}

Using entities:
- common bottlenose dolphin (wd:Q174199), also known as Atlantic bottlenose dolphin, Bottle-Nosed Dolphin, bottlenose dolphin, Bottlenose dolphin, Tursiops truncatus: is instance of taxon / best-known species of the dolphin family / best-known species of the dolphin family
- Ursus arctos (wd:Q36341), also known as brown bear, grizzly bear: is instance of taxon / is subclass of bear / species of mammal / species of mammal / species of mammal / species of mammal

Using properties:
- longest observed lifespan (wd:P4214 as wdt), also known as highest observed lifespan, longest lifespan, maximum age, maximum life expectancy, maximum life span, etc.: age of the oldest specimen of a taxon for which the age can be verified

Execution result:
Got 1 row and 2 columns:
| dolphinLifespan    | bearLifespan       |
| ------------------ | ------------------ |
| 51.6 (xsd:decimal) | 40.0 (xsd:decimal) |

[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] Who has a higher observed lifespan out of the common bottlenose dolphin and the brown bear?

[Assistant]
To determine which animal has a higher observed lifespan between the common bottlenose dolphin and the brown bear, I need to find the maximum observed lifespan for each species.

### Step 1: Identify the entities for the common bottlenose dolphin and the brown bear
I will first search for the Wikidata entities for both animals.

Question: common bottlenose dolphin

Top 10 entity alternatives:
1. common bottlenose dolphin (wd:Q174199), also known as Atlantic bottlenose dolphin, Bottle-Nosed Dolphin, bottlenose dolphin, Bottlenose dolphin, Tursiops truncatus: best-known species of the dolphin family / best-known species of the dolphin family / is instance of taxon
2. Short-beaked Common Dolphin (wd:Q207114), also known as Delphinus delphis: is instance of taxon / species of mammal
3. Delphinus (wd:Q312257, matched via Common dolphin genus), also known as Common dolphin genus: is instance of taxon / genus of mammals
4. Indo-Pacific bottlenose dolphin (wd:Q370597), also known as Indian Ocean bottlenose dolphin, Tursiops aduncus: is instance of taxon / species of mammal
5. bottlenose dolphin (wd:Q149069), also known as Tursiops: is instance of taxon / genus of dolphin
6. Delphinus capensis (wd:Q604326, matched via Long-beaked common dolphin), also known as Long-beaked common dolphin: is instance of taxon / species of mammal
7. Tursiops erebennus (wd:Q121222034, matched via Tamanend's bottlenose dolphin), also known as Tamanend's bottlenose dolphin: is instance of taxon / species of dolphin
8. Fetal omphalocele in a common bottlenose dolphin (Tursiops truncatus). (wd:Q46363505): is instance of scholarly article / is instance of academic article / scientific article
9. Common Dolphin (wd:Q84262742): is instance of ship / ship built in 2012
10. mahi-mahi (wd:Q14443, matched via common dolphinfish), also known as common dolphinfish, Coryphaena hippurus, dorado, mahi mahi: is subclass of fish as food / is instance of taxon / is subclass of fish / is subclass of Fish / species of fish

Question: brown bear

Top 10 entity alternatives:
1. Ursus arctos (wd:Q36341, matched via brown bear), also known as brown bear, grizzly bear: is instance of taxon / is subclass of bear / species of mammal / species of mammal / species of mammal / species of mammal
2. Brown Bear (wd:Q26318258), also known as Brown Bear Public House, Brown Bear, Whitechapel, The Brown Bear, Whitechapel: pub in Whitechapel, London / is instance of pub / pub in London, UK
3. Brown Bear (wd:Q124961726), also known as Beube: has occupation online streamer / South Korean online streamer / is instance of human
4. The Brown Bear Public House (wd:Q17554255, matched via Brown Bear), also known as Brown Bear, The Brown Bear, Ware: pub in Braughing, Ware, UK / pub in Braughing, Ware, UK / is instance of pub
5. Brown bear (wd:Q57080481): sculpture by François Pompon on display at Musée de Grenoble / sculpture by François Pompon on display at Musée de Grenoble / is instance of sculpture
6. Brown Bear (wd:Q79684102), also known as The Brown Bear: pub in Berwick-Upon-Tweed, Northumberland, UK / pub in Berwick-Upon-Tweed, Northumberland, UK / is instance of pub
7. Brown bear (wd:Q117481410): sculpture by Georg Wrba in Tierpark Berlin, Germany / is instance of statue
8. brown bear (wd:Q113488817), also known as grizzly bear: fictional monster from Dungeons & Dragons / is subclass of monster / is subclass of bear
9. Brown Bear (wd:Q80476278), also known as Brown Bear, Devonport, Plymouth: pub in Plymouth, Devon, UK / pub in Plymouth, Devon, UK / is instance of pub
10. Ursus arctos arctos (wd:Q839769, matched via Common brown bear), also known as Common brown bear, Eurasian Brown Bear: subspecies of brown bear / is instance of taxon

[Assistant]
Now I have identified the correct entities:
- Common bottlenose dolphin: `wd:Q174199`
- Brown bear: `wd:Q36341`

### Step 2: Find the property for maximum observed lifespan
I need to find the property that represents the maximum observed lifespan for a taxon (species). I will search for properties related to "lifespan" or "maximum lifespan" for these entities.

Question: lifespan

Top 10 property alternatives:
1. longest observed lifespan (wd:P4214 as p/wdt, matched via maximum lifespan), also known as highest observed lifespan, longest lifespan, maximum age, maximum life expectancy, maximum life span, etc.: age of the oldest specimen of a taxon for which the age can be verified
2. taxon range (wd:P9714 as p/wdt, matched via range), also known as geographic range, geographic range of taxon, range, range of taxon, taxon geographic range, etc.: geographic area(s) where a taxon is found
3. Encyclopedia of Life ID (wd:P830 as p/wdt), also known as eol, EoL ID, P830: eol.org item reference number / eol.org item reference number
4. gestation period (wd:P3063 as p/wdt), also known as P3063: amount of time needed for gestation for this animal taxon / amount of time needed for gestation for this animal taxon / is subproperty of duration
5. image (wd:P18 as p/wdt, matched via still), also known as camera picture, Commons image, drawing, File:, graph, etc.: image of relevant illustration of the subject; if available, ... only images which exist on Wikimedia Commons are acceptable / image of relevant illustration of the subject; if available, ... only images which exist on Wikimedia Commons are acceptable / image of relevant illustration of the subject; if available, ... map, flag image, signature image, logo image, collage image) / image of relevant illustration of the subject; if available, ... map, flag image, signature image, logo image, collage image)
6. Catalogue of Life ID (wd:P10585 as p/wdt), also known as CoL ID, P10585: identifier of a taxon or synonym in the Catalogue of Life
7. instance of (wd:P31 as p/wdt, matched via type), 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
8. IUCN conservation status (wd:P141 as p/wdt, matched via conservation status), also known as conservation status, P141: conservation status assigned by the International Union for Conservation of Nature / conservation status assigned by the International Union for Conservation of Nature
9. topic's main category (wd:P910 as p/wdt, matched via category), also known as article's main category, category, category for this topic, catmain, has category, etc.: main category of this topic / main Wikimedia category
10. original combination (wd:P1403 as p/wdt, matched via protonym), also known as protonym, P1403: for animals: the combination (binomen or trinomen) where the species-group name used in this taxon name was first published

No other items found

[Assistant]
I found the property `wdt:P4214` which represents "longest observed lifespan" for a taxon. This is exactly what I need.

### Step 3: Query the longest observed lifespan for both species
Now I will construct a SPARQL query to retrieve the longest observed lifespan for both the common bottlenose dolphin (`wd:Q174199`) and the brown bear (`wd:Q36341`).

The query will:
- Select the lifespan value for each species
- Return the values so I can compare them

Let me execute the query:

execute

SELECT ?dolphinLifespan ?bearLifespan WHERE { wd:Q174199 wdt:P4214 ?dolphinLifespan . wd:Q36341 wdt:P4214 ?bearLifespan . }

Got 1 row and 2 columns:
| dolphinLifespan    | bearLifespan       |
| ------------------ | ------------------ |
| 51.6 (xsd:decimal) | 40.0 (xsd:decimal) |

[Assistant]
The query results show:
- Common bottlenose dolphin (`wd:Q174199`): 51.6 years
- Brown bear (`wd:Q36341`): 40.0 years

Therefore, the common bottlenose dolphin has a higher observed lifespan than the brown bear.

### Final Answer
The common bottlenose dolphin has a higher observed lifespan (51.6 years) compared to the brown bear (40.0 years).

I will now provide the final SPARQL query and answer.

answer

SELECT ?dolphinLifespan ?bearLifespan WHERE { wd:Q174199 wdt:P4214 ?dolphinLifespan . wd:Q36341 wdt:P4214 ?bearLifespan . }

Answer: The common bottlenose dolphin has a higher observed lifespan (51.6 years) than the brown bear (40.0 years).


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

Using entities:
- Hamburg Airport (wd:Q27706), also known as EDDH, HAM, Hamburg Airport “Helmut Schmidt”, Hamburg-Fuhlsbüttel Airport: is instance of commercial airport / is instance of international airport / airport in Fuhlsbüttel, Hamburg, Germany

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 Hamburg Airport was inaugurated on January 1, 1911.

The Hamburg Airport was inaugurated on January 1, 1911.

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

Using entities:
- Hamburg Airport (wd:Q27706), also known as EDDH, HAM, Hamburg Airport “Helmut Schmidt”, Hamburg-Fuhlsbüttel Airport: is instance of commercial airport / is instance of international airport / airport in Fuhlsbüttel, Hamburg, Germany

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                           |
| ----------------------------------- |
| 1911-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 was the Hamburg Airport inaugurated?

[Assistant]
To determine when the Hamburg Airport was inaugurated, I need to find the inception date (P571) of Hamburg Airport. First, I will search for the entity corresponding to Hamburg Airport.

Question: Hamburg Airport

Top 10 entity alternatives:
1. Hamburg Airport (wd:Q27706), also known as EDDH, HAM, Hamburg Airport “Helmut Schmidt”, Hamburg-Fuhlsbüttel Airport: airport in Fuhlsbüttel, Hamburg, Germany / is instance of international airport / is instance of commercial airport
2. Hamburg Finkenwerder Airport (wd:Q663819), also known as Airbus Hamburg-Finkenwerder, EDHI, Finkenwerder Airport, XFW: aircraft manufacturing plant and associated private airport in the Finkenwerder quarter of southwest Hamburg, Germany / aircraft manufacturing plant and private airport in Germany / is instance of German special airfield / is instance of company airport
3. Hamburg Airport station (wd:Q5644290): is instance of underground railway station / is instance of dead-end railway station / is instance of airport railway station / is instance of Bahnhof (station) / is instance of dead-end station / is instance of S-Bahn station / railway station in Germany
4. Hamburg Airport Classics (wd:Q1572874)
5. Hamburg Inc Airport (wd:Q34959585), also known as 4G2, Hamburg Inc Aerodrome: is instance of aerodrome / is instance of Aerodrome / is instance of airport
6. Hamburg : Airport (wd:Q104725193), also known as A9 n35_Sm2: is instance of PM20 country/subject folder / folder of the 20th Century Press Archives
7. Novo Hamburgo Airport (wd:Q12694211), also known as SSNH: is instance of airport / airport in Brazil / airport in Brazil / Brazilian airport
8. Hamburg Airport S-Bahn line (wd:Q1430696): is instance of airport rail link / is instance of railway tunnel / is instance of railway line / railway line in Germany
9. Hamburg : Airport, individual (wd:Q104725196), also known as A9 n35_Sm2.II: is instance of PM20 country/subject folder / folder of the 20th Century Press Archives
10. Hamburg : Airport, general (wd:Q104725195), also known as A9 n35_Sm2.I: is instance of PM20 country/subject folder / folder of the 20th Century Press Archives

[Assistant]
The correct entity for Hamburg Airport is wd:Q27706. Now, I will retrieve the inception date (P571) of Hamburg Airport.

list

wd:Q27706

[Assistant]
The Hamburg Airport was inaugurated on January 1, 1911. I will now provide the final answer.

answer

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

Answer: The Hamburg Airport was inaugurated on January 1, 1911.