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

Got 9 rows and 2 columns:
| language               | languageLabel  |
| ---------------------- | -------------- |
| Arabic (wd:Q13955)     | Arabic (en)    |
| Nuristani (wd:Q161804) | Nuristani (en) |
| Pamir (wd:Q1772864)    | Pamir (en)     |
| Dari (wd:Q178440)      | Dari (en)      |
| Balochi (wd:Q33049)    | Balochi (en)   |
| Pashayi (wd:Q36670)    | Pashayi (en)   |
| Pashto (wd:Q58680)     | Pashto (en)    |
| Uzbek (wd:Q9264)       | Uzbek (en)     |
| Turkmen (wd:Q9267)     | Turkmen (en)   |

The two main languages spoken by most people in Afghanistan are Dari and Pashto. These are also official languages of the country. While Afghanistan has several official languages, Dari and Pashto are the predominant languages spoken by the majority of the population.

[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-sebastian

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 language do most people speak in afghanistan?

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

[Tool]
Example 1:
Question:
what songs does katherine jenkins sing?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?x wdt:P175 wd:Q272581 .
}

Using entities:
Katherine Jenkins, also known as Katherine Maria Jenkins, Catherine Maria Jenkins (wd:Q272581): Welsh classical crossover singer, opera singer, music artist

Using properties:
performer, also known as actor, sung by, singer, recording by, recorded by (wd:P175 as wdt): actor, musician, band or other performer associated with this role or musical work, contributor to the creative work or subject

Example 2:
Question:
where did robbie hummel go to high school?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q1571580 wdt:P69 ?x .
  ?x wdt:P31 / wdt:P279 * wd:Q9826 .
}

Using entities:
Robbie Hummel, also known as Robert John Hummel (wd:Q1571580): American basketball player, basketball player
high school, also known as H.S., upper middle school, senior high school, HS (wd:Q9826): institution which provides all or part of secondary education

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)
educated at, also known as graduated from, graduate of, place of education, school attended, schooled at (wd:P69 as wdt): educational institution attended by subject, affiliation

Example 3:
Question:
what religions are in russia?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q159 wdt:P3075 ?x .
}

Using entities:
Russia, also known as Russian Federation, RUS, RU, RF, ISO 3166-1:RU (wd:Q159): country in Eastern Europe and Northern Asia

Using properties:
official religion, also known as established religion, state religion (wd:P3075 as wdt): official religion in this administrative entity

[Assistant]
The question is about the language most people speak in Afghanistan. We need to find the entity for Afghanistan and then find the property that indicates the most spoken language or official languages spoken by the population.

Step 1: Search for the entity "Afghanistan" in Wikidata.
Step 2: Search for properties related to languages spoken in Afghanistan.
Step 3: Construct a SPARQL query to get the most spoken language(s) in Afghanistan.

Let's start with step 1 and search for the entity "Afghanistan".

[Tool]
Top 10 entity alternatives:
1. Afghanistan, also known as Afghaunistaun, Afghaunistan, Afghanisthan, Affghaunistan, Afghania (wd:Q889): country in Central and South Asia
2. Afghanistan, also known as Affghanistan, Affghanisthan, Afghaunistaun, Affghaunistan, Afghania (wd:Q889): country in Central and South Asia
3. Kingdom of Afghanistan, also known as Afghanistan, Afghan Kingdom (wd:Q1138904): kingdom in Central Asia between 1926–1973
4. Afghanistan (wd:Q50172288): scientific article published in May 1983
5. Afghanistan (wd:Q47409831): scientific article published in July 1986
6. Afghanistan (wd:Q27715795): journal
7. Afghanistan (wd:Q124440154): journal article from 'Ethnohistory' published in 1973
8. Afghanistan (wd:Q119628112): painting by James Hart Dyke (b.1966), The Black Watch Castle & Museum
9. Afghanistan (wd:Q119441439): painting by Wilhelmina Barns-Graham (1912–2004), Wilhelmina Barns-Graham Trust
10. Afghanistan (wd:Q103889244): encyclopedia article

[Assistant] The entity for the country Afghanistan is wd:Q889. Next, I will search for properties related to languages spoken in Afghanistan. I will search for properties of the entity Afghanistan with a query related to language.

[Tool]
Top 10 property alternatives:
1. official language, also known as language spoken, spoken in, speaking, language official (wd:P37 as p/wdt): language designated as official by this item, language used
2. language used, also known as languages used, medium of instruction, used language, uses language, working language (wd:P2936 as p/wdt): language widely used (spoken or written) in this place or at this event or organisation
3. instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as p/wdt): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)
4. native label, also known as official title, original label, original language label, original language name, original language title (wd:P1705 as p/wdt): label for the items in their official language  or their original language, name
5. culture, also known as archaeological culture, civilisation, civilization (wd:P2596 as p/wdt): human culture or people (or several cultures) associated with this item, part of
6. ethnic group, also known as ethnic or cultural origin, tribal affiliation, race, people, ethnicity (wd:P172 as p/wdt): subject's ethnicity (consensus is that a VERY high standard of p...agreed on by scholars, or 3) is fictional and portrayed as such)
7. country, also known as sovereign state, state, land, host country (wd:P17 as p/wdt): sovereign state that this item is in (not to be used for human beings), located in the administrative territorial entity
8. described by source, also known as mentioned in, source of item, reviewed in, mentioned in news article, talked about in (wd:P1343 as p/wdt): work where this item is described, attested in
9. Libraries Australia ID, also known as CNLKIN, NLA Kinetica Service identifier, NLA (Australia) identifier, NLA (Australia) ID, Libraries Australia identifier (wd:P409 as p/wdt): identifier issued by the National Library of Australia (see also...F component. Format: 1-12 digits, removing leading zero-padding.
10. Unicode character, also known as emoji, emote, pictograph, Unicode symbol (wd:P487 as p/wdt): Unicode character representing the item (only if this is not a c...acter or a compatiblity character: in that case, use only P4213)

No other items found

[Assistant]
The relevant properties related to language for Afghanistan are:
- official language (wdt:P37)
- language used (wdt:P2936)

To answer the question about the language most people speak in Afghanistan, the "official language" property is likely the most relevant. However, to be more comprehensive, we can also consider "language used."

Next, I will construct a SPARQL query to get the official languages and languages used in Afghanistan.

[Tool]
SPARQL execution failed:
Invalid SPARQL query: The target variable ?language of an AS clause was already used before in the query body.

[Assistant]
The SPARQL query failed because I used the same variable name ?language in the BIND clause which was already used before. I will fix the query by using a different variable name for the BIND result. Also, I realize that the OPTIONAL clause is not correctly used to combine the two properties. I will instead query both properties separately and return their values distinctly.

I will now fix and re-execute the query.

[Tool]
Got 44 rows and 2 columns, showing the first 5 and last 5 rows below:
| lang                            | langLabel             |
| ------------------------------- | --------------------- |
| Southern Uzbek (wd:Q1066787)    | Southern Uzbek (en)   |
| Kamviri (wd:Q1193495)           | Kamviri (en)          |
| Northern Pashto (wd:Q12642194)  | Northern Pashto (en)  |
| Northeast Pashai (wd:Q12642198) | Northeast Pashai (en) |
| Warduji (wd:Q12645075)          | Warduji (en)          |
| ...                             | ...                   |
| Tajiki Arabic (wd:Q56833)       | Tajiki Arabic (en)    |
| Pashto (wd:Q58680)              | Pashto (en)           |
| Pahlavni (wd:Q7124567)          | Pahlavni (en)         |
| Uzbek (wd:Q9264)                | Uzbek (en)            |
| Turkmen (wd:Q9267)              | Turkmen (en)          |

[Assistant]
The query returned many languages spoken or used in Afghanistan, including Pashto, Uzbek, Turkmen, and others. To answer the question about the language most people speak, we should focus on the most widely spoken or official languages.

I will now refine the query to get the population percentage or rank of these languages spoken in Afghanistan if available, or check if there is a property indicating the most spoken language.

[Tool]
Top 10 property alternatives:
1. official language, also known as language spoken, spoken in, speaking, language official (wd:P37 as p/wdt): language designated as official by this item, language used
2. language used, also known as languages used, medium of instruction, used language, uses language, working language (wd:P2936 as p/wdt): language widely used (spoken or written) in this place or at this event or organisation
3. native label, also known as official title, original label, original language label, original language name, original language title (wd:P1705 as p/wdt): label for the items in their official language  or their original language, name
4. literacy rate, also known as percentage of literate population, literate population (%) (wd:P6897 as p/wdt): percentage of the population that is not illiterate
5. country, also known as sovereign state, state, land, host country (wd:P17 as p/wdt): sovereign state that this item is in (not to be used for human beings), located in the administrative territorial entity
6. pronunciation audio, also known as listen, audio pronunciation (wd:P443 as p/wdt): audio file with pronunciation, audio
7. coordinates of easternmost point, also known as coordinate of easternmost point, easterly, easternmost point coordinates, extreme point east, farthest east (wd:P1334 as p/wdt): easternmost point of a location
8. France 24 topic ID (Spanish), also known as France 24 ID (wd:P9348 as p/wdt): identifier of a topic on the Spanish version of the France 24 website
9. ethnic group, also known as ethnic or cultural origin, tribal affiliation, race, people, ethnicity (wd:P172 as p/wdt): subject's ethnicity (consensus is that a VERY high standard of p...agreed on by scholars, or 3) is fictional and portrayed as such)
10. demographics of topic, also known as demography of topic (wd:P9241 as p/wdt): item that deals with demographics of the subject

No other items found

[Assistant]
There is no direct property for "most spoken language" in Afghanistan. The best available properties are "official language" (wdt:P37) and "language used" (wdt:P2936).

Since the question asks for the language most people speak, it is likely referring to the most widely spoken language, which is often one of the official languages.

I will now check the official languages of Afghanistan with their population ranks or descriptions to identify the most spoken language. I will query the official languages and try to get any qualifiers or descriptions that indicate their prominence.

[Tool]
SPARQL execution failed:
HTTPSConnectionPool(host='qlever.cs.uni-freiburg.de', port=443): Read timed out. (read timeout=30)

[Assistant]
The query to get qualifiers for official languages timed out, possibly due to complexity or endpoint issues. I will simplify the query to just get the official languages of Afghanistan with their English labels.

Then, I will check if the returned languages include the most spoken ones like Pashto and Dari (Persian).

[Tool]
Got 9 rows and 2 columns:
| language               | languageLabel  |
| ---------------------- | -------------- |
| Arabic (wd:Q13955)     | Arabic (en)    |
| Nuristani (wd:Q161804) | Nuristani (en) |
| Pamir (wd:Q1772864)    | Pamir (en)     |
| Dari (wd:Q178440)      | Dari (en)      |
| Balochi (wd:Q33049)    | Balochi (en)   |
| Pashayi (wd:Q36670)    | Pashayi (en)   |
| Pashto (wd:Q58680)     | Pashto (en)    |
| Uzbek (wd:Q9264)       | Uzbek (en)     |
| Turkmen (wd:Q9267)     | Turkmen (en)   |

[Assistant]
The official languages of Afghanistan include Dari and Pashto among others. Dari and Pashto are known to be the two most widely spoken languages in Afghanistan.

To answer the question "what language do most people speak in Afghanistan?", the answer would be Dari and Pashto as the primary languages spoken by most people.

I will now provide the final SPARQL query and answer.

[Tool] Stopped generation process

[User]
Feedback (status=refine):
The SPARQL query correctly retrieves the official languages of Afghanistan, but the answer could be improved by specifying which languages are most widely spoken rather than listing all official languages. Dari and Pashto are indeed the most spoken languages, but the query result includes many other official languages without indicating their prevalence. To refine, consider adding information or filtering to highlight the most spoken languages or clarify that the query returns all official languages, not necessarily the most spoken ones.

[Assistant] Thank you for the feedback. To improve the answer, I will clarify that Dari and Pashto are the two most widely spoken languages in Afghanistan, even though there are several official languages. The SPARQL query will remain the same as it retrieves all official languages, but the answer will explicitly highlight Dari and Pashto as the predominant languages spoken by most people.

[Tool] Stopped generation process

[User]
Feedback (status=refine):
The SPARQL query correctly retrieves the official languages of Afghanistan, but the answer could be improved by explicitly stating that Dari and Pashto are the two most widely spoken languages, as the user asked for the language most people speak. The query currently returns all official languages without indicating which are the most spoken. To better answer the question, the query or answer should highlight Dari and Pashto as the primary languages spoken by most people in Afghanistan. Additionally, the answer should clarify that these are the main languages spoken, not just official languages.

[Assistant] To address the feedback, I will explicitly mention in the answer that Dari and Pashto are the two main languages spoken by most people in Afghanistan. Since there is no direct property for "most spoken language," the query will remain the same to retrieve official languages, but the answer will clearly highlight Dari and Pashto as the primary spoken languages, not just official ones. This will better align the answer with the user's question.

[Tool] Stopped generation process


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

Got 1 row and 2 columns:
| placeOfBirth         | placeOfBirthLabel |
| -------------------- | ----------------- |
| Lynwood (wd:Q849619) | Lynwood (en)      |

Venus Williams was born in Lynwood.

[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-sebastian

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] where did venus williams come from?

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

[Tool]
Example 1:
Question:
what is anderson silva trained in?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q356871 wdt:P106 ?x .
}

Using entities:
Anderson Silva (wd:Q356871): Brazilian mixed martial artist, mixed martial arts fighter, taekwondo athlete, Thai boxer, judoka, boxer

Using properties:
occupation, also known as job, work, vocation, profession, employment (wd:P106 as wdt): occupation of a person; see also "field of work" (Property:P101), "position held" (Property:P39)

Example 2:
Question:
where did justin bieber grew up?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q34086 wdt:P19 ?x .
}

Using entities:
Justin Bieber, also known as Justin Drew Bieber (wd:Q34086): Canadian singer (born 1994), musician

Using properties:
place of birth, also known as POB, location of birth, location born, born in, birthplace (wd:P19 as wdt): most specific known birth location of a person, animal or fictional character, location

Example 3:
Question:
in what country is amsterdam?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q727 wdt:P17 ?x .
}

Using entities:
Amsterdam, also known as Amsterdam, Netherlands, Amsterdam, NL, A'dam, Amsterdam, North Holland, Mokum (wd:Q727): capital and most populous city of the Netherlands

Using properties:
country, also known as sovereign state, state, land, host country (wd:P17 as wdt): sovereign state that this item is in (not to be used for human beings), located in the administrative territorial entity

[Assistant]
The question "where did Venus Williams come from?" is asking about the place of origin or birthplace of Venus Williams. From the examples, we see that the property "place of birth" (wdt:P19) is used to find where a person was born.

Next, I will search for the entity "Venus Williams" in Wikidata to get her identifier.

[Tool]
Top 10 entity alternatives:
1. Venus Williams, also known as Venus Ebony Starr Williams (wd:Q11578): American tennis player (born 1980), tennis player, entrepreneur, writer
2. B. Venus Williams (wd:Q102291516): Ph.D. Dartmouth College 2005
3. Williams sisters, also known as Venus and Serena Williams (wd:Q1180052): doubles partnership between Venus and Serena Williams
4. Venus Williams career statistics (wd:Q7920613)
5. 2014 Venus Williams tennis season (wd:Q16960857)
6. Venus Williams at 2009 US Open (wd:Q124025673)
7. Venus Williams at the 2013 US Open (wd:Q124025332)
8. Venus, also known as Planet Venus, Sol II, Sol 2, ♀ (wd:Q313): planet second-closest to the Sun in the Solar System
9. Venus, also known as ♀, Planet Venus, Sol 2, Sol II (wd:Q313): planet second-closest to the Sun in the Solar System
10. Venus (wd:Q47652): Roman goddess of love, sexuality, procreation and pleasure

[Assistant] The entity for Venus Williams is wd:Q11578. Now I will query the place of birth (wdt:P19) for Venus Williams.

[Tool]
Got 1 row and 2 columns:
| placeOfBirth         | placeOfBirthLabel |
| -------------------- | ----------------- |
| Lynwood (wd:Q849619) | Lynwood (en)      |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves the place of birth of Venus Williams using the property P19 (place of birth). The query also optionally retrieves the English label of the place, which is Lynwood. The answer given is accurate and complete based on the query result. The query follows the rules by returning the identifier and label, and no further refinement is necessary.


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

Got 3 rows and 2 columns:
| formOfGovernment                    | formOfGovernmentLabel        |
| ----------------------------------- | ---------------------------- |
| parliamentary system (wd:Q166747)   | parliamentary system (en)    |
| constitutional monarchy (wd:Q41614) | constitutional monarchy (en) |
| federation (wd:Q43702)              | federation (en)              |

Canada has a form of government that is a parliamentary system, a constitutional monarchy, and a federation.

[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-sebastian

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 form of government does canada?

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

[Tool]
Example 1:
Question:
where is george bush from?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q207 wdt:P19 ?x .
}

Using entities:
George W. Bush, also known as GWB, POTUS 43, George Bush, President Bush, Bush Jr. (wd:Q207): President of the United States from 2001 to 2009, motivational speaker, rugby union player, military officer, autobiographer, businessperson, statesperson, politician, financier, painter

Using properties:
place of birth, also known as POB, location of birth, location born, born in, birthplace (wd:P19 as wdt): most specific known birth location of a person, animal or fictional character, location

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 college did matt lauer attend?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q1100609 wdt:P69 ?x .
  ?x wdt:P31 / wdt:P279 * wd:Q38723 .
}

Using entities:
Matt Lauer, also known as Matthew Todd Lauer (wd:Q1100609): former American journalist, television presenter, news presenter, journalist, actor
higher education institution, also known as HEI, Higher Education school, institution of higher education, Superior Institute (wd:Q38723): institution that provides higher education (e.g., universities, ...es, liberal arts colleges, institutes of technology, and others)

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)
educated at, also known as graduated from, graduate of, place of education, school attended, schooled at (wd:P69 as wdt): educational institution attended by subject, affiliation

[Assistant]
The examples show how to query for properties of an entity. In this case, we want to find the form of government of Canada.

Step 1: Search for the entity "Canada" in Wikidata to get its identifier.
Step 2: Search for properties related to "form of government" for the entity Canada.
Step 3: Query the form of government of Canada using the identified property.

Let's start with step 1 and search for the entity "Canada".

[Tool]
Top 10 entity alternatives:
1. Canada, also known as CA, CAN, Dominion of Canada, ISO 3166-1:CA (wd:Q16): country in North America
2. La Canyada, also known as Cañada (wd:Q1553440): municipality of Spain
3. Province of Canada, also known as British Canada, Canada, United Canadas, United Province of Canada (wd:Q1121436): 1841–1867 UK possession in North America
4. Canada, also known as French Canada (wd:Q2569593): French colony in New France between 1534 and 1763
5. Canada, also known as Canada, KS (wd:Q5029265): unincorporated community in Kansas, United States
6. Canada, also known as Canada, KY, Canada, Kentucky (wd:Q1031917): unincorporated community in Pike County, Kentucky, United States
7. Canadá (wd:Q20275156): human settlement in Mexico
8. Canada, also known as Kanada (wd:Q2684010): hamlet in Ooststellingwerf, Netherlands
9. Canada (wd:Q21287484): Wikimedia permanent duplicate item
10. Canada (wd:Q13265795): 2012 novel by Richard Ford

[Assistant] The entity for the country Canada is wd:Q16. Now, let's search for properties related to "form of government" for this entity.

[Tool]
Top 10 property alternatives:
1. basic form of government, also known as form of government, government, type of government (wd:P122 as p/wdt): subject's government
2. capital, also known as administrative seat, seat of government, seat, principal place, location of capital (wd:P36 as p/wdt): seat of government of a country, province, state or other type of administrative territorial entity
3. head of government, also known as head of national government, mayor, premier, president, prime minister (wd:P6 as p/wdt): head of the executive power of this town, city, municipality, state, country, or other governmental body, director / manager, chairperson
4. office held by head of government, also known as title of head of government, position of head of government, office of head of government, head of government's office, position held by head of government (wd:P1313 as p/wdt): political office that is fulfilled by the head of the government of this item
5. office held by head of state, also known as head of state, position held by head of state, state headed by (wd:P1906 as p/wdt): political office that is fulfilled by the head of state of this item
6. country, also known as sovereign state, state, land, host country (wd:P17 as p/wdt): sovereign state that this item is in (not to be used for human beings), located in the administrative territorial entity
7. foundational text, also known as main text, treaty, organic law, founding document, establishing document (wd:P457 as p/wdt): text through which an institution or object has been created or established
8. legislative body, also known as aboriginal council, Zila, Tehsil, rural council, representative body (wd:P194 as p/wdt): legislative body governing this entity; political institution wi...ted representatives, such as a parliament/legislature or council
9. main regulatory text, also known as regulated by, statutory authorization, statutory authority, legally established by, legal basis (wd:P92 as p/wdt): text setting the main rules by which the subject is regulated
10. diplomatic relation, also known as political relation, political relations, foreign relations, foreign relation, diplomatic relations (wd:P530 as p/wdt): diplomatic relations of the country

No other items found

[Assistant] The property "basic form of government" (wdt:P122) is the relevant property for the form of government of Canada. Now, I will write a SPARQL query to get the form of government of Canada (wd:Q16) using this property.

[Tool]
Got 3 rows and 2 columns:
| formOfGovernment                    | formOfGovernmentLabel        |
| ----------------------------------- | ---------------------------- |
| parliamentary system (wd:Q166747)   | parliamentary system (en)    |
| constitutional monarchy (wd:Q41614) | constitutional monarchy (en) |
| federation (wd:Q43702)              | federation (en)              |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves the form of government for Canada using the property P122 (basic form of government). The query returns three relevant forms of government: parliamentary system, constitutional monarchy, and federation, which matches the human-readable answer. The query also optionally retrieves English labels for these forms of government, which is helpful for readability. The answer is accurate and complete based on the data from Wikidata. No further refinement is necessary.


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

Got 2 rows and 2 columns:
| occupation                      | occupationLabel        |
| ------------------------------- | ---------------------- |
| actor (wd:Q33999)               | actor (en)             |
| basketball player (wd:Q3665646) | basketball player (en) |

Scottie Pippen was known for being a basketball player and an actor.

[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-sebastian

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 scottie pippen known for?

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

[Tool]
Example 1:
Question:
what job did george w bush have?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q207 wdt:P106 ?x .
}

Using entities:
George W. Bush, also known as GWB, POTUS 43, George Bush, President Bush, Bush Jr. (wd:Q207): President of the United States from 2001 to 2009, motivational speaker, rugby union player, military officer, autobiographer, businessperson, statesperson, politician, financier, painter

Using properties:
occupation, also known as job, work, vocation, profession, employment (wd:P106 as wdt): occupation of a person; see also "field of work" (Property:P101), "position held" (Property:P39)

Example 2:
Question:
what kind of language does switzerland speak?

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

Using entities:
Switzerland, also known as Confoederatio Helvetica, Swiss, Swiss Confederation (wd:Q39): country in Central Europe

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:
where does allen iverson live now?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q190094 wdt:P551 ?x .
}

Using entities:
Allen Iverson, also known as The Answer, Allen Ezail Iverson (wd:Q190094): American basketball player, basketball player, rapper

Using properties:
residence, also known as living in, place of residence, resided at, resided in, resident in (wd:P551 as wdt): the place where the person is or has been, resident, location

[Assistant] From the examples, to find what Scottie Pippen was known for, we can look for his occupation or what he is notable for. The property for occupation is wdt:P106. Let's first find the entity for Scottie Pippen.

[Tool]
Top 10 entity alternatives:
1. Scottie Pippen, also known as No Tippin' Pippen, Scotty Maurice Pippen, Scott Pippen, Robin, Pip (wd:Q193637): American basketball player, basketball player, actor
2. Scotty Pippen Jr., also known as Scottie Pippen Jr. (wd:Q100901254): American basketball player, basketball player
3. Slam City with Scottie Pippen (wd:Q3486520): 1994 video game
4. Scottish Terrier, also known as Aberdeen Terrier, Scottie, Scotty Dog (wd:Q39035): dog breed
5. 2024 in anime, also known as Scottie (wd:Q116673398): overview of anime-related events during the year of 2024
6. Pippen, also known as Pippen (surname), Pippen (family name) (wd:Q7197481): family name
7. pronunciation respelling for English, also known as Scottie (wd:Q7249972): non-IPA notation used to convey the pronunciation of English words (lookig like "lew-TEE-shee-əm")
8. Scottie (wd:Q7437589): album by Shirley Scott
9. English-language vowel changes before historic /r/, also known as Scottie (wd:Q5378157): vowel shifts
10. IBM Open Class, also known as scottie (wd:Q5968916): C++ class library

[Assistant] The entity for Scottie Pippen is wd:Q193637. Now, let's find what he was known for by looking at his occupation (wdt:P106).

[Tool]
Got 2 rows and 2 columns:
| occupation                      | occupationLabel        |
| ------------------------------- | ---------------------- |
| actor (wd:Q33999)               | actor (en)             |
| basketball player (wd:Q3665646) | basketball player (en) |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The answer correctly identifies Scottie Pippen's occupations as a basketball player and an actor, which matches the occupations retrieved by the SPARQL query from Wikidata. The query is well-formed, retrieves the occupation items and their English labels, and the answer is concise and accurate. No further refinement is necessary.


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?date WHERE {
  wd:Q211386 wdt:P585 ?date .
}

The San Francisco earthquake occurred on April 18, 1906.

[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-sebastian

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] when did the san francisco earthquake occur?

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

[Tool]
Example 1:
Question:
who was phil harris married to?

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

Using entities:
Phil Harris, also known as Wonga Philip Harris (wd:Q596717): American musician (1904–1995), television actor, jazz musician, voice actor, songwriter, bandleader, dub actor, conductor, composer, comedian, singer, actor

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

Example 2:
Question:
what are some of the awards taylor swift has won?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q26876 wdt:P166 ?x .
}

Using entities:
Taylor Swift, also known as Taylor Alison Swift (wd:Q26876): American singer-songwriter (born 1989), music video director, singer-songwriter, record producer, philanthropist, film director, lyricist, composer, singer, actor

Using properties:
award received, also known as win, winner of, recognition title, received award, prize received (wd:P166 as wdt): award or recognition received by a person, organization or creative work

Example 3:
Question:
where great britain located?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q23666 wdt:P30 ?x .
}

Using entities:
Great Britain, also known as Gt. Brit, mainland Britain, GBR, GB, Britannia (wd:Q23666): island in the North Atlantic Ocean off the northwest coast of continental Europe

Using properties:
continent (wd:P30 as wdt): continent of which the subject is a part, located in/on physical feature

[Assistant]
The question is about the date of the San Francisco earthquake. I need to find the entity for the San Francisco earthquake and then find the property related to the date or time of occurrence.

Step 1: Search for the entity "San Francisco earthquake" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. 1906 San Francisco earthquake, also known as Great San Francisco Earthquake and Fire, San Francisco earthquake of 1906, San Francisco earthquake and fire, 1906, Great 1906 San Francisco Earthquake, earthquake of 1906 (wd:Q211386): major earthquake that struck San Francisco and the coast of Northern California
2. 1906 San Francisco earthquake, also known as 1906 San Francisco earthquake and fire, earthquake of 1906, San Francisco earthquake of 1906, Great 1906 San Francisco Earthquake, Great San Francisco Earthquake and Fire (wd:Q211386): major earthquake that struck San Francisco and the coast of Northern California
3. 1989 Loma Prieta earthquake, also known as 1989 San Francisco earthquake, Loma Prieta earthquake (wd:Q1053476): major earthquake in northern California
4. 1957 San Francisco earthquake (wd:Q20312370)
5. Earthquake waves at San Francisco (wd:Q80986050): scientific article published on 01 February 1884
6. The Great San Francisco Earthquake (wd:Q125816606): scientific article published in 1988
7. The San Francisco earthquake of 1906 (wd:Q58176314): scholarly article by Dennis R. Dean published November 1993 in Annals of Science
8. Saints and the San Francisco earthquake (wd:Q57138167): scientific article published on 01 January 1983
9. The Big Picture: San Francisco Earthquake (wd:Q110056932): sketch from Saturday Night Live
10. Psychic Effects of the San Francisco Earthquake (wd:Q57143755): scholarly article published 4 August 1906 in The Hospital

[Assistant]
The most relevant entity for the San Francisco earthquake is "1906 San Francisco earthquake" with the entity ID wd:Q211386. Now, I need to find the property that represents the date or time of occurrence for this earthquake.

Step 2: Search for properties related to the date or time of occurrence for the entity wd:Q211386.

[Tool]
Top 10 property alternatives:
1. point in time, also known as at time, as of, year, when, time of event (wd:P585 as p/wdt): date something took place, existed or a statement was true; for providing time use the "refine date" property (P4241)
2. location, also known as neighbourhood, whereabouts, vilage, venue, town (wd:P276 as p/wdt): location of the object, structure or event. In the case of an ad...ity use P706. Use P7153 for locations associated with the object
3. instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as p/wdt): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)
4. located in the administrative territorial entity, also known as is in the settlement of, is in the voivodeship of, is in the shire of, is in the state of, is in the territory of (wd:P131 as p/wdt): the item is located on the territory of the following administra...if the item falls only partially into the administrative entity., location, part of
5. video, also known as gif, animation, trailer, media (wd:P10 as p/wdt): relevant video. For images, use the property P18. For film trailers, qualify with "object has role" (P3831)="trailer" (Q622550)
6. has cause, also known as implied by, originated due to, initial cause, outcome of, reason (wd:P828 as p/wdt): underlying cause, entity that ultimately resulted in this effect, follows
7. described by source, also known as mentioned in, source of item, reviewed in, mentioned in news article, talked about in (wd:P1343 as p/wdt): work where this item is described, attested in
8. country, also known as sovereign state, state, land, host country (wd:P17 as p/wdt): sovereign state that this item is in (not to be used for human beings), located in the administrative territorial entity
9. image, also known as still capture, still, screenshot, screen capture, portrait (wd:P18 as p/wdt): image of relevant illustration of the subject; if available, als...tor map, flag image, signature image, logo image, collage image)
10. coordinate location, also known as point on a map, gps coordinates, gps location, latitude, location (wd:P625 as p/wdt): geocoordinates of the subject. For Earth, please note that only WGS84 coordinating system is supported at the moment

No other items found

[Assistant] The property "point in time" (wdt:P585) is the most suitable to represent the date or time of occurrence for the earthquake. Now I will write a SPARQL query to get the date of the 1906 San Francisco earthquake (wd:Q211386) using the property "point in time" (wdt:P585).

[Tool]
Got 1 row and 1 column:
| date                                |
| ----------------------------------- |
| 1906-04-18T00:00:00Z (xsd:dateTime) |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves the date of the San Francisco earthquake (Q211386) using the property 'point in time' (P585). The answer 'April 18, 1906' matches the query result and is accurate. The query returns the actual identifier and the date in xsd:dateTime format, which is appropriate. No further refinement is necessary.


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

Got 1 row and 2 columns:
| placeOfBirth           | placeOfBirthLabel |
| ---------------------- | ----------------- |
| Salisbury (wd:Q160642) | Salisbury (en)    |

Robert Irvine comes from Salisbury.

[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-sebastian

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] where does robert irvine come from?

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

[Tool]
Example 1:
Question:
when was the last time the dallas cowboys went to the super bowl?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?y wdt:P31 / wdt:P279 * wd:Q32096 ; wdt:P1923 wd:Q204862 ; wdt:P585 ?x .
}
ORDER BY DESC ( ?x )
LIMIT 1

Using entities:
Dallas Cowboys, also known as Cowboys (wd:Q204862): American football team
Super Bowl, also known as AFL–NFL World Championship Game (wd:Q32096): National Football League championship game

Using properties:
participating team, also known as teams (wd:P1923 as wdt): like 'Participant' (P710) but for teams. For an event like a cyc...member of sports team' (P54) as a qualifier for the individuals), participant
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)
point in time, also known as at time, as of, year, when, time of event (wd:P585 as wdt): date something took place, existed or a statement was true; for providing time use the "refine date" property (P4241)

Example 2:
Question:
where did timothy mcveigh go to prison?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q220850 wdt:P2632 ?x .
}

Using entities:
Timothy McVeigh, also known as Timothy James McVeigh, Timmy McVey [plausible misspelling], Timmy McVeghe [plausible misspelling] (wd:Q220850): American domestic anti-government terrorist (1968–2001), military personnel, security guard, mass murderer, terrorist

Using properties:
place of detention, also known as internment at, internment place, jail, jailed at, penal (wd:P2632 as wdt): place where this person is or was detained, residence

Example 3:
Question:
what does michael vick do?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q505431 wdt:P106 ?x .
}

Using entities:
Michael Vick, also known as Michael Dwayne Vick (wd:Q505431): American football player (born 1980), American football player, offensive coordinator

Using properties:
occupation, also known as job, work, vocation, profession, employment (wd:P106 as wdt): occupation of a person; see also "field of work" (Property:P101), "position held" (Property:P39)

[Assistant]
The examples show that to answer "where does [person] come from?" we likely need to find the place of birth or the place of origin of the person. For Robert Irvine, we should first identify the Wikidata entity for him and then find properties related to place of birth or origin.

Step 1: Search for the entity "Robert Irvine" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. Bobby Irvine, also known as Robert Irvine, Robert James Irvine (wd:Q4935169): Northern Irish association footballer (born 1942), association football player
2. Robert Irvine (wd:Q29561444): association football player
3. Robert Irvine, also known as Robert Paul Irvine (wd:Q13603754): British celebrity chef, chef
4. Irvine, Robert (wd:Q94829234): entry in Alumni Oxonienses: the Members of the University of Oxford, 1715-1886
5. Robert Irvine (wd:Q7345808): New Zealand rugby league footballer, rugby league player
6. Robert Brian Irvine, also known as Robert Irvine (wd:Q75949893): Peerage person ID=423923
7. Robert Irvine (wd:Q93942944)
8. Robert Irvine (wd:Q76346164): Peerage person ID=703910
9. Robert Irvine (wd:Q76170766): Peerage person ID=579126
10. Robert Irvine (wd:Q76037914): Peerage person ID=485894

[Assistant] There are multiple Robert Irvine entities. The most likely relevant one based on common knowledge is Robert Irvine the British celebrity chef (wd:Q13603754). I will now check properties related to place of birth or origin for this entity.

[Tool]
Top 10 property alternatives:
1. place of birth, also known as POB, location of birth, location born, born in, birthplace (wd:P19 as p/wdt): most specific known birth location of a person, animal or fictional character, location
2. date of birth, also known as year of birth, birthdate, DOB, born on, born (wd:P569 as p/wdt): date on which the subject was born, inception
3. country of citizenship, also known as subject of (country), nation of citizenship, national of, nationality, nation (wd:P27 as p/wdt): the object is a country that recognizes the subject as its citizen, country
4. occupation, also known as job, work, vocation, profession, employment (wd:P106 as p/wdt): occupation of a person; see also "field of work" (Property:P101), "position held" (Property:P39)
5. given name, also known as name, proper name, personal name, middle name, forename (wd:P735 as p/wdt): first name or another given name of this person; values used with the property should not link disambiguations nor family names, name
6. native language, also known as first language, L1 speaker of, language native, mother tongue (wd:P103 as p/wdt): language or languages a person has learned from early childhood, languages spoken, written or signed
7. family name, also known as clan name, last name, surname (wd:P734 as p/wdt): part of full name of person, name
8. image, also known as still capture, still, screenshot, screen capture, portrait (wd:P18 as p/wdt): image of relevant illustration of the subject; if available, als...tor map, flag image, signature image, logo image, collage image)
9. instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as p/wdt): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)
10. languages spoken, written or signed, also known as language of expression, language, wrote language, writes language, uses language (wd:P1412 as p/wdt): language(s) that a person or a people speaks, writes or signs, including the native language(s)

No other items found

[Assistant] The property "place of birth" (wdt:P19) is the most relevant to answer where Robert Irvine comes from. I will now query the place of birth for Robert Irvine (wd:Q13603754).

[Tool]
Got 1 row and 2 columns:
| placeOfBirth           | placeOfBirthLabel |
| ---------------------- | ----------------- |
| Salisbury (wd:Q160642) | Salisbury (en)    |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves the place of birth of Robert Irvine using the property P19 (place of birth). The query also optionally retrieves the English label of the place of birth, which is Salisbury. The answer given, "Robert Irvine comes from Salisbury," is accurate and directly supported by the query result. The query follows the rules by returning the identifier and label, and the answer is complete and correct.


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

Got 1 row and 2 columns:
| location             | locationLabel  |
| -------------------- | -------------- |
| Stockholm (wd:Q1754) | Stockholm (en) |

Electrolux is based in Stockholm.

[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-sebastian

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] where is electrolux based?

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

[Tool]
Example 1:
Question:
what type of music does ella fitzgerald sing?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q1768 wdt:P136 ?x .
}

Using entities:
Ella Fitzgerald, also known as The First Lady of Jazz, The First Lady of Song, Lady Ella, Queen of Jazz (wd:Q1768): American jazz singer (1917–1996), singer-songwriter, recording artist, jazz musician, bandleader, film actor, conductor, composer, singer

Using properties:
genre, also known as genre of music, type of music, type of film, music genre, literary genre (wd:P136 as wdt): creative work's genre or an artist's field of work (P101). Use main subject (P921) to relate creative works to their topic

Example 2:
Question:
what years have the dodgers won the world series?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?y wdt:P3450 wd:Q265538 ; wdt:P1346 wd:Q334634 ; wdt:P585 ?x .
}

Using entities:
World Series, also known as Fall Classic (wd:Q265538): Championship of Major League Baseball
Los Angeles Dodgers, also known as Robins, Superbas, LA Dodgers, Trolley Dodgers, LAD (wd:Q334634): Major League Baseball franchise in Los Angeles, California

Using properties:
winner, also known as nominee, prizewinner, titleholder, top dog, victor (wd:P1346 as wdt): winner of a competition or similar event, not to be used for awa...ssibly qualified with "for work" (P1686)) or for wars or battles, participating team, participant
sports season of league or competition, also known as sport season, seasons of, edition of annual athletics meeting, season of sports tournament, season of sports league (wd:P3450 as wdt): property that shows the competition of which the item is a season. Use P5138 for "season of club or team"., part of
point in time, also known as at time, as of, year, when, time of event (wd:P585 as wdt): date something took place, existed or a statement was true; for providing time use the "refine date" property (P4241)

Example 3:
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)

[Assistant]
The question is "where is Electrolux based?" which means we want to find the location of the headquarters or the base of the company Electrolux.

Step 1: Identify the entity "Electrolux" in Wikidata.
Step 2: Find the property that indicates the location of the headquarters or base of a company. Common properties for this are "headquarters location" (P159) or "location" (P276).

I will start by searching for the entity "Electrolux" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. Electrolux, also known as AB Electrolux (wd:Q505922): Swedish multinational manufacturer and marketer of home appliances
2. Electrolux (wd:Q2923843): genus of fishes
3. ELECTROLUX, also known as ELECTROLUX, s.r.o. (wd:Q58218446): Czech company
4. Electrolux addisoni (wd:Q2387882): species of fish
5. Electrolux Assistent, also known as Electrolux Ankarsrum Assistent (wd:Q17496378): stand mixer introduced by Electrolux in 1940
6. Electrolux Trilobite (wd:Q5358060): first commercially available robotic vacuum cleaner
7. Electrolux (Italy), also known as Electrolux Italia S.p.A., Electrolux Rex (wd:Q106045223)
8. Electrolux F.C. (wd:Q96377107): football club
9. Electrolux Professional (wd:Q109974149): Swedish professional appliance manufacturer
10. Lux Norge AS, also known as Electrolux-Euroclean AS, Electrolux AS, Electrolux Rengjøringsmaskiner AS (wd:Q15729564)

[Assistant]
The entity "Electrolux" as a Swedish multinational manufacturer and marketer of home appliances is wd:Q505922. This is the entity we are interested in.

Next, I will look for the property that indicates the headquarters location or base of this company. I will search for properties related to "headquarters" or "location" for this entity.

[Tool]
Top 10 property alternatives:
1. headquarters location, also known as headquarters locality, seat, headquarters town, HQ, HQ location (wd:P159 as p/wdt): city or town where an organization's headquarters is or has been situated. Use P276 qualifier for specific building, significant place
2. has subsidiary, also known as subordinate body, subsidiary body, subordinate unit, subsidiary, subsidiary company (wd:P355 as p/wdt): subsidiary of a company or organization; generally a fully owned...siness division" (P199). Opposite of parent organization (P749)., has part(s), owner of
3. location of formation, also known as place of incorporation, originates from, place of establishment, place of formation, place of foundation (wd:P740 as p/wdt): location where a group or organization was formed, location of creation
4. employees, also known as workers, staff, personnel, number of employees, employee count (wd:P1128 as p/wdt): total number of employees of a company at a given "point in time...not deprecated rank). Add data for recent years, don't overwrite
5. inception, also known as initial release date, founded in, founded on, founded on date, founding date (wd:P571 as p/wdt): time when an entity begins to exist; for date of official opening use P1619, start time
6. LittleSis organization ID, also known as LittleSis organisation ID, LittleSis organisation identifier, LittleSis organization identifier (wd:P3393 as p/wdt): organisation in the LittleSis who-knows-who of government and business database
7. product, material, or service produced or provided, also known as products, product or service provided, product, material, or service produced or provided, product, output (wd:P1056 as p/wdt): material or product produced or sold by an organization, industry, facility, or process, material or product produced by an organization, industry, facility, or process, immediate cause of
8. chief executive officer, also known as executive director, CEO, chief executive (wd:P169 as p/wdt): highest-ranking corporate officer appointed as the CEO within an organization, director / manager, corporate officer
9. official website, also known as site (official), home page, site official, URL, URL (official) (wd:P856 as p/wdt): URL of the official page of an item (current or former). Usage: ...but see the "Hijacked or dead websites" section of the Talk page, URL
10. LinkedIn company or organization ID, also known as https://www.linkedin.com/company/, www.linkedin.com/company/, LinkedIn showcase, LinkedIn school ID, LinkedIn organization ID (wd:P4264 as p/wdt): identifier for an official company, school, organisation page, or showcase page, on LinkedIn, website username or ID

No other items found

[Assistant]
The property "headquarters location" (wdt:P159) is the appropriate property to find where Electrolux is based.

Now I will write a SPARQL query to get the headquarters location of Electrolux (wd:Q505922) using the property headquarters location (wdt:P159). I will also include the label of the location for better readability.

[Tool]
Got 1 row and 2 columns:
| location             | locationLabel  |
| -------------------- | -------------- |
| Stockholm (wd:Q1754) | Stockholm (en) |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves the headquarters location of Electrolux using the property P159. The result is accurate and matches the answer provided, stating that Electrolux is based in Stockholm. The query also includes an optional label retrieval for readability, which is appropriate. No further refinement is necessary.


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?postalCode WHERE {
  wd:Q793929 wdt:P281 ?postalCode .
}

Got 1 row and 1 column:
| postalCode |
| ---------- |
| 76020      |

The zip code for Azle, Texas is 76020.

[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-sebastian

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 the zip code for azle texas?

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

[Tool]
Example 1:
Question:
who is neil patrick harris dating?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q485310 wdt:P451 ?x .
}

Using entities:
Neil Patrick Harris, also known as NPH (wd:Q485310): American actor (born 1973), television presenter, television producer, theatrical director, television actor, stage magician, autobiographer, film director, film producer, screenwriter, voice actor, stage actor, illusionist, film actor, dub actor, memoirist, musician, comedian, dancer, singer, actor

Using properties:
unmarried partner, also known as romantic partner, partner of, partners, posslq, relationship (wd:P451 as wdt): someone with whom the person is in a relationship without being married. Use "spouse" (P26) for married couples, significant person

Example 2:
Question:
what car companies does ford motor company own?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q44294 wdt:P1830 ?x .
  ?x wdt:P31 wd:Q10429667 .
}

Using entities:
car brand, also known as automobile brand, automobile marque, badge, car marque, make of car (wd:Q10429667): brand or make of a car
Ford Motor Company, also known as FoMoCo, Ford Motors, Ford Motor Corporation, Ford Motor Co., Ford Motor (wd:Q44294): American multinational automotive company

Using properties:
owner of, also known as owns, owns property, shareholder of (wd:P1830 as wdt): entities owned by the subject
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 language do they in belgium?

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

Using entities:
Belgium, also known as Kingdom of Belgium, BEL, be, BE, 🇧🇪 (wd:Q31): country in western Europe

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]
The question is about the zip code for Azle, Texas. We need to identify the entity for Azle, Texas and the property that corresponds to the zip code (postal code).

Step 1: Search for the entity "Azle, Texas" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. Azle, also known as Azle, Texas, Azle, TX (wd:Q793929): city in Texas, United States
2. Texas Health Resources Azle heliport (wd:Q61719753): heliport in Texas, United States
3. Causal factors for seismicity near Azle, Texas (wd:Q35541092): scientific article published on 21 April 2015
4. Texas, also known as Tex., US-TX, Lone Star State, Texas, United States, State of Texas (wd:Q1439): state of the United States of America
5. Texas, also known as Lone Star State, US-TX, TX, Texas, United States, Tex. (wd:Q1439): state of the United States of America
6. Texas (wd:Q916484): Scottish musical group; alternative rock band
7. Texas, also known as Texas, WI (wd:Q1887280): town in Wisconsin, United States
8. Texas (wd:Q7707414): 1941 Western film directed by George Marshall
9. Texas, also known as Texas, Queensland, Texas, Queensland, Australia (wd:Q144229): town in Queensland, Australia
10. Texas, also known as Texas, NY, Texas, New York (wd:Q3816828): town in Oswego County, New York

[Assistant]
The entity "Azle, Texas" corresponds to wd:Q793929, which is a city in Texas, United States.

Step 2: Search for properties related to postal code or zip code for the entity Azle (wd:Q793929).

[Tool]
Top 10 property alternatives:
1. postal code, also known as pincode, PIN Code, postal index number, post code, postcode (wd:P281 as p/wdt): identifier assigned by postal authorities for the subject area or building
2. local dialing code, also known as area code, dialling code, local calling code, local dialling code, STD code (wd:P473 as p/wdt): identifier dedicated to subject city by the area communication network
3. UN/LOCODE, also known as LOCCODE, LOCODE, UNECE location code, UNECE LOCODE, United Nations location code (wd:P1937 as p/wdt): geographic location code maintained by UNECE
4. coordinate location, also known as point on a map, gps coordinates, gps location, latitude, location (wd:P625 as p/wdt): geocoordinates of the subject. For Earth, please note that only WGS84 coordinating system is supported at the moment
5. FIPS 55-3 (locations in the US), also known as fips code for US locations, Federal Information Processing Standard 55-3, FIPS 55-3 (wd:P774 as p/wdt): identifier for places in the United States per former Federal Information Processing Standard FIPS 55-3
6. social media followers, also known as number of subs, number of subscribers, sub count, sub number, subscriber number (wd:P8687 as p/wdt): number of subscribers on a particular social media website (use ... in time" and property for account. For Twitter, use numeric id.
7. located in the administrative territorial entity, also known as is in the settlement of, is in the voivodeship of, is in the shire of, is in the state of, is in the territory of (wd:P131 as p/wdt): the item is located on the territory of the following administra...if the item falls only partially into the administrative entity., location, part of
8. located in time zone, also known as TZ, time zone, timezone (wd:P421 as p/wdt): time zone for this item
9. official website, also known as site (official), home page, site official, URL, URL (official) (wd:P856 as p/wdt): URL of the official page of an item (current or former). Usage: ...but see the "Hijacked or dead websites" section of the Talk page, URL
10. GeoNames ID, also known as GeoNames, Geonames Id (wd:P1566 as wdt/p/wdtn): identifier in the GeoNames geographical database

No other items found

[Assistant]
The property for postal code (zip code) is wd:P281.

Step 3: Construct a SPARQL query to get the postal code for Azle, Texas (wd:Q793929) using the property wd:P281.

[Tool]
Got 1 row and 1 column:
| postalCode |
| ---------- |
| 76020      |

[Tool] Stopped generation process

[User]
Feedback (status=done):
The SPARQL query correctly retrieves the postal code (P281) for the city Azle, Texas (Q793929) from Wikidata. The query is simple, direct, and returns the expected result: 76020. The answer is accurate and complete based on the data from the knowledge graph. No further refinement is necessary.