PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?dog ?dogLabel ( ( YEAR( ?dod ) - YEAR( ?dob ) ) AS ?lifespan ) WHERE {
  ?dog wdt:P31 wd:Q144 .
  ?dog wdt:P569 ?dob .
  ?dog wdt:P570 ?dod .
  OPTIONAL {
    ?dog rdfs:label ?dogLabel FILTER ( LANG( ?dogLabel ) = "en" )
  }
}
ORDER BY DESC ( ?lifespan )
LIMIT 2

The second oldest dog in the world is Bobi, who lived for 31 years.

[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] How many years did the second oldest dog in the world live?

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

[Tool]
Example 1:
Question:
When did Michael Jackson die?

SPARQL:
SELECT ?o1 WHERE {
  wd:Q2831 wdt:P570 ?o1 .
}

Using entities:
Michael Jackson, also known as M.J., MJ, M. J., The King of Pop, King of Pop (wd:Q2831): American singer, songwriter, and dancer (1958–2009), singer-songwriter, recording artist, record producer, businessperson, philanthropist, music arranger, autobiographer, film director, choreographer, art collector, entrepreneur, screenwriter, voice actor, songwriter, film actor, composer, dancer, singer, actor, model, poet

Using properties:
date of death, also known as DOD, deathdate, died, died on, year of death (wd:P570 as wdt): dissolved, abolished or demolished date, date on which the subject died, end time

Example 2:
Question:
Give me the capitals of all countries in Africa.

SPARQL:
SELECT DISTINCT ?uri WHERE {
  ?country wdt:P31 wd:Q6256 .
  ?country wdt:P30 wd:Q15 .
  ?country wdt:P36 ?uri .
}

Using entities:
Africa, also known as African continent (wd:Q15): continent
country, also known as countries (wd:Q6256): distinct territorial body or political entity

Using properties:
continent (wd:P30 as wdt): continent of which the subject is a part, located in/on physical feature
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)
capital, also known as administrative seat, seat of government, seat, principal place, location of capital (wd:P36 as wdt): seat of government of a country, province, state or other type of administrative territorial entity

Example 3:
Question:
How high is the Yokohama Marine Tower?

SPARQL:
SELECT DISTINCT ?num WHERE {
  wd:Q1207989 wdt:P2048 ?num .
}

Using entities:
Yokohama Marine Tower (wd:Q1207989): lighthouse in Japan

Using properties:
height, also known as heighth, size, depth over terrain (wd:P2048 as wdt): vertical length of an entity, length

[Assistant]
The question is about the lifespan of the second oldest dog in the world. To answer this, I need to:

1. Identify the entity for "dog" or "dogs" in Wikidata.
2. Find dogs that have a recorded lifespan or age at death.
3. Sort these dogs by their lifespan or age at death to find the second oldest.
4. Retrieve the lifespan or age at death of the second oldest dog.

I will start by searching for entities related to "dog" to find the relevant class or individual dogs with recorded lifespans.

[Tool]
Top 10 entity alternatives:
1. dog, also known as Canis lupus familiaris, Canis familiaris, domestic dogs, domestic dog (wd:Q144): domestic animal
2. Dog (wd:Q755126): sign of Chinese zodiac
3. Dog (wd:Q104843787): 2022 film directed by Reid Carolin and Channing Tatum
4. Dongola Airport, also known as DOG, HSDN (wd:Q1431231): airport
5. Hurricane Dog, also known as Dog (wd:Q217669): Category 5 Atlantic hurricane in 1950
6. Wax, also known as Dog, WAX (wd:Q624269): South Korean singer, singer
7. Dog, also known as D0g (wd:Q1211818): fictional character in Half-Life
8. hound, also known as dog (wd:Q1637371): heraldic animal
9. dog, also known as shutter, shutter dog (wd:Q5288153): tool in engineering
10. Canis familiaris, also known as dog, domestic dog (wd:Q20717272): species of mammal

[Assistant] The entity for "dog" as a domestic animal is wd:Q144. Next, I need to find properties related to the lifespan or age at death of dogs. I will search for properties related to "age" or "lifespan" for this entity.

[Tool]
Top 10 property alternatives:
1. longest observed lifespan, also known as maximum age, oldest recorded individual, oldest observed, maximum life span, highest observed lifespan (wd:P4214 as wdt/p): age of the oldest specimen of a taxon for which the age can be verified
2. life expectancy, also known as life span, lifespan (wd:P2250 as wdt/p): average life expectancy for this group or species, duration
3. has use, also known as utility, used in, used for, used as, use (wd:P366 as wdt/p): main use of the subject (includes current and former usage)
4. earliest date, also known as no earlier than, terminus post quem, start date (earliest), on or after this date, minimum date (wd:P1319 as wdt/p): earliest date at which an event could have happened. Use as qualifier for other date properties
5. used by, also known as armiger, user, played by, of (wd:P1535 as wdt/p): item or concept that makes use of the subject (use sub-properties when appropriate)
6. instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as wdt/p): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)
7. OpenStreetMap tag or key, also known as tag, OSM wiki tag or key, OpenStreetMap relation role, OSM tag or key, OSM tag (wd:P1282 as wdt/p): OpenStreetMap tagging schema (a Key:key, Tag:key=value, Relation:type, or Role:role) for classes, properties, and values
8. taxon rank, also known as taxonomic rank, type of taxon, rank (wd:P105 as wdt/p): level in a taxonomic hierarchy, instance of
9. main food source, also known as diet, eats, ecology (Fossilworks field  name), food plant, food source (wd:P1034 as wdt/p): species, genus or family that an organism depends on for nutrition
10. image, also known as still capture, still, screenshot, screen capture, portrait (wd:P18 as wdt/p): image of relevant illustration of the subject; if available, als...tor map, flag image, signature image, logo image, collage image)

No other items found

[Assistant] The property "longest observed lifespan" (wdt:P4214) seems to be the most relevant for finding the age of the oldest dogs. I will now search for dogs (instances or individuals) that have this property to find the oldest dogs and their lifespans.

[Tool]
Got 1,159 rows and 3 columns, showing the first 10 rows below:
| subject                     | property                              | object             |
| --------------------------- | ------------------------------------- | ------------------ |
| dog (wd:Q144)               | longest observed lifespan (wdt:P4214) | 30 (xsd:decimal)   |
| lion (wd:Q140)              | longest observed lifespan (wdt:P4214) | 27 (xsd:decimal)   |
| tiger (wd:Q19939)           | longest observed lifespan (wdt:P4214) | 26.3 (xsd:decimal) |
| sheep (wd:Q7368)            | longest observed lifespan (wdt:P4214) | 22.8 (xsd:decimal) |
| cattle (wd:Q830)            | longest observed lifespan (wdt:P4214) | 48 (xsd:decimal)   |
| Canis lupus (wd:Q18498)     | longest observed lifespan (wdt:P4214) | 20.6 (xsd:decimal) |
| goat (wd:Q2934)             | longest observed lifespan (wdt:P4214) | 20.8 (xsd:decimal) |
| leopard (wd:Q34706)         | longest observed lifespan (wdt:P4214) | 27.3 (xsd:decimal) |
| Ursus maritimus (wd:Q33609) | longest observed lifespan (wdt:P4214) | 43.8 (xsd:decimal) |
| Vulpes vulpes (wd:Q8332)    | longest observed lifespan (wdt:P4214) | 21.3 (xsd:decimal) |
| ...                         | ...                                   | ...                |

[Assistant] The property "longest observed lifespan" (wdt:P4214) is used for species like dog (wd:Q144) with a value of 30 years, but this refers to the species in general, not individual dogs. I need to find individual dogs with recorded ages or lifespans. I will search for entities related to "dog" that are individual dogs or notable dogs.

[Tool]
Top 10 entity alternatives:
1. INDIVIDUAL SPECIFICITY OF DOG SERUM AND PLASMA (wd:Q81004665): scientific article published on 01 July 1942
2. dog, also known as Canis lupus familiaris, Canis familiaris, domestic dogs, domestic dog (wd:Q144): domestic animal
3. individual, also known as individual organism, individual person, individuals (wd:Q795052): individual person or organism
4. Dog (wd:Q755126): sign of Chinese zodiac
5. Dog (wd:Q104843787): 2022 film directed by Reid Carolin and Channing Tatum
6. Dongola Airport, also known as DOG, HSDN (wd:Q1431231): airport
7. Hurricane Dog, also known as Dog (wd:Q217669): Category 5 Atlantic hurricane in 1950
8. urelement, also known as atom, individual, ur-element (wd:Q1896657): object (concrete or abstract) that is not a set, but that may be an element of a set
9. Wax, also known as Dog, WAX (wd:Q624269): South Korean singer, singer
10. Dog, also known as D0g (wd:Q1211818): fictional character in Half-Life

[Assistant] I did not find a specific entity for individual dogs from the search. I will try a different approach and search for notable dogs or famous dogs that might have recorded lifespans. I will search for "famous dog" or "notable dog".

[Tool]
Top 10 entity alternatives:
1. Famous Dog Lassie, also known as Meiken Lassie (wd:Q546373): Japanese anime television series
2. Art's Famous Chili Dog Stand (wd:Q24439147): hot dog stand in Los Angeles, California, U.S
3. Nathan's Hot Dog Eating Contest, also known as Nathan's Famous Hot Dog Eating Contest (wd:Q1058816): competition
4. Little Remi and Famous Dog Capi, also known as Nobody's Boy (wd:Q11271849): 1970 Japanese animated film directed by Yūgo Serikawa
5. DINGO BLOOD IMPROVES FAMOUS CATTLE DOG (wd:Q77071610): scientific article published on 01 November 1964
6. The most famous dog in history (wd:Q56449057)
7. dog, also known as Canis lupus familiaris, Canis familiaris, domestic dogs, domestic dog (wd:Q144): domestic animal
8. Dog (wd:Q755126): sign of Chinese zodiac
9. Dog (wd:Q104843787): 2022 film directed by Reid Carolin and Channing Tatum
10. fame, also known as famous, celebrity, recognition, notoriety (wd:Q1519566): social status of publicly known persons

[Assistant] I did not find individual famous dogs with lifespan information from the search. I will try to find dogs that have a date of birth and date of death recorded, so I can calculate their lifespan and find the second oldest. I will search for properties related to "date of birth" and "date of death" for dogs.

[Tool]
Top 10 property alternatives:
1. used by, also known as armiger, user, played by, of (wd:P1535 as wdt/p): item or concept that makes use of the subject (use sub-properties when appropriate)
2. depicted by, also known as acted by, shown in, seen in, portrayed by, played by (wd:P1299 as wdt/p): object depicting this subject (object being creative works such as books, films, paintings)
3. OpenStreetMap tag or key, also known as tag, OSM wiki tag or key, OpenStreetMap relation role, OSM tag or key, OSM tag (wd:P1282 as wdt/p): OpenStreetMap tagging schema (a Key:key, Tag:key=value, Relation:type, or Role:role) for classes, properties, and values
4. Personality Database profile ID, also known as Personality DB ID, www.personality-database.com/profile/, Personality DB profile ID, Personality DB profile, Personality DB identifier (wd:P10757 as wdt/p): identifier of a human, fictional character, or other entity on the Personality Database website
5. described by source, also known as mentioned in, source of item, reviewed in, mentioned in news article, talked about in (wd:P1343 as wdt/p): work where this item is described, attested in
6. longest observed lifespan, also known as maximum age, oldest recorded individual, oldest observed, maximum life span, highest observed lifespan (wd:P4214 as wdt/p): age of the oldest specimen of a taxon for which the age can be verified
7. PSH ID, also known as Czech Technical Library ID, PSH, PSH identifier (wd:P1051 as wdt/p): identifier in the authority database of the Czech Technical Library
8. instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as wdt/p): 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 wdt/p): image of relevant illustration of the subject; if available, als...tor map, flag image, signature image, logo image, collage image)
10. taxon rank, also known as taxonomic rank, type of taxon, rank (wd:P105 as wdt/p): level in a taxonomic hierarchy, instance of

No other items found

[Assistant] There are no specific properties for "date of birth" or "date of death" directly associated with the entity "dog" (wd:Q144). I will try to find individual dogs (instances of dog) that have date of birth and date of death properties. I will search for instances of dogs with these properties.

[Tool]
Got 10 rows and 4 columns:
| dog                               | dogLabel                | dob                                 | dod                                 |
| --------------------------------- | ----------------------- | ----------------------------------- | ----------------------------------- |
| Boye (wd:Q4952431)                | Boye (en)               | 1638-01-01T00:00:00Z (xsd:dateTime) | 1644-07-02T00:00:00Z (xsd:dateTime) |
| Zemira (wd:Q4191012)              | Zemira (en)             | 1778-01-01T00:00:00Z (xsd:dateTime) | 1785-07-18T00:00:00Z (xsd:dateTime) |
| Nevado (wd:Q9049682)              | Nevado (en)             | 1813-01-01T00:00:00Z (xsd:dateTime) | 1821-06-24T00:00:00Z (xsd:dateTime) |
| Dash (wd:Q1171851)                | Dash (en)               | 1830-01-01T00:00:00Z (xsd:dateTime) | 1840-01-01T00:00:00Z (xsd:dateTime) |
| Flush (wd:Q125298880)             | Flush (en)              | 1841-01-01T00:00:00Z (xsd:dateTime) | 1854-06-01T00:00:00Z (xsd:dateTime) |
| Fido (wd:Q4483493)                | Fido (en)               | 1855-01-01T00:00:00Z (xsd:dateTime) | 1865-01-01T00:00:00Z (xsd:dateTime) |
| Old Jock (wd:Q7084299)            | Old Jock (en)           | 1859-01-01T00:00:00Z (xsd:dateTime) | 1871-01-01T00:00:00Z (xsd:dateTime) |
| Néro (wd:Q86516809)               | Néro (en)               | 1861-01-01T00:00:00Z (xsd:dateTime) | 1868-06-02T00:00:00Z (xsd:dateTime) |
| Sallie Ann Jarrett (wd:Q20709260) | Sallie Ann Jarrett (en) | 1861-01-01T00:00:00Z (xsd:dateTime) | 1865-02-06T00:00:00Z (xsd:dateTime) |
| Master McGrath (wd:Q13647435)     | Master McGrath (en)     | 1866-01-01T00:00:00Z (xsd:dateTime) | 1873-01-01T00:00:00Z (xsd:dateTime) |

[Assistant]
I found individual dogs with date of birth (dob) and date of death (dod) recorded. To find the second oldest dog, I need to calculate the lifespan (difference between dod and dob) for each dog, order them by lifespan in descending order, and select the second one.

I will write a SPARQL query to calculate the lifespan in years, order by lifespan descending, and get the second oldest dog's lifespan.

[Tool]
Got 2 rows and 3 columns:
| dog                  | dogLabel   | lifespan     |
| -------------------- | ---------- | ------------ |
| Boris (wd:Q2022604)  | Boris (en) | 97 (xsd:int) |
| Bobi (wd:Q116658361) | Bobi (en)  | 31 (xsd:int) |

[Assistant] The second oldest dog in the world is Bobi (wd:Q116658361), who lived for 31 years. I will now provide the final answer.

[Tool] Stopped generation process


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ( COUNT( DISTINCT ?mountain ) AS ?count ) WHERE {
  ?mountain wdt:P31 wd:Q8502 .
  ?mountain wdt:P131 wd:Q183 .
}

Got 1 row and 1 column:
| count        |
| ------------ |
| 10 (xsd:int) |

There are 10 mountains located in Germany according to Wikidata.

[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] How many mountains are located in Germany?

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

[Tool]
Example 1:
Question:
How many missions does the Soyuz programme have?

SPARQL:
SELECT ( COUNT( DISTINCT ?uri ) AS ?c ) WHERE {
  ?uri wdt:P361 wd:Q207329
}

Using entities:
Soyuz programme (wd:Q207329): crewed spaceflight programme of the Soviet Union

Using properties:
part of, also known as of, within, system of, subsystem of, subgroup of (wd:P361 as wdt): object of which the subject is a part (if this subject is alread... of "has part" (P527, see also "has parts of the class" (P2670))

Example 2:
Question:
Which countries have more than two official languages?

SPARQL:
SELECT DISTINCT ?uri WHERE {
  ?uri wdt:P31 wd:Q6256 .
  ?uri wdt:P37 ?language .
}
GROUP BY ?uri
HAVING ( COUNT( ?language ) > 2 )

Using entities:
country, also known as countries (wd:Q6256): distinct territorial body or political entity

Using properties:
instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as wdt): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)
official language, also known as language spoken, spoken in, speaking, language official (wd:P37 as wdt): language designated as official by this item, language used

Example 3:
Question:
Which city has the most inhabitants?

SPARQL:
SELECT DISTINCT ?uri WHERE {
  ?uri wdt:P31 / wdt:279 * wd:Q515 ; wdt:P1082 ?population .
}
ORDER BY DESC ( ?population )
LIMIT 1

Using entities:
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
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 examples show how to count entities of a certain type and how to filter by location. For the question "How many mountains are located in Germany?", we need to:

1. Identify entities that are instances of "mountain".
2. Filter those mountains by location in Germany.

Next, I will search for the entity "mountain" in Wikidata to get its identifier.

[Tool]
Top 10 entity alternatives:
1. mountain, also known as mt., mtn., mountains, mount (wd:Q8502): large natural elevation of the Earth's surface
2. Mountain (wd:Q1255792): American band
3. Mountain, also known as Mountain, ND, Mountain, North Dakota (wd:Q2032181): city in North Dakota, USA
4. Mountain, also known as Town of Mountain (wd:Q1885759): civil town in Oconto County, Wisconsin
5. The Mountain, also known as Mountain (wd:Q910112): 1956 film by Edward Dmytryk
6. ☶, also known as U+2636, gèn, TRIGRAM FOR MOUNTAIN, mountain, immobility (wd:Q2068902): trigram for mountain (U+2636), immobility, or stability: gen4, gèn, ken
7. The Mountain, also known as Mountain (wd:Q1192451): 1991 film by Markus Imhoof
8. 4-8-2, also known as 241, 2D1, 4/7, Mohawk, Mountain (wd:Q1473477): locomotive wheel arrangement
9. Mountain (wd:Q13422857): human settlement in Wisconsin, United States of America
10. Mountain (wd:Q29293936): 2014 simulation video game

[Assistant] The entity for mountain is wd:Q8502. Now, I will search for the entity "Germany" to get its identifier.

[Tool]
Top 10 entity alternatives:
1. Germany, also known as BR Deutschland, Bundesrepublik Deutschland, Deutschland, Federal Republic of Germany (wd:Q183): country in Central Europe
2. Weimar Republic, also known as German Republic, Weimar Germany, Republic of Germany, Germany, German Reich (wd:Q41304): Germany in the years 1918/1919–1933
3. German Reich, also known as Deutsches Reich, German Empire, German Realm, Germany, Imperial Germany (wd:Q1206012): official name for the German nation state from 1871 to 1945, and name of Germany until 1949
4. Burg Drachenfels, also known as Germany (wd:Q1011486): castle
5. Germany (wd:Q5552078): European Parliament constituency
6. Geilenkirchen-Heinsberg, also known as Germany (wd:Q2268218)
7. Germany, also known as Germany, IN, Germany, Indiana (wd:Q18151573): unincorporated community in Clark County, Indiana
8. Germany (wd:Q19147844): poem by Vladimir Mayakovsky
9. Germany, also known as Ludwig, West (wd:Q3839160): Hetalia character
10. Germany, also known as Germany, Texas, Germany, TX (wd:Q15221573): unincorporated community in Houston County, Texas, United States

[Assistant] The entity for Germany is wd:Q183. Next, I will search for a property that indicates the location or country of a mountain. I will search for properties related to "located in" or "country" for the entity mountain (wd:Q8502).

[Tool]
Top 10 property alternatives:
1. described by source, also known as mentioned in, source of item, reviewed in, mentioned in news article, talked about in (wd:P1343 as wdt/p): work where this item is described, attested in
2. part of, also known as of, within, system of, subsystem of, subgroup of (wd:P361 as wdt/p): object of which the subject is a part (if this subject is alread... of "has part" (P527, see also "has parts of the class" (P2670))
3. image, also known as still capture, still, screenshot, screen capture, portrait (wd:P18 as wdt/p): image of relevant illustration of the subject; if available, als...tor map, flag image, signature image, logo image, collage image)
4. instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as wdt/p): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)
5. model item, also known as specimen, sample, featured item, example item, best example (wd:P5869 as wdt/p): defines which item is a best practice example of modelling a sub...lue of this property, usage instructions at Wikidata:Model items
6. studied in, also known as is studied by, studied by, science, that studies, researched in, researched by (wd:P2579 as wdt/p): subject is studied by this science or domain, field of work
7. properties for this type, also known as uses properties, Wikidata properties for this type, Wikidata properties for this class, uses property, things one could say about (wd:P1963 as wdt/p): when this subject is used as object of “instance of”, the following properties normally apply
8. has part(s), also known as has component, incorporates, has ingredient, has ingredients, has member (wd:P527 as wdt/p): part of this subject; inverse property of "part of" (P361). See also "has parts of the class" (P2670).
9. OpenStreetMap tag or key, also known as tag, OSM wiki tag or key, OpenStreetMap relation role, OSM tag or key, OSM tag (wd:P1282 as wdt/p): OpenStreetMap tagging schema (a Key:key, Tag:key=value, Relation:type, or Role:role) for classes, properties, and values
10. subclass of, also known as rdfs:subClassOf, sort of, subcategory of, subgenre of, subtype of (wd:P279 as wdt/p): this item is a subclass (subset) of that item; ALL instances of ...stance of volcanic landform); Everest is an instance of mountain

No other items found

[Assistant] The property "located in the administrative territorial entity" (wdt:P131) is commonly used to indicate the location of an entity. I will check if mountains have this property pointing to Germany. I will write a query to count mountains (wd:Q8502) that are located in Germany (wd:Q183) using the property wdt:P131.

[Tool]
Got 1 row and 1 column:
| count        |
| ------------ |
| 10 (xsd:int) |

[Tool] Stopped generation process


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?foundingDate WHERE {
  wd:Q1771942 wdt:P571 ?foundingDate .
}

The United Fruit Company was founded in the year 1899.

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

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

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

You should follow a step-by-step approach to generate the SPARQL query:
1. Determine possible entities and properties implied by the user question.
2. Use the functions to search for entities and properties in the knowledge graphs. Where applicable, constrain the searches with already identified entities and properties.
3. Gradually build up the SPARQL query using the identified entities and properties. Start with simple queries and add more complexity as needed. Use the execute function to get feedback on intermediate queries. You can go back and forth between knowledge graph searches and SPARQL query executions to refine the query.
4. Use the answer or cancel function to finalize your answer and stop the generation process.

Additional rules:
1. Explain your thought process before and after each step and function call.
2. Do not assume or make up any entities or properties without verifying them with the knowledge graphs and functions.
3. The SPARQL query should always return the actual identifiers / IRIs of the items in its result. It additionally may return labels or other human-readable information, but they are optional and should be put within optional clauses unless explicitly requested by the user.
4. Do not stop early if there are still obvious improvements to be made to the SPARQL query. For example, keep refining your SPARQL query if its result contains irrelevant items or is missing items you expected.
5. Do not perform additional computation (e.g. filtering, sorting, calculations) on the result of the SPARQL query to determine the answer. All computation should be done solely within SPARQL.
6. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
7. Do not use 'SERVICE wikibase:label { bd:serviceParam wikibase:language ...' in SPARQL queries. It is not SPARQL standard and unsupported by the used QLever SPARQL endpoints. Use rdfs:label or similar properties to get labels instead.

[User] When was United Fruit Company founded?

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

[Tool]
Example 1:
Question:
What was the first Queen album?

SPARQL:
SELECT DISTINCT ?uri WHERE {
  ?uri wdt:P31 wd:Q482994 .
  ?uri wdt:P175 wd:Q15862 .
  ?uri wdt:P577 ?date
}
ORDER BY ?date
LIMIT 1

Using entities:
Queen (wd:Q15862): British musical group; rock band
album, also known as full album, record album, music album, full-length album, audio album (wd:Q482994): grouping of album releases by an artist usually released at the ...racks but in different formats for consumption (digital, CD, LP)

Using properties:
performer, also known as actor, sung by, singer, recording by, recorded by (wd:P175 as wdt): actor, musician, band or other performer associated with this role or musical work, contributor to the creative work or subject
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)
publication date, also known as launched, published, publication time, publication, pubdate (wd:P577 as wdt): date or point in time when a work was first published or released, point in time

Example 2:
Question:
Give me the runtime of Toy Story.

SPARQL:
SELECT ?val WHERE {
  wd:Q171048 wdt:P2047 ?val .
}

Using entities:
Toy Story, also known as Toy Story 1 (wd:Q171048): 1995 American animated film

Using properties:
duration, also known as time length, timespan, time span, time interval, runtime (wd:P2047 as wdt): length of time of an event or process

Example 3:
Question:
What are the names of the Teenage Mutant Ninja Turtles?

SPARQL:
SELECT DISTINCT ?uri WHERE {
  ?uri wdt:P361 wd:Q1381762 .
}

Using entities:
Teenage Mutant Ninja Turtles, also known as Ninja Turtles, Teenage Mutant Hero Turtles, TMNT (wd:Q1381762): fictional team of four teenage anthropomorphic turtles

Using properties:
part of, also known as of, within, system of, subsystem of, subgroup of (wd:P361 as wdt): object of which the subject is a part (if this subject is alread... of "has part" (P527, see also "has parts of the class" (P2670))

[Assistant]
From the examples, I see that the property for the founding date or inception of an organization is often represented by the property "inception" (wdt:P571).

Next, I will search for the entity "United Fruit Company" in Wikidata to get its identifier.

[Tool]
Top 10 entity alternatives:
1. United Fruit Company (wd:Q1771942): American corporation
2. United Fruit Company Building (wd:Q79310992): historic building in Wellington, New Zealand
3. United Fruit Company Infrastructure (wd:Q65591387): Tentative World Heritage Site in Colombia
4. Kossick v. United Fruit Company (wd:Q19089122): United States Supreme Court case
5. United Fruit Company Medal (obverse) (wd:Q122934149): bronze medal-sample by Paul Manship
6. United Fruit Company Medal (reverse) (wd:Q122934151): bronze medal-sample by Paul Manship
7. American Banana Company v. United Fruit Company (wd:Q19037455)
8. United Fruit Company strike of 1913 (wd:Q105962401)
9. United States v. Fruit Growers' Express Company (wd:Q19030798): United States Supreme Court case
10. United Surety Company v. American Fruit Product Company (wd:Q19041555)

[Assistant] The entity "United Fruit Company" corresponds to wd:Q1771942 in Wikidata. The property for founding or inception date is usually wdt:P571. I will now construct a SPARQL query to get the founding date of the United Fruit Company.

[Tool]
Got 1 row and 1 column:
| foundingDate                        |
| ----------------------------------- |
| 1899-01-01T00:00:00Z (xsd:dateTime) |

[Tool] Stopped generation process


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?discipline ?disciplineLabel WHERE {
  {
    ?discipline wdt:P279 wd:Q11862829 .
  } UNION {
    ?discipline wdt:P31 wd:Q11862829 .
  }
  ?discipline rdfs:label ?disciplineLabel .
  FILTER ( CONTAINS( LCASE( ?disciplineLabel ) , "linguistik" ) ) FILTER ( LANG( ?disciplineLabel ) = "de" )
}

Got 16 rows and 2 columns, showing the first 5 and last 5 rows below:
| discipline                             | disciplineLabel             |
| -------------------------------------- | --------------------------- |
| Saami linguistics (wd:Q12718141)       | Samische Linguistik (de)    |
| general linguistics (wd:Q14357850)     | Allgemeine Linguistik (de)  |
| sociolinguistics (wd:Q160845)          | Soziolinguistik (de)        |
| computational linguistics (wd:Q182557) | Computerlinguistik (de)     |
| historical linguistics (wd:Q190375)    | historische Linguistik (de) |
| ...                                    | ...                         |
| applied linguistics (wd:Q321249)       | angewandte Linguistik (de)  |
| wd:Q357196                             | Rechtslinguistik (de)       |
| descriptive linguistics (wd:Q777864)   | deskriptive Linguistik (de) |
| ethnolinguistics (wd:Q853085)          | Ethnolinguistik (de)        |
| interlinguistics (wd:Q856574)          | Interlinguistik (de)        |

The German names of academic disciplines containing "linguistik" include Samische Linguistik, Allgemeine Linguistik, Soziolinguistik, Computerlinguistik, historische Linguistik, angewandte Linguistik, Rechtslinguistik, deskriptive Linguistik, Ethnolinguistik, and Interlinguistik.

[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 are the German names of academic disciplines containing “linguistik”?

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

[Tool]
Example 1:
Question:
In which countries do people speak Japanese?

SPARQL:
SELECT DISTINCT ?uri WHERE {
  ?uri wdt:P31 wd:Q6256 .
  ?uri wdt:P37 wd:Q5287 .
}

Using entities:
Japanese, also known as Japanese language, Japanesic (wd:Q5287): language spoken in East Asia
country, also known as countries (wd:Q6256): distinct territorial body or political entity

Using properties:
instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as wdt): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)
official language, also known as language spoken, spoken in, speaking, language official (wd:P37 as wdt): language designated as official by this item, language used

Example 2:
Question:
Give me the birth place of Frank Sinatra.

SPARQL:
SELECT DISTINCT ?uri WHERE {
  wd:Q40912 wdt:P19 ?uri
}

Using entities:
Frank Sinatra, also known as Old Blue Eyes, Ol' Blue Eyes, Sinatra, Francis Albert Sinatra (wd:Q40912): American singer and actor (1915–1998), television actor, film producer, film director, voice actor, film actor, director, producer, singer, 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:
Which movies starring Brad Pitt were directed by Guy Ritchie?

SPARQL:
SELECT DISTINCT ?uri WHERE {
  ?type wdt:P279 * wd:Q11424 .
  ?uri wdt:P31 ?type ; wdt:P161 wd:Q35332 ; wdt:P57 wd:Q192990 .
}

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
Guy Ritchie, also known as Guy Stuart Ritchie, Guy Stewart Ritchie (wd:Q192990): English filmmaker, film producer, film director, screenwriter, entrepreneur, director, judoka
Brad Pitt, also known as William Bradley Pitt, Brad Jolie-Pitt (wd:Q35332): American actor and filmmaker (born 1963), television producer, executive producer, television actor, film producer, film director, voice actor, film actor, producer, director, model, actor

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

[Assistant]
The question asks for the German names of academic disciplines containing the term "linguistik." Academic disciplines are often represented as subclasses or instances of a class related to academic disciplines or fields of study. The German names are likely stored as labels in the German language.

Step 1: Identify the entity for "academic discipline" or "field of study."
Step 2: Find subclasses or instances of this entity that contain "linguistik" in their German label.
Step 3: Return the German labels of these entities.

I will start by searching for the entity "academic discipline" or "field of study" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. academic discipline, also known as research field, sub-discipline, field of study, field of research, discipline (wd:Q11862829): academic field of study or profession
2. academic discipline (wd:L24102-S1)
3. field of work, also known as purpose, specialty, research, research field, research fields (wd:P101): specialization of a person or organization; see P106 for the occupation
4. English studies, also known as English philology, English major, English language and literature, English (academic discipline), English language (wd:Q27968): discipline that studies the English language and literature
5. French language studies, also known as French (academic discipline), French philology, French major, French language, French language and literature (wd:Q11333703): discipline that studies the French language and literature
6. fictional academic discipline (wd:Q126090312)
7. legal management (academic discipline), also known as LegMa (wd:Q6517540): academic and professional discipline that is a hybrid between the study of law and management
8. Academic freedom and academic discipline (wd:Q72399041): scientific article published on 01 April 1969
9. academic discipline and profession (wd:L454629-S1)
10. postcolonialism, - academic discipline (wd:L1319105-S1)

[Assistant] The entity "academic discipline" is wd:Q11862829. Next, I will find subclasses or instances of this entity that have German labels containing the term "linguistik." I will write a SPARQL query to get these entities and their German labels.

[Tool] Got no rows and 2 columns

[Assistant] No results were found using subclasses of academic discipline. I will try to include instances (wdt:P31) of academic discipline as well in the query to find entities with German labels containing "linguistik."

[Tool]
Got 16 rows and 2 columns, showing the first 5 and last 5 rows below:
| discipline                             | disciplineLabel             |
| -------------------------------------- | --------------------------- |
| Saami linguistics (wd:Q12718141)       | Samische Linguistik (de)    |
| general linguistics (wd:Q14357850)     | Allgemeine Linguistik (de)  |
| sociolinguistics (wd:Q160845)          | Soziolinguistik (de)        |
| computational linguistics (wd:Q182557) | Computerlinguistik (de)     |
| historical linguistics (wd:Q190375)    | historische Linguistik (de) |
| ...                                    | ...                         |
| applied linguistics (wd:Q321249)       | angewandte Linguistik (de)  |
| wd:Q357196                             | Rechtslinguistik (de)       |
| descriptive linguistics (wd:Q777864)   | deskriptive Linguistik (de) |
| ethnolinguistics (wd:Q853085)          | Ethnolinguistik (de)        |
| interlinguistics (wd:Q856574)          | Interlinguistik (de)        |

[Tool] Stopped generation process


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?birthYear WHERE {
  wd:Q27449519 wdt:P569 ?birthDate .
  BIND( YEAR( ?birthDate ) AS ?birthYear )
}

Got 1 row and 1 column:
| birthYear      |
| -------------- |
| 1990 (xsd:int) |

The author of "The Vanishing Half" is Brit Bennett, who was born in the year 1990.

[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] In which year was the author of “The Vanishing Half” born?

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

[Tool]
Example 1:
Question:
When did Muhammad die?

SPARQL:
SELECT ?date WHERE {
  wd:Q9458 wdt:P570 ?date .
}

Using entities:
Muhammad, also known as Mohammed, Muhammad ibn Abdullah, Mohammad, Mahomet, Prophet Muhammad (wd:Q9458): founder and main prophet of Islam (c. 570–632), military leader, politician, consignor, merchant, preacher, prophet, herder

Using properties:
date of death, also known as DOD, deathdate, died, died on, year of death (wd:P570 as wdt): dissolved, abolished or demolished date, date on which the subject died, end time

Example 2:
Question:
Who created Goofy?

SPARQL:
SELECT DISTINCT ?uri WHERE {
  wd:Q111135 wdt:P170 ?uri .
}

Using entities:
Goofy, also known as Dippy Dawg, George Geef, Goofy Goof (wd:Q111135): Disney cartoon character

Using properties:
creator, also known as created by, visual artist, sculptor, sculpted by, realized by (wd:P170 as wdt): maker of this creative work or other object (where no more specific property exists)

Example 3:
Question:
Which U.S. state has been admitted latest?

SPARQL:
SELECT ?uri WHERE {
  ?uri wdt:P31 wd:Q35657 .
  ?uri wdt:P571 ?date
}
ORDER BY DESC ( ?date )
LIMIT 1

Using entities:
U.S. state, also known as U.S. states, US state, USA state, U.S.A. state, United States states (wd:Q35657): constituent political entity of the United States of America

Using properties:
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)
inception, also known as initial release date, founded in, founded on, founded on date, founding date (wd:P571 as wdt): time when an entity begins to exist; for date of official opening use P1619, start time

[Assistant]
The question is about the author of the book "The Vanishing Half" and the year of their birth. The key steps are:
1. Identify the entity for the book "The Vanishing Half".
2. Find the author of this book.
3. Find the birth year of this author.

I will start by searching for the entity "The Vanishing Half" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. The Vanishing Half (wd:Q98476957): 2020 novel by Brit Bennett
2. The Vanishing, also known as Vanishing (wd:Q616301): 1993 film directed by George Sluizer
3. The Vanishing, also known as L'Homme qui voulait savoir, Vanishing (wd:Q1895379): 1988 film by George Sluizer
4. The Vanishing, also known as Keepers, The Devil to Pay (wd:Q29514859): 2018 film directed by Kristoffer Nyholm
5. The Half (wd:Q63109025)
6. The Vanishing (wd:Q129416681): 2024 film by Karim Moussaoui
7. The Vanishing, also known as Far Cry: The Vanishing, Far Cry 6: The Vanishing (wd:Q114877764): 2022 Far Cry 6 mission that is a crossover with Stranger Things
8. The Vanishing (wd:Q114523535): episode of Scream (S2 E10)
9. The Vanishing (wd:Q114539612): episode of Z Nation (S4 E3)
10. The Vanishing (wd:Q123307638): 1993 film by George Sluizer

[Assistant] The entity "The Vanishing Half" corresponds to wd:Q98476957, which is a 2020 novel by Brit Bennett. Next, I will find the author of this book.

[Tool]
Got 1 row and 3 columns:
| subject                           | property         | object                      |
| --------------------------------- | ---------------- | --------------------------- |
| The Vanishing Half (wd:Q98476957) | author (wdt:P50) | Brit Bennett (wd:Q27449519) |

[Assistant] The author of "The Vanishing Half" is Brit Bennett (wd:Q27449519). Now I will find the birth year of Brit Bennett.

[Tool]
Got 1 row and 3 columns:
| subject                     | property                 | object                              |
| --------------------------- | ------------------------ | ----------------------------------- |
| Brit Bennett (wd:Q27449519) | date of birth (wdt:P569) | 1990-01-01T00:00:00Z (xsd:dateTime) |

[Assistant]
The birth date of Brit Bennett is 1990-01-01. The year of birth is 1990.

I will now provide the final answer.

[Tool] Stopped generation process


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

Got 1 row and 2 columns:
| country              | countryLabel     |
| -------------------- | ---------------- |
| Switzerland (wd:Q39) | Switzerland (en) |

The Kandahar-downhill is associated with the Kandahar Ski Club, which is located in the country Switzerland.

[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] In what country is the Kandahar-downhill?

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

[Tool]
Example 1:
Question:
What is Donald Trump's main business?

SPARQL:
SELECT DISTINCT ?uri WHERE {
  ?uri wdt:P488 wd:Q22686 ; wdt:P31 / wdt:P279 * wd:Q4830453 . MINUS {
    ?uri wdt:P576 ?closed
  }
}

Using entities:
Donald Trump, also known as President Donald Trump, President Donald J. Trump, President Trump, President Donald J Trump, Trump (wd:Q22686): president of the United States (2017–2021, 2025–present), real estate entrepreneur, chief executive officer, television producer, business magnate, businessperson, game show host, film producer, entrepreneur, politician, merchant, investor, writer, actor
business (wd:Q4830453): organization undertaking commercial, industrial, or professional activity

Using properties:
subclass of, also known as rdfs:subClassOf, sort of, subcategory of, subgenre of, subtype of (wd:P279 as wdt): this item is a subclass (subset) of that item; ALL instances of ...stance of volcanic landform); Everest is an instance of mountain
instance of, also known as unitary element of class, has type, unique individual of, type, item of type (wd:P31 as wdt): that class of which this subject is a particular example and mem...is a subclass of mountain (and an instance of volcanic landform)
chairperson, also known as dean, headed by, leader, president, chairwoman (wd:P488 as wdt): presiding member of an organization, group or body, director / manager, significant person
dissolved, abolished or demolished date, also known as ended, publication end date, final issue, date repealed, final year (wd:P576 as wdt): point in time at which the subject (organisation, building) ceas...g equipment,  "discontinued date" (P2669) for stopping a product, end time

Example 2:
Question:
In what city is the Heineken brewery?

SPARQL:
SELECT DISTINCT ?uri WHERE {
  wd:Q854383 wdt:P176 / wdt:P159 ?uri .
}

Using entities:
Heineken, also known as Heineken Lager Beer, Heineken Pilsener (wd:Q854383): pale lager beer by the Dutch brewing company Heineken International

Using properties:
headquarters location, also known as headquarters locality, seat, headquarters town, HQ, HQ location (wd:P159 as wdt): city or town where an organization's headquarters is or has been situated. Use P276 qualifier for specific building, significant place
manufacturer, also known as manufactured by, provider, provided by, product of, producer (wd:P176 as wdt): (main or final) manufacturer or producer of this product

Example 3:
Question:
Who has Tom Cruise been married to?

SPARQL:
SELECT DISTINCT ?o1 WHERE {
  wd:Q37079 wdt:P26 ?o1 .
}

Using entities:
Tom Cruise, also known as Thomas Cruise Mapother IV (wd:Q37079): American actor and producer (born 1962), stunt performer, aircraft pilot, film producer, film director, screenwriter, film actor, producer, director, writer, actor

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

[Assistant] The Kandahar-downhill is likely a ski race or ski event. To find the country where it is located, I will first search for the entity "Kandahar-downhill" in Wikidata.

[Tool] No entity items found

[Assistant] I did not find an exact entity for "Kandahar-downhill" in Wikidata. I will try searching for "Kandahar" alone to see if it is associated with a ski race or event.

[Tool]
Top 10 entity alternatives:
1. Kandahar, also known as Candahar, Qandahar (wd:Q45604): city in Kandahar Province, Afghanistan
2. Kandahar, also known as Safar-e Ghandehar, The Sun Behind the Moon (wd:Q785496): 2001 film directed by Mohsen Makhmalbaf
3. Kandahar, also known as with Albert and sonichoc (wd:Q111940088): 2023 film by Ric Roman Waugh
4. Kandahar (wd:Q6361199): 2010 Malayalam film directed by Major Ravi
5. Kandahar, also known as Kandahar, Saskatchewan (wd:Q14874966): organized hamlet in Saskatchewan, Canada
6. Kandahar (wd:Q55956959): episode of The Punisher (S1 E3)
7. Kandahar (wd:Q50902249): painting by Victor Vasarely
8. Kandahar Province, also known as Ghandahar Province, Qandahar Province (wd:Q173808): province of Afghanistan
9. Kandahar International Airport, also known as OAKN, Kandahar Airfield, KDH, KAF, Kandahar Airport (wd:Q33156): international airport serving Kandahar, Afghanistan
10. Kandahar District, also known as Dand District (wd:Q2673970): district in Kandahar Province, Afghanistan

[Assistant] The search for "Kandahar" returned mostly entities related to the city and province in Afghanistan, as well as some films and other unrelated items. Since "Kandahar-downhill" is likely related to skiing, I will try searching for "Kandahar ski" to find a more relevant entity.

[Tool]
Top 10 entity alternatives:
1. Kandahar Ski Club (wd:Q16988658): ski racing club
2. Kandahar, also known as Candahar, Qandahar (wd:Q45604): city in Kandahar Province, Afghanistan
3. ski, also known as esqui, ski table (wd:Q172226): narrow strip of semi-rigid material used (usually in a pair) for gliding over snow ie skiing
4. Ski Mask the Slump God, also known as The Slump God, Stokeley Goulbourne, Stokeley Clevon Goulbourne, Ski Mask, $ki Mask "The Slump God" (wd:Q42224353): American rapper, songwriter, rapper
5. Kandahar, also known as Safar-e Ghandehar, The Sun Behind the Moon (wd:Q785496): 2001 film directed by Mohsen Makhmalbaf
6. Kandahar, also known as with Albert and sonichoc (wd:Q111940088): 2023 film by Ric Roman Waugh
7. ski skins (wd:Q1775641): removable pieces of fabric that enable skis to move uphill
8. Ski (wd:Q1770672): town in Nordre Follo Municipality, Norway
9. Skikda Airport, also known as DABP, SKI (wd:Q7535164): airport in Algeria
10. Kandahar (wd:Q6361199): 2010 Malayalam film directed by Major Ravi

[Assistant] I found an entity called "Kandahar Ski Club" (wd:Q16988658) which is related to ski racing. This might be connected to the Kandahar-downhill event. I will now look for properties of this entity to find the country it is located in.

[Tool]
Top 10 property alternatives:
1. country, also known as sovereign state, state, land, host country (wd:P17 as wdt/p): sovereign state that this item is in (not to be used for human beings), located in the administrative territorial entity
2. logo image, also known as masthead, wordmark, trademark, trade mark, sign (wd:P154 as wdt/p): graphic mark or emblem commonly used by commercial enterprises, organizations and products, icon
3. Freebase ID, also known as Freebase, MID, Freebase identifier, FID (wd:P646 as wdt/p): identifier for a page in the Freebase database. Format: "/m/0" f...r IDs starting with "/g/", use Google Knowledge Graph ID (P2671)

No other items found

[Assistant] The property "country" (wdt:P17) is available for the Kandahar Ski Club entity. I will now query the country for the Kandahar Ski Club.

[Tool]
Got 1 row and 2 columns:
| country              | countryLabel     |
| -------------------- | ---------------- |
| Switzerland (wd:Q39) | Switzerland (en) |

[Tool] Stopped generation process


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?game ?gameLabel WHERE {
  ?game wdt:P178 wd:Q677273 .
  ?game wdt:P577 ?publicationDate .
  OPTIONAL {
    ?game rdfs:label ?gameLabel FILTER ( LANG( ?gameLabel ) = "en" )
  }
}
ORDER BY ?publicationDate
LIMIT 1
OFFSET 1

The second game developed by Piranha Bytes is Gothic II (wd:Q1456987).

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

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

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

You should follow a step-by-step approach to generate the SPARQL query:
1. Determine possible entities and properties implied by the user question.
2. Use the functions to search for entities and properties in the knowledge graphs. Where applicable, constrain the searches with already identified entities and properties.
3. Gradually build up the SPARQL query using the identified entities and properties. Start with simple queries and add more complexity as needed. Use the execute function to get feedback on intermediate queries. You can go back and forth between knowledge graph searches and SPARQL query executions to refine the query.
4. Use the answer or cancel function to finalize your answer and stop the generation process.

Additional rules:
1. Explain your thought process before and after each step and function call.
2. Do not assume or make up any entities or properties without verifying them with the knowledge graphs and functions.
3. The SPARQL query should always return the actual identifiers / IRIs of the items in its result. It additionally may return labels or other human-readable information, but they are optional and should be put within optional clauses unless explicitly requested by the user.
4. Do not stop early if there are still obvious improvements to be made to the SPARQL query. For example, keep refining your SPARQL query if its result contains irrelevant items or is missing items you expected.
5. Do not perform additional computation (e.g. filtering, sorting, calculations) on the result of the SPARQL query to determine the answer. All computation should be done solely within SPARQL.
6. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
7. Do not use 'SERVICE wikibase:label { bd:serviceParam wikibase:language ...' in SPARQL queries. It is not SPARQL standard and unsupported by the used QLever SPARQL endpoints. Use rdfs:label or similar properties to get labels instead.

[User] What is the second game developed by Piranha Bytes?

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

[Tool]
Example 1:
Question:
What is the capital of Canada?

SPARQL:
SELECT DISTINCT ?o1 WHERE {
  wd:Q16 wdt:P36 ?o1 .
}

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

Using properties:
capital, also known as administrative seat, seat of government, seat, principal place, location of capital (wd:P36 as wdt): seat of government of a country, province, state or other type of administrative territorial entity

Example 2:
Question:
Give me the runtime of Toy Story.

SPARQL:
SELECT ?val WHERE {
  wd:Q171048 wdt:P2047 ?val .
}

Using entities:
Toy Story, also known as Toy Story 1 (wd:Q171048): 1995 American animated film

Using properties:
duration, also known as time length, timespan, time span, time interval, runtime (wd:P2047 as wdt): length of time of an event or process

Example 3:
Question:
Who was called Scarface?

SPARQL:
SELECT ?uri {
  ?uri wdt:P1449 ?nickname .
  FILTER REGEX( STR( ?nickname ) , "^Scarface$" )
}

Using properties:
nickname, also known as informal name, moniker, other name, othername, other_names (wd:P1449 as wdt): informal name (for a pseudonym use P742), name

[Assistant]
To answer the question "What is the second game developed by Piranha Bytes?" we need to identify the entity for "Piranha Bytes" and find the games developed by this entity. Then we need to order these games by their release date and select the second one.

Step 1: Search for the entity "Piranha Bytes" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. Piranha Bytes (wd:Q677273): German video game development company
2. piranha, also known as piraña, Serrasalmus nattereri (wd:Q185215): group of fish
3. Piranha 3D, also known as Piranha (wd:Q733995): 2010 film directed by Alexandre Aja
4. Piranha, also known as Mowag Piranha (wd:Q687702): armored fighting vehicle family by MOWAG
5. Piranha (wd:Q1140216): 1978 film by Joe Dante
6. Piranha (wd:Q1215873): 1995 television film
7. Piranha (wd:Q1551737): 2006 film by Andrey Kavun
8. Bytes (wd:Q5004626): 1993 debut studio album by Black Dog Productions
9. Piranha (wd:Q4394050): single by The Grace
10. Piranha (wd:Q3389104): fictional comic book character

[Assistant] The entity "Piranha Bytes" corresponds to wd:Q677273, which is a German video game development company. Next, I will search for the games developed by Piranha Bytes. The property for "developer" in Wikidata is usually P178. I will check the games developed by Piranha Bytes using this property.

[Tool]
Got 15 rows and 3 columns, showing the first 10 rows below:
| subject                                     | property             | object                     |
| ------------------------------------------- | -------------------- | -------------------------- |
| Gothic II (wd:Q1456987)                     | developer (wdt:P178) | Piranha Bytes (wd:Q677273) |
| Gothic 3 (wd:Q738909)                       | developer (wdt:P178) | Piranha Bytes (wd:Q677273) |
| Risen (wd:Q1513013)                         | developer (wdt:P178) | Piranha Bytes (wd:Q677273) |
| Risen 2: Dark Waters (wd:Q2526173)          | developer (wdt:P178) | Piranha Bytes (wd:Q677273) |
| Gothic (wd:Q1088631)                        | developer (wdt:P178) | Piranha Bytes (wd:Q677273) |
| Risen 3: Titan Lords (wd:Q15918760)         | developer (wdt:P178) | Piranha Bytes (wd:Q677273) |
| Gothic II: Night of the Raven (wd:Q2662055) | developer (wdt:P178) | Piranha Bytes (wd:Q677273) |
| Elex (wd:Q25345979)                         | developer (wdt:P178) | Piranha Bytes (wd:Q677273) |
| Risen (wd:Q3433133)                         | developer (wdt:P178) | Piranha Bytes (wd:Q677273) |
| Elex II (wd:Q107248040)                     | developer (wdt:P178) | Piranha Bytes (wd:Q677273) |
| ...                                         | ...                  | ...                        |

[Assistant] I found multiple games developed by Piranha Bytes. To determine the second game developed by Piranha Bytes, I need to order these games by their release date. I will now write a SPARQL query to get the games developed by Piranha Bytes ordered by their publication date and select the second one.

[Tool]
Got 2 rows and 3 columns:
| game                    | gameLabel      | publicationDate                     |
| ----------------------- | -------------- | ----------------------------------- |
| Gothic II (wd:Q1456987) | Gothic II (en) | 2002-11-29T00:00:00Z (xsd:dateTime) |
| Gothic II (wd:Q1456987) | Gothic II (en) | 2003-04-16T00:00:00Z (xsd:dateTime) |

[Assistant] The second game developed by Piranha Bytes is "Gothic II" (wd:Q1456987). It has two publication dates listed, but the game is the same. I will now provide the final answer.

[Tool] Stopped generation process


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ( COUNT( DISTINCT ?album ) AS ?count ) WHERE {
  ?album wdt:P175 wd:Q41076 ; wdt:P31 wd:Q482994 .
}

Got 1 row and 1 column:
| count        |
| ------------ |
| 37 (xsd:int) |

Mariah Carey performs on 37 albums according to Wikidata.

[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] On how many albums does Mariah Carey perform?

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

[Tool]
Example 1:
Question:
Who wrote Harry Potter?

SPARQL:
SELECT DISTINCT ?uri WHERE {
  wd:Q8337 wdt:P50 ?uri
}

Using entities:
Harry Potter, also known as Harry Potter series (wd:Q8337): 1997–2007 fantasy book series by J. K. Rowling

Using properties:
author, also known as writer, written by, poet, playwright, maker (wd:P50 as wdt): main creator(s) of a written work (use on works, not humans); us...hor name string) when Wikidata item is unknown or does not exist, creator

Example 2:
Question:
To which party does the mayor of Paris belong?

SPARQL:
SELECT DISTINCT ?uri WHERE {
  wd:Q90 wdt:P6 / wdt:P102 ?uri
}

Using entities:
Paris, also known as City of Love, Lutetia, City of Light (wd:Q90): capital city and largest city of France

Using properties:
member of political party, also known as political party member, political party, party membership, party, member of party (wd:P102 as wdt): the political party of which a person is or has been a member or otherwise affiliated, member of
head of government, also known as head of national government, mayor, premier, president, prime minister (wd:P6 as wdt): head of the executive power of this town, city, municipality, state, country, or other governmental body, director / manager, chairperson

Example 3:
Question:
What is the capital of Canada?

SPARQL:
SELECT DISTINCT ?o1 WHERE {
  wd:Q16 wdt:P36 ?o1 .
}

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

Using properties:
capital, also known as administrative seat, seat of government, seat, principal place, location of capital (wd:P36 as wdt): seat of government of a country, province, state or other type of administrative territorial entity

[Assistant]
The question is about the number of albums on which Mariah Carey performs. To answer this, I need to identify Mariah Carey as an entity and find the property that links her to albums she performs on. Typically, this might be represented by a property like "performer" or "artist" on an album entity or a property on Mariah Carey's entity that links to albums.

Step 1: Search for the entity "Mariah Carey" in Wikidata.

[Tool]
Top 10 entity alternatives:
1. Mariah Carey, also known as Queen of Christmas, Mirage, Songbird Supreme, Reina de la navidad, Carey (wd:Q41076): American singer and songwriter (born 1969), music video director, singer-songwriter, recording artist, philanthropist, businessperson, film director, film producer, DJ producer, voice actor, entertainer, composer, singer, model, actor
2. Mariah Carey (wd:Q732845): 1990 debut studio album by Mariah Carey
3. WikiProject Mariah Carey (wd:Q21830328): Wikimedia subject-area collaboration
4. Here Is Mariah Carey (wd:Q836551): VHS and DVD by Mariah Carey
5. The Essential Mariah Carey (wd:Q3235035): 2011 compilation album by Mariah Carey
6. M, also known as M By Mariah Carey (wd:Q690434): women's fragrance from Elizabeth Arden
7. Mariah Carey: DVD Collection (wd:Q3282698): album by Mariah Carey
8. Mariah Carey: Her Story (wd:Q131320674): book by the British writer Chris Nickson
9. Mariah Carey Collector's Set (wd:Q18277464): album by Mariah Carey
10. Why Mariah Carey Matters (wd:Q131160633): book written by Andrew Chan

[Assistant] I found the entity for Mariah Carey as a singer and songwriter with the identifier wd:Q41076. Now I need to find the property that links Mariah Carey to albums she performs on. I will search for properties related to "album" for the entity Mariah Carey.

[Tool]
Top 10 property alternatives:
1. AllMusic artist ID, also known as AllMusic, AllMusic ID, amg artist (wd:P1728 as wdt/p): identifier for an artist, musical group, or record label in the AllMusic database (record labels are listed as "artists")
2. genre, also known as genre of music, type of music, type of film, music genre, literary genre (wd:P136 as wdt/p): creative work's genre or an artist's field of work (P101). Use main subject (P921) to relate creative works to their topic
3. discography, also known as discography link, recording catalog (wd:P358 as wdt/p): item for list pages with discography of artist or band, list of works
4. image, also known as still capture, still, screenshot, screen capture, portrait (wd:P18 as wdt/p): image of relevant illustration of the subject; if available, als...tor map, flag image, signature image, logo image, collage image)
5. country of citizenship, also known as subject of (country), nation of citizenship, national of, nationality, nation (wd:P27 as wdt/p): the object is a country that recognizes the subject as its citizen, country
6. record label, also known as label, labels (wd:P264 as wdt/p): brand and trademark associated with the marketing of subject music recordings and music videos
7. Apple Music artist ID (U.S. version), also known as iTunes author ID, music.apple.com/artist/, iTunes artist ID (American version), https://music.apple.com/artist/, Apple Music artist ID (American version) (wd:P2850 as wdt/p): identifier for a musical artist or author in the U.S. version of Apple Music
8. work period (start), also known as start working, flourished (start), start time for work, start date of activity, fl. (start) (wd:P2031 as wdt/p): start of period during which a person or group flourished (fl. = "floruit") in their professional activity, start time, floruit
9. award received, also known as win, winner of, recognition title, received award, prize received (wd:P166 as wdt/p): award or recognition received by a person, organization or creative work
10. Official Charts artist ID, also known as Official Charts ID (wd:P6559 as wdt/p): identifier for musical acts at Official Charts Company's website

No other items found

[Assistant] The property "discography" (wdt:P358) seems relevant as it relates to the list of works (albums) of an artist. However, it might link to a list page rather than individual albums. I will check if there is a property that directly links Mariah Carey to albums she performs on by searching for properties related to "performer" or "artist" on albums.

[Tool]
Top 10 property alternatives:
1. performer, also known as actor, sung by, singer, recording by, recorded by (wd:P175 as pr/wdtn/pq/pqn/pqv/p/prn/psn/wdt/psv/prv/ps): actor, musician, band or other performer associated with this role or musical work, contributor to the creative work or subject
2. character role, also known as role, plays, performer of, as, acting role (wd:P453 as pr/wdtn/pq/pqn/pqv/p/prn/psn/wdt/psv/prv/ps): specific role played or filled by subject -- use only as qualifier of "cast member" (P161), "voice actor" (P725)
3. cover art by, also known as jacket art by, sleeve art by, designer, cover design by, cover artist (wd:P736 as pr/wdtn/pq/pqn/pqv/p/prn/psn/wdt/psv/prv/ps): name of person or team creating cover artwork for book, record album, single record etc.
4. setlist, also known as set list, works performed, songs performed, performances, performance list (wd:P9793 as pr/wdtn/pq/pqn/pqv/p/prn/psn/wdt/psv/prv/ps): performances of songs or other music at an event; concert program, presented works
5. number of representations, also known as shows, performances, number of shows, number of concerts, no. of shows (wd:P5027 as pr/wdtn/pq/pqn/pqv/p/prn/psn/wdt/psv/prv/ps): number of shows (including the premiere) of a concert tour or a performing arts production
6. used by, also known as armiger, user, played by, of (wd:P1535 as pr/wdtn/pq/pqn/pqv/p/prn/psn/wdt/psv/prv/ps): item or concept that makes use of the subject (use sub-properties when appropriate)
7. depicted by, also known as acted by, shown in, seen in, portrayed by, played by (wd:P1299 as pr/wdtn/pq/pqn/pqv/p/prn/psn/wdt/psv/prv/ps): object depicting this subject (object being creative works such as books, films, paintings)
8. exhibited creator, also known as artist exhibited, exhibited artist (wd:P10661 as pr/wdtn/pq/pqn/pqv/p/prn/psn/wdt/psv/prv/ps): intellectual or creative entity (person or organization) responsible for the elements exhibited, creator
9. Muziekweb performer ID, also known as Muziekweb artist ID, Muziekweb band ID (wd:P5882 as pr/wdtn/pq/pqn/pqv/p/prn/psn/wdt/psv/prv/ps): identifier for a performer, composer or band at Muziekweb
10. talk show guest, also known as show guest, podcast guest, participant in talk show, participant in podcast interview, interviewed person (wd:P5030 as pr/wdtn/pq/pqn/pqv/p/prn/psn/wdt/psv/prv/ps): person invited in a talk show, recorded participant

[Assistant]
The property "performer" (wdt:P175) is used to indicate an actor, musician, band, or other performer associated with a musical work or creative work. This property can be used on albums to indicate the performers.

Next, I will write a SPARQL query to count the number of albums where Mariah Carey (wd:Q41076) is listed as a performer (wdt:P175). I will filter for items that are instances of an album (wdt:P31 wd:Q482994).

[Tool]
Got 1 row and 1 column:
| count        |
| ------------ |
| 37 (xsd:int) |

[Tool] Stopped generation process