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

Got 3 rows and 2 columns:
| school                                   | schoolLabel                     |
| ---------------------------------------- | ------------------------------- |
| Juneau-Douglas High School (wd:Q6312473) | Juneau-Douglas High School (en) |
| Wasilla High School (wd:Q7972657)        | Wasilla High School (en)        |
| West Anchorage High School (wd:Q7984309) | West Anchorage High School (en) |

Bristol Palin went to Juneau-Douglas High School, Wasilla High School, and West Anchorage High School.

[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 bristol palin go to school?

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

[Tool]
Example 1:
Question:
who played atticus finch in the movie?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?p p:P161 ?y .
  ?y ps:P161 ?x ; pq:P453 wd:Q525777 .
}

Using entities:
Atticus Finch (wd:Q525777): fictional character from To Kill a Mockingbird, lawyer

Using properties:
cast member, also known as feat., starring (film/play), film starring, starring, actor (wd:P161 as p/ps): actor in the subject production [use "character role" (P453) and...use "recorded participant" (P11108) for non-fiction productions], significant person, performer
character role, also known as role, plays, performer of, as, acting role (wd:P453 as pq): specific role played or filled by subject -- use only as qualifier of "cast member" (P161), "voice actor" (P725)

Example 2:
Question:
what is the present form of government in iran?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q794 wdt:P122 ?x .
}

Using entities:
Iran, also known as ir, IRI, IRN, Islamic Rep. Iran, Islamic Republic of Iran (wd:Q794): country in Western Asia

Using properties:
basic form of government, also known as form of government, government, type of government (wd:P122 as wdt): subject's government

Example 3:
Question:
what city was barack obama born in?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q76 p:P19 ?p .
  ?p ps:P19 ?x .
  ?x wdt:P31 / wdt:P279 * wd:Q515 .
}

Using entities:
city, also known as cities (wd:Q515): large human settlement
Barack Obama, also known as Honorable Barack Obama, BHO, Obama, Barry O Bomber, President Obama (wd:Q76): president of the United States from 2009 to 2017, community organizer, political writer, statesperson, politician, podcaster, memoirist, academic, lawyer, jurist

Using properties:
place of birth, also known as POB, location of birth, location born, born in, birthplace (wd:P19 as p/ps): most specific known birth location of a person, animal or fictional character, location
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 did Bristol Palin go to school?" We want to find the educational institution(s) associated with Bristol Palin.

Step 1: Identify the entity for "Bristol Palin" in Wikidata.
Step 2: Identify the property that relates a person to their school or educational institution. Common properties for this are "educated at" (wdt:P69).

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

[Tool]
Top 10 entity alternatives:
1. Bristol Palin, also known as Bristol Sheeran Marie Palin (wd:Q2190766): reality television participant, daughter of Sarah Palin, real estate agent, politician, writer
2. Bristol Palin: Life's a Tripp (wd:Q4968974): television series
3. Bristol, also known as Bristol, UK, Bristol, England, Bristol, Gloucestershire (wd:Q23154): city in South West England, United Kingdom
4. Bristol, also known as Bristol, CT, Bristol, Connecticut (wd:Q755149): city in Hartford County, Connecticut, United States
5. Bristol, also known as Bristol, Tennessee, Bristol, TN (wd:Q917821): city in Sullivan County, Tennessee, United States
6. Bristol Airport, also known as Bristol (Lulsgate) Airport, EGGD, BRS, Bristol International Airport, Bristol (wd:Q8725): commercial airport serving the city of Bristol, England
7. Bristol, also known as Bristol, VA, Bristol, Virginia (wd:Q503366): independent city in Virginia, United States
8. Bristol, also known as Bristol, Florida, Bristol, FL (wd:Q568950): city in and the county seat of Liberty County, Florida, United States
9. Bristol Airport, also known as EGGD, Bristol, Bristol International Airport, Bristol (Lulsgate) Airport, BRS (wd:Q8725): commercial airport serving the city of Bristol, England
10. Bristol, also known as Bristol, Rhode Island, Bristol, RI (wd:Q917809): town in Rhode Island, United States

[Assistant]
The entity for Bristol Palin is wd:Q2190766.

Next, I will check the properties of Bristol Palin to find the property related to the school or educational institution she attended. I will search for properties of the entity wd:Q2190766 with a query related to "school" or "education."

[Tool]
Top 10 property alternatives:
1. educated at, also known as graduated from, graduate of, place of education, school attended, schooled at (wd:P69 as p/wdt): educational institution attended by subject, affiliation
2. 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)
3. number of children, also known as children, children (number), how many children, issue, kids (wd:P1971 as p/wdt): number of children of the person, animal, or character
4. child, also known as has son, kids, mother of, kid, issue (wd:P40 as p/wdt): subject has object as child. Do not use for stepchildren—use "relative" (P1038), qualified with "type of kinship" (P1039), significant person, relative
5. 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)
6. 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
7. 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)
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. residence, also known as living in, place of residence, resided at, resided in, resident in (wd:P551 as p/wdt): the place where the person is or has been, resident, location
10. 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

No other items found

[Assistant]
The property "educated at" (wdt:P69) is the relevant property for the school or educational institution attended by Bristol Palin.

Now I will construct a SPARQL query to find the schools where Bristol Palin (wd:Q2190766) went to. I will query for the objects of the property wdt:P69 for the subject wd:Q2190766. I will also try to get the labels of the schools.

[Tool]
Got 3 rows and 2 columns:
| school                                   | schoolLabel                     |
| ---------------------------------------- | ------------------------------- |
| Juneau-Douglas High School (wd:Q6312473) | Juneau-Douglas High School (en) |
| Wasilla High School (wd:Q7972657)        | Wasilla High School (en)        |
| West Anchorage High School (wd:Q7984309) | West Anchorage High School (en) |

[Tool] Stopped generation process


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

Got 7 rows and 4 columns:
| occupation                     | occupationLabel       | label                 | description                                                      |
| ------------------------------ | --------------------- | --------------------- | ---------------------------------------------------------------- |
| theologian (wd:Q1234713)       | theologian (en)       | Paul the Apostle (en) | Early Christian apostle and missionary (c. AD 5 – c. 64/65) (en) |
| artisan (wd:Q1294787)          | artisan (en)          | Paul the Apostle (en) | Early Christian apostle and missionary (c. AD 5 – c. 64/65) (en) |
| rabbi (wd:Q133485)             | rabbi (en)            | Paul the Apostle (en) | Early Christian apostle and missionary (c. AD 5 – c. 64/65) (en) |
| missionary (wd:Q219477)        | missionary (en)       | Paul the Apostle (en) | Early Christian apostle and missionary (c. AD 5 – c. 64/65) (en) |
| traveler (wd:Q22813352)        | traveler (en)         | Paul the Apostle (en) | Early Christian apostle and missionary (c. AD 5 – c. 64/65) (en) |
| writer (wd:Q36180)             | writer (en)           | Paul the Apostle (en) | Early Christian apostle and missionary (c. AD 5 – c. 64/65) (en) |
| religious figure (wd:Q4504549) | religious figure (en) | Paul the Apostle (en) | Early Christian apostle and missionary (c. AD 5 – c. 64/65) (en) |

Saint Paul the Apostle (Paul the Apostle, wd:Q9200) was an early Christian apostle and missionary. His occupations include theologian, artisan, rabbi, missionary, traveler, writer, and religious figure.

[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] who was saint paul the apostle?

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

[Tool]
Example 1:
Question:
who started up mcdonalds?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q38076 wdt:P112 ?x .
}

Using entities:
McDonald’s, also known as Macca's, Mickey D's, McDonald's Restaurant, McDonald's Corporation, McDonald's (wd:Q38076): American fast food restaurant chain

Using properties:
founded by, also known as starter, co-founded by, started by, institutor, instituted by (wd:P112 as wdt): founder or co-founder of this organization, religion, place or entity, creator

Example 2:
Question:
what is gibby's mom's name?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q5559079 wdt:P25 ?x .
}

Using entities:
Gibby Haynes, also known as Gibson Jerome Haynes, Gibby Haines (wd:Q5559079): American musician, singer-songwriter, painter, singer, actor

Using properties:
mother, also known as mom, is child of, mommy, mum, mummy (wd:P25 as wdt): female parent of the subject. For stepmother, use "stepparent" (P3448), parent

Example 3:
Question:
what is the major language spoken in canada?

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

Using entities:
Canada, also known as CA, CAN, Dominion of Canada, ISO 3166-1:CA (wd:Q16): country in North America

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 "Who was Saint Paul the Apostle?" is asking for information about the identity or description of Saint Paul the Apostle. We should first identify the Wikidata entity for "Saint Paul the Apostle" and then find relevant properties that describe who he was, such as his occupation, roles, or notable descriptions.

Step 1: Search for the entity "Saint Paul the Apostle" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. Paul the Apostle, also known as Saul of Tarsus, Saulus, Šā'ûl, Saul, Saint Paulus (wd:Q9200): Early Christian apostle and missionary (c. AD 5 – c. 64/65), religious figure, missionary, theologian, traveler, artisan, writer, rabbi
2. San Paolo convent, also known as Saint Paul the Apostle, San Paolo (Ferrara) - Convent (wd:Q124151525): convent at the church of San Paolo, Ferrara, Italy
3. San Paolo al Cimitero, also known as Saint Paul the Apostle (wd:Q123987072): religious building at the cemetery of Sassari, Italy
4. San Paolo, also known as Saint Paul the Apostle (wd:Q118516744): religious building in Biancareddu, Sassari, Italy
5. Saint Paul the Apostle (wd:Q19859112): painting by José Ferraz de Almeida Júnior
6. Saint Paul the Apostle (wd:Q118591287): painting by Spanish School, Wellcome Collection
7. The apostle Saint Paul (wd:Q121546195): painting by Anthony van Dyck
8. St. Paul the Apostle Church, also known as Saint Paul the Apostle Church (wd:Q7591285): church in New York, United States
9. Saint Paul the Apostle writing (wd:Q123163634): painting by Lambert Jacobsz
10. Church of St Paul, 1651 Shettleston Road, Glasgow, also known as 1651 Shettleston Road, Church Of St Paul, Church of Saint Paul the Apostle (wd:Q17815655): church building in Glasgow, Scotland, UK

[Assistant]
The entity "Paul the Apostle" (wd:Q9200) corresponds to Saint Paul the Apostle, an early Christian apostle and missionary. This is the correct entity to use for answering the question.

Next, I will look for properties that describe who Paul the Apostle was, such as occupation, roles, or descriptions. I will search for properties related to "Paul the Apostle" with the query "occupation" or "role".

[Tool]
Top 10 property alternatives:
1. 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)
2. position held, also known as function, held position, holds position, job, office held (wd:P39 as p/wdt): subject currently or formerly holds the object position or public office
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. significant person, also known as significant people, sigper, sign. person, relevant person, relevant people (wd:P3342 as p/wdt): person linked to the item in any possible way
5. 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
6. 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
7. lifestyle, also known as diet, follows lifestyle, has lifestyle, life style (wd:P1576 as p/wdt): typical way of life of an individual, group, or culture
8. residence, also known as living in, place of residence, resided at, resided in, resident in (wd:P551 as p/wdt): the place where the person is or has been, resident, location
9. student of, also known as professor, studied under, pupil of, tutor, mentor (wd:P1066 as p/wdt): person who has taught this person, significant person
10. notable work, also known as artwork, wrote, writer of, works, work (wd:P800 as p/wdt): notable scientific, artistic or literary work, or other work of significance among subject's works

No other items found

[Assistant] The property "occupation" (wdt:P106) is suitable to describe who Paul the Apostle was. I will now write a SPARQL query to get the occupations of Paul the Apostle (wd:Q9200) and also include his description (rdfs:label) in English.

[Tool]
Got 7 rows and 2 columns:
| occupation                     | occupationLabel       |
| ------------------------------ | --------------------- |
| theologian (wd:Q1234713)       | theologian (en)       |
| artisan (wd:Q1294787)          | artisan (en)          |
| rabbi (wd:Q133485)             | rabbi (en)            |
| missionary (wd:Q219477)        | missionary (en)       |
| traveler (wd:Q22813352)        | traveler (en)         |
| writer (wd:Q36180)             | writer (en)           |
| religious figure (wd:Q4504549) | religious figure (en) |

[Assistant]
Paul the Apostle was a theologian, artisan, rabbi, missionary, traveler, writer, and religious figure.

I will now provide a final SPARQL query that returns the occupations and labels of Paul the Apostle, along with his English label and description, to give a fuller answer to the question "Who was Saint Paul the Apostle?"

[Tool] Stopped generation process


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

Got 5 rows and 2 columns:
| school                                            | schoolLabel                              |
| ------------------------------------------------- | ---------------------------------------- |
| University of Alabama (wd:Q492318)                | University of Alabama (en)               |
| University of Utah Health Care (wd:Q56582915)     | University of Utah Health Care (en)      |
| Huntingdon College (wd:Q5945112)                  | Huntingdon College (en)                  |
| Monroe County High School (wd:Q6902164)           | Monroe County High School (en)           |
| University of Alabama School of Law (wd:Q7895034) | University of Alabama School of Law (en) |

Harper Lee attended Monroe County High School among other educational institutions.

[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 harper lee attend high school?

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

[Tool]
Example 1:
Question:
who is angelina jolie husband name?

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

Using entities:
Angelina Jolie, also known as Angelina Jolie Voight (wd:Q13909): American actress, philanthropist, actor, model

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:
who was louis riel?

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

Using entities:
Louis Riel, also known as Louis "David" Riel (wd:Q313691): Métis leader in Canada (1844–1885), politician

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 3:
Question:
what did harriet beecher stowe do as an abolitionist?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q102513 wdt:P800 ?x .
}

Using entities:
Harriet Beecher Stowe, also known as Harriet Elizabeth Beecher Stowe, Harriet Elisabeth Beecher Stowe, Harriet Elizabeth Beecher, Harriet Beecher, Harriet Elizabeth Beecher-Stowe (wd:Q102513): American abolitionist and author (1811–1896), short story writer, children's writer, abolitionist, essayist, novelist, writer, poet

Using properties:
notable work, also known as artwork, wrote, writer of, works, work (wd:P800 as wdt): notable scientific, artistic or literary work, or other work of significance among subject's works

[Assistant]
The examples show how to query for specific properties of a person. For the question "where did Harper Lee attend high school?", we need to find the entity for Harper Lee and then find the property related to high school attended or education.

Step 1: Search for the entity "Harper Lee".
Step 2: Search for properties related to "high school" or "education" for Harper Lee.
Step 3: Construct the SPARQL query to get the high school attended by Harper Lee.

I will start by searching for the entity "Harper Lee".

[Tool]
Top 10 entity alternatives:
1. Harper Lee, also known as Nelle Harper Lee (wd:Q182658): American author, prose writer, screenwriter, poet lawyer, novelist, musician, writer, actor
2. Lee Harper, also known as Lee Charles Philip Harper (wd:Q6513809): Footballer and manager (born 1971), association football manager, association football player
3. Lee Harper (wd:Q1811814): American musician (1945–2010), jazz guitarist, musician
4. Ron Harper, also known as Ronald Lee Harper (wd:Q7363883): Canadian politician, politician
5. Harper B. Lee, also known as Harper Baylor Lee, James Harper Gillett (wd:Q3127694): American matador (1884-1941), matador
6. Harper Lee Award (wd:Q107354207): award for Alabama writers
7. Harper Lee Kaye (wd:Q88315759): researcher
8. Jonathan Lee Harper (wd:Q102342439): Ph.D. Montana State University 2007
9. Eric Harper, also known as Eric Lee Harper (wd:Q116510885): guitarist, composer, musician
10. Gloria Harper Lee (wd:Q117517845): Cousin of Monica Hargrove, interviewee of Dartmouth Black Lives

[Assistant] I found the entity for Harper Lee: wd:Q182658. Now I will search for properties related to "high school" or "education" for this entity.

[Tool]
Top 10 property alternatives:
1. educated at, also known as graduated from, graduate of, place of education, school attended, schooled at (wd:P69 as p/wdt): educational institution attended by subject, affiliation
2. field of work, also known as scientific discipline, scientific area, responsible for, research on, research fields (wd:P101 as p/wdt): specialization of a person or organization; see P106 for the occupation, interested in
3. award received, also known as win, winner of, recognition title, received award, prize received (wd:P166 as p/wdt): award or recognition received by a person, organization or creative work
4. 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
5. 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
6. 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
7. sibling, also known as is sister of, is the brother of, is the sibling of, is the sister of, sib (wd:P3373 as p/wdt): the subject and the object have at least one common parent (brot...law, etc.) and step-siblings (step-brothers, step-sisters, etc.), relative
8. 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)
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. genre, also known as genre of music, type of music, type of film, music genre, literary genre (wd:P136 as p/wdt): creative work's genre or an artist's field of work (P101). Use main subject (P921) to relate creative works to their topic

No other items found

[Assistant] The property "educated at" (wdt:P69) is the relevant property for the educational institution attended by Harper Lee. Now I will construct a SPARQL query to get the high school or educational institution attended by Harper Lee (wd:Q182658).

[Tool] Got no rows and 2 columns

[Assistant]
The query returned no results when filtering for high schools specifically. It is possible that the educational institution attended by Harper Lee is not classified as a high school in Wikidata or the information is not available.

I will try a broader query to get all educational institutions attended by Harper Lee without filtering for high schools. This might include colleges or universities as well.

[Tool]
Got 5 rows and 2 columns:
| school                                            | schoolLabel                              |
| ------------------------------------------------- | ---------------------------------------- |
| University of Alabama (wd:Q492318)                | University of Alabama (en)               |
| University of Utah Health Care (wd:Q56582915)     | University of Utah Health Care (en)      |
| Huntingdon College (wd:Q5945112)                  | Huntingdon College (en)                  |
| Monroe County High School (wd:Q6902164)           | Monroe County High School (en)           |
| University of Alabama School of Law (wd:Q7895034) | University of Alabama School of Law (en) |

[Tool] Stopped generation process


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

Got 2 rows and 2 columns:
| location             | locationLabel |
| -------------------- | ------------- |
| Midland (wd:Q128321) | Midland (en)  |
| Texas (wd:Q1439)     | Texas (en)    |

George W. Bush lived as a child in Midland, Texas, where his childhood home is located.

[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 george w bush live as a child?

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

[Tool]
Example 1:
Question:
what time zone is colorado springs co?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q49258 wdt:P421 ?x .
}

Using entities:
Colorado Springs, also known as Colorado Springs, CO, Colorado Springs, Colorado, Olympic City USA (wd:Q49258): city in and county seat of El Paso County, Colorado, United States

Using properties:
located in time zone, also known as TZ, time zone, timezone (wd:P421 as wdt): time zone for this item

Example 2:
Question:
what to see and do in revelstoke?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?x wdt:P31 / wdt:P279 * wd:Q570116 ; wdt:P131 wd:Q1893229 .
}

Using entities:
Revelstoke, also known as Revelstoke, BC, Revelstoke, British Columbia (wd:Q1893229): city in British Columbia, Canada
tourist attraction, also known as attraction for tourists, POI for tourists, tourism attraction, touristic attraction, tourist place (wd:Q570116): place of interest where tourists visit

Using properties:
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 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
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 hotel should i stay in san francisco?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?x wdt:P31 wd:Q27686 ; wdt:P131 wd:Q62 .
}

Using entities:
hotel, also known as hotel resort, hotel resorts, hotels (wd:Q27686): business enterprise that provides lodging in a single building paid on a short-term basis
San Francisco, also known as San Francisco County, California, The Golden City, The City by the Bay, SFO, SF (wd:Q62): consolidated city and county in California, United States

Using properties:
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 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
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] I have seen examples of how to query locations related to entities. Now I will search for the entity "George W. Bush" in Wikidata to get his identifier.

[Tool]
Top 10 entity alternatives:
1. 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
2. George Washington Bush, also known as George W. Bush (wd:Q5545944): American pioneer, husbandry worker, employee, pioneer, trapper, farmer
3. George W. Bush (wd:Q104844437): 2020 television documentary film
4. George W. Bush (wd:Q111279895): episode of Dokument utifrån
5. George W. Bush (wd:Q47513370): painting by Robert A. Anderson
6. George W. Bush, also known as George Washington Bush (wd:Q94496272): operator of George W. Bush & Son, a shipping business in Delaware, United States (1824-1900), consignor, director, merchant
7. George H. W. Bush, also known as G H W Bush, George W. Bush Senior, GHWB, GHW Bush, G.H.W. Bush (wd:Q23505): President of the United States from 1989 to 1993, baseball player, aircraft pilot, autobiographer, naval officer, statesperson, entrepreneur, politician, diplomat
8. George W. Bush Presidential Center, also known as GWB Library, GWB Presidential Library, George W. Bush Presidential Library, George W. Bush Library, Bush Presidential Library (wd:Q1508430): Presidential library and museum for U.S. President George W. Bush, located in Dallas, Texas
9. George W. Bush Administration cabinet, also known as Bush Cabinet, George W. Bush Cabinet, Cabinet of George W. Bush, Cabinet George W. Bush, Cabinet Bush (wd:Q28464532): most senior appointed officers of the executive branch of the fe...ent of the United States under the George W. Bush Administration
10. USS George W. Bush (wd:Q131753450): planned Gerald R. Ford-class aircraft carrier

[Assistant] The entity for George W. Bush, the President of the United States from 2001 to 2009, is wd:Q207. Next, I will search for properties related to "childhood residence" or "place lived as a child" for this entity.

[Tool]
Top 10 property alternatives:
1. residence, also known as living in, place of residence, resided at, resided in, resident in (wd:P551 as p/wdt): the place where the person is or has been, resident, location
2. family, also known as royal house, noble family, member of family, house, dynasty (wd:P53 as p/wdt): family, including dynasty and nobility houses. Not family name (use P734 for family name)., member of
3. 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
4. child, also known as has son, kids, mother of, kid, issue (wd:P40 as p/wdt): subject has object as child. Do not use for stepchildren—use "relative" (P1038), qualified with "type of kinship" (P1039), significant person, relative
5. work location, also known as work place, working from, working at, worked from, worked at (wd:P937 as p/wdt): location where persons or organisations were actively participating in employment, business or other work, significant place, location
6. mother, also known as mom, is child of, mommy, mum, mummy (wd:P25 as p/wdt): female parent of the subject. For stepmother, use "stepparent" (P3448), parent
7. father, also known as son of, child of, parent, is son of, is daughter of (wd:P22 as p/wdt): male parent of the subject. For stepfather, use "stepparent" (P3448), parent
8. number of children, also known as children, children (number), how many children, issue, kids (wd:P1971 as p/wdt): number of children of the person, animal, or character
9. sibling, also known as is sister of, is the brother of, is the sibling of, is the sister of, sib (wd:P3373 as p/wdt): the subject and the object have at least one common parent (brot...law, etc.) and step-siblings (step-brothers, step-sisters, etc.), relative
10. 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

No other items found

[Assistant] The property "residence" (wdt:P551) seems to be the most relevant to where George W. Bush lived, including potentially his childhood residence. I will now query the places where George W. Bush lived, and try to find if any of these places are marked as his childhood residence or if we can infer from the data.

[Tool]
Got 2 rows and 2 columns:
| place                                       | placeLabel                         |
| ------------------------------------------- | ---------------------------------- |
| George W. Bush Childhood Home (wd:Q1508408) | George W. Bush Childhood Home (en) |
| Dallas (wd:Q16557)                          | Dallas (en)                        |

[Assistant] George W. Bush has a residence listed as "George W. Bush Childhood Home" (wd:Q1508408) and also Dallas. The "George W. Bush Childhood Home" is likely the specific place where he lived as a child. I will now query the location of this childhood home to provide a more precise answer.

[Tool]
Got 2 rows and 2 columns:
| location             | locationLabel |
| -------------------- | ------------- |
| Midland (wd:Q128321) | Midland (en)  |
| Texas (wd:Q1439)     | Texas (en)    |

[Tool] Stopped generation process


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

Got 3 rows and 2 columns:
| governmentType                        | governmentTypeLabel           |
| ------------------------------------- | ----------------------------- |
| representative democracy (wd:Q188759) | representative democracy (en) |
| constitutional monarchy (wd:Q41614)   | constitutional monarchy (en)  |
| federation (wd:Q43702)                | federation (en)               |

Australia has a government that is a representative democracy, 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 type of government does australia have?

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

[Tool]
Example 1:
Question:
who raised queen victoria?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q9439 wdt:P22 | wdt:P25 ?x .
}

Using entities:
Victoria, also known as Victoria, Queen of Great Britain, Victoria of the United Kingdom, Victoria Hanover, Alexandrina Victoria von Hannover, Victoria Alexandrina (wd:Q9439): Queen of the United Kingdom from 1837 to 1901, monarch

Using properties:
father, also known as son of, child of, parent, is son of, is daughter of (wd:P22 as wdt): male parent of the subject. For stepfather, use "stepparent" (P3448), parent
mother, also known as mom, is child of, mommy, mum, mummy (wd:P25 as wdt): female parent of the subject. For stepmother, use "stepparent" (P3448), parent

Example 2:
Question:
what country do arabic people come from?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?x wdt:P172 wd:Q35323 ; wdt:P31 wd:Q6256 .
}

Using entities:
Arabs, also known as Arab, Arab people, Shukriya, Shuwa, Sukriya (wd:Q35323): Arabic-speaking ethnic and national groups, originally from the Arabian Peninsula
country, also known as countries (wd:Q6256): distinct territorial body or political entity

Using properties:
ethnic group, also known as ethnic or cultural origin, tribal affiliation, race, people, ethnicity (wd:P172 as 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)
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:
who played daniel larusso?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?p p:P161 ?y .
  ?y ps:P161 ?x ; pq:P453 wd:Q55315887 .
}

Using entities:
Daniel LaRusso, also known as Daniel-san (wd:Q55315887): fictional character from the Karate Kid franchise, business executive, car dealer, karateka

Using properties:
cast member, also known as feat., starring (film/play), film starring, starring, actor (wd:P161 as p/ps): actor in the subject production [use "character role" (P453) and...use "recorded participant" (P11108) for non-fiction productions], significant person, performer
character role, also known as role, plays, performer of, as, acting role (wd:P453 as pq): specific role played or filled by subject -- use only as qualifier of "cast member" (P161), "voice actor" (P725)

[Assistant]
From the examples, I see that to find the type of government of a country, I need to identify the entity for Australia and then find the property that corresponds to "type of government" or "form of government."

Step 1: Search for the entity "Australia" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. Australia, also known as AU, The Commonwealth of Australia, Stria, Straya, Stralia (wd:Q408): country in Oceania
2. Australian continent, also known as New Holland, Sahul, Nova Hollandia, Meganesia, Australinea (wd:Q3960): continent in the Earth's Southern Hemisphere
3. Australia (wd:Q275180): 2008 film by Baz Luhrmann
4. Australia (wd:Q205546): 1989 film by Jean-Jacques Andrien
5. Australia (wd:Q4823546): 1996 single by Manic Street Preachers
6. Australia (wd:Q781244): board game
7. Australia (wd:Q16835533): Racehorse
8. Australia, also known as Australia (KA–5) (wd:Q4823541): yacht that raced in the Americas Cup
9. Australia (wd:Q4823543): 2000 album by Howie Day
10. Australia (wd:Q25907685): albedo feature on the planet Mercury

[Assistant] The entity for the country Australia is wd:Q408. Now, I will search for properties related to "type of government" or "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. 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
3. 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
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. 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
6. executive body, also known as executive branch (wd:P208 as p/wdt): branch of government for the daily administration of the territorial entity
7. 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
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. has cabinet, also known as cabinet (wd:P12443 as p/wdt): value is the advisory committee to the item's head of state
10. 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

No other items found

[Assistant] The property "basic form of government" (wdt:P122) corresponds to the type of government. Now I will query the value of this property for Australia (wd:Q408).

[Tool]
Got 3 rows and 2 columns:
| governmentType                        | governmentTypeLabel           |
| ------------------------------------- | ----------------------------- |
| representative democracy (wd:Q188759) | representative democracy (en) |
| constitutional monarchy (wd:Q41614)   | constitutional monarchy (en)  |
| federation (wd:Q43702)                | federation (en)               |

[Tool] Stopped generation process


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

Got 4 rows and 2 columns:
| team                                   | teamLabel                     |
| -------------------------------------- | ----------------------------- |
| New Orleans Saints (wd:Q172435)        | New Orleans Saints (en)       |
| Minnesota Vikings (wd:Q221150)         | Minnesota Vikings (en)        |
| Tennessee Titans (wd:Q320484)          | Tennessee Titans (en)         |
| Ole Miss Rebels football (wd:Q7085897) | Ole Miss Rebels football (en) |

Peyton Manning's dad, Archie Manning, played for the following teams: New Orleans Saints, Minnesota Vikings, Tennessee Titans, and Ole Miss Rebels football.

[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 team did peyton manning's dad play for?

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

[Tool]
Example 1:
Question:
what language do irish people speak?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q170826 wdt:P1412 ?x .
}

Using entities:
Irish people, also known as Gaels, Irish (wd:Q170826): Celtic people

Using properties:
languages spoken, written or signed, also known as language of expression, language, wrote language, writes language, uses language (wd:P1412 as wdt): language(s) that a person or a people speaks, writes or signs, including the native language(s)

Example 2:
Question:
who is angelina jolie's husband?

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

Using entities:
Angelina Jolie, also known as Angelina Jolie Voight (wd:Q13909): American actress, philanthropist, actor, model

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 3:
Question:
where is belgium at?

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

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

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

[Assistant]
I have seen examples where we find the entity for a person and then find the property related to their spouse or language spoken. For this question, we need to find the entity for Peyton Manning's dad and then find the team he played for.

Step 1: Find the entity for Peyton Manning's dad.
Step 2: Find the property that relates this person to the team he played for.
Step 3: Query the team(s) he played for.

Let's start with step 1 and search for Peyton Manning's dad.

[Tool]
Top 10 entity alternatives:
1. Peyton Manning's Monologue (wd:Q110057291): sketch from Saturday Night Live
2. Townsend Dade Peyton (wd:Q111679872): (1774-1852)
3. father, also known as fathers, pop, papa, pa, daddy (wd:Q7565): male parent
4. Da Nang International Airport, also known as DAD, VVDN (wd:Q773330): airport in Vietnam
5. Ḍād, also known as dad, ḍād, ﺽ (wd:Q221893): letter of the Arabic alphabet
6. Dad (wd:Q1156922): 1989 film by Gary David Goldberg
7. Dad (wd:Q901107): village in Hungary
8. David Berg, also known as Mo, Moses David, King David, Dad, David Brandt Berg (wd:Q716827): American leader of Children of God (1920–1994), cult leader, preacher
9. Peyton, also known as Peyton, CO, Peyton, Colorado (wd:Q7179619): census-designated place in El Paso County, Colorado, United States
10. David Berg, also known as King David, Mo, Grandpa, David Brandt Berg, Father David (wd:Q716827): American leader of Children of God (1920–1994), cult leader, preacher

[Assistant] The search for "Peyton Manning's dad" did not directly return an entity for Peyton Manning's father. I will now search for "Peyton Manning" to find his entity and then look for the property that links him to his father.

[Tool]
Top 10 entity alternatives:
1. Peyton Manning, also known as The Sheriff, Peyton Williams Manning (wd:Q7539): American football player (born 1976), American football player, restaurateur, voice actor, actor
2. Peyton Manning statue (wd:Q130406528): statue of Peyton Manning
3. Statue of Peyton Manning (wd:Q130641896): bronze sculpture in Indianapolis, Indiana, U.S
4. Peyton Manning/Carrie Underwood, also known as Saturday Night Live S32E16, Saturday Night Live, season 32 episode 16 (wd:Q110036879): episode of Saturday Night Live (S32 E16)
5. Peyton Manning's Monologue (wd:Q110057291): sketch from Saturday Night Live
6. Peyton Manning Children’s Hospital at St.Vincent (wd:Q30293441): healthcare organization in Indianapolis, United States
7. Manning, also known as Manning, IA, Manning, Iowa (wd:Q2233616): city in Iowa, USA
8. Manning, also known as Manning, SC, Manning, South Carolina (wd:Q2025061): city in South Carolina, USA
9. Manning, also known as Manning, ND, Manning, North Dakota (wd:Q3286067): census-designated place in Dunn County, North Dakota, United States
10. Peyton, also known as Peyton, CO, Peyton, Colorado (wd:Q7179619): census-designated place in El Paso County, Colorado, United States

[Assistant] I found the entity for Peyton Manning (wd:Q7539). Now I will search for properties of Peyton Manning related to his family or father.

[Tool]
Top 10 property alternatives:
1. father, also known as son of, child of, parent, is son of, is daughter of (wd:P22 as p/wdt): male parent of the subject. For stepfather, use "stepparent" (P3448), parent
2. relative, also known as relatives, grandparent, relation, non-binary parent, niece (wd:P1038 as p/wdt): family member (qualify with "kinship to subject", P1039; for direct family member please use specific property), significant person
3. family, also known as royal house, noble family, member of family, house, dynasty (wd:P53 as p/wdt): family, including dynasty and nobility houses. Not family name (use P734 for family name)., member of
4. sibling, also known as is sister of, is the brother of, is the sibling of, is the sister of, sib (wd:P3373 as p/wdt): the subject and the object have at least one common parent (brot...law, etc.) and step-siblings (step-brothers, step-sisters, etc.), relative
5. family name, also known as clan name, last name, surname (wd:P734 as p/wdt): part of full name of person, name
6. 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
7. 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
8. 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)
9. 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
10. 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

No other items found

[Assistant] The property "father" (wdt:P22) is used to link Peyton Manning to his father. Now I will query Peyton Manning's father using this property.

[Tool]
Got 1 row and 2 columns:
| father                      | fatherLabel         |
| --------------------------- | ------------------- |
| Archie Manning (wd:Q611891) | Archie Manning (en) |

[Assistant] Peyton Manning's father is Archie Manning. Now I will search for the property that relates Archie Manning to the team he played for. I will search for properties of Archie Manning related to sports teams or clubs.

[Tool]
Top 10 property alternatives:
1. member of sports team, also known as plays for, played for, sport team, team, team played for (wd:P54 as p/wdt): sports teams or clubs that the subject represents or represented, member of
2. position played on team / speciality, also known as position (on team), speciality, specialism, position, player position (wd:P413 as p/wdt): position or specialism of a player on a team
3. educated at, also known as graduated from, graduate of, place of education, school attended, schooled at (wd:P69 as p/wdt): educational institution attended by subject, affiliation
4. 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
5. sport, also known as play, plays, sport played, sports (wd:P641 as p/wdt): sport that the subject participates or participated in or is associated with
6. award received, also known as win, winner of, recognition title, received award, prize received (wd:P166 as p/wdt): award or recognition received by a person, organization or creative work
7. 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)
8. 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)
9. family, also known as royal house, noble family, member of family, house, dynasty (wd:P53 as p/wdt): family, including dynasty and nobility houses. Not family name (use P734 for family name)., member of
10. relative, also known as relatives, grandparent, relation, non-binary parent, niece (wd:P1038 as p/wdt): family member (qualify with "kinship to subject", P1039; for direct family member please use specific property), significant person

No other items found

[Assistant] The property "member of sports team" (wdt:P54) is used to indicate the sports teams or clubs that Archie Manning played for. I will now query the teams that Archie Manning played for.

[Tool]
Got 4 rows and 2 columns:
| team                                   | teamLabel                     |
| -------------------------------------- | ----------------------------- |
| New Orleans Saints (wd:Q172435)        | New Orleans Saints (en)       |
| Minnesota Vikings (wd:Q221150)         | Minnesota Vikings (en)        |
| Tennessee Titans (wd:Q320484)          | Tennessee Titans (en)         |
| Ole Miss Rebels football (wd:Q7085897) | Ole Miss Rebels football (en) |

[Tool] Stopped generation process


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

Got 1 row and 2 columns:
| lyricist                       | lyricistLabel            |
| ------------------------------ | ------------------------ |
| Rabindranath Tagore (wd:Q7241) | Rabindranath Tagore (en) |

The author (lyricist) who wrote the Jana Gana Mana is Rabindranath Tagore.

[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] who wrote the jana gana mana?

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

[Tool]
Example 1:
Question:
what war was george washington president during?

SPARQL:
SELECT DISTINCT ?x WHERE {
  wd:Q23 wdt:P607 ?x .
}

Using entities:
George Washington, also known as Father of the United States (wd:Q23): Founding Father and first U.S. president (1789–1797), revolutionary, statesperson, army officer, cartographer, politician, engineer, geometer, writer, farmer

Using properties:
conflict, also known as war, theatre (military), theater (military), participated in conflict, military conflict (wd:P607 as wdt): battles, wars or other military engagements in which the person or item participated, participant in

Example 2:
Question:
what city was ronald reagan born in?

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

Using entities:
Ronald Reagan, also known as Ronald W Reagan, Ronald W. Reagan, R. W. Reagan, President Reagan, President Ronald Reagan (wd:Q9960): president of the United States from 1981 to 1989 and actor, television actor, military officer, character actor, game show host, autobiographer, anti-communist, trade unionist, art collector, statesperson, screenwriter, voice actor, film actor, politician, announcer, lifeguard, diarist, actor

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:
what are the major religions practiced in israel?

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

Using entities:
Israel, also known as Yisrael, State of Israel, IL, ISR, il (wd:Q801): country in Western 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 "Who wrote the Jana Gana Mana?" Jana Gana Mana is the national anthem of India. We want to find the author or writer of this anthem.

Step 1: Search for the entity "Jana Gana Mana" in Wikidata to find its identifier.
Step 2: Find the property related to "author" or "writer" for this entity.
Step 3: Query the author or writer of Jana Gana Mana.

I will start by searching for the entity "Jana Gana Mana" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. Jana Gana Mana (wd:Q83099): national anthem of India
2. Jana Gana Mana (wd:Q112072761): 2022 film directed by Dijo Jose Antony
3. Jana Gana Mana (wd:Q80196923): musical score approved for Indian national anthem
4. Jana Gana Mana (wd:Q6150500): 2012 film
5. Jana Gana Mana (wd:Q112274393): Telegu film
6. Jana Gana Mana (wd:Q121757500): 1942 radio performance
7. Jana Gana Mana Video (wd:Q6150505): national anthem
8. Jana Gana Mana Adhinayaka Jaya He (wd:Q121756199): vocal track by Amala Dutt, Nandita Devi, Sudhin Dutt & Santi Ghosh; 1934 studio recording
9. Jana Gana Mana Adhinayaka Jaya He (wd:Q121763513)
10. Manas Jana (wd:Q93070394): researcher (ORCID 0000-0003-3178-0647), researcher

[Assistant]
The entity "Jana Gana Mana" as the national anthem of India is identified as wd:Q83099.

Next, I will search for properties related to "author" or "writer" for this entity to find the author of Jana Gana Mana.

[Tool]
Top 10 property alternatives:
1. lyricist, also known as text poet, writer (of song lyrics), words by, text writer, text by (wd:P676 as p/wdt): author of song lyrics, author
2. composer, also known as music by, written by, songwriter, musical score by, film score by (wd:P86 as p/wdt): person(s) who wrote the music [for lyricist, use "lyrics by" (P676)], creator
3. publication date, also known as launched, published, publication time, publication, pubdate (wd:P577 as p/wdt): date or point in time when a work was first published or released, point in time
4. title, also known as name, titled, page name, original title, known as (wd:P1476 as p/wdt): published name of a work, such as a newspaper article, a literary work, piece of music, a website, or a performance work, name
5. tonality, also known as in key, key, key of musical composition, key used, musical key (wd:P826 as p/wdt): key of a musical composition
6. country of origin, also known as origin country, place of origin, originates from, country, CoO (wd:P495 as p/wdt): country of origin of this item (creative work, food, phrase, product, etc.), significant place, country
7. based on, also known as modelled after, inspired by, iteration of, modeled after, fork of (wd:P144 as p/wdt): the work(s) or inputs used as the basis for subject item; for fictional analog use P1074, references work, tradition or theory, inspired by
8. language of work or name, also known as language of the reference, language of URL, language of website, language of work, named in language (wd:P407 as p/wdt): language associated with this creative work (such as books, show...guage" (P103) and "languages spoken, written or signed" (P1412))
9. permanent duplicated item, also known as same concept as, same as, duplicate of, permanently duplicated item, duplicate of item (wd:P2959 as p/wdt): this item duplicates another item and the two can't be merged, a... cdowiki, gomwiki, nanwiki).  Use P31=Q17362920 for other wikis.
10. 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)

No other items found

[Assistant]
The property "lyricist" (wdt:P676) is used for the author of song lyrics, which fits the question "Who wrote the Jana Gana Mana?" since it is a song/anthem.

Now I will write a SPARQL query to get the lyricist (author of the lyrics) of Jana Gana Mana (wd:Q83099).

[Tool]
Got 1 row and 2 columns:
| lyricist                       | lyricistLabel            |
| ------------------------------ | ------------------------ |
| Rabindranath Tagore (wd:Q7241) | Rabindranath Tagore (en) |

[Tool] Stopped generation process


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

Kobe Bryant was drafted by the Charlotte Hornets.

[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] who was kobe bryant drafted by?

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

[Tool]
Example 1:
Question:
who did juan ponce de leon mary?

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

Using entities:
Juan Ponce de León, also known as Ponce de Leon, Juan Ponce de Leon, Don Juan Ponce de León, Don Juan Ponce de Leon (wd:Q185974): Spanish explorer and conquistador, military personnel, conquistador, explorer

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 the 5 biggest cities in the usa?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?x wdt:P31 wd:Q515 ; wdt:P17 wd:Q30 ; wdt:P1082 ?y .
}
ORDER BY DESC ( ?y )
LIMIT 5

Using entities:
United States, also known as the U.S. of A, United States of America, the US of America, United States of North America, U. S. (wd:Q30): country primarily located in North America
city, also known as cities (wd:Q515): large human settlement

Using properties:
population, also known as inhabitants, human population (wd:P1082 as wdt): number of people inhabiting the place; number of people of subject
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
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:
who played princess leia in star wars movies?

SPARQL:
SELECT DISTINCT ?x WHERE {
  ?p wdt:P31 wd:Q11424 ; p:P161 ?y .
  ?y ps:P161 ?x ; pq:P453 wd:Q51797 .
}

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
Princess Leia, also known as Princess Leia Organa, Leia Organa Solo, Leia Organa, Princess Leia Organa of Alderaan, General Organa (wd:Q51797): fictional character from Star Wars, starship pilot, politician, diplomat, impostor, rebel, Jedi, spy

Using properties:
cast member, also known as feat., starring (film/play), film starring, starring, actor (wd:P161 as p/ps): actor in the subject production [use "character role" (P453) and...use "recorded participant" (P11108) for non-fiction productions], significant person, performer
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)
character role, also known as role, plays, performer of, as, acting role (wd:P453 as pq): specific role played or filled by subject -- use only as qualifier of "cast member" (P161), "voice actor" (P725)

[Assistant] From the examples, I see that to find who drafted Kobe Bryant, I need to identify Kobe Bryant as an entity and then find the property related to "drafted by" or "drafted team" or similar. I will start by searching for the entity "Kobe Bryant" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. Kobe Bryant, also known as Kobe Bean Bryant, Kobe B. Bryant, Kobe, KB24, Black Mamba (wd:Q25369): American basketball player (1978–2020), professional athlete, basketball player, screenwriter
2. Kobe Bryant Day (wd:Q98969272): proposed Federal Holiday
3. death of Kobe Bryant, also known as Kobe Bryant death, Kobe Bryant's death (wd:Q83737550): 26 January 2020 death of Kobe Bryant in helicopter crash
4. Kobe Bryant Boulevard (wd:Q107299206): proposed street renaming in Los Angeles
5. NBA All-Star Game Kobe Bryant Most Valuable Player Award, also known as Kobe Bryant Most Valuable Player Award, Kobe Bryant MVP Award, NBA All-Star Game Kobe Bryant MVP Award (wd:Q31391): basketball award of the National Basketball Association (NBA)
6. Kobe Bryant China Fund (wd:Q6424297): for education, sports, and culture programs for children from China and the United States
7. Statue of Kobe Bryant (wd:Q125101336): sculpture in Los Angeles, California, U.S
8. Kobe Bryant/Ice Cube (wd:Q125446155): episode of All That (S4 E19)
9. Kobe Bryant sexual assault case (wd:Q6424298): legal case
10. Kobe Bryant in NBA Courtside (wd:Q3198120): 1998 video game

[Assistant] I found the entity for Kobe Bryant: wd:Q25369. Now I will search for properties related to "draft" or "drafted by" for this entity.

[Tool]
Top 10 property alternatives:
1. drafted by (wd:P647 as p/wdt): which team the player was drafted by
2. The Draft Review ID, also known as Draft Review identifier, The Draft Review identifier, Draft Review ID (wd:P9514 as p/wdt): identifier for a basketball player in the database of The Draft Review
3. DraftExpress ID, also known as draftexpress.com ID (wd:P3533 as p/wdt): identifier for a basketball player at draftexpress.com
4. nominated for, also known as nominee for, shortlisted for, selected for award, selected for, nominee for award (wd:P1411 as p/wdt): award nomination received by a person, organisation or creative work (inspired from "award received" (Property:P166))
5. sport, also known as play, plays, sport played, sports (wd:P641 as p/wdt): sport that the subject participates or participated in or is associated with
6. 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)
7. 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)
8. league or competition, also known as tournament, sports league, division, cup, competition (wd:P118 as p/wdt): league or competition in which team or player has played, or in which an event occurs, participant in
9. 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
10. 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

No other items found

[Assistant] The property "drafted by" (wdt:P647) is the relevant property for the team that drafted Kobe Bryant. Now I will write a SPARQL query to find the team that drafted Kobe Bryant.

[Tool]
Got 1 row and 2 columns:
| team                           | teamLabel              |
| ------------------------------ | ---------------------- |
| Charlotte Hornets (wd:Q163480) | Charlotte Hornets (en) |

[Tool] Stopped generation process