PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?item ?itemLabel ?inception ?commemorates ?commemoratesLabel ?image ?coord WHERE {
  VALUES ?helsinki {
    wd:Q1757
  }
  {
    ?item wdt:P131 ?helsinki .
  } UNION {
    ?item wdt:P276 ?helsinki .
  }
  FILTER ( EXISTS {
    ?item wdt:P31 / wdt:P279 * wd:Q358
  }
  || EXISTS {
    ?item wdt:P1435 ?anyDesig
  }
  ) OPTIONAL {
    ?item wdt:P571 ?inception .
  }
  OPTIONAL {
    ?item wdt:P547 ?commemorates .
    ?commemorates rdfs:label ?commemoratesLabel .
    FILTER ( LANG( ?commemoratesLabel ) = "en" )
  }
  OPTIONAL {
    ?item wdt:P18 ?image .
  }
  OPTIONAL {
    ?item wdt:P625 ?coord .
  }
  OPTIONAL {
    ?item rdfs:label ?itemLabel .
    FILTER ( LANG( ?itemLabel ) = "en" )
  }
}
ORDER BY ?item

Using entities:
- Helsinki (wd:Q1757), also known as Helsingfors, Helsingia, Helsingin kaupunki, Hesa, Stadi: is instance of municipality of Finland / capital and most populous city of Finland / capital and most populous city of Finland
- heritage site (wd:Q358), also known as cultural monument, heritage place, heritage property, historic monument, immovable heritage, etc.: is subclass of human-geographic territorial entity / is subclass of cultural property / is subclass of cultural heritage / general term for a site of cultural heritage for a specific country / general term for a site of cultural heritage for a specific ... value except for large sites containing multiple entities)

Using properties:
- located in the administrative territorial entity (wd:P131 as wdt), also known as administrative territorial entity, administrative territory, city, happens in, in, etc.: is subproperty of location / is subproperty of part of / the item is located on the territory of the following administrative entity / the item is located on the territory of the following administrative entity / the item is located on the territory of the following ... the item falls only partially into the administrative entity. / the item is located on the territory of the following ... the item falls only partially into the administrative entity.
- heritage designation (wd:P1435 as wdt), also known as designation, heritage status, legal protection, listed status, listing, etc.: is subproperty of instance of / is subproperty of has part / is subproperty of has part(s) / heritage designation of a cultural or natural site / the heritage status of a historical site / the heritage status of a historical site
- image (wd:P18 as wdt), also known as camera picture, Commons image, drawing, File:, graph, etc.: 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) / 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
- location (wd:P276 as wdt), also known as based in, city, from, held by, in, etc.: location of the item, physical object or event is within. In ... use P131. In case of a distinct terrain feature use P706. / location of the item, physical object or event is within. In ... use P131. In case of a distinct terrain feature use P706. / location of the object, structure or event. In the case of an ... use P706. Use P7153 for locations associated with the object
- subclass of (wd:P279 as wdt), also known as all members of this class also belong to, category of, form of, has superclass, is a class of, etc.: this item is a subclass (subset) of that item; ALL instances ... of volcanic landform); Everest is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain
- instance of (wd:P31 as wdt), also known as example of, has type, is a, is an, is of type, etc.: that class of which this subject is a particular example and ... a subclass of mountain (and an instance of volcanic landform) / type to which this subject corresponds/belongs. Different ... and the volcano is a type (instance) of volcanic landform
- commemorates (wd:P547 as wdt), also known as anniversary of, birthday of, celebrates, commemorandum, honors, etc.: is subproperty of main subject / what the place, monument, memorial, holiday, commemorates / what the place, monument, memorial, or holiday, commemorates / what the place, monument, memorial, or holiday, commemorates
- 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
- coordinate location (wd:P625 as wdt), also known as co-ordinate location, co-ordinates, coordinates, co-ords, coords, etc.: coordinates of the subject / coordinates of the subject / geocoordinates of the subject. For Earth, please note that only WGS84 coordinating system is supported at the moment

Answer:
Results and notes

- I ran a SPARQL query that selects items located in Helsinki (wd:Q1757) by either direct "located in the administrative territorial entity" (wdt:P131) or direct "location" (wdt:P276), and that are either instances/subclasses of "heritage site" (wd:Q358) or have a heritage designation (wdt:P1435).
- For each item I requested: its IRI (?item), English label (?itemLabel), inception (P571), commemorates (P547) with an English label, image (P18), and coordinates (P625). Results are ordered by the item IRI as you requested.

What I found

- The query returned 6,378 rows (items). Columns returned are: item (IRI), itemLabel (en), inception (date/time if present), commemorates (IRI) + commemoratesLabel (en) if present, image (file path on Commons) if present, and coord (geometric POINT WKT) if present.
- Example items seen in the returned results (first rows from the query output):
  - wd:Q102117141 — "Stolperstein dedicated to Hans Korn" (coordinates and image available)
  - wd:Q10403832 — "Aino Acktén huvila" (inception 1877, coordinates, image available)
  - wd:Q10428420 — "Kallio Library" (inception 1912, coordinates, image available)
  - wd:Q1044613 — "Helsinki Central Railway Station" (inception 1909, coordinates, image available)

Limitations and notes

- To avoid timeouts I used direct location links (?item wdt:P131 wd:Q1757 and ?item wdt:P276 wd:Q1757). That retrieves items that state Helsinki itself as their direct administrative location or direct location. There are additional heritage items that are located in administrative subdivisions inside Helsinki (their P131 points to a neighbourhood or district); those would be found by using wdt:P131* wd:Q1757 (traversing the admin hierarchy). The broader query with wdt:P131* may be more expensive and previously timed out on this endpoint; if you want an exhaustive run including P131* I can attempt it (it may take longer or require batching).
- Many items lack some optional values (inception, commemorates, image, or coordinates), so those cells are empty for those rows.

What I can do next

- Export the full 6,378-row result table in CSV/JSON for you.
- Re-run the query with wdt:P131* to be more exhaustive (may time out or take longer). I can run it with paging/limits to collect results in batches.
- Filter the results further (e.g., only items with P1435 = a specific national register, or only items with images, or only items of a specific subclass like "architectural heritage monument").

If you want the full result table exported (CSV/JSON) or want me to re-run the broader wdt:P131* version to include sub-admin items, tell me which you prefer and I will proceed.

Results and notes

- I ran a SPARQL query that selects items located in Helsinki (wd:Q1757) by either direct "located in the administrative territorial entity" (wdt:P131) or direct "location" (wdt:P276), and that are either instances/subclasses of "heritage site" (wd:Q358) or have a heritage designation (wdt:P1435).
- For each item I requested: its IRI (?item), English label (?itemLabel), inception (P571), commemorates (P547) with an English label, image (P18), and coordinates (P625). Results are ordered by the item IRI as you requested.

What I found

- The query returned 6,378 rows (items). Columns returned are: item (IRI), itemLabel (en), inception (date/time if present), commemorates (IRI) + commemoratesLabel (en) if present, image (file path on Commons) if present, and coord (geometric POINT WKT) if present.
- Example items seen in the returned results (first rows from the query output):
  - wd:Q102117141 — "Stolperstein dedicated to Hans Korn" (coordinates and image available)
  - wd:Q10403832 — "Aino Acktén huvila" (inception 1877, coordinates, image available)
  - wd:Q10428420 — "Kallio Library" (inception 1912, coordinates, image available)
  - wd:Q1044613 — "Helsinki Central Railway Station" (inception 1909, coordinates, image available)

Limitations and notes

- To avoid timeouts I used direct location links (?item wdt:P131 wd:Q1757 and ?item wdt:P276 wd:Q1757). That retrieves items that state Helsinki itself as their direct administrative location or direct location. There are additional heritage items that are located in administrative subdivisions inside Helsinki (their P131 points to a neighbourhood or district); those would be found by using wdt:P131* wd:Q1757 (traversing the admin hierarchy). The broader query with wdt:P131* may be more expensive and previously timed out on this endpoint; if you want an exhaustive run including P131* I can attempt it (it may take longer or require batching).
- Many items lack some optional values (inception, commemorates, image, or coordinates), so those cells are empty for those rows.

What I can do next

- Export the full 6,378-row result table in CSV/JSON for you.
- Re-run the query with wdt:P131* to be more exhaustive (may time out or take longer). I can run it with paging/limits to collect results in batches.
- Filter the results further (e.g., only items with P1435 = a specific national register, or only items with images, or only items of a specific subclass like "architectural heritage monument").

If you want the full result table exported (CSV/JSON) or want me to re-run the broader wdt:P131* version to include sub-admin items, tell me which you prefer and I will proceed.

SPARQL query over wikidata:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?item ?itemLabel ?inception ?commemorates ?commemoratesLabel ?image ?coord WHERE {
  VALUES ?helsinki {
    wd:Q1757
  }
  {
    ?item wdt:P131 ?helsinki .
  } UNION {
    ?item wdt:P276 ?helsinki .
  }
  FILTER ( EXISTS {
    ?item wdt:P31 / wdt:P279 * wd:Q358
  }
  || EXISTS {
    ?item wdt:P1435 ?anyDesig
  }
  ) OPTIONAL {
    ?item wdt:P571 ?inception .
  }
  OPTIONAL {
    ?item wdt:P547 ?commemorates .
    ?commemorates rdfs:label ?commemoratesLabel .
    FILTER ( LANG( ?commemoratesLabel ) = "en" )
  }
  OPTIONAL {
    ?item wdt:P18 ?image .
  }
  OPTIONAL {
    ?item wdt:P625 ?coord .
  }
  OPTIONAL {
    ?item rdfs:label ?itemLabel .
    FILTER ( LANG( ?itemLabel ) = "en" )
  }
}
ORDER BY ?item

Using entities:
- Helsinki (wd:Q1757), also known as Helsingfors, Helsingia, Helsingin kaupunki, Hesa, Stadi: is instance of municipality of Finland / capital and most populous city of Finland / capital and most populous city of Finland
- heritage site (wd:Q358), also known as cultural monument, heritage place, heritage property, historic monument, immovable heritage, etc.: is subclass of human-geographic territorial entity / is subclass of cultural property / is subclass of cultural heritage / general term for a site of cultural heritage for a specific country / general term for a site of cultural heritage for a specific ... value except for large sites containing multiple entities)

Using properties:
- located in the administrative territorial entity (wd:P131 as wdt), also known as administrative territorial entity, administrative territory, city, happens in, in, etc.: is subproperty of location / is subproperty of part of / the item is located on the territory of the following administrative entity / the item is located on the territory of the following administrative entity / the item is located on the territory of the following ... the item falls only partially into the administrative entity. / the item is located on the territory of the following ... the item falls only partially into the administrative entity.
- heritage designation (wd:P1435 as wdt), also known as designation, heritage status, legal protection, listed status, listing, etc.: is subproperty of instance of / is subproperty of has part / is subproperty of has part(s) / heritage designation of a cultural or natural site / the heritage status of a historical site / the heritage status of a historical site
- image (wd:P18 as wdt), also known as camera picture, Commons image, drawing, File:, graph, etc.: 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) / 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
- location (wd:P276 as wdt), also known as based in, city, from, held by, in, etc.: location of the item, physical object or event is within. In ... use P131. In case of a distinct terrain feature use P706. / location of the item, physical object or event is within. In ... use P131. In case of a distinct terrain feature use P706. / location of the object, structure or event. In the case of an ... use P706. Use P7153 for locations associated with the object
- subclass of (wd:P279 as wdt), also known as all members of this class also belong to, category of, form of, has superclass, is a class of, etc.: this item is a subclass (subset) of that item; ALL instances ... of volcanic landform); Everest is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain
- instance of (wd:P31 as wdt), also known as example of, has type, is a, is an, is of type, etc.: that class of which this subject is a particular example and ... a subclass of mountain (and an instance of volcanic landform) / type to which this subject corresponds/belongs. Different ... and the volcano is a type (instance) of volcanic landform
- commemorates (wd:P547 as wdt), also known as anniversary of, birthday of, celebrates, commemorandum, honors, etc.: is subproperty of main subject / what the place, monument, memorial, holiday, commemorates / what the place, monument, memorial, or holiday, commemorates / what the place, monument, memorial, or holiday, commemorates
- 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
- coordinate location (wd:P625 as wdt), also known as co-ordinate location, co-ordinates, coordinates, co-ords, coords, etc.: coordinates of the subject / coordinates of the subject / geocoordinates of the subject. For Earth, please note that only WGS84 coordinating system is supported at the moment

Execution result:
Got 6,378 rows and 7 columns, showing the first 5 and last 5 rows below:
| item                                                          | itemLabel                                                | inception                           | commemorates | commemoratesLabel | image                                                                                | coord                                       |
| ------------------------------------------------------------- | -------------------------------------------------------- | ----------------------------------- | ------------ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------- |
| Stolperstein dedicated to Hans Korn (wd:Q102117141)           | Stolperstein dedicated to Hans Korn (lang:en)            |                                     |              |                   | <http://commons.wikimedia.org/wiki/Special:FilePath/Hans%20Korn.jpg>                                                                                | POINT(24.946700 60.160000) (geo:wktLiteral) |
| Aino Acktén huvila (wd:Q10403832)                             | Aino Acktén huvila (lang:en)                             | 1877-01-01T00:00:00Z (xsd:dateTime) |              |                   | <http://commons.wikimedia.org/wiki/Special:FilePath/Aino%20Ackt%C3%A9n%20huvila%20%28Villa%20Aino%20Ackt%C3%A9%2C%20Aino%20Ackt%C3%A9s%20villa%29.%2002.jpg> | POINT(25.034100 60.180900) (geo:wktLiteral) |
| Kallio Library (wd:Q10428420)                                 | Kallio Library (lang:en)                                 | 1912-01-01T00:00:00Z (xsd:dateTime) |              |                   | <http://commons.wikimedia.org/wiki/Special:FilePath/Kallion%20kirjasto%202008.jpg>                                                                           | POINT(24.953639 60.183611) (geo:wktLiteral) |
| Helsinki Central Railway Station (wd:Q1044613)                | Helsinki Central Railway Station (lang:en)               | 1909-01-01T00:00:00Z (xsd:dateTime) |              |                   | <http://commons.wikimedia.org/wiki/Special:FilePath/Helsinki%20Central%20railway%20station%20in%20Finland%2C%202021%20July.jpg>                              | POINT(24.941449 60.171048) (geo:wktLiteral) |
| Kannelmäki Church (wd:Q10502496)                              | Kannelmäki Church (lang:en)                              | 1968-01-01T00:00:00Z (xsd:dateTime) |              |                   | <http://commons.wikimedia.org/wiki/Special:FilePath/Helsinki-Kannelm%C3%A4en%20kirkko1m.jpg>                                                                 | POINT(24.882977 60.244034) (geo:wktLiteral) |
| ...                                                           | ...                                                      | ...                                 | ...          | ...               | ...                                                                                | ...                                         |
| Äestäjäntie 2 (wd:Q98433832)                                  | Äestäjäntie 2 (lang:en)                                  | 1933-01-01T00:00:00Z (xsd:dateTime) |              |                   |                                                                                | POINT(24.844168 60.231564) (geo:wktLiteral) |
| Ähtärintie 4 (wd:Q98433833)                                   | Ähtärintie 4 (lang:en)                                   | 1920-01-01T00:00:00Z (xsd:dateTime) |              |                   |                                                                                | POINT(24.960155 60.193686) (geo:wktLiteral) |
| Ähtärintie 6 (wd:Q98433834)                                   | Ähtärintie 6 (lang:en)                                   |                                     |              |                   |                                                                                | POINT(24.960357 60.193781) (geo:wktLiteral) |
| Huopalahti railway station outbuilding (35018) (wd:Q99474345) | Huopalahti railway station outbuilding (35018) (lang:en) |                                     |              |                   |                                                                                | POINT(24.894484 60.217345) (geo:wktLiteral) |
| Salmisaarenranta 7 (4451) (wd:Q99676068)                      | Salmisaarenranta 7 (4451) (lang:en)                      |                                     |              |                   |                                                                                | POINT(24.901584 60.164128) (geo:wktLiteral) |

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

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

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

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

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

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

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

[User] What are the cultural heritage items located in Helsinki? Please provide their year of creation (if available), commemorated entities (if available), images (if available), and coordinates (if available), and order by item ID.

[Assistant]
Plan:
1. Find relevant Wikidata classes/properties for "cultural heritage items" — likely instance-of values like heritage monument, cultural heritage, or protected site — and property for location in Helsinki (wd:Q1768).
2. Confirm Helsinki entity QID.
3. Build a SPARQL query to retrieve items that are cultural heritage items located in Helsinki (using wdt:P131* or wdt:P276/wdt:P495? Usually location uses wdt:P276 (location), wdt:P131 (located in administrative territorial entity), or instance of heritage monument classes). Also include qualifiers: year of creation (P571 date of inception? P1619? or "inception" P571), commemorates (P547? Wait that's "commemorates" property P547), image (P18), coordinates (P625). Commemorated entity property: P547 is "commemorates". Year of creation: inception P571; creation date might also be P571. We'll search for properties: "inception", "commemorates", "image", "coordinate location".
4. Iteratively test with searches and then construct final SPARQL ordering by item ID.

I'll first search for the entity Helsinki and likely classes for cultural heritage. I'll verify property IDs: inception (P571), commemorates (P547), image (P18), coordinate location (P625), located in the administrative territorial entity is P131. I'll search for a likely class like "cultural heritage monument" or "cultural heritage site".

Question: Helsinki

Top 10 entity alternatives:
1. Helsinki (wd:Q1757), also known as Helsingfors, Helsingia, Helsingin kaupunki, Hesa, Stadi: capital and most populous city of Finland / capital and most populous city of Finland / is instance of municipality of Finland
2. Helsinki (wd:Q3736245), also known as Helsingfors valkrets, Helsingin kaupungin vaalipiiri, Helsingin vaalipiiri, Helsinki constituency, Helsinki (electoral district): is instance of electoral district of Finland / electoral district of Finland
3. Helsinki (wd:Q10520602): 1980 Helsinki-class missile boat / is instance of missile boat
4. Helsinki (wd:Q94699533), also known as Helsinginkylä, Helsinginranta, Helsinki (Taivassalo): village in Taivassalo, Finland / is instance of village
5. .helsinki (wd:Q24033265): is instance of top-level domain / top-level domain
6. Helsinki (wd:Q23041158): is instance of album / album by Häiriköt
7. TC Grace (wd:Q83585758, matched via Helsinki), also known as Helsinki, IMO 9130236, T. C. Grace, T.C. Grace: is instance of general cargo ship / general cargo ship built in 1997
8. Helsinki (wd:Q97375355): album by Daria Zawiałow / is instance of album
9. Helsinki (wd:Q133249494): is instance of board game / board game
10. Helsinki (wd:Q125243336): 2015 edition of written work by Jesús García Marín / is instance of version, edition or translation

[Assistant]
I'll verify the properties I plan to use: "inception" (creation year), "commemorates", "image", and "coordinate location". I'll search for these properties to confirm their P numbers.

Question: inception

Top 10 property alternatives:
1. inception (wd:P571 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), 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
2. production company (wd:P272 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via movie studio), also known as ballet company, broadcasting company, film studio, motion picture studio, movie studio, etc.: company that produced this film, audio or performing arts work / company that produced this film, audio or performing arts work
3. of (wd:P642 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via in), also known as applies to, for, in, in scope of, in the scope of, etc.: (This property is being deprecated, see details at WD:P642) ... a statement applies within the scope of a particular item / (This property is being deprecated, see details at WD:P642) ... a statement applies within the scope of a particular item / (This property is being deprecated, see details at WD:P642) ... a statement applies within the scope of a particular item / (being deprecated, find alternatives at WD:P642) qualifier ... a statement applies within the scope of a particular item
4. location (wd:P276 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via in), also known as based in, city, from, held by, in, etc.: location of the object, structure or event. In the case of an ... use P706. Use P7153 for locations associated with the object / location of the item, physical object or event is within. In ... use P131. In case of a distinct terrain feature use P706. / location of the item, physical object or event is within. In ... use P131. In case of a distinct terrain feature use P706.
5. part of (wd:P361 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via in), also known as assembly of, branch of, chain, collateral branch of, component of, etc.: object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670)) / object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670)) / object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670)) / object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670))
6. located in the administrative territorial entity (wd:P131 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via in), also known as administrative territorial entity, administrative territory, city, happens in, in, etc.: the item is located on the territory of the following ... the item falls only partially into the administrative entity. / the item is located on the territory of the following ... the item falls only partially into the administrative entity. / the item is located on the territory of the following administrative entity / the item is located on the territory of the following administrative entity / is subproperty of location / is subproperty of part of
7. last entry (wd:P10818 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via last entrance), also known as last admission, last entrance, P10818: time after which an establishment or attraction no longer admits entry, qualifier for P3025 (for closing time, use P8627)
8. International Nuclear Event Scale (wd:P2127 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via INES), also known as INES, P2127: international scale for rating nuclear events and accidents
9. first flight (wd:P606 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via first launch), also known as 1st flight, date of the first flight, FF, first launch, maiden flight, etc.: date or point in time on which aircraft, rocket, or airline first flew / is subproperty of significant event
10. derivative work (wd:P4969 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via incarnation), 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

[Assistant]
I'll search for the "commemorates" property and confirm image and coordinates properties as well. Then I'll look for classes used for cultural heritage items (e.g., heritage monument/site) so I can find items in Helsinki that are cultural heritage. I will also confirm Helsinki's QID (from earlier search I suspect wd:Q1757).

Question: commemorates

Top 10 property alternatives:
1. commemorates (wd:P547 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as anniversary of, birthday of, celebrates, commemorandum, honors, etc.: what the place, monument, memorial, or holiday, commemorates / what the place, monument, memorial, or holiday, commemorates / what the place, monument, memorial, holiday, commemorates / is subproperty of main subject
2. significant event (wd:P793 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via notable event), also known as big event, event, fate, important event, key event, etc.: significant or notable events associated with the subject / significant or notable events associated with the subject / significant or notable events associated with the subject
3. Monuments de mémoire ID (wd:P8820 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as monumentsdememoire.fr ID, P8820: identifier for a French war memorial on the Monuments de mémoire website
4. National September 11 Memorial ID (wd:P7795 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as P7795: identifier of person killed in the attacks of September 11, 2001 and February 26, 1993.
5. named after (wd:P138 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via named in honor of), also known as eponym, etymology, name after, named for, named in honor of, etc.: entity or event that inspired the subject's name, or namesake ... "applies to name" (P5168) can be used to indicate which one / person or other entity that inspired this item's name / person or other entity that inspired this item's name
6. symbol of (wd:P8058 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via emblem of), also known as emblem of, flag of, logo of, seal of, symbolises, etc.: item of which the image is a symbol
7. date of burial or cremation (wd:P4602 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via cremation date), also known as burial date, cremation date, date of cremation, funeral date, P4602: date on which the person was buried or cremated soon after death / is subproperty of point in time
8. posthumous name (wd:P1786 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via Honor Death), also known as Honor Death, P1786: name given to a person after death (East Asia)
9. inception (wd:P571 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via dedication date), 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
10. dedicated to (wd:P825 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as dedicatee, dedication, tribute to, P825: person or organisation to whom the subject was dedicated / person or organization to whom the subject was dedicated

[Assistant]
Next I'll search for candidate class items for "cultural heritage" such as "cultural heritage monument", "heritage site", "listed building", "protected site", etc., to decide which instance-of values to include. I'll search for "cultural heritage", "heritage site", and "monument".

Question: cultural heritage monument

Top 10 entity alternatives:
1. architectural heritage monument (wd:Q811165, matched via cultural heritage monument), also known as architectural monument, built heritage, cultural heritage monument: type of cultural heritage monuments (buildings) / type of cultural heritage monuments (buildings) / is subclass of architectural landmark / is subclass of cultural heritage / is subclass of cultural property
2. Bien de Interés Cultural (wd:Q23712, matched via Cultural Heritage Monument (BIC)), also known as B.I.C., BIC, Bien de Interes Cultural, Cultural Heritage Monument (BIC), Good of cultural interest, etc.: is subclass of patrimonio histórico español / Spanish heritage good of cultural interest / is subclass of national heritage site / is instance of historic preservation / is instance of classification scheme / is instance of heritage designation / is subclass of cultural property / is instance of classification / is subclass of heritage site / cultural property of Spain
3. Allerheiligenkirche (wd:Q15729834, matched via cultural heritage monument D-6-72-140-12), also known as Allerheiligenkirche Ebenhausen, cultural heritage monument D-6-72-140-12, Pfarrkirche Ebenhausen: church building in Ebenhausen,  Oerlenbach, Bavaria, Germany / is instance of church building / is instance of church
4. cultural heritage monument D-1-62-000-8499 (wd:Q109462983): cultural heritage monument in Munich, Bavaria / is instance of Parish church / is instance of parish church
5. Heidenhügel (wd:Q41297686, matched via cultural heritage monument D-5-71-135-39), also known as cultural heritage monument D-5-71-135-39: cultural heritage monument north-west of Münchzell (Dietenhofen), Middle Franconia, Germany / is instance of heritage site / is instance of monument
6. Estonian National Registry of Cultural Monuments (wd:Q3743725, matched via cultural heritage monument in Estonia), also known as cultural heritage monument in Estonia, Estonian cultural monuments registry, Kultuurimälestis: is instance of government database / is instance of heritage register / Estonian heritage register
7. cultural heritage monument in Germany (wd:Q11691318), also known as German site of cultural heritage, heritage site in Germany, Kulturdenkmal: official term for a site of cultural heritage in Germany / is subclass of architectural heritage monument / is instance of aspect in a geographic region / is subclass of national heritage site / is subclass of cultural property
8. cultural heritage monument of Curaçao (wd:Q40166150): site of cultural significance in Curaçao / is instance of heritage designation / is subclass of cultural heritage / is subclass of heritage site
9. Cultural heritage monument in South Tyrol (wd:Q18946666, matched via South Tyrolean cultural heritage monument), also known as South Tyrolean cultural heritage monument: protected cultural heritage monument in South Tyrol / is instance of aspect in a geographic region / is subclass of subnational heritage site
10. Stable, Vysichka (cultural heritage monument) (wd:Q122282617): is instance of monument

[Assistant]
I'll search for "heritage site" and "monument" to collect relevant classes to include in the query (so we don't miss items labelled in different ways).

Question: heritage site

Top 10 entity alternatives:
1. heritage site (wd:Q358), also known as cultural monument, heritage place, heritage property, historic monument, immovable heritage, etc.: general term for a site of cultural heritage for a specific ... value except for large sites containing multiple entities) / general term for a site of cultural heritage for a specific country / is subclass of human-geographic territorial entity / is subclass of cultural property / is subclass of cultural heritage
2. immovable monument in Poland (wd:Q29940414, matched via heritage site), also known as heritage site, historic landmark: immovable object on the Polish cultural heritage register / is subclass of cultural property protection in Poland / is subclass of national heritage site / is instance of heritage designation / is instance of geographical feature / is instance of geographical object
3. World Heritage Site (wd:Q9259), also known as Patrimonio de la Humanidad, United Nations Educational, Scientific and Cultural Organization (UNESCO) World Heritage Site, WHS, World Heritage List Site, World heritage site: place listed by the UNESCO as of special cultural or physical significance / is instance of conservation designation / place of significance listed by UNESCO / place of significance listed by UNESCO / is instance of heritage designation / is subclass of cultural heritage / is subclass of natural heritage / is subclass of Natural heritage
4. Rijksmonument (wd:Q916333, matched via national heritage site), also known as national heritage site: national heritage site of the Netherlands / is instance of heritage register / is subclass of heritage site
5. Old Montreal (wd:Q1529351, matched via Montreal Heritage Site), also known as arrondissement historique de Montreal, arrondissement historique de Montréal, Historic Arrondissement of Montreal, Historic Borough of Montreal, Montreal Heritage Site, etc.: historic city centre in Montreal, Quebec, Canada / is instance of sociological neighborhood / is instance of historic center / is instance of old town / is instance of quarter
6. industrial heritage site (wd:Q1569871): industrial plant, which can stand as a monument to monument preservation and heritage conservation law / is subclass of cultural environment / is subclass of historic site
7. Bhangarh (wd:Q861921, matched via Bhangarh heritage site), also known as ancient site of Bhangarh, Bhangarh heritage site: historical village and archaeological site (fort complex) in Rajasthan, India / is instance of archaeological site / is instance of former settlement / is instance of village in India
8. Jelling Heritage Site (wd:Q4993586), also known as Jelling monuments: Jelling Mounds, Runic Stones and Church / is instance of archaeological site
9. national heritage site (wd:Q45580643): cultural heritage site of national significance / is subclass of physical location / is subclass of heritage site / is subclass of location
10. Palatki Heritage Site (wd:Q4342465): archaeological site in Coconino County, Arizona

[Assistant]
I'll search for a property used to indicate heritage designation or listing (e.g., national register ID) to better capture cultural heritage items. Then I'll assemble the SPARQL pattern: select items that are instance of heritage site classes OR items that have a heritage designation property, and that are located in Helsinki (wd:Q1757) via P131 (located in the administrative territorial entity) or with P276 location within Helsinki. I'll include optional retrieval of inception (P571), commemorates (P547), image (P18), and coordinates (P625). Finally, I'll order by item ID as requested. Now I'll search for properties mentioning "heritage", "listed", or "designation".

Question: heritage designation

Top 10 property alternatives:
1. heritage designation (wd:P1435 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as designation, heritage status, legal protection, listed status, listing, etc.: heritage designation of a cultural or natural site / the heritage status of a historical site / the heritage status of a historical site / is subproperty of instance of / is subproperty of has part(s) / is subproperty of has part
2. dedicated heritage entity (wd:P8786 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as associated heritage entity, has museum, P8786: heritage entity dedicated to or associated with the item's subject
3. Heritage NL ID (wd:P933 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via heritagefoundation.ca ID), also known as heritagefoundation.ca ID, Heritage Foundation of Newfoundland and Labrador heritage property ID ID, Heritage Foundation of Newfoundland & Labrador heritage property ID, P933: identifier of Heritage Foundation of Newfoundland and Labrador heritage property
4. Cultural Heritage Online (Japan) heritage ID (wd:P12144 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as P12144: identifier for heritage assets on Cultural Heritage Online
5. intangible cultural heritage status (wd:P3259 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as P3259: status of an item that is designated as intangible heritage / status of an item that is designated as intangible heritage
6. Argentinian Historic Heritage ID (wd:P4587 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via Comisión Nacional de Monumentos, de Lugares y de Bienes Históricos ID), also known as Comisión Nacional de Monumentos, de Lugares y de Bienes Históricos ID, P4587: identifier for historic heritage object included in the national index of Argentina
7. military designation (wd:P798 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via designation), also known as 1962 US military aerospace vehicle designation, designation, MAD, mdsd, mildes, etc.: officially assigned designation for a vehicle in military service
8. UNESCO ICH ID (wd:P10221 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via UNESCO Intangible Cultural Heritage identifier), also known as List of Intangible Cultural Heritage in Need of Urgent Safeguarding ID, List of Intangible Cultural Heritage in Need of Urgent Safeguarding identifier, Register of Good Safeguarding Practices ID, Register of Good Safeguarding Practices identifier, Representative List of the Intangible Cultural Heritage of Humanity ID, etc.: identifier of an item on the UNESCO Intangible Cultural Heritage Lists
9. World Heritage criteria (wd:P2614 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as WHS criteria, P2614: selection criteria for UNESCO's cultural and natural 'World Heritage' designation since 2005
10. provisional designation (wd:P490 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as P490: designation of an astronomical body after its discovery and before its official name / designation of an astronomical body after its discovery and before its official name

[Assistant]
I'll run a SPARQL query that:
- finds items located in Helsinki (wd:Q1757) via wdt:P131* (administrative containment) or wdt:P276 (location),
- filters items to those that are instances (P31) of (or subclasses of) "heritage site" (wd:Q358) OR that have a heritage designation (P1435),
- retrieves optional inception (P571), commemorates (P547), image (P18), coordinates (P625), and English labels,
- orders results by item IRI (item ID).

I'll execute the query now to check results.

execute

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

SELECT DISTINCT ?item ?itemLabel ?inception ?commemorates ?commemoratesLabel ?image ?coord WHERE {
  VALUES ?helsinki { wd:Q1757 }
  {
    ?item wdt:P131* ?helsinki .
  } UNION {
    ?item wdt:P276 ?helsinki .
  }

  FILTER (
    EXISTS { ?item wdt:P31/wdt:P279* wd:Q358 } ||
    EXISTS { ?item wdt:P1435 ?anyDesig }
  )

  OPTIONAL { ?item wdt:P571 ?inception. }
  OPTIONAL { ?item wdt:P547 ?commemorates.
             ?commemorates rdfs:label ?commemoratesLabel . FILTER(LANG(?commemoratesLabel) = "en") }
  OPTIONAL { ?item wdt:P18 ?image. }
  OPTIONAL { ?item wdt:P625 ?coord. }
  OPTIONAL { ?item rdfs:label ?itemLabel . FILTER(LANG(?itemLabel) = "en") }
}
ORDER BY ?item

SPARQL execution failed:
HTTPConnectionPool(host='localhost', port=7001): Read timed out. (read timeout=30)

[Assistant]
The query timed out when contacting the Wikidata endpoint. I'll retry the same query (adding no limits) to attempt again. If it times out again, I'll try a smaller query (e.g., with a LIMIT) to ensure we can retrieve results and then refine. Now retrying.

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 DISTINCT ?item ?itemLabel ?inception ?commemorates ?commemoratesLabel ?image ?coord WHERE {
  VALUES ?helsinki { wd:Q1757 }
  {
    ?item wdt:P131* ?helsinki .
  } UNION {
    ?item wdt:P276 ?helsinki .
  }

  FILTER (
    EXISTS { ?item wdt:P31/wdt:P279* wd:Q358 } ||
    EXISTS { ?item wdt:P1435 ?anyDesig }
  )

  OPTIONAL { ?item wdt:P571 ?inception. }
  OPTIONAL { ?item wdt:P547 ?commemorates.
             ?commemorates rdfs:label ?commemoratesLabel . FILTER(LANG(?commemoratesLabel) = "en") }
  OPTIONAL { ?item wdt:P18 ?image. }
  OPTIONAL { ?item wdt:P625 ?coord. }
  OPTIONAL { ?item rdfs:label ?itemLabel . FILTER(LANG(?itemLabel) = "en") }
}
ORDER BY ?item

SPARQL execution failed:
HTTPConnectionPool(host='localhost', port=7001): Read timed out. (read timeout=30)

[Assistant]
The endpoint is timing out for the broader query using wdt:P131*. I'll simplify to use only direct location links (wdt:P131 = Helsinki) or direct location (wdt:P276 = Helsinki). This may miss some items whose P131 points to a smaller administrative unit inside Helsinki, but it will avoid the heavy wdt:P131* traversal and should return results reliably. I'll run the simplified query now.

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 DISTINCT ?item ?itemLabel ?inception ?commemorates ?commemoratesLabel ?image ?coord WHERE {
  VALUES ?helsinki { wd:Q1757 }
  {
    ?item wdt:P131 ?helsinki .
  } UNION {
    ?item wdt:P276 ?helsinki .
  }

  FILTER (
    EXISTS { ?item wdt:P31/wdt:P279* wd:Q358 } ||
    EXISTS { ?item wdt:P1435 ?anyDesig }
  )

  OPTIONAL { ?item wdt:P571 ?inception. }
  OPTIONAL { ?item wdt:P547 ?commemorates.
             ?commemorates rdfs:label ?commemoratesLabel . FILTER(LANG(?commemoratesLabel) = "en") }
  OPTIONAL { ?item wdt:P18 ?image. }
  OPTIONAL { ?item wdt:P625 ?coord. }
  OPTIONAL { ?item rdfs:label ?itemLabel . FILTER(LANG(?itemLabel) = "en") }
}
ORDER BY ?item

[Assistant]
answer

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

SELECT DISTINCT ?item ?itemLabel ?inception ?commemorates ?commemoratesLabel ?image ?coord WHERE {
  VALUES ?helsinki { wd:Q1757 }
  {
    ?item wdt:P131 ?helsinki .
  } UNION {
    ?item wdt:P276 ?helsinki .
  }

  FILTER (
    EXISTS { ?item wdt:P31/wdt:P279* wd:Q358 } ||
    EXISTS { ?item wdt:P1435 ?anyDesig }
  )

  OPTIONAL { ?item wdt:P571 ?inception. }
  OPTIONAL { ?item wdt:P547 ?commemorates.
             ?commemorates rdfs:label ?commemoratesLabel . FILTER(LANG(?commemoratesLabel) = "en") }
  OPTIONAL { ?item wdt:P18 ?image. }
  OPTIONAL { ?item wdt:P625 ?coord. }
  OPTIONAL { ?item rdfs:label ?itemLabel . FILTER(LANG(?itemLabel) = "en") }
}
ORDER BY ?item

Answer:
Results and notes

- I ran a SPARQL query that selects items located in Helsinki (wd:Q1757) by either direct "located in the administrative territorial entity" (wdt:P131) or direct "location" (wdt:P276), and that are either instances/subclasses of "heritage site" (wd:Q358) or have a heritage designation (wdt:P1435).
- For each item I requested: its IRI (?item), English label (?itemLabel), inception (P571), commemorates (P547) with an English label, image (P18), and coordinates (P625). Results are ordered by the item IRI as you requested.

What I found

- The query returned 6,378 rows (items). Columns returned are: item (IRI), itemLabel (en), inception (date/time if present), commemorates (IRI) + commemoratesLabel (en) if present, image (file path on Commons) if present, and coord (geometric POINT WKT) if present.
- Example items seen in the returned results (first rows from the query output):
  - wd:Q102117141 — "Stolperstein dedicated to Hans Korn" (coordinates and image available)
  - wd:Q10403832 — "Aino Acktén huvila" (inception 1877, coordinates, image available)
  - wd:Q10428420 — "Kallio Library" (inception 1912, coordinates, image available)
  - wd:Q1044613 — "Helsinki Central Railway Station" (inception 1909, coordinates, image available)

Limitations and notes

- To avoid timeouts I used direct location links (?item wdt:P131 wd:Q1757 and ?item wdt:P276 wd:Q1757). That retrieves items that state Helsinki itself as their direct administrative location or direct location. There are additional heritage items that are located in administrative subdivisions inside Helsinki (their P131 points to a neighbourhood or district); those would be found by using wdt:P131* wd:Q1757 (traversing the admin hierarchy). The broader query with wdt:P131* may be more expensive and previously timed out on this endpoint; if you want an exhaustive run including P131* I can attempt it (it may take longer or require batching).
- Many items lack some optional values (inception, commemorates, image, or coordinates), so those cells are empty for those rows.

What I can do next

- Export the full 6,378-row result table in CSV/JSON for you.
- Re-run the query with wdt:P131* to be more exhaustive (may time out or take longer). I can run it with paging/limits to collect results in batches.
- Filter the results further (e.g., only items with P1435 = a specific national register, or only items with images, or only items of a specific subclass like "architectural heritage monument").

If you want the full result table exported (CSV/JSON) or want me to re-run the broader wdt:P131* version to include sub-admin items, tell me which you prefer and I will proceed.


PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?person ?personLabel WHERE {
  ?person wdt:P31 wd:Q5 ; wdt:P106 wd:Q10833314 ; wdt:P27 wd:Q31 .
  FILTER NOT EXISTS {
    ?person wdt:P27 ?otherCit .
    FILTER ( ?otherCit != wd:Q31 )
  }
  OPTIONAL {
    ?person rdfs:label ?personLabel .
    FILTER ( LANG( ?personLabel ) = "en" )
  }
}
ORDER BY ?personLabel

Using entities:
- tennis player (wd:Q10833314): is instance of profession / is subclass of competitive player / is subclass of athlete / is subclass of sportsperson / sportsperson who plays tennis
- Belgium (wd:Q31), also known as 🇧🇪, be, BE, BEL, Kingdom of Belgium: is instance of country / is instance of federation / is instance of sovereign state / constitutional monarchy in Western Europe / country in Europe / country in western Europe / country in western Europe
- human (wd:Q5), also known as human being, humans, individual Homo sapiens, individual human, modern humans, etc.: is instance of class of organisms known by one particular common name / is instance of organisms known by a particular common name / is subclass of mammal / is subclass of natural person / is subclass of omnivore / is subclass of person / is subclass of individual animal / any member of Homo sapiens, unique extant species of the genus Homo / common name of Homo sapiens, unique extant species of the genus Homo / common name of Homo sapiens, unique extant species of the genus Homo / common name of Homo sapiens, unique extant species of the genus Homo, from embryo to adult

Using properties:
- occupation (wd:P106 as wdt), also known as avocation, career, craft, employ, employment, etc.: occupation of a person; see also "field of work" (Property:P101), "position held" (Property:P39) / occupation of a person; see also "field of work" (Property:P101), "position held" (Property:P39) / occupation of a person; see also "field of work" (Property:P101), "position held" (Property:P39)
- country of citizenship (wd:P27 as wdt), also known as citizen of, citizenship, country, (legal) nationality, nation, etc.: is subproperty of country / the object is a country that recognizes the subject as its citizen / the object is a country that recognizes the subject as its citizen
- instance of (wd:P31 as wdt), also known as example of, has type, is a, is an, is of type, etc.: that class of which this subject is a particular example and ... a subclass of mountain (and an instance of volcanic landform) / type to which this subject corresponds/belongs. Different ... and the volcano is a type (instance) of volcanic landform

Got 167 rows and 2 columns, showing the first 5 and last 5 rows below:
| person                            | personLabel                   |
| --------------------------------- | ----------------------------- |
| Alain Brichant (wd:Q55584629)     | Alain Brichant (lang:en)      |
| Albert Lammens (wd:Q16029210)     | Albert Lammens (lang:en)      |
| Alison Van Uytvanck (wd:Q1976217) | Alison Van Uytvanck (lang:en) |
| Amélie Van Impe (wd:Q113773739)   | Amélie Van Impe (lang:en)     |
| André Lacroix (wd:Q4759951)       | André Lacroix (lang:en)       |
| ...                               | ...                           |
| Yanina Wickmayer (wd:Q228983)     | Yanina Wickmayer (lang:en)    |
| Yannick Mertens (wd:Q3065798)     | Yannick Mertens (lang:en)     |
| Yannik Reuter (wd:Q16302324)      | Yannik Reuter (lang:en)       |
| Ysaline Bonaventure (wd:Q2511279) | Ysaline Bonaventure (lang:en) |
| Zizou Bergs (wd:Q100700157)       | Zizou Bergs (lang:en)         |

Answer: I ran the above SPARQL query on Wikidata. It returns 167 human items whose occupation includes "tennis player" and whose only country of citizenship recorded on Wikidata is Belgium (wd:Q31). Examples from the results include Alison Van Uytvanck (wd:Q1976217), Yanina Wickmayer (wd:Q228983), Zizou Bergs (wd:Q100700157), Ysaline Bonaventure (wd:Q2511279), and Yannick Mertens (wd:Q3065798). The full set of matching items (with their Wikidata IRIs) is returned by the query above.

I ran the above SPARQL query on Wikidata. It returns 167 human items whose occupation includes "tennis player" and whose only country of citizenship recorded on Wikidata is Belgium (wd:Q31). Examples from the results include Alison Van Uytvanck (wd:Q1976217), Yanina Wickmayer (wd:Q228983), Zizou Bergs (wd:Q100700157), Ysaline Bonaventure (wd:Q2511279), and Yannick Mertens (wd:Q3065798). The full set of matching items (with their Wikidata IRIs) is returned by the query above.

SPARQL query over wikidata:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?person ?personLabel WHERE {
  ?person wdt:P31 wd:Q5 ; wdt:P106 wd:Q10833314 ; wdt:P27 wd:Q31 .
  FILTER NOT EXISTS {
    ?person wdt:P27 ?otherCit .
    FILTER ( ?otherCit != wd:Q31 )
  }
  OPTIONAL {
    ?person rdfs:label ?personLabel .
    FILTER ( LANG( ?personLabel ) = "en" )
  }
}
ORDER BY ?personLabel

Using entities:
- tennis player (wd:Q10833314): is instance of profession / is subclass of competitive player / is subclass of athlete / is subclass of sportsperson / sportsperson who plays tennis
- Belgium (wd:Q31), also known as 🇧🇪, be, BE, BEL, Kingdom of Belgium: is instance of country / is instance of federation / is instance of sovereign state / constitutional monarchy in Western Europe / country in Europe / country in western Europe / country in western Europe
- human (wd:Q5), also known as human being, humans, individual Homo sapiens, individual human, modern humans, etc.: is instance of class of organisms known by one particular common name / is instance of organisms known by a particular common name / is subclass of mammal / is subclass of natural person / is subclass of omnivore / is subclass of person / is subclass of individual animal / any member of Homo sapiens, unique extant species of the genus Homo / common name of Homo sapiens, unique extant species of the genus Homo / common name of Homo sapiens, unique extant species of the genus Homo / common name of Homo sapiens, unique extant species of the genus Homo, from embryo to adult

Using properties:
- occupation (wd:P106 as wdt), also known as avocation, career, craft, employ, employment, etc.: occupation of a person; see also "field of work" (Property:P101), "position held" (Property:P39) / occupation of a person; see also "field of work" (Property:P101), "position held" (Property:P39) / occupation of a person; see also "field of work" (Property:P101), "position held" (Property:P39)
- country of citizenship (wd:P27 as wdt), also known as citizen of, citizenship, country, (legal) nationality, nation, etc.: is subproperty of country / the object is a country that recognizes the subject as its citizen / the object is a country that recognizes the subject as its citizen
- instance of (wd:P31 as wdt), also known as example of, has type, is a, is an, is of type, etc.: that class of which this subject is a particular example and ... a subclass of mountain (and an instance of volcanic landform) / type to which this subject corresponds/belongs. Different ... and the volcano is a type (instance) of volcanic landform

Execution result:
Got 167 rows and 2 columns, showing the first 5 and last 5 rows below:
| person                            | personLabel                   |
| --------------------------------- | ----------------------------- |
| Alain Brichant (wd:Q55584629)     | Alain Brichant (lang:en)      |
| Albert Lammens (wd:Q16029210)     | Albert Lammens (lang:en)      |
| Alison Van Uytvanck (wd:Q1976217) | Alison Van Uytvanck (lang:en) |
| Amélie Van Impe (wd:Q113773739)   | Amélie Van Impe (lang:en)     |
| André Lacroix (wd:Q4759951)       | André Lacroix (lang:en)       |
| ...                               | ...                           |
| Yanina Wickmayer (wd:Q228983)     | Yanina Wickmayer (lang:en)    |
| Yannick Mertens (wd:Q3065798)     | Yannick Mertens (lang:en)     |
| Yannik Reuter (wd:Q16302324)      | Yannik Reuter (lang:en)       |
| Ysaline Bonaventure (wd:Q2511279) | Ysaline Bonaventure (lang:en) |
| Zizou Bergs (wd:Q100700157)       | Zizou Bergs (lang:en)         |

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

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

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

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

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

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

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

[User] Who are the tennis players that are citizens of only Belgium?

[Assistant]
Step 1: I'll search for the occupation item for "tennis player" to confirm the correct Wikidata Q-id for use in the query. I'll use search_object_of_property with property wdt:P106 and query "tennis".

Question: tennis player

Top 10 entity alternatives:
1. tennis player (wd:Q10833314): is subclass of competitive player / sportsperson who plays tennis / is subclass of sportsperson / is instance of profession / is subclass of athlete
2. table tennis player (wd:Q13382519), also known as ping-pong player, table tennis athlete: sportsperson taking part in table tennis competitions / sportsperson taking part in table tennis competitions / sportsperson taking part in table tennis competitions / is subclass of competitive player / is subclass of sportsperson / is instance of profession / is subclass of athlete
3. soft tennis player (wd:Q130482100): is subclass of tennis player / is instance of occupation
4. real tennis player (wd:Q26233091): is subclass of sportsperson / is instance of profession / is subclass of athlete / is subclass of player / player of real tennis
5. wheelchair tennis player (wd:Q18814798): sportsperson who plays wheelchair tennis / is subclass of tennis player / is subclass of para athlete / is instance of occupation
6. beach tennis player (wd:Q30525637): is subclass of tennis player / is instance of profession
7. professional tennis player (wd:Q48673045), also known as tennis pro: is subclass of tennis player / is instance of profession
8. football tennis player (wd:Q97610399), also known as futnet player: sportsperson who is active in football tennis (also known as futnet) / is subclass of sportsperson / is instance of profession / is subclass of athlete
9. para table tennis player (wd:Q124516127): sportsperson taking part in para table tennis competitions / sportsperson taking part in para table tennis competitions / is subclass of competitive player / is subclass of para athlete / is instance of profession
10. tennis (wd:Q847), also known as lawn tennis, lawntennis: racket sport played on a court bisected by a net / is instance of type of sport / is subclass of Olympic sport / is subclass of racket sport / is subclass of ball game / is instance of hobby

No other items found

No literal items found

[Assistant]
I'll run a SPARQL SELECT query that finds human items with occupation "tennis player" and with a country of citizenship statement equal to Belgium (wd:Q31), and excludes any person who has any other P27 value. I will request English labels for readability. Now I'll execute that query.

execute

SELECT ?person ?personLabel WHERE {
  ?person wdt:P31 wd:Q5;           # instance of human
          wdt:P106 wd:Q10833314;   # occupation: tennis player
          wdt:P27 wd:Q31.          # country of citizenship: Belgium
  # exclude anyone with any other citizenship value
  FILTER NOT EXISTS { ?person wdt:P27 ?otherCit . FILTER(?otherCit != wd:Q31) }
  OPTIONAL { ?person rdfs:label ?personLabel . FILTER(LANG(?personLabel) = "en") }
}
ORDER BY ?personLabel

Got 167 rows and 2 columns, showing the first 5 and last 5 rows below:
| person                            | personLabel                   |
| --------------------------------- | ----------------------------- |
| Alain Brichant (wd:Q55584629)     | Alain Brichant (lang:en)      |
| Albert Lammens (wd:Q16029210)     | Albert Lammens (lang:en)      |
| Alison Van Uytvanck (wd:Q1976217) | Alison Van Uytvanck (lang:en) |
| Amélie Van Impe (wd:Q113773739)   | Amélie Van Impe (lang:en)     |
| André Lacroix (wd:Q4759951)       | André Lacroix (lang:en)       |
| ...                               | ...                           |
| Yanina Wickmayer (wd:Q228983)     | Yanina Wickmayer (lang:en)    |
| Yannick Mertens (wd:Q3065798)     | Yannick Mertens (lang:en)     |
| Yannik Reuter (wd:Q16302324)      | Yannik Reuter (lang:en)       |
| Ysaline Bonaventure (wd:Q2511279) | Ysaline Bonaventure (lang:en) |
| Zizou Bergs (wd:Q100700157)       | Zizou Bergs (lang:en)         |

[Assistant]
After running the query I inspected the results: it returned 167 human items that have occupation "tennis player" and have country of citizenship only Belgium (no other P27 values). I'll finalize by providing the exact SPARQL query I ran and a short summary (including examples and the total count).

answer

SELECT ?person ?personLabel WHERE {
  ?person wdt:P31 wd:Q5;           # instance of human
          wdt:P106 wd:Q10833314;   # occupation: tennis player
          wdt:P27 wd:Q31.          # country of citizenship: Belgium
  # exclude anyone with any other citizenship value
  FILTER NOT EXISTS { ?person wdt:P27 ?otherCit . FILTER(?otherCit != wd:Q31) }
  OPTIONAL { ?person rdfs:label ?personLabel . FILTER(LANG(?personLabel) = "en") }
}
ORDER BY ?personLabel

Answer: I ran the above SPARQL query on Wikidata. It returns 167 human items whose occupation includes "tennis player" and whose only country of citizenship recorded on Wikidata is Belgium (wd:Q31). Examples from the results include Alison Van Uytvanck (wd:Q1976217), Yanina Wickmayer (wd:Q228983), Zizou Bergs (wd:Q100700157), Ysaline Bonaventure (wd:Q2511279), and Yannick Mertens (wd:Q3065798). The full set of matching items (with their Wikidata IRIs) is returned by the query above.