PREFIX fb: <http://rdf.freebase.com/ns/>
SELECT DISTINCT ?actor WHERE {
  fb:m.0gmm518 fb:film.film_character.portrayed_in_films ?performance .
  ?performance fb:film.performance.actor ?actor .
}

Johnny Depp (fb:m.0jfx1) plays Edward Scissorhands.

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

You have access to the following knowledge graphs:
freebase at https://qlever.cs.uni-freiburg.de/api/freebase

You can use the following SPARQL prefixes implicitly in all functions:
fb: <http://rdf.freebase.com/ns/
fbkey: <http://rdf.freebase.com/key/
rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs: <http://www.w3.org/2000/01/rdf-schema#
owl: <http://www.w3.org/2002/07/owl#
xsd: <http://www.w3.org/2001/XMLSchema#
foaf: <http://xmlns.com/foaf/0.1/
skos: <http://www.w3.org/2004/02/skos/core#
dct: <http://purl.org/dc/terms/
dc: <http://purl.org/dc/elements/1.1/
prov: <http://www.w3.org/ns/prov#
schema: <http://schema.org/
geo: <http://www.opengis.net/ont/geosparql#
geosparql: <http://www.opengis.net/ont/geosparql#
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
wikibase: <http://wikiba.se/ontology#
qb: <http://purl.org/linked-data/cube#
void: <http://rdfs.org/ns/void#

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. Use the functions to search for 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. Use the execute function to get feedback on intermediate queries. You can go back and forth between knowledge graph searches and SPARQL query executions to refine the query.
4. Use the answer or cancel function to finalize your answer and stop the generation process.

Additional rules:
1. Explain your thought process before and after each step and function call.
2. Do not assume or make up any entities or properties without verifying them with the knowledge graphs and functions.
3. 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.
4. 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.
5. 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.
6. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
7. 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.

[User] who plays edward scissorhands?

[Assistant] Let's start by looking at some similar examples.

[Tool]
Example 1:
Question:
who plays edward elric?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.074qkg ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.074qkg fb:tv.tv_character.appeared_in_tv_program ?y .
  ?y fb:tv.regular_tv_appearance.actor ?x .
}

Using entities:
Edward Elric (fb:m.074qkg): Edward Elric, commonly nicknamed Ed, is a fictional character an... moments have been celebrated as the best moments in the series., has type Film character

Using properties:
Actor (fb:tv.regular_tv_appearance.actor): part of TV Regular Performance schema, links to type TV Actor
Programs in which this was a regular character (fb:tv.tv_character.appeared_in_tv_program): links to type TV Regular Performance, part of TV Character schema

Example 2:
Question:
who plays edward elric?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.074qkg ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.074qkg fb:film.film_character.portrayed_in_films ?y .
  ?y fb:film.performance.actor ?x .
}

Using entities:
Edward Elric (fb:m.074qkg): Edward Elric, commonly nicknamed Ed, is a fictional character an... moments have been celebrated as the best moments in the series., has type Film character

Using properties:
Portrayed in films (fb:film.film_character.portrayed_in_films): links to type Film performance, part of Film character schema
Actor (fb:film.performance.actor): part of Film performance schema, links to type Film actor

Example 3:
Question:
who plays jacob black in the twilight movies?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.03nm_fh ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.03nm_fh fb:film.film.starring ?y .
  ?y fb:film.performance.actor ?x .
  ?y fb:film.performance.character fb:m.02qd_td .
}

Using entities:
Jacob Black, also known as Jake (fb:m.02qd_td): Jacob Black is a character in the Twilight series by Stephenie M...t 1 and Breaking Dawn Part 2, Jacob is played by Taylor Lautner., has type Film character
Twilight, also known as Twilight - La fascination, Twilight - Biss zum Morgengrau, Twilight: Chapitre 1 - Fascination, Twilight, chapitre I : Fascination, Twilight - Evighetens kyss (fb:m.03nm_fh): Twilight is a 2008 American vampire romance film based on Stephe...VD March 21, 2009 and became the most purchased DVD of the year., has type Film

Using properties:
Performances (fb:film.film.starring): links to type Film performance, part of Film schema
Actor (fb:film.performance.actor): part of Film performance schema, links to type Film actor
Character (fb:film.performance.character): part of Film performance schema, links to type Film character

[Assistant]
From the similar examples, the approach is to:

1. Identify the entity for "Edward Scissorhands" (the character).
2. Use the property fb:film.film_character.portrayed_in_films to find performances.
3. From those performances, use fb:film.performance.actor to get the actor.

Let's search for "Edward Scissorhands" in Freebase to get its entity ID.

[Tool]
Top 10 entity alternatives:
1. Edward Scissorhands, also known as Edward Skaroruki, El joven manos de tijera, El joven manos de tijeras, Johnny Depp: O psalidoheris, Makas eller (fb:m.01s3vk): Edward Scissorhands is a 1990 American romantic dark fantasy fil...the Tampa Bay Area of Florida between March 10 and June 10 1990., has type Award-Winning Work
2. Edward Scissorhands: Introduction (Titles), also known as Introduction (Titles), Introduction, Edward Scissorhands: Main Titles, Edward Scissorhands (main title), Edward Scissorhands: Introduction (Titles) (fb:m.0m4qjl): has type Musical Recording, has type Canonical Version
3. Edward Scissorhands (fb:m.03fr14q): has type Consumer product
4. Edward Scissorhands (fb:m.0dszf1q): has type Consumer product
5. Edward Scissorhands (fb:m.0f6rqzl): has type Consumer product
6. Edward Scissorhands (fb:m.0gmm518): Edward Scissorhands is a fictional character from the 2012 TV series  Family Guy episode Lois Comes Out of Her Shell., Edward Scissorhands is a fictional character from the 1990 film Edward Scissorhands., has type Film character
7. Edward Scissorhands (fb:m.0f4l78x): has type Musical Release
8. Edward Scissorhands (fb:m.036767g): has type Musical Release
9. Edward Scissorhands, also known as Main Title/Ice Dance, Edward Scissorhands: Main Title, Edward Scissorhands: Main Title / Ice Dance, Edward Scissorhands: Main Theme, Edward Scissorhands (Main Title/Ice Dance) (fb:m.0f15kzy): has type Musical Recording
10. Edward Scissorhands, also known as Edward Scissorhands Soundtrack (fb:m.01gydxd): has type Soundtrack

[Assistant]
There are two relevant entities:
- fb:m.01s3vk: Edward Scissorhands (the film)
- fb:m.0gmm518: Edward Scissorhands (the character from the 1990 film)

Since we want the actor who played the character, we should use the character entity (fb:m.0gmm518).

Now, let's check what properties are available for this character, especially those related to film performances.

[Tool]
Got 64 rows and 3 columns, showing the first 10 rows below:
| subject                            | property                                                             | object                                                                   |
| ---------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| Edward Scissorhands (fb:m.0gmm518) | Type (fb:type.object.type)                                           | Topic (fb:common.topic)                                                  |
| Edward Scissorhands (fb:m.0gmm518) | Name (fb:type.object.name)                                           | Edvardas Žirkliarankis (lt)                                              |
| Edward Scissorhands (fb:m.0gmm518) | Notable for (fb:common.topic.notable_for)                            | fb:g.1255nbrqm                                                           |
| Edward Scissorhands (fb:m.0gmm518) | Notable types (fb:common.topic.notable_types)                        | Film character (fb:m.02nsjl9)                                            |
| Edward Scissorhands (fb:m.0gmm518) | Description (fb:common.topic.description)                            | Edward Scissorhands is a fiction...e 1990 film Edward Scissorhands. (en) |
| Edward Scissorhands (fb:m.0gmm518) | Also known as (fb:common.topic.alias)                                | Edvard Škaroruki (hr)                                                    |
| Edward Scissorhands (fb:m.0gmm518) | Portrayed in films (fb:film.film_character.portrayed_in_films)       | fb:m.0jxqvs                                                              |
| Edward Scissorhands (fb:m.0gmm518) | Appeared In TV Episodes (fb:tv.tv_character.appeared_in_tv_episodes) | fb:m.0y4s46f                                                             |
| Edward Scissorhands (fb:m.0gmm518) | Gender (fb:fictional_universe.fictional_character.gender)            | Male (fb:m.05zppz)                                                       |
| Edward Scissorhands (fb:m.0gmm518) | rdf:type                                                             | Topic (fb:common.topic)                                                  |
| ...                                | ...                                                                  | ...                                                                      |

[Tool]
Got 1 row and 3 columns:
| subject                            | property                                                       | object      |
| ---------------------------------- | -------------------------------------------------------------- | ----------- |
| Edward Scissorhands (fb:m.0gmm518) | Portrayed in films (fb:film.film_character.portrayed_in_films) | fb:m.0jxqvs |

[Tool]
Got 5 rows and 3 columns:
| subject     | property                                  | object                                 |
| ----------- | ----------------------------------------- | -------------------------------------- |
| fb:m.0jxqvs | Type (fb:type.object.type)                | Film performance (fb:film.performance) |
| fb:m.0jxqvs | Actor (fb:film.performance.actor)         | Johnny Depp (fb:m.0jfx1)               |
| fb:m.0jxqvs | Film (fb:film.performance.film)           | Edward Scissorhands (fb:m.01s3vk)      |
| fb:m.0jxqvs | Character (fb:film.performance.character) | Edward Scissorhands (fb:m.0gmm518)     |
| fb:m.0jxqvs | rdf:type                                  | Film performance (fb:film.performance) |

[Tool]
Got 1,595 rows and 3 columns, showing the first 10 rows below:
| subject                  | property                                                            | object                                                                   |
| ------------------------ | ------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| Johnny Depp (fb:m.0jfx1) | Type (fb:type.object.type)                                          | Topic (fb:common.topic)                                                  |
| Johnny Depp (fb:m.0jfx1) | Key (fb:type.object.key)                                            | /authority/daylife/topic/0fP6eUcf0j0gE                                   |
| Johnny Depp (fb:m.0jfx1) | Name (fb:type.object.name)                                          | Džonijs Deps (lv)                                                        |
| Johnny Depp (fb:m.0jfx1) | Topic equivalent webpage (fb:common.topic.topic_equivalent_webpage) | <http://ar.wikipedia.org/wiki/%2C%48%46%4A_%2F%4A%28>                    |
| Johnny Depp (fb:m.0jfx1) | Notable for (fb:common.topic.notable_for)                           | fb:g.1256yvxzx                                                           |
| Johnny Depp (fb:m.0jfx1) | Notable types (fb:common.topic.notable_types)                       | Celebrity (fb:m.02_7frv)                                                 |
| Johnny Depp (fb:m.0jfx1) | Description (fb:common.topic.description)                           | Džons Kristofers "Džonijs" Deps ...dienasgrāmata", "Transcendence". (lv) |
| Johnny Depp (fb:m.0jfx1) | Recordings (fb:music.artist.track)                                  | Hello, Little Girl (fb:m.012mywvj)                                       |
| Johnny Depp (fb:m.0jfx1) | Article (fb:common.topic.article)                                   | fb:m.0jfxc                                                               |
| Johnny Depp (fb:m.0jfx1) | Also known as (fb:common.topic.alias)                               | Colonel (cs)                                                             |
| ...                      | ...                                                                 | ...                                                                      |

[Tool]
Got 1 row and 1 column:
| actor                    |
| ------------------------ |
| Johnny Depp (fb:m.0jfx1) |

[Tool]
Got 42 rows and 2 columns, showing the first 5 and last 5 rows below:
| actor                    | actorLabel         |
| ------------------------ | ------------------ |
| Johnny Depp (fb:m.0jfx1) | Džonijs Deps (lv)  |
| Johnny Depp (fb:m.0jfx1) | Džonis Depas (lt)  |
| Johnny Depp (fb:m.0jfx1) | Johnny Depp (ca)   |
| Johnny Depp (fb:m.0jfx1) | Johnny Depp (cs)   |
| Johnny Depp (fb:m.0jfx1) | Johnny Depp (da)   |
| ...                      | ...                |
| Johnny Depp (fb:m.0jfx1) | จอห์นนี เดปป์ (th) |
| Johnny Depp (fb:m.0jfx1) | 조니 뎁 (ko)          |
| Johnny Depp (fb:m.0jfx1) | ジョニー・デップ (ja)      |
| Johnny Depp (fb:m.0jfx1) | 強尼·戴普 (zh-Hant)    |
| Johnny Depp (fb:m.0jfx1) | 强尼·戴普 (zh)         |

[Tool] Stopped generation process


PREFIX fb: <http://rdf.freebase.com/ns/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?book ?book_label WHERE {
  fb:m.01lwx fb:book.author.works_written ?book .
  OPTIONAL {
    ?book rdfs:label ?book_label FILTER ( lang( ?book_label ) = 'en' )
  }
}

Got 153 rows and 2 columns, showing the first 5 and last 5 rows below:
| book                                                                               | book_label                                                               |
| ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| Charles Darwin's zoology notes & specimen lists from H.M.S. Beagle (fb:m.010rjsvs) | Charles Darwin's zoology notes & specimen lists from H.M.S. Beagle (en)  |
| Charles Darwin's letters (fb:m.010sfr1g)                                           | Charles Darwin's letters (en)                                            |
| The Voyage of the Beagle (fb:m.01qq45)                                             | The Voyage of the Beagle (en)                                            |
| The Descent of Man, and Selection in Relation to Sex (fb:m.02l2z6)                 | The Descent of Man, and Selection in Relation to Sex (en)                |
| The zoology of the voyage of H.M...eagle during the years 1832-1836 (fb:m.02pzzmw) | The zoology of the voyage of H.M...eagle during the years 1832-1836 (en) |
| ...                                                                                | ...                                                                      |
| A Monograph on the Fossil Balanidæ and Verrucidæ of Great Britain (fb:m.0y4rxbs)   | A Monograph on the Fossil Balanidæ and Verrucidæ of Great Britain (en)   |
| A Monograph of the Sub-class Cir...irripedes); the Verrucidae, etc. (fb:m.0y4rydg) | A Monograph of the Sub-class Cir...irripedes); the Verrucidae, etc. (en) |
| A Monograph on the Fossil Lepadi...ated Cirripedes of Great Britain (fb:m.0y4ryn4) | A Monograph on the Fossil Lepadi...ated Cirripedes of Great Britain (en) |
| A Monograph of the Sub-class Cir...ae; or, Pedunculated Cirripedes. (fb:m.0y4ryvd) | A Monograph of the Sub-class Cir...ae; or, Pedunculated Cirripedes. (en) |
| Geology from A Manual of scienti...dapted for travellers in general (fb:m.0y4rzcc) | Geology from A Manual of scienti...dapted for travellers in general (en) |

Charles Darwin wrote several books. Some of the titles include:
- Charles Darwin's zoology notes & specimen lists from H.M.S. Beagle
- Charles Darwin's letters
- The Voyage of the Beagle
- The Descent of Man, and Selection in Relation to Sex
- The zoology of the voyage of H.M.S. Beagle during the years 1832-1836

If you are looking for a specific title, 'On the Origin of Species' is his most famous work, but he wrote many others as well.

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

You have access to the following knowledge graphs:
freebase at https://qlever.cs.uni-freiburg.de/api/freebase

You can use the following SPARQL prefixes implicitly in all functions:
fb: <http://rdf.freebase.com/ns/
fbkey: <http://rdf.freebase.com/key/
rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs: <http://www.w3.org/2000/01/rdf-schema#
owl: <http://www.w3.org/2002/07/owl#
xsd: <http://www.w3.org/2001/XMLSchema#
foaf: <http://xmlns.com/foaf/0.1/
skos: <http://www.w3.org/2004/02/skos/core#
dct: <http://purl.org/dc/terms/
dc: <http://purl.org/dc/elements/1.1/
prov: <http://www.w3.org/ns/prov#
schema: <http://schema.org/
geo: <http://www.opengis.net/ont/geosparql#
geosparql: <http://www.opengis.net/ont/geosparql#
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
wikibase: <http://wikiba.se/ontology#
qb: <http://purl.org/linked-data/cube#
void: <http://rdfs.org/ns/void#

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. Use the functions to search for 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. Use the execute function to get feedback on intermediate queries. You can go back and forth between knowledge graph searches and SPARQL query executions to refine the query.
4. Use the answer or cancel function to finalize your answer and stop the generation process.

Additional rules:
1. Explain your thought process before and after each step and function call.
2. Do not assume or make up any entities or properties without verifying them with the knowledge graphs and functions.
3. 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.
4. 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.
5. 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.
6. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
7. 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.

[User] what was the title of the book charles darwin wrote?

[Assistant] Let's start by looking at some similar examples.

[Tool]
Example 1:
Question:
what was the name of the book that charles darwin wrote?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.01lwx ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.01lwx fb:book.author.works_written ?x .
}

Using entities:
Charles Darwin, also known as Charles Robert Darwin, Darwin, Charles (fb:m.01lwx): Charles Robert Darwin, FRS was an English naturalist and geologi...g theory of the life sciences, explaining the diversity of life., has type Academic

Using properties:
Works written (fb:book.author.works_written): links to type Written Work, part of Author schema

Example 2:
Question:
what book did charles darwin write on evolution?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.01lwx ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.01lwx fb:book.author.works_written ?x .
  ?x fb:common.topic.notable_types fb:m.01xryvm .
  ?x fb:book.written_work.subjects fb:m.02j8z .
}

Using entities:
Charles Darwin, also known as Charles Robert Darwin, Darwin, Charles (fb:m.01lwx): Charles Robert Darwin, FRS was an English naturalist and geologi...g theory of the life sciences, explaining the diversity of life., has type Academic
Book (fb:m.01xryvm): A book is a written work or a collection of written works in boo...For more information, please see the Freebase wiki page on book.
Evolution (fb:m.02j8z): Evolution is change in heritable traits of biological population...ll species that ever lived on Earth are estimated to be extinct., has type Field of study

Using properties:
Works written (fb:book.author.works_written): links to type Written Work, part of Author schema
Subjects (fb:book.written_work.subjects): links to type Literature Subject, part of Written Work schema
Notable types (fb:common.topic.notable_types): part of Topic schema, links to type Type

Example 3:
Question:
what is the work of charles darwin?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.01lwx ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.01lwx fb:book.book_subject.works ?x .
}

Using entities:
Charles Darwin, also known as Charles Robert Darwin, Darwin, Charles (fb:m.01lwx): Charles Robert Darwin, FRS was an English naturalist and geologi...g theory of the life sciences, explaining the diversity of life., has type Academic

Using properties:
Works Written About This Topic (fb:book.book_subject.works): part of Literature Subject schema, links to type Written Work

[Assistant]
The similar example shows that Charles Darwin's Freebase entity is fb:m.01lwx, and the property for works written is fb:book.author.works_written. To get the title, we should also retrieve the label of the book entity.

I'll write a SPARQL query to get the IRIs and (optionally) the English labels of the books written by Charles Darwin.

[Tool]
Got 153 rows and 2 columns, showing the first 5 and last 5 rows below:
| book                                                                               | book_label                                                               |
| ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| Charles Darwin's zoology notes & specimen lists from H.M.S. Beagle (fb:m.010rjsvs) | Charles Darwin's zoology notes & specimen lists from H.M.S. Beagle (en)  |
| Charles Darwin's letters (fb:m.010sfr1g)                                           | Charles Darwin's letters (en)                                            |
| The Voyage of the Beagle (fb:m.01qq45)                                             | The Voyage of the Beagle (en)                                            |
| The Descent of Man, and Selection in Relation to Sex (fb:m.02l2z6)                 | The Descent of Man, and Selection in Relation to Sex (en)                |
| The zoology of the voyage of H.M...eagle during the years 1832-1836 (fb:m.02pzzmw) | The zoology of the voyage of H.M...eagle during the years 1832-1836 (en) |
| ...                                                                                | ...                                                                      |
| A Monograph on the Fossil Balanidæ and Verrucidæ of Great Britain (fb:m.0y4rxbs)   | A Monograph on the Fossil Balanidæ and Verrucidæ of Great Britain (en)   |
| A Monograph of the Sub-class Cir...irripedes); the Verrucidae, etc. (fb:m.0y4rydg) | A Monograph of the Sub-class Cir...irripedes); the Verrucidae, etc. (en) |
| A Monograph on the Fossil Lepadi...ated Cirripedes of Great Britain (fb:m.0y4ryn4) | A Monograph on the Fossil Lepadi...ated Cirripedes of Great Britain (en) |
| A Monograph of the Sub-class Cir...ae; or, Pedunculated Cirripedes. (fb:m.0y4ryvd) | A Monograph of the Sub-class Cir...ae; or, Pedunculated Cirripedes. (en) |
| Geology from A Manual of scienti...dapted for travellers in general (fb:m.0y4rzcc) | Geology from A Manual of scienti...dapted for travellers in general (en) |

[Tool] Stopped generation process


PREFIX fb: <http://rdf.freebase.com/ns/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?cause ?label WHERE {
  fb:m.034bs fb:people.deceased_person.cause_of_death ?cause .
  OPTIONAL {
    ?cause rdfs:label ?label .
    FILTER ( lang( ?label ) = 'en' )
  }
}

George Orwell died of tuberculosis. (IRI: fb:m.07jwr)

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

You have access to the following knowledge graphs:
freebase at https://qlever.cs.uni-freiburg.de/api/freebase

You can use the following SPARQL prefixes implicitly in all functions:
fb: <http://rdf.freebase.com/ns/
fbkey: <http://rdf.freebase.com/key/
rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs: <http://www.w3.org/2000/01/rdf-schema#
owl: <http://www.w3.org/2002/07/owl#
xsd: <http://www.w3.org/2001/XMLSchema#
foaf: <http://xmlns.com/foaf/0.1/
skos: <http://www.w3.org/2004/02/skos/core#
dct: <http://purl.org/dc/terms/
dc: <http://purl.org/dc/elements/1.1/
prov: <http://www.w3.org/ns/prov#
schema: <http://schema.org/
geo: <http://www.opengis.net/ont/geosparql#
geosparql: <http://www.opengis.net/ont/geosparql#
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
wikibase: <http://wikiba.se/ontology#
qb: <http://purl.org/linked-data/cube#
void: <http://rdfs.org/ns/void#

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. Use the functions to search for 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. Use the execute function to get feedback on intermediate queries. You can go back and forth between knowledge graph searches and SPARQL query executions to refine the query.
4. Use the answer or cancel function to finalize your answer and stop the generation process.

Additional rules:
1. Explain your thought process before and after each step and function call.
2. Do not assume or make up any entities or properties without verifying them with the knowledge graphs and functions.
3. 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.
4. 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.
5. 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.
6. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
7. 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.

[User] what did george orwell died of?

[Assistant] Let's start by looking at some similar examples.

[Tool]
Example 1:
Question:
what did george v die of?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.0cmpn ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.0cmpn fb:people.deceased_person.cause_of_death ?x .
}

Using entities:
George V, also known as George Frederick Ernest Albert, Prince of Wales, George Frederick Ernest Albert Wettin (fb:m.0cmpn): George V was King of the United Kingdom and the British Dominion...xe-Coburg and Gotha as a result of anti-German public sentiment., has type Monarch

Using properties:
Cause of death (fb:people.deceased_person.cause_of_death): part of Deceased Person schema, links to type Cause Of Death

Example 2:
Question:
what did king george vi die of?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.0cm83 ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.0cm83 fb:people.deceased_person.cause_of_death ?x .
}

Using entities:
George VI, also known as Albert Frederick Arthur George, Prince Albert, King George VI, King George, H.M. King George VI (fb:m.0cm83): George VI was King of the United Kingdom and the Dominions of th...and its transition into the Commonwealth of Nations accelerated., has type Monarch

Using properties:
Cause of death (fb:people.deceased_person.cause_of_death): part of Deceased Person schema, links to type Cause Of Death

Example 3:
Question:
what did lbj die of?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.0f7fy ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.0f7fy fb:people.deceased_person.cause_of_death ?x .
}

Using entities:
Lyndon B. Johnson, also known as Sen. Lyndon B. Johnson, President Lyndon Johnson, President Lyndon B. Johnson, Lyndon Johnson, Lyndon B Johnson (fb:m.0f7fy): Lyndon Baines Johnson, often referred to as LBJ, was the 36th Pr... of the executive branch, as well as in both houses of Congress., has type US President

Using properties:
Cause of death (fb:people.deceased_person.cause_of_death): part of Deceased Person schema, links to type Cause Of Death

[Assistant]
From the similar examples, the approach is to:

1. Find the Freebase entity for George Orwell.
2. Use the property fb:people.deceased_person.cause_of_death to get the cause of death.

Let's search for the Freebase entity for George Orwell.

[Tool]
Top 10 entity alternatives:
1. George Orwell, also known as Eric Arthur Blair (fb:m.034bs): Eric Arthur Blair, who used the pen name George Orwell, was an E...ht Police, Room 101, Memory hole, doublethink, and thoughtcrime., Eric Arthur Blair (25 June 1903 21 January 1950), better known b...in language.His two most popular works are 1984 and Animal Farm., has type Author
2. George Orwell (fb:m.0b3mv01): has type Book Edition
3. George Orwell (fb:m.08n0rk7): has type Book Edition
4. George Orwell (fb:m.0c5xtp5): has type Book Edition
5. George Orwell (fb:m.04vtrvn): has type Book Edition
6. George Orwell (fb:m.04t4gy2): has type Book
7. George Orwell (fb:m.0c6n17d): has type Book Edition
8. George Orwell (fb:m.04txhhn): has type Book Edition
9. George Orwell (fb:m.079p0vv): has type Book Edition
10. George Orwell (fb:m.079p0vc): has type Book Edition

[Tool]
Got 1 row and 1 column:
| cause                     |
| ------------------------- |
| Tuberculosis (fb:m.07jwr) |

[Tool]
Got 1 row and 1 column:
| cause                     |
| ------------------------- |
| Tuberculosis (fb:m.07jwr) |

[Tool]
Got 1 row and 2 columns:
| cause                     | label             |
| ------------------------- | ----------------- |
| Tuberculosis (fb:m.07jwr) | Tuberculosis (en) |

[Tool] Stopped generation process


PREFIX fb: <http://rdf.freebase.com/ns/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?attraction ?label WHERE {
  FILTER ( ?attraction != fb:m.0f2wj ) fb:m.0f2wj fb:travel.travel_destination.tourist_attractions ?attraction .
  OPTIONAL {
    ?attraction rdfs:label ?label .
    FILTER ( lang( ?label ) = 'en' )
  }
}

Got 10 rows and 2 columns:
| attraction                                | label                            |
| ----------------------------------------- | -------------------------------- |
| Griffith Observatory (fb:m.02_4ml)        | Griffith Observatory (en)        |
| Universal CityWalk (fb:m.025shr0)         | Universal CityWalk (en)          |
| Grauman's Egyptian Theatre (fb:m.029x2z)  | Grauman's Egyptian Theatre (en)  |
| Dolby Theatre (fb:m.02hksn)               | Dolby Theatre (en)               |
| Hollywood Heritage Museum (fb:m.031dp8)   | Hollywood Heritage Museum (en)   |
| TCL Chinese Theatre (fb:m.04n2h_)         | TCL Chinese Theatre (en)         |
| Hollywood Sign (fb:m.050ctv)              | Hollywood Sign (en)              |
| Universal Studios Hollywood (fb:m.05qsy8) | Universal Studios Hollywood (en) |
| Hollywood Wax Museum (fb:m.07_dsf)        | Hollywood Wax Museum (en)        |
| Hollywood Walk of Fame (fb:m.0qjfl)       | Hollywood Walk of Fame (en)      |

Some things to do in Hollywood, CA this weekend include visiting:
- Griffith Observatory
- Universal CityWalk
- Grauman's Egyptian Theatre
- Dolby Theatre
- Hollywood Heritage Museum
- TCL Chinese Theatre
- Hollywood Sign
- Universal Studios Hollywood
- Hollywood Wax Museum
- Hollywood Walk of Fame
These are popular tourist attractions in Hollywood.

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

You have access to the following knowledge graphs:
freebase at https://qlever.cs.uni-freiburg.de/api/freebase

You can use the following SPARQL prefixes implicitly in all functions:
fb: <http://rdf.freebase.com/ns/
fbkey: <http://rdf.freebase.com/key/
rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs: <http://www.w3.org/2000/01/rdf-schema#
owl: <http://www.w3.org/2002/07/owl#
xsd: <http://www.w3.org/2001/XMLSchema#
foaf: <http://xmlns.com/foaf/0.1/
skos: <http://www.w3.org/2004/02/skos/core#
dct: <http://purl.org/dc/terms/
dc: <http://purl.org/dc/elements/1.1/
prov: <http://www.w3.org/ns/prov#
schema: <http://schema.org/
geo: <http://www.opengis.net/ont/geosparql#
geosparql: <http://www.opengis.net/ont/geosparql#
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
wikibase: <http://wikiba.se/ontology#
qb: <http://purl.org/linked-data/cube#
void: <http://rdfs.org/ns/void#

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. Use the functions to search for 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. Use the execute function to get feedback on intermediate queries. You can go back and forth between knowledge graph searches and SPARQL query executions to refine the query.
4. Use the answer or cancel function to finalize your answer and stop the generation process.

Additional rules:
1. Explain your thought process before and after each step and function call.
2. Do not assume or make up any entities or properties without verifying them with the knowledge graphs and functions.
3. 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.
4. 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.
5. 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.
6. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
7. 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.

[User] what to do in hollywood ca this weekend?

[Assistant] Let's start by looking at some similar examples.

[Tool]
Example 1:
Question:
what to do in venice beach ca?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.07_fl ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.07_fl fb:travel.travel_destination.tourist_attractions ?x .
}

Using entities:
Venice, also known as Venice Beach, California, Venice, Los Angeles, California, Venice, Los Angeles, Venice, California (fb:m.07_fl): Venice is a residential, commercial, and recreational beachfront...that features performers, fortune-tellers, artists, and vendors., has type Neighborhood

Using properties:
Tourist attractions (fb:travel.travel_destination.tourist_attractions): part of Travel destination schema, links to type Tourist attraction

Example 2:
Question:
what can you do in palm springs ca?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.0r3tq ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.0r3tq fb:travel.travel_destination.tourist_attractions ?x .
}

Using entities:
Palm Springs, also known as Palm Springs, California, Riverside County / Palm Springs city (fb:m.0r3tq): Palm Springs is a desert resort city in Riverside County, Califo...nd mountain areas are major forms of recreation in Palm Springs., has type City/Town/Village

Using properties:
Tourist attractions (fb:travel.travel_destination.tourist_attractions): part of Travel destination schema, links to type Tourist attraction

Example 3:
Question:
what is there to do in palm springs?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.0r3tq ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.0r3tq fb:travel.travel_destination.tourist_attractions ?x .
}

Using entities:
Palm Springs, also known as Palm Springs, California, Riverside County / Palm Springs city (fb:m.0r3tq): Palm Springs is a desert resort city in Riverside County, Califo...nd mountain areas are major forms of recreation in Palm Springs., has type City/Town/Village

Using properties:
Tourist attractions (fb:travel.travel_destination.tourist_attractions): part of Travel destination schema, links to type Tourist attraction

[Assistant]
The similar examples suggest that for "what to do in [city]?", the approach is to find the entity for the city (here, Hollywood, CA) and then query for its tourist attractions using the property fb:travel.travel_destination.tourist_attractions.

Step 1: Find the Freebase entity for Hollywood, CA.
Step 2: Use the property fb:travel.travel_destination.tourist_attractions to get things to do.

Let's search for the entity "Hollywood, CA" in Freebase.

[Tool]
Top 10 entity alternatives:
1. Hollywood, CA (fb:m.024vvx0): has type Canonical Version
2. Hollywood, CA (fb:m.0l7kvp8)
3. Hollywood, also known as Hollywood, California, Hollywood, Los Angeles, California (fb:m.0f2wj): Hollywood is a neighborhood in the central region of Los Angeles...tually becoming the most dominant and recognizable in the world., has type Neighborhood
4. Captain Hollywood, also known as Hollywood, Captain, Tony Dawson-Harrison, Captain Hollywood - More & More (fb:m.03f1vfn): has type Composer
5. Hollywood Canteen (fb:m.0b3klf): Hollywood Canteen is a 1944 American musical romantic comedy fil... cameo roles. The film received three Academy Award nominations., has type Film
6. Hollywood Cavalcade (fb:m.08q3qg2): Hollywood Cavalcade is a 1939 American film featuring Alice Faye...ctionalized look at silent-era performers and their productions., Hollywood Cavalcade is a 1939 film directed by Irving Cummings and Malcolm St. Clair., has type Film
7. Canal Hollywood (fb:m.02w1hcj): Canal Hollywood is a movies cable channel available in Spain and...w cable, satellite or IPTV in Angola, Mozambique and Cape Verde., has type Employer
8. Capri Hollywood Film Festival, also known as Capri, Hollywood (fb:m.0s953m_): Capri Hollywood Film Festival is an international film festival., has type Film festival
9. Hollywood Capers (fb:m.0h3rfqt): Hollywood Capers is a short animated film of the Looney Tunes se...hat have fallen into the public domain. Porky also made a cameo., has type Film
10. Hollywood Canteen (fb:m.0j7711m): The Hollywood Canteen operated at 1451 Cahuenga Boulevard in Hol...taffed completely by volunteers from the entertainment industry., has type Organization

[Assistant]
Among the search results, the most relevant entity for "Hollywood, CA" as a place to visit is:

- Hollywood, also known as Hollywood, California, Hollywood, Los Angeles, California (fb:m.0f2wj): has type Neighborhood

This matches the pattern in the similar examples, where neighborhoods or cities are used as the subject.

Next, I will construct a SPARQL query to get tourist attractions for Hollywood (fb:m.0f2wj) using the property fb:travel.travel_destination.tourist_attractions.

[Tool]
Got 167 rows and 2 columns, showing the first 5 and last 5 rows below:
| attraction                          | attractionLabel             |
| ----------------------------------- | --------------------------- |
| Griffith Observatory (fb:m.02_4ml)  | Griffith-observatoriet (no) |
| Griffith Observatory (fb:m.02_4ml)  | Griffith-observatorium (nl) |
| Griffith Observatory (fb:m.02_4ml)  | Griffith Observatory (de)   |
| Griffith Observatory (fb:m.02_4ml)  | Griffith Observatory (en)   |
| Griffith Observatory (fb:m.02_4ml)  | Griffith Rasathanesi (tr)   |
| ...                                 | ...                         |
| Hollywood Walk of Fame (fb:m.0qjfl) | ฮอลลีวูด วอล์ก ออฟ เฟม (th) |
| Hollywood Walk of Fame (fb:m.0qjfl) | 할리우드 명예의 거리 (ko)            |
| Hollywood Walk of Fame (fb:m.0qjfl) | ハリウッド・ウォーク・オブ・フェーム (ja)     |
| Hollywood Walk of Fame (fb:m.0qjfl) | 好莱坞星光大道 (zh)                |
| Hollywood Walk of Fame (fb:m.0qjfl) | 好萊塢星光大道 (zh-Hant)           |

[Tool]
Got 10 rows and 2 columns:
| attraction                                | label                            |
| ----------------------------------------- | -------------------------------- |
| Griffith Observatory (fb:m.02_4ml)        | Griffith Observatory (en)        |
| Universal CityWalk (fb:m.025shr0)         | Universal CityWalk (en)          |
| Grauman's Egyptian Theatre (fb:m.029x2z)  | Grauman's Egyptian Theatre (en)  |
| Dolby Theatre (fb:m.02hksn)               | Dolby Theatre (en)               |
| Hollywood Heritage Museum (fb:m.031dp8)   | Hollywood Heritage Museum (en)   |
| TCL Chinese Theatre (fb:m.04n2h_)         | TCL Chinese Theatre (en)         |
| Hollywood Sign (fb:m.050ctv)              | Hollywood Sign (en)              |
| Universal Studios Hollywood (fb:m.05qsy8) | Universal Studios Hollywood (en) |
| Hollywood Wax Museum (fb:m.07_dsf)        | Hollywood Wax Museum (en)        |
| Hollywood Walk of Fame (fb:m.0qjfl)       | Hollywood Walk of Fame (en)      |

[Tool] Stopped generation process


PREFIX fb: <http://rdf.freebase.com/ns/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?language ?label WHERE {
  fb:m.07ssc fb:location.country.languages_spoken ?language .
  OPTIONAL {
    ?language rdfs:label ?label .
    FILTER ( lang( ?label ) = 'en' )
  }
}

Got 8 rows and 2 columns:
| language                           | label                      |
| ---------------------------------- | -------------------------- |
| Cornish Language (fb:m.01v0g)      | Cornish Language (en)      |
| English Language (fb:m.02h40lc)    | English Language (en)      |
| Esperanto Language (fb:m.02jcw)    | Esperanto Language (en)    |
| Irish (fb:m.03x42)                 | Irish (en)                 |
| Scottish Gaelic (fb:m.070zw)       | Scottish Gaelic (en)       |
| Welsh Language (fb:m.083tk)        | Welsh Language (en)        |
| British Sign Language (fb:m.0ct8m) | British Sign Language (en) |
| Scots Language (fb:m.0h407)        | Scots Language (en)        |

People in the UK speak the following languages: English, Welsh, Scottish Gaelic, Cornish, Scots, Irish, British Sign Language, and Esperanto. The query returns the IRIs for each language as well as their English labels.

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

You have access to the following knowledge graphs:
freebase at https://qlever.cs.uni-freiburg.de/api/freebase

You can use the following SPARQL prefixes implicitly in all functions:
fb: <http://rdf.freebase.com/ns/
fbkey: <http://rdf.freebase.com/key/
rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs: <http://www.w3.org/2000/01/rdf-schema#
owl: <http://www.w3.org/2002/07/owl#
xsd: <http://www.w3.org/2001/XMLSchema#
foaf: <http://xmlns.com/foaf/0.1/
skos: <http://www.w3.org/2004/02/skos/core#
dct: <http://purl.org/dc/terms/
dc: <http://purl.org/dc/elements/1.1/
prov: <http://www.w3.org/ns/prov#
schema: <http://schema.org/
geo: <http://www.opengis.net/ont/geosparql#
geosparql: <http://www.opengis.net/ont/geosparql#
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
wikibase: <http://wikiba.se/ontology#
qb: <http://purl.org/linked-data/cube#
void: <http://rdfs.org/ns/void#

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. Use the functions to search for 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. Use the execute function to get feedback on intermediate queries. You can go back and forth between knowledge graph searches and SPARQL query executions to refine the query.
4. Use the answer or cancel function to finalize your answer and stop the generation process.

Additional rules:
1. Explain your thought process before and after each step and function call.
2. Do not assume or make up any entities or properties without verifying them with the knowledge graphs and functions.
3. 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.
4. 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.
5. 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.
6. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
7. 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.

[User] what do people speak in uk?

[Assistant] Let's start by looking at some similar examples.

[Tool]
Example 1:
Question:
what dialects are spoken in the uk?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.07ssc ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.07ssc fb:location.country.languages_spoken ?x .
}

Using entities:
United Kingdom, also known as United Kingdom of Great Britain and Northern Ireland, United Kingdom of Great Britain and Ireland, United Kingdom of Great Britain, UK, U.K. (fb:m.07ssc): The United Kingdom of Great Britain and Northern Ireland, common...urth-largest in Europe and second-largest in the European Union., has type Country

Using properties:
Languages spoken (fb:location.country.languages_spoken): links to type Human Language, part of Country schema

Example 2:
Question:
what language is mainly spoken in england?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.02jx1 ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.02jx1 fb:location.country.languages_spoken ?x .
  ?x fb:language.human_language.main_country fb:m.02jx1 .
}

Using entities:
England, also known as Albion, England, Loegria, Pow Sows (fb:m.02jx1): England /ˈɪŋɡlənd/ is a country that is part of the United Kingd... had a significant cultural and legal impact on the wider world., has type Country

Using properties:
Main Country (fb:language.human_language.main_country): part of Human Language schema, links to type Country
Languages spoken (fb:location.country.languages_spoken): links to type Human Language, part of Country schema

Example 3:
Question:
what does scottish people speak?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.06q1r ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.06q1r fb:location.country.languages_spoken ?x .
}

Using entities:
Scotland, also known as Scotia (fb:m.06q1r): Scotland is a country that is part of the United Kingdom and cov...tate in the Early Middle Ages and continued to exist until 1707., has type Country

Using properties:
Languages spoken (fb:location.country.languages_spoken): links to type Human Language, part of Country schema

[Assistant]
From the similar examples, I see that the United Kingdom is represented by the entity fb:m.07ssc in Freebase, and the property for languages spoken is fb:location.country.languages_spoken. The example queries filter out the country entity itself and retrieve the languages spoken.

I will construct a SPARQL query to get the languages spoken in the UK (fb:m.07ssc), returning their IRIs and optionally their labels.

[Tool]
Got 301 rows and 2 columns, showing the first 5 and last 5 rows below:
| language                      | languageLabel        |
| ----------------------------- | -------------------- |
| Cornish Language (fb:m.01v0g) | Bahasa Cornish (ms)  |
| Cornish Language (fb:m.01v0g) | Bahasa Kernowek (id) |
| Cornish Language (fb:m.01v0g) | Còrnic (ca)          |
| Cornish Language (fb:m.01v0g) | Cornique (fr)        |
| Cornish Language (fb:m.01v0g) | Cornisch (nl)        |
| ...                           | ...                  |
| Scots Language (fb:m.0h407)   | لغة أسكتلندية (ar)   |
| Scots Language (fb:m.0h407)   | 스코트어 (ko)            |
| Scots Language (fb:m.0h407)   | スコットランド語 (ja)        |
| Scots Language (fb:m.0h407)   | 低地苏格兰语 (zh)          |
| Scots Language (fb:m.0h407)   | 低地蘇格蘭語 (zh-Hant)     |

[Tool]
Got 8 rows and 1 column:
| language                           |
| ---------------------------------- |
| Cornish Language (fb:m.01v0g)      |
| English Language (fb:m.02h40lc)    |
| Esperanto Language (fb:m.02jcw)    |
| Irish (fb:m.03x42)                 |
| Scottish Gaelic (fb:m.070zw)       |
| Welsh Language (fb:m.083tk)        |
| British Sign Language (fb:m.0ct8m) |
| Scots Language (fb:m.0h407)        |

[Tool]
Got 8 rows and 2 columns:
| language                           | label                      |
| ---------------------------------- | -------------------------- |
| Cornish Language (fb:m.01v0g)      | Cornish Language (en)      |
| English Language (fb:m.02h40lc)    | English Language (en)      |
| Esperanto Language (fb:m.02jcw)    | Esperanto Language (en)    |
| Irish (fb:m.03x42)                 | Irish (en)                 |
| Scottish Gaelic (fb:m.070zw)       | Scottish Gaelic (en)       |
| Welsh Language (fb:m.083tk)        | Welsh Language (en)        |
| British Sign Language (fb:m.0ct8m) | British Sign Language (en) |
| Scots Language (fb:m.0h407)        | Scots Language (en)        |

[Tool] Stopped generation process


PREFIX fb: <http://rdf.freebase.com/ns/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?position ?positionLabel WHERE {
  fb:m.02yy8 fb:government.politician.government_positions_held ?govpos .
  ?govpos fb:government.government_position_held.office_position_or_title ?position .
  ?govpos fb:government.government_position_held.to ?to .
  FILTER ( ?to < "1933-03-04" ^^ xsd:date ) OPTIONAL {
    ?position rdfs:label ?positionLabel
  }
}
ORDER BY DESC ( ?to )
LIMIT 1

Franklin D. Roosevelt's job before becoming President was Governor of New York.

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

You have access to the following knowledge graphs:
freebase at https://qlever.cs.uni-freiburg.de/api/freebase

You can use the following SPARQL prefixes implicitly in all functions:
fb: <http://rdf.freebase.com/ns/
fbkey: <http://rdf.freebase.com/key/
rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs: <http://www.w3.org/2000/01/rdf-schema#
owl: <http://www.w3.org/2002/07/owl#
xsd: <http://www.w3.org/2001/XMLSchema#
foaf: <http://xmlns.com/foaf/0.1/
skos: <http://www.w3.org/2004/02/skos/core#
dct: <http://purl.org/dc/terms/
dc: <http://purl.org/dc/elements/1.1/
prov: <http://www.w3.org/ns/prov#
schema: <http://schema.org/
geo: <http://www.opengis.net/ont/geosparql#
geosparql: <http://www.opengis.net/ont/geosparql#
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
wikibase: <http://wikiba.se/ontology#
qb: <http://purl.org/linked-data/cube#
void: <http://rdfs.org/ns/void#

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. Use the functions to search for 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. Use the execute function to get feedback on intermediate queries. You can go back and forth between knowledge graph searches and SPARQL query executions to refine the query.
4. Use the answer or cancel function to finalize your answer and stop the generation process.

Additional rules:
1. Explain your thought process before and after each step and function call.
2. Do not assume or make up any entities or properties without verifying them with the knowledge graphs and functions.
3. 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.
4. 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.
5. 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.
6. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
7. 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.

[User] what was franklin d roosevelt's job before president?

[Assistant] Let's start by looking at some similar examples.

[Tool]
Example 1:
Question:
what jobs did ben franklin do?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.019fz ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.019fz fb:people.person.profession ?x .
}

Using entities:
Benjamin Franklin, also known as Ben Franklin (fb:m.019fz): Benjamin Franklin was one of the Founding Fathers of the United ...s, with the scientific and tolerant values of the Enlightenment., Benjamin Franklin (1706  1790) was an inventor, publisher. scien...ng library in America and first fire department in Pennsylvania., has type U.S. Congressperson

Using properties:
Profession (fb:people.person.profession): links to type Profession, part of Person schema

Example 2:
Question:
who became president when roosevelt died in office?

SPARQL:
SELECT DISTINCT ?x WHERE {
  fb:m.060d2 fb:government.government_office_or_title.office_holders ?y1 .
  ?y1 fb:government.government_position_held.office_holder fb:m.02yy8 ; fb:government.government_position_held.to ?to .
  fb:m.060d2 fb:government.government_office_or_title.office_holders ?y2 .
  ?y2 fb:government.government_position_held.office_holder ?x ; fb:government.government_position_held.to ?from .
  FILTER ( xsd:dateTime ( ?from ) - xsd:dateTime ( ?to ) > 0 )
}
ORDER BY xsd:dateTime ( ?from )
LIMIT 1

Using entities:
Franklin D. Roosevelt, also known as Houdini In the White House, Franklin Roosevelt, Pres. Franklin D. Roosevelt, President Franklin Delano Roosevelt, President Franklin D. Roosevelt (fb:m.02yy8): Franklin Delano Roosevelt, commonly known by his initials FDR, w...05, he married Eleanor Roosevelt, with whom he had six children., has type US President
President of the United States, also known as Commander in Chief, President of the United States of America (fb:m.060d2): The President of the United States of America is the elected hea...er or both houses of Congress under extraordinary circumstances., has type Government Office or Title

Using properties:
Office Holders (fb:government.government_office_or_title.office_holders): part of Government Office or Title schema, links to type Government Position Held
Officeholder (fb:government.government_position_held.office_holder): part of Government Position Held schema, links to type Politician
To (fb:government.government_position_held.to): part of Government Position Held schema, links to type Date/Time

Example 3:
Question:
what did barack obama do before he took office?

SPARQL:
SELECT DISTINCT ?x WHERE {
  {
    SELECT ?pFrom WHERE {
      fb:m.02mjmr fb:government.politician.government_positions_held ?y .
      ?y fb:government.government_position_held.office_position_or_title ?x ; fb:government.government_position_held.basic_title fb:m.060c4 ; fb:government.government_position_held.from ?pFrom .
    }
  }
  fb:m.02mjmr fb:government.politician.government_positions_held ?y .
  ?y fb:government.government_position_held.office_position_or_title ?x ; fb:government.government_position_held.from ?from .
  FILTER ( xsd:dateTime ( ?pFrom ) - xsd:dateTime ( ?from ) > 0 )
}

Using entities:
Barack Obama, also known as President Obama, President Barack Obama, President Barack Hussein Obama II, President Barack H. Obama, Obama (fb:m.02mjmr): Barack Hussein Obama II is the 44th and current President of the...mocratic Party primaries to receive the presidential nomination., Barack Hussein Obama II (/bəˈrɑːk huːˈseɪn oʊˈbɑːmə/; born Augus...ting the 13th District in the Illinois Senate from 1997 to 2004., has type US President
President, also known as Chairman (fb:m.060c4): A president is the leader of a country or a division or part of ...publics, semi-presidential republics or parliamentary republics., has type Fictional job title

Using properties:
Basic title (fb:government.government_position_held.basic_title): links to type Government office category, part of Government Position Held schema
From (fb:government.government_position_held.from): part of Government Position Held schema, links to type Date/Time
Office, position, or title (fb:government.government_position_held.office_position_or_title): links to type Government Office or Title, part of Government Position Held schema
Government Positions Held (fb:government.politician.government_positions_held): links to type Government Position Held, part of Politician schema

[Assistant]
From the examples, it seems that to find Franklin D. Roosevelt's job before becoming president, I need to:

1. Identify Franklin D. Roosevelt's entity in Freebase.
2. Find his government positions held (using fb:government.politician.government_positions_held).
3. Filter for positions held before he became President (fb:government.government_position_held.office_position_or_title = President, fb:m.060c4).
4. Return the position(s) he held immediately before becoming President.

First, let's search for Franklin D. Roosevelt's Freebase entity.

[Tool]
Top 10 entity alternatives:
1. Franklin D. Roosevelt, also known as Houdini In the White House, Franklin Roosevelt, Pres. Franklin D. Roosevelt, President Franklin Delano Roosevelt, President Franklin D. Roosevelt (fb:m.02yy8): Franklin Delano Roosevelt, commonly known by his initials FDR, w...05, he married Eleanor Roosevelt, with whom he had six children., has type US President
2. Franklin D. Roosevelt, also known as Franklin D. Roosevelt, Paris (fb:m.02h_t7): Franklin D. Roosevelt is a station of the Paris Métro serving bo...elt is the fourteenth busiest station in the Paris Métro system., has type Transit Stop
3. Franklin Roosevelt, also known as President Franklin Delano Roosevelt, President Franklin D. Roosevelt, Roosevelt, Ruzvelt, Voice of Franklin Delano Roosevelt (fb:m.0kdxy8v): Franklin Roosevelt  is a fictional character from the 2012 film A Christmas Story 2., Fictional representation of President Franklin Delano Roosevelt., has type Film character
4. Franklin D. Roosevelt (fb:m.06s5wnm): Franklin D. Roosevelt is a serialized work written by Frank Burt Freidel., has type Book
5. Franklin D. Roosevelt (fb:m.0c8h4p1): has type Book Edition
6. Franklin D. Roosevelt D'Alesandro, also known as Roosie (fb:m.0vn1kft): Franklin D. Roosevelt D'Alesandro was the brother of Nancy Pelosi., has type Deceased Person
7. Franklin D Roosevelt (fb:m.0760h6t): has type School
8. Franklin D Roosevelt (fb:m.076lbz2): has type School
9. Franklin D Roosevelt (fb:m.076gshf): has type School
10. Franklin D Roosevelt (fb:m.076l0x7): has type School

[Assistant]
The correct entity for Franklin D. Roosevelt, the US President, is fb:m.02yy8.

Next, I need to find his government positions held, and specifically the one(s) held immediately before he became President. From the examples, the relevant property is fb:government.politician.government_positions_held, and within that, the office_position_or_title and the from/to dates.

I will first list all government positions held by Franklin D. Roosevelt to see what data is available.

[Tool]
Got 4 rows and 3 columns:
| subject                            | property                                                                       | object       |
| ---------------------------------- | ------------------------------------------------------------------------------ | ------------ |
| Franklin D. Roosevelt (fb:m.02yy8) | Government Positions Held (fb:government.politician.government_positions_held) | fb:m.03q2h_9 |
| Franklin D. Roosevelt (fb:m.02yy8) | Government Positions Held (fb:government.politician.government_positions_held) | fb:m.03q2h_j |
| Franklin D. Roosevelt (fb:m.02yy8) | Government Positions Held (fb:government.politician.government_positions_held) | fb:m.04ml2v0 |
| Franklin D. Roosevelt (fb:m.02yy8) | Government Positions Held (fb:government.politician.government_positions_held) | fb:m.0b_p9hl |

[Assistant]
Franklin D. Roosevelt has four government positions held, represented by the following entities:
- fb:m.03q2h_9
- fb:m.03q2h_j
- fb:m.04ml2v0
- fb:m.0b_p9hl

Next, I need to determine which of these corresponds to his presidency, and which one(s) immediately precede it. To do this, I will list the office_position_or_title, from, and to dates for each of these positions.

[Tool]
Got 8 rows and 3 columns:
| subject      | property                                                                                | object                                                            |
| ------------ | -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| fb:m.03q2h_9 | Type (fb:type.object.type)                                                                   | Government Position Held (fb:government.government_position_held) |
| fb:m.03q2h_9 | Officeholder (fb:government.government_position_held.office_holder)                          | Franklin D. Roosevelt (fb:m.02yy8)                                |
| fb:m.03q2h_9 | From (fb:government.government_position_held.from)                                           | 1933-03-04 (xsd:date)                                             |
| fb:m.03q2h_9 | Office, position, or title (fb:government.government_position_held.office_position_or_title) | President of the United States (fb:m.060d2)                       |
| fb:m.03q2h_9 | Basic title (fb:government.government_position_held.basic_title)                             | President (fb:m.060c4)                                            |
| fb:m.03q2h_9 | Jurisdiction of office (fb:government.government_position_held.jurisdiction_of_office)       | United States of America (fb:m.09c7w0)                            |
| fb:m.03q2h_9 | To (fb:government.government_position_held.to)                                               | 1945-04-12 (xsd:date)                                             |
| fb:m.03q2h_9 | rdf:type                                                                                | Government Position Held (fb:government.government_position_held) |

[Tool]
Got 10 rows and 3 columns:
| subject      | property                                                                                | object                                                            |
| ------------ | --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| fb:m.03q2h_j | Type (fb:type.object.type)                                                                                | Government Position Held (fb:government.government_position_held) |
| fb:m.03q2h_j | Officeholder (fb:government.government_position_held.office_holder)                                       | Franklin D. Roosevelt (fb:m.02yy8)                                |
| fb:m.03q2h_j | Governmental body (if position is part of one) (fb:government.government_position_held.governmental_body) | United States Department of the Navy (fb:m.03cv24)                |
| fb:m.03q2h_j | From (fb:government.government_position_held.from)                                                        | 1913-03-17 (xsd:date)                                             |
| fb:m.03q2h_j | Office, position, or title (fb:government.government_position_held.office_position_or_title)              | Assistant Secretary of the Navy (fb:m.03whjr)                     |
| fb:m.03q2h_j | Basic title (fb:government.government_position_held.basic_title)                                          | Assistant Secretary (fb:m.09tm8y)                                 |
| fb:m.03q2h_j | Jurisdiction of office (fb:government.government_position_held.jurisdiction_of_office)                    | United States of America (fb:m.09c7w0)                            |
| fb:m.03q2h_j | To (fb:government.government_position_held.to)                                                            | 1920-08-26 (xsd:date)                                             |
| fb:m.03q2h_j | Appointed By (if Position is Appointed) (fb:government.government_position_held.appointed_by)             | Woodrow Wilson (fb:m.083q7)                                       |
| fb:m.03q2h_j | rdf:type                                                                                | Government Position Held (fb:government.government_position_held) |

[Tool]
Got 8 rows and 3 columns:
| subject      | property                                                                                | object                                                            |
| ------------ | -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| fb:m.04ml2v0 | Type (fb:type.object.type)                                                                   | Government Position Held (fb:government.government_position_held) |
| fb:m.04ml2v0 | Officeholder (fb:government.government_position_held.office_holder)                          | Franklin D. Roosevelt (fb:m.02yy8)                                |
| fb:m.04ml2v0 | From (fb:government.government_position_held.from)                                           | 1929-01-01 (xsd:date)                                             |
| fb:m.04ml2v0 | Office, position, or title (fb:government.government_position_held.office_position_or_title) | Governor of New York (fb:m.02_w_r9)                               |
| fb:m.04ml2v0 | Basic title (fb:government.government_position_held.basic_title)                             | Governor (fb:m.0fkvn)                                             |
| fb:m.04ml2v0 | Jurisdiction of office (fb:government.government_position_held.jurisdiction_of_office)       | New York (fb:m.059rby)                                            |
| fb:m.04ml2v0 | To (fb:government.government_position_held.to)                                               | 1932-12-31 (xsd:date)                                             |
| fb:m.04ml2v0 | rdf:type                                                                                | Government Position Held (fb:government.government_position_held) |

[Tool]
Got 9 rows and 3 columns:
| subject      | property                                                                                | object                                                            |
| ------------ | --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| fb:m.0b_p9hl | Type (fb:type.object.type)                                                                                | Government Position Held (fb:government.government_position_held) |
| fb:m.0b_p9hl | Officeholder (fb:government.government_position_held.office_holder)                                       | Franklin D. Roosevelt (fb:m.02yy8)                                |
| fb:m.0b_p9hl | Governmental body (if position is part of one) (fb:government.government_position_held.governmental_body) | New York State Senate (fb:m.04z288)                               |
| fb:m.0b_p9hl | From (fb:government.government_position_held.from)                                                        | 1911-01-01 (xsd:date)                                             |
| fb:m.0b_p9hl | Office, position, or title (fb:government.government_position_held.office_position_or_title)              | New York State Senator (fb:m.04kz0b7)                             |
| fb:m.0b_p9hl | Basic title (fb:government.government_position_held.basic_title)                                          | State Senator (fb:m.01t7n9)                                       |
| fb:m.0b_p9hl | Jurisdiction of office (fb:government.government_position_held.jurisdiction_of_office)                    | New York (fb:m.059rby)                                            |
| fb:m.0b_p9hl | To (fb:government.government_position_held.to)                                                            | 1913-03-17 (xsd:date)                                             |
| fb:m.0b_p9hl | rdf:type                                                                                | Government Position Held (fb:government.government_position_held) |

[Assistant]
Now I have the following timeline for Franklin D. Roosevelt's government positions:

- New York State Senator: 1911-01-01 to 1913-03-17
- Assistant Secretary of the Navy: 1913-03-17 to 1920-08-26
- Governor of New York: 1929-01-01 to 1932-12-31
- President of the United States: 1933-03-04 to 1945-04-12

The job he held immediately before becoming President was Governor of New York (ending 1932-12-31, presidency starting 1933-03-04).

I will now write a SPARQL query that returns the identifier for the position he held immediately before becoming President, along with its label.

[Tool] Stopped generation process


PREFIX fb: <http://rdf.freebase.com/ns/>
SELECT DISTINCT ?zip WHERE {
  fb:m.0fvxz fb:location.citytown.postal_codes ?zip .
}

Trenton, New Jersey has multiple zip codes, including 08628, 08618, 08638, 08610, 08619, 08605, 08604, 08603, 08602, and 08601.

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

You have access to the following knowledge graphs:
freebase at https://qlever.cs.uni-freiburg.de/api/freebase

You can use the following SPARQL prefixes implicitly in all functions:
fb: <http://rdf.freebase.com/ns/
fbkey: <http://rdf.freebase.com/key/
rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs: <http://www.w3.org/2000/01/rdf-schema#
owl: <http://www.w3.org/2002/07/owl#
xsd: <http://www.w3.org/2001/XMLSchema#
foaf: <http://xmlns.com/foaf/0.1/
skos: <http://www.w3.org/2004/02/skos/core#
dct: <http://purl.org/dc/terms/
dc: <http://purl.org/dc/elements/1.1/
prov: <http://www.w3.org/ns/prov#
schema: <http://schema.org/
geo: <http://www.opengis.net/ont/geosparql#
geosparql: <http://www.opengis.net/ont/geosparql#
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
wikibase: <http://wikiba.se/ontology#
qb: <http://purl.org/linked-data/cube#
void: <http://rdfs.org/ns/void#

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. Use the functions to search for 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. Use the execute function to get feedback on intermediate queries. You can go back and forth between knowledge graph searches and SPARQL query executions to refine the query.
4. Use the answer or cancel function to finalize your answer and stop the generation process.

Additional rules:
1. Explain your thought process before and after each step and function call.
2. Do not assume or make up any entities or properties without verifying them with the knowledge graphs and functions.
3. 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.
4. 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.
5. 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.
6. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
7. 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.

[User] what is the zip code for trenton?

[Assistant] Let's start by looking at some similar examples.

[Tool]
Example 1:
Question:
what is the zip code for trenton ga?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.0fvxz ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.0fvxz fb:location.citytown.postal_codes ?x .
}

Using entities:
Trenton, also known as Trenton, NJ, Trenton, New Jersey, Mercer County / Trenton city (fb:m.0fvxz): Trenton is the capital city of the U.S. state of New Jersey and ...Trenton was formed within Trenton Township on November 13, 1792., has type City/Town/Village

Using properties:
Postal codes (fb:location.citytown.postal_codes): part of City/Town/Village schema, links to type Postal Code

Example 2:
Question:
what is the zip code for trenton ohio?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.0ytcc ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.0ytcc fb:location.citytown.postal_codes ?x .
}

Using entities:
Trenton, also known as Butler County / Trenton city, Trenton, Ohio (fb:m.0ytcc): Trenton is a city in northeastern Butler County, Ohio, United St...in Wayne Township. The population was 11,869 at the 2010 census., has type City/Town/Village

Using properties:
Postal codes (fb:location.citytown.postal_codes): part of City/Town/Village schema, links to type Postal Code

Example 3:
Question:
what is zip code for davenport iowa?

SPARQL:
SELECT DISTINCT ?x WHERE {
  FILTER ( ?x != fb:m.02d6c ) FILTER ( ! isLiteral( ?x ) || lang( ?x ) = '' || langMatches( lang( ?x ) , 'en' ) ) fb:m.02d6c fb:location.citytown.postal_codes ?x .
}

Using entities:
Davenport, also known as Davenport, Iowa, Scott County / Davenport city (fb:m.02d6c): Davenport is the largest city located along the Mississippi Rive... frequent flooding due to its location on the Mississippi River., has type City/Town/Village

Using properties:
Postal codes (fb:location.citytown.postal_codes): part of City/Town/Village schema, links to type Postal Code

[Tool]
Top 10 entity alternatives:
1. Trenton, also known as Trenton, NJ, Trenton, New Jersey, Mercer County / Trenton city (fb:m.0fvxz): Trenton is the capital city of the U.S. state of New Jersey and ...Trenton was formed within Trenton Township on November 13, 1792., has type City/Town/Village
2. Trenton, also known as Trenton, Michigan, Wayne County / Trenton city (fb:m.0vry4): Trenton is a small city in Wayne County in the southeast portion...m and was the first county park in Michigan, designated in 1919., has type City/Town/Village
3. Trenton, also known as Gilchrist County / Trenton city, Trenton, Florida (fb:m.0rksn): Trenton is a city in Gilchrist County, Florida, United States. T... as of April 1, 2008. It is the county seat of Gilchrist County., has type City/Town/Village
4. Trenton, also known as Trenton, Illinois, Clinton County / Trenton city (fb:m.0s4bc): Trenton is a town in Clinton County, Illinois, United States. The population was 3,184 at the 2010 census., has type City/Town/Village
5. Trenton, also known as Cache County / Trenton town, Trenton, Utah (fb:m.010dk_): Trenton is a town in Cache County, Utah, United States. The popu...included in the Logan, Utah-Idaho Metropolitan Statistical Area., has type City/Town/Village
6. Trenton, also known as Gibson County / Trenton city, Trenton, Tennessee (fb:m.0_txt): Trenton is a city in Gibson County, Tennessee. The population wa...is the county seat of Gibson County, and its third largest city., has type City/Town/Village
7. Trenton, also known as Dade County / Trenton city, Trenton, Georgia (fb:m.0rvq2): Trenton is a city in Dade County, Georgia, United States. Founde...50MPH hit the city, causing significant damage and loss of life., has type City/Town/Village
8. Trenton, also known as Edgefield County / Trenton town, Trenton, South Carolina (fb:m.0_lhg): Trenton is a town in Edgefield County, South Carolina, United St...00 census. It is part of the Augusta, Georgia metropolitan area., has type City/Town/Village
9. Trenton, also known as Trenton, Texas, Fannin County / Trenton city (fb:m.010123): Trenton is a city in Fannin County, Texas, United States. The population was 635 at the 2010 census., has type City/Town/Village
10. Trenton, also known as Butler County / Trenton city, Trenton, Ohio (fb:m.0ytcc): Trenton is a city in northeastern Butler County, Ohio, United St...in Wayne Township. The population was 11,869 at the 2010 census., has type City/Town/Village

[Tool]
Got 27 rows and 1 column, showing the first 5 and last 5 rows below:
| zip                  |
| -------------------- |
| 08628 (fb:m.0206ng_) |
| 08618 (fb:m.0206njw) |
| 08638 (fb:m.0206nlg) |
| 08610 (fb:m.0206qfx) |
| 08619 (fb:m.0206qgw) |
| ...                  |
| 08605 (fb:m.07nrtpr) |
| 08604 (fb:m.07nrtpz) |
| 08603 (fb:m.07nrtq5) |
| 08602 (fb:m.07nrtqd) |
| 08601 (fb:m.07nrtqm) |

[Tool] Stopped generation process