PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?movie ?movieLabel WHERE {
  ?movie wdt:P161 wd:Q169982 ; wdt:P31 / wdt:P279 * wd:Q11424 .
  OPTIONAL {
    ?movie rdfs:label ?movieLabel FILTER ( LANG( ?movieLabel ) = "en" )
  }
}

Got 53 rows and 2 columns, showing the first 5 and last 5 rows below:
| movie                             | movieLabel                |
| --------------------------------- | ------------------------- |
| Fast Food (wd:Q10280250)          | Fast Food (en)            |
| Copshop (wd:Q103822078)           | Copshop (en)              |
| Plane (wd:Q108131599)             | Plane (en)                |
| Kandahar (wd:Q111940088)          | Kandahar (en)             |
| Last Seen Alive (wd:Q112343991)   | Last Seen Alive (en)      |
| ...                               | ...                       |
| The Ugly Truth (wd:Q922630)       | The Ugly Truth (en)       |
| Reign of Fire (wd:Q925384)        | Reign of Fire (en)        |
| Gamer (wd:Q947885)                | Gamer (en)                |
| Law Abiding Citizen (wd:Q951071)  | Law Abiding Citizen (en)  |
| Butterfly on a Wheel (wd:Q967489) | Butterfly on a Wheel (en) |

Gerard Butler has been in movies such as Fast Food, Copshop, Plane, Kandahar, Last Seen Alive, The Game of Their Lives, Beowulf & Grendel, RocknRolla, The Ugly Truth, and Reign of Fire, among others.

[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:
wikidata at https://qlever.cs.uni-freiburg.de/api/wikidata

You can use the following SPARQL prefixes implicitly in all functions:
cc: <http://creativecommons.org/ns#
data: <https://www.wikidata.org/wiki/Special:EntityData/
dct: <http://purl.org/dc/terms/
geo: <http://www.opengis.net/ont/geosparql#
geof: <http://www.opengis.net/def/function/geosparql/
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/
qfn: <http://qlever.cs.uni-freiburg.de/function#
ql: <http://qlever.cs.uni-freiburg.de/builtin-functions/
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/
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#
foaf: <http://xmlns.com/foaf/0.1/
dc: <http://purl.org/dc/elements/1.1/
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
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 movies gerard butler has been in?

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

[Tool]
Example 1:
Question:
what films has gerard butler starred in?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?x wdt:P161 wd:Q169982 ; wdt:P31 / wdt:P279 * wd:Q11424 .
}

Using entities:
film, also known as cinematic work, moving picture, movie, motion pictures, motion picture (wd:Q11424): sequence of images that give the impression of movement, stored on film stock
Gerard Butler, also known as Gerard James Butler (wd:Q169982): Scottish actor and film producer (born 1969), television actor, film producer, stage actor, film actor, lawyer, actor

Using properties:
cast member, also known as feat., starring (film/play), film starring, starring, actor (wd:P161 as wdt): actor in the subject production [use "character role" (P453) and...use "recorded participant" (P11108) for non-fiction productions], significant person, performer
subclass of, also known as rdfs:subClassOf, sort of, subcategory of, subgenre of, subtype of (wd:P279 as wdt): this item is a subclass (subset) of that item; ALL instances of ...stance of volcanic landform); Everest is an instance of mountain
instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as wdt): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)

Example 2:
Question:
what movies did james franco play in?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?x wdt:P161 wd:Q306403 ; wdt:P31 / wdt:P279 * wd:Q11424 .
}

Using entities:
film, also known as cinematic work, moving picture, movie, motion pictures, motion picture (wd:Q11424): sequence of images that give the impression of movement, stored on film stock
James Franco, also known as James Edward Franco (wd:Q306403): television presenter, television actor, American actor, film producer, film director, screenwriter, film editor, film actor, playwright, teacher, writer, actor, poet

Using properties:
cast member, also known as feat., starring (film/play), film starring, starring, actor (wd:P161 as wdt): actor in the subject production [use "character role" (P453) and...use "recorded participant" (P11108) for non-fiction productions], significant person, performer
subclass of, also known as rdfs:subClassOf, sort of, subcategory of, subgenre of, subtype of (wd:P279 as wdt): this item is a subclass (subset) of that item; ALL instances of ...stance of volcanic landform); Everest is an instance of mountain
instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as wdt): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)

Example 3:
Question:
what are all the movies channing tatum has been in?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?x wdt:P161 wd:Q212064 ; wdt:P31 / wdt:P279 * wd:Q11424 .
}

Using entities:
film, also known as cinematic work, moving picture, movie, motion pictures, motion picture (wd:Q11424): sequence of images that give the impression of movement, stored on film stock
Channing Tatum, also known as Channing Matthew Tatum (wd:Q212064): American actor, dancer and model (born 1980), television actor, film director, film producer, voice actor, film actor, dancer, model, actor

Using properties:
cast member, also known as feat., starring (film/play), film starring, starring, actor (wd:P161 as wdt): actor in the subject production [use "character role" (P453) and...use "recorded participant" (P11108) for non-fiction productions], significant person, performer
subclass of, also known as rdfs:subClassOf, sort of, subcategory of, subgenre of, subtype of (wd:P279 as wdt): this item is a subclass (subset) of that item; ALL instances of ...stance of volcanic landform); Everest is an instance of mountain
instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as wdt): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)

[Assistant]
From the examples, the query to find movies Gerard Butler has been in involves:
- Using Gerard Butler's entity (wd:Q169982)
- Using the property "cast member" (wdt:P161)
- Filtering for instances of films (wd:Q11424)

I will now execute a query to get the movies Gerard Butler has been in.

[Tool]
Got 50 rows and 2 columns, showing the first 5 and last 5 rows below:
| movie                               | movieLabel                   |
| ----------------------------------- | ---------------------------- |
| Fast Food (wd:Q10280250)            | Fast Food (en)               |
| Copshop (wd:Q103822078)             | Copshop (en)                 |
| Plane (wd:Q108131599)               | Plane (en)                   |
| Kandahar (wd:Q111940088)            | Kandahar (en)                |
| Last Seen Alive (wd:Q112343991)     | Last Seen Alive (en)         |
| ...                                 | ...                          |
| The Game of Their Lives (wd:Q80437) | The Game of Their Lives (en) |
| Beowulf & Grendel (wd:Q818604)      | Beowulf & Grendel (en)       |
| RocknRolla (wd:Q898461)             | RocknRolla (en)              |
| The Ugly Truth (wd:Q922630)         | The Ugly Truth (en)          |
| Reign of Fire (wd:Q925384)          | Reign of Fire (en)           |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves movies where Gerard Butler (wd:Q169982) is a cast member (wdt:P161) and ensures the items are instances or subclasses of films (wd:Q11424). The query also optionally fetches English labels for better readability. The answer lists several movies from the query result, which is appropriate and informative. The query and answer follow the guidelines well, returning actual identifiers and labels without unnecessary complexity. No further refinement is needed.


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?language ?languageLabel WHERE {
  wd:Q145 wdt:P2936 ?language .
  OPTIONAL {
    ?language rdfs:label ?languageLabel FILTER ( LANG( ?languageLabel ) = "en" )
  }
}

Got 12 rows and 2 columns, showing the first 5 and last 5 rows below:
| language                    | languageLabel        |
| --------------------------- | -------------------- |
| Polari (wd:Q1359130)        | Polari (en)          |
| Scots (wd:Q14549)           | Scots (en)           |
| English (wd:Q1860)          | English (en)         |
| Welsh Romani (wd:Q2097387)  | Welsh Romani (en)    |
| Cornish (wd:Q25289)         | Cornish (en)         |
| ...                         | ...                  |
| Scottish Cant (wd:Q3915671) | Scottish Cant (en)   |
| Angloromani (wd:Q541279)    | Angloromani (en)     |
| Irish (wd:Q9142)            | Irish (en)           |
| Welsh (wd:Q9309)            | Welsh (en)           |
| Scottish Gaelic (wd:Q9314)  | Scottish Gaelic (en) |

The major languages spoken in the United Kingdom include English, Scots, Welsh, Scottish Gaelic, Irish, Cornish, Polari, Welsh Romani, Scottish Cant, and Angloromani among others.

[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:
wikidata at https://qlever.cs.uni-freiburg.de/api/wikidata

You can use the following SPARQL prefixes implicitly in all functions:
cc: <http://creativecommons.org/ns#
data: <https://www.wikidata.org/wiki/Special:EntityData/
dct: <http://purl.org/dc/terms/
geo: <http://www.opengis.net/ont/geosparql#
geof: <http://www.opengis.net/def/function/geosparql/
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/
qfn: <http://qlever.cs.uni-freiburg.de/function#
ql: <http://qlever.cs.uni-freiburg.de/builtin-functions/
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/
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#
foaf: <http://xmlns.com/foaf/0.1/
dc: <http://purl.org/dc/elements/1.1/
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
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 are the major languages spoken in the united kingdom?

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

[Tool]
Example 1:
Question:
what language is mainly spoken in england?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q21 wdt:P2936 ?x .
}

Using entities:
England, also known as England, United Kingdom, England, UK, ENG (wd:Q21): country in north-west Europe, part of the United Kingdom

Using properties:
language used, also known as languages used, medium of instruction, used language, uses language, working language (wd:P2936 as wdt): language widely used (spoken or written) in this place or at this event or organisation

Example 2:
Question:
what are the major religions in uk?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q145 wdt:P140 ?x .
}

Using entities:
United Kingdom, also known as U.K., UK, U. K., U K, United Kingdom of Great Britain and Northern Ireland (wd:Q145): country in north-west Europe

Using properties:
religion or worldview, also known as believes, worldview, religious affiliation, religion or world view, religion (wd:P140 as wdt): religion of a person, organization or religious building, or associated with this subject

Example 3:
Question:
which countries speak english?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?x wdt:P37 wd:Q1860 ; wdt:P31 / wdt:P279 * wd:Q6256 .
}

Using entities:
English, also known as English (language), The English language, English the Global Language, English-language, English language (wd:Q1860): West Germanic language
country, also known as countries (wd:Q6256): distinct territorial body or political entity

Using properties:
subclass of, also known as rdfs:subClassOf, sort of, subcategory of, subgenre of, subtype of (wd:P279 as wdt): this item is a subclass (subset) of that item; ALL instances of ...stance of volcanic landform); Everest is an instance of mountain
instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as wdt): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)
official language, also known as language spoken, spoken in, speaking, language official (wd:P37 as wdt): language designated as official by this item, language used

[Assistant]
From the similar examples, we see that the property "language used" (wdt:P2936) is used to find languages spoken in a place. The entity for the United Kingdom is wd:Q145.

I will now write a SPARQL query to get the major languages spoken in the United Kingdom using the property wdt:P2936. I will also try to get the labels of the languages for better readability.

[Tool]
Got 12 rows and 2 columns, showing the first 5 and last 5 rows below:
| language                    | languageLabel        |
| --------------------------- | -------------------- |
| Polari (wd:Q1359130)        | Polari (en)          |
| Scots (wd:Q14549)           | Scots (en)           |
| English (wd:Q1860)          | English (en)         |
| Welsh Romani (wd:Q2097387)  | Welsh Romani (en)    |
| Cornish (wd:Q25289)         | Cornish (en)         |
| ...                         | ...                  |
| Scottish Cant (wd:Q3915671) | Scottish Cant (en)   |
| Angloromani (wd:Q541279)    | Angloromani (en)     |
| Irish (wd:Q9142)            | Irish (en)           |
| Welsh (wd:Q9309)            | Welsh (en)           |
| Scottish Gaelic (wd:Q9314)  | Scottish Gaelic (en) |

[Assistant]
The major languages spoken in the United Kingdom include English, Scots, Welsh, Scottish Gaelic, Irish, Cornish, Polari, Welsh Romani, Scottish Cant, and Angloromani among others.

I will now finalize the answer with the SPARQL query and the list of major languages.

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves the major languages spoken in the United Kingdom using the property 'language used' (wdt:P2936) for the entity United Kingdom (wd:Q145). The query returns the language identifiers and their English labels, which matches the user's question. The answer lists the languages found in the query result, which is complete and relevant. The query follows the rules by returning identifiers and labels in an optional clause. No further refinement is necessary.


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?causeOfDeath ?causeOfDeathLabel WHERE {
  wd:Q40933 wdt:P509 ?causeOfDeath .
  OPTIONAL {
    ?causeOfDeath rdfs:label ?causeOfDeathLabel FILTER ( LANG( ?causeOfDeathLabel ) = "en" )
  }
}

Got 1 row and 2 columns:
| causeOfDeath                       | causeOfDeathLabel          |
| ---------------------------------- | -------------------------- |
| cervix uterine cancer (wd:Q160105) | cervix uterine cancer (en) |

Eva Peron died from cervix uterine cancer.

[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:
wikidata at https://qlever.cs.uni-freiburg.de/api/wikidata

You can use the following SPARQL prefixes implicitly in all functions:
cc: <http://creativecommons.org/ns#
data: <https://www.wikidata.org/wiki/Special:EntityData/
dct: <http://purl.org/dc/terms/
geo: <http://www.opengis.net/ont/geosparql#
geof: <http://www.opengis.net/def/function/geosparql/
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/
qfn: <http://qlever.cs.uni-freiburg.de/function#
ql: <http://qlever.cs.uni-freiburg.de/builtin-functions/
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/
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#
foaf: <http://xmlns.com/foaf/0.1/
dc: <http://purl.org/dc/elements/1.1/
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
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 type of cancer did eva peron die from?

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

[Tool]
Example 1:
Question:
what type of cancer did donna summer died from?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q908933 wdt:P509 ?x .
}

Using entities:
Donna Summer, also known as Donna Sommer, LaDonna Gaines (wd:Q908933): American singer (1948–2012), recording artist, songwriter, musician, composer, singer, actor

Using properties:
cause of death, also known as death cause, murder method, method of murder, die of, die from (wd:P509 as wdt): underlying or immediate cause of death.  Underlying cause (e.g. ...adest category, e.g. natural causes, accident, homicide, suicide

Example 2:
Question:
what cancer did audrey hepburn died of?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q42786 wdt:P509 ?x .
}

Using entities:
Audrey Hepburn, also known as Edda Kathleen Ruston, Audrey Kathleen Ruston, Edda van Heemstra, Audrey Kathleen Hepburn-Ruston (wd:Q42786): British actress (1929–1993), philanthropist, ballet dancer, humanitarian, stage actor, film actor, dancer, actor, model

Using properties:
cause of death, also known as death cause, murder method, method of murder, die of, die from (wd:P509 as wdt): underlying or immediate cause of death.  Underlying cause (e.g. ...adest category, e.g. natural causes, accident, homicide, suicide

Example 3:
Question:
what type of cancer did huell howser die of?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q2837916 wdt:P509 ?x .
}

Using entities:
Huell Howser, also known as Huel Howser, Huel Burnley Howser (wd:Q2837916): American television personality (1945-2013), television presenter, television actor, screenwriter, voice actor, film actor

Using properties:
cause of death, also known as death cause, murder method, method of murder, die of, die from (wd:P509 as wdt): underlying or immediate cause of death.  Underlying cause (e.g. ...adest category, e.g. natural causes, accident, homicide, suicide

[Assistant]
From the similar examples, the property "cause of death" (wdt:P509) is used to find the type of cancer or cause of death for a person. The entity for Eva Peron needs to be identified first, then we can query the cause of death for her.

Next, I will search for the entity "Eva Peron" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. Eva Perón, also known as Evita Perón, Maria Eva Duarte de Peron, Evita, María Eva Duarte de Perón, Maria Eva Duarte Peron (wd:Q40933): Argentine actress and politician (1919–1952), women's rights activist, trade unionist, stage actor, suffragist, politician, film actor
2. Eva Perón: The True Story, also known as Eva Peron, Eva Perón (wd:Q953441): 1996 film by Juan Carlos Desanzo
3. Fray Luis Beltrán, also known as Eva Perón, Eva Perón tanker, Fray Luis Beltrán tanker (wd:Q113059537): tanker
4. Eva Perón (wd:Q113030601): tanker
5. Hospital Lagomarsino, also known as Eva Perón (wd:Q5902632): hospital in Merlo, Buenos Aires
6. Uruguay, also known as Eva Perón (wd:Q113330807): 1951 passenger ship
7. Eva Perón (wd:Q47512378): painting by Boris Chaliapin
8. Estadio Eva Perón, also known as Estadio Eva Peron (wd:Q5400194): football stadium in Junín, Argentina
9. Puerto Eva Perón (wd:Q972928): ciudad en la provincia de Chaco, Argentina
10. Eva Perón Foundation (wd:Q2004004): former Argentine foundation

[Assistant] The entity for Eva Peron is wd:Q40933 (Eva Perón, Argentine actress and politician 1919–1952). Now I will query the cause of death (property wdt:P509) for Eva Perón.

[Tool]
Got 1 row and 2 columns:
| causeOfDeath                       | causeOfDeathLabel          |
| ---------------------------------- | -------------------------- |
| cervix uterine cancer (wd:Q160105) | cervix uterine cancer (en) |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves the cause of death for Eva Peron using the property 'cause of death' (wdt:P509). The result 'cervix uterine cancer' matches the answer provided. The query also optionally retrieves the English label for readability. The output is accurate, complete, and follows the rules for SPARQL queries. No further refinement is necessary.


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?language ?languageLabel WHERE {
  wd:Q408 wdt:P37 ?language .
  OPTIONAL {
    ?language rdfs:label ?languageLabel FILTER ( LANG( ?languageLabel ) = "en" )
  }
}

Got 2 rows and 2 columns:
| language                       | languageLabel           |
| ------------------------------ | ----------------------- |
| Auslan (wd:Q29525)             | Auslan (en)             |
| Australian English (wd:Q44679) | Australian English (en) |

People in Australia speak languages including Australian English and Auslan.

[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:
wikidata at https://qlever.cs.uni-freiburg.de/api/wikidata

You can use the following SPARQL prefixes implicitly in all functions:
cc: <http://creativecommons.org/ns#
data: <https://www.wikidata.org/wiki/Special:EntityData/
dct: <http://purl.org/dc/terms/
geo: <http://www.opengis.net/ont/geosparql#
geof: <http://www.opengis.net/def/function/geosparql/
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/
qfn: <http://qlever.cs.uni-freiburg.de/function#
ql: <http://qlever.cs.uni-freiburg.de/builtin-functions/
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/
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#
foaf: <http://xmlns.com/foaf/0.1/
dc: <http://purl.org/dc/elements/1.1/
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
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 in australia speak?

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

[Tool]
Example 1:
Question:
what language does people speak in australia?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q408 wdt:P37 ?x .
}

Using entities:
Australia, also known as AU, The Commonwealth of Australia, Stria, Straya, Stralia (wd:Q408): country in Oceania

Using properties:
official language, also known as language spoken, spoken in, speaking, language official (wd:P37 as wdt): language designated as official by this item, language used

Example 2:
Question:
what language do australian people speak?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q408 wdt:P37 ?x .
}

Using entities:
Australia, also known as AU, The Commonwealth of Australia, Stria, Straya, Stralia (wd:Q408): country in Oceania

Using properties:
official language, also known as language spoken, spoken in, speaking, language official (wd:P37 as wdt): language designated as official by this item, language used

Example 3:
Question:
what do people in south africa speak?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q258 wdt:P37 ?x .
}

Using entities:
South Africa, also known as zaf, R.S.A., za, RSA, SA (wd:Q258): country in southern Africa

Using properties:
official language, also known as language spoken, spoken in, speaking, language official (wd:P37 as wdt): language designated as official by this item, language used

[Assistant] From the similar examples, it is clear that the property for the language spoken in a country is wdt:P37 (official language). The entity for Australia is wd:Q408. I will now write a SPARQL query to get the languages spoken in Australia using this property and entity.

[Tool]
Got 2 rows and 2 columns:
| language                       | languageLabel           |
| ------------------------------ | ----------------------- |
| Auslan (wd:Q29525)             | Auslan (en)             |
| Australian English (wd:Q44679) | Australian English (en) |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves the languages spoken in Australia by using the property for official language (wdt:P37) on the entity Australia (wd:Q408). The result includes both Australian English and Auslan, which matches the answer provided. The query also optionally retrieves English labels for readability. The answer is accurate and complete for the question asked.


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?currency ?currencyLabel WHERE {
  wd:Q38 wdt:P38 ?currency .
  OPTIONAL {
    ?currency rdfs:label ?currencyLabel FILTER ( LANG( ?currencyLabel ) = "en" )
  }
}

Got 1 row and 2 columns:
| currency        | currencyLabel |
| --------------- | ------------- |
| Euro (wd:Q4916) | euro (en)     |

The money used in Italy is called the Euro.

[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:
wikidata at https://qlever.cs.uni-freiburg.de/api/wikidata

You can use the following SPARQL prefixes implicitly in all functions:
cc: <http://creativecommons.org/ns#
data: <https://www.wikidata.org/wiki/Special:EntityData/
dct: <http://purl.org/dc/terms/
geo: <http://www.opengis.net/ont/geosparql#
geof: <http://www.opengis.net/def/function/geosparql/
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/
qfn: <http://qlever.cs.uni-freiburg.de/function#
ql: <http://qlever.cs.uni-freiburg.de/builtin-functions/
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/
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#
foaf: <http://xmlns.com/foaf/0.1/
dc: <http://purl.org/dc/elements/1.1/
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
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 money called in italy?

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

[Tool]
Example 1:
Question:
what money do they have in italy?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q38 wdt:P38 ?x .
}

Using entities:
Italy, also known as Italia, Republic of Italy, Repubblica Italiana, Italian Republic, ITA (wd:Q38): country in Southern Europe

Using properties:
currency, also known as base currency, used money (wd:P38 as wdt): currency used by item, uses

Example 2:
Question:
what currency should i bring to italy?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q38 wdt:P38 ?x .
}

Using entities:
Italy, also known as Italia, Republic of Italy, Repubblica Italiana, Italian Republic, ITA (wd:Q38): country in Southern Europe

Using properties:
currency, also known as base currency, used money (wd:P38 as wdt): currency used by item, uses

Example 3:
Question:
what is the money called in spain?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q29 wdt:P38 ?x .
}

Using entities:
Spain, also known as Kingdom of Spain (wd:Q29): country in southwestern Europe with territories in Africa

Using properties:
currency, also known as base currency, used money (wd:P38 as wdt): currency used by item, uses

[Assistant]
From the examples, the property "currency" (wdt:P38) is used to find the money used in a country. Italy is represented by wd:Q38. So, to answer the question "what is money called in Italy?", we can query the currency used by Italy using the property wdt:P38.

I will now write and execute a SPARQL query to get the currency used in Italy.

[Tool]
Got 1 row and 2 columns:
| currency        | currencyLabel |
| --------------- | ------------- |
| Euro (wd:Q4916) | euro (en)     |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves the currency used in Italy by querying the property 'currency' (wdt:P38) for the entity Italy (wd:Q38). The query returns the currency identifier and its English label, which is 'Euro'. The answer provided is accurate and complete, matching the query result. No further refinement is necessary.


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?wife ?wifeLabel WHERE {
  wd:Q34969 wdt:P26 ?wife .
  OPTIONAL {
    ?wife rdfs:label ?wifeLabel FILTER ( LANG( ?wifeLabel ) = "en" )
  }
}

The name of Benjamin Franklin's wife was Deborah Read Franklin.

[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:
wikidata at https://qlever.cs.uni-freiburg.de/api/wikidata

You can use the following SPARQL prefixes implicitly in all functions:
cc: <http://creativecommons.org/ns#
data: <https://www.wikidata.org/wiki/Special:EntityData/
dct: <http://purl.org/dc/terms/
geo: <http://www.opengis.net/ont/geosparql#
geof: <http://www.opengis.net/def/function/geosparql/
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/
qfn: <http://qlever.cs.uni-freiburg.de/function#
ql: <http://qlever.cs.uni-freiburg.de/builtin-functions/
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/
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#
foaf: <http://xmlns.com/foaf/0.1/
dc: <http://purl.org/dc/elements/1.1/
gn: <http://www.geonames.org/ontology#
bd: <http://www.bigdata.com/rdf#
hint: <http://www.bigdata.com/queryHints#
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 name of benjamin franklin wife?

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

[Tool]
Example 1:
Question:
where did benjamin franklin died?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q34969 wdt:P20 ?x .
}

Using entities:
Benjamin Franklin, also known as The First American, Silence Dogood, Poor Richard, Ben Franklin, Franklin (wd:Q34969): American polymath and statesman (1706–1790), politician, polymath, diplomat, writer

Using properties:
place of death, also known as POD, location of death, killed in, deathplace, died in (wd:P20 as wdt): most specific known (e.g. city instead of country, or hospital i... city) death location of a person, animal or fictional character, location

Example 2:
Question:
what was one of benjamin franklin's inventions?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?x wdt:P61 wd:Q34969 .
}

Using entities:
Benjamin Franklin, also known as The First American, Silence Dogood, Poor Richard, Ben Franklin, Franklin (wd:Q34969): American polymath and statesman (1706–1790), politician, polymath, diplomat, writer

Using properties:
discoverer or inventor, also known as inventor or discoverer, inventor, invented by, invented, introduced by (wd:P61 as wdt): subject who discovered, first described, invented, or developed this discovery or invention or scientific hypothesis or theory

Example 3:
Question:
what was lincoln's wife's name?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q91 wdt:P26 ?x .
}

Using entities:
Abraham Lincoln, also known as President Lincoln, Uncle Abe, Honest Abe, Abe Lincoln (wd:Q91): president of the United States from 1861 to 1865, military officer, statesperson, postmaster, politician, farmer, writer, lawyer

Using properties:
spouse, also known as married partner, married to, marry, partner, spouses (wd:P26 as wdt): the subject has the object as their spouse (husband, wife, partn...etc.). Use "unmarried partner" (P451) for non-married companions, significant person, relative

[Assistant] From the similar examples, I see that the property for spouse or wife is wdt:P26. Benjamin Franklin is wd:Q34969 in Wikidata. I will now write a query to get the spouse (wife) of Benjamin Franklin using this property.

[Tool]
Got 1 row and 2 columns:
| wife                                | wifeLabel                  |
| ----------------------------------- | -------------------------- |
| Deborah Read Franklin (wd:Q3020859) | Deborah Read Franklin (en) |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves the wife of Benjamin Franklin using the spouse property (wdt:P26) and includes an optional label in English. The answer 'Deborah Read Franklin' matches the query result and is accurate. The query follows the rules by returning the actual identifier and an optional label. No further refinement is necessary.