PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?event ?tournament WHERE {
  ?event wdt:P2094 wd:Q16893072 .
  ?event wdt:P361 ?tournament .
  ?tournament wdt:P361 ?circuit .
  VALUES ?circuit {
    wd:Q300008 wd:Q3775082
  }
  FILTER NOT EXISTS {
    ?event wdt:P1346 []
  }
}

The men's singles tennis events that do not have a winner indicated and are part of a tournament belonging to either the ATP Tour or the Grand Prix tennis circuit are:
- 2012 Apia International Sydney (men) (wd:Q2057401), part of ATP World Tour 250 series
- 2011 U.S. Men's Clay Court Championships – singles qualifying (wd:Q4001574), part of 2011 U.S. Men's Clay Court Championships

What are the men's singles tennis events that do not have a winner indicated and are part of a tournament that belongs to either the ATP Tour or the Grand Prix tennis circuit?

[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 with notes:
1. For P39 legislative memberships, filter by pq:P2937 (legislative term) on the p:P39 statement; don’t use P793 for term filtering. For UK MPs, avoid a generic Q16707842-only scan; rely on term qualifiers and proper date overlap on pq:P580/pq:P582.
2. For residence (P551), time bounds are qualifiers on the statement: p:P551/ps:P551 place, pq:P580 start, pq:P582 end. To include containing areas (e.g., NYC boroughs), expand via wdt:P551/wdt:P131*. Durations usually need client-side calc on QLever.
3. Ticker symbols are pq:P249 on p:P414 statements; query via the statement node (?org p:P414 ?st . ?st ps:P414 ?ex ; pq:P249 ?ticker). Use VALUES to pre-limit orgs/exchanges. Don’t expect wdt:P249 on the org. Prefer qualifiers for time-bound tickers.
4. Archives: use p:P485/ps:P485 for the holding institution. Inventory numbers are qualifiers pq:P217 on that P485 statement. Don’t expect wdt:P217 directly on the person/work. “Archive descriptions” may be separate collection items (P195).
5. When listing contained municipalities or similar, prefer wdt:P150* (has parts) from the parent to enumerate children, then join other relations (e.g., twin towns via wdt:P190). Avoid broad wdt:P131+ scans from children; they are slow and can timeout.
6. On QLever, avoid SERVICE wikibase:label (frequent 301). Use OPTIONAL rdfs:label with LANG filters or fetch QIDs then labels separately. For property mapping, (?prop wikibase:directClaim ?p). Pre-limit with subselect/VALUES to avoid timeouts.
7. Employer constraints: to find people employed by UN or international orgs, use wdt:P108 directly for UN (wd:Q1065), or traverse employer to part of (wdt:P361*) UN, or employer wdt:P31 wd:Q484652 (international organization). Combine with other occupations.
8. For sports/events/editions, prefer explicit edition items (e.g., Q47345468) with wdt:P361 linking to the parent series/tour and filter by wdt:P585/P571 for year; avoid P641/P2139 that model sports played or participants, not the edition metadata.
9. For author/creator queries, use occupation wdt:P106 (e.g., author/writer) rather than P31 typing. To list works, prefer the reverse path ^wdt:P50 ?work; P800 (notable work) is incomplete and curated, not a full bibliography.
10. Awards: use p:P166/ps:P166 and constrain award via wdt:P31/wdt:P279* to a target class (e.g., Cannes awards Q28444913). Recipients can be films or people; don’t assume film-specific properties exist. Count/group by recipient type if needed.
11. To select current/active codes or memberships on QLever, use statement nodes (p:/ps:) and MINUS { ?st pq:P582 [] }. For time series counts (e.g., daily members), generate a date series (VALUES/UNNEST), then test overlap with pq:P580/pq:P582 per date.
12. For people’s native names, use wdt:P1559 (name in native language) on the person, not rdfs:label. Return multiple if multiple native languages exist; pick a preferred language client-side if needed.
13. For multi-valued props (e.g., P1082), GROUP BY entity and aggregate (MAX/MIN/SAMPLE) to avoid duplicates; DISTINCT won’t collapse multiple statements. For category/gender counts, prefer indicator sums: SUM(IF(cond,1,0)) over COUNT on OPTIONAL vars.
14. Avoid SERVICE wikibase:label on QLever; it often 301s. Use OPTIONAL rdfs:label with LANG filters, or fetch QIDs first and labels in a follow-up. Pre-limit with subselect/VALUES to avoid timeouts when joining many labels.
15. For P551 duration comparisons, avoid unsupported date arithmetic. If needed, compute overlaps client-side. On-endpoint, you can only compare presence/counts or use simple MIN/MAX of dates (casting and arithmetic are limited in QLever).
16. When excluding specific entities from a relation (e.g., siblings), use FILTER to drop explicit QIDs or FILTER NOT EXISTS with a VALUES list. Ensure you use the exact sibling QIDs returned by the KG, not assumed ones.

General notes for all knowledge graphs:
1. When checking date interval overlaps, handle open intervals (missing start/end) and use xsd:dateTime. Use OR conditions to cover start within, end within, or spanning the whole range.
2. For P39 queries, qualifiers (e.g., P2937 term, P768 electoral district, P4100 parliamentary group) live on the p:P39 statement node. Do not expect them as wdt: properties on the person or use ps: for non-main values.
3. To get sitelink counts, use wikibase:sitelinks on the entity; it returns a single numeric value, so GROUP BY the entity and avoid COUNT over ?sitelink.
4. Use subclass expansion for types: wdt:P31/wdt:P279* target (e.g., dams, educational institutions). This captures items modeled with subclasses.
5. For locations, prefer hierarchies via wdt:P131+ to reach a containing region/state, and wdt:P17 for country. If HQ is a building, P159 ps points to a city; specific site is qualifier pq:P276 on the P159 statement.
6. When excluding or selecting by a legislative term on P39, check pq:P2937 on the relevant statement. Use FILTER NOT EXISTS over p:P39 with ps:P39 target and pq:P2937 value to exclude a term.
7. QLever endpoints may not support Wikidata’s “WITH {…} AS %name” and “INCLUDE %name” syntax. Avoid named subqueries; use nested SELECTs or VALUES instead.
8. The wikibase:label SERVICE often fails on QLever. Prefer rdfs:label with FILTER(LANG(..)="en") or get QIDs only and resolve labels client-side.
9. Avoid COUNT over OPTIONAL variables that may be unbound for all rows; prefer EXISTS/BOUND checks or aggregate over DISTINCT entities to prevent misleading zeros.
10. On QLever, heavy OPTIONAL label/property joins often time out. Pre-limit with a subselect/VALUES over IDs (ORDER BY + LIMIT), then join labels/properties. Or fetch QIDs first and labels in a second, smaller query.
11. For precise date filtering on Wikidata (birth/death), prefer p/psv time nodes and wikibase:timeValue plus timePrecision checks over wdt:P569/P570 to include values with year/month precision and avoid silent drops.
12. When filtering by exact day of birth or event, avoid STRSTARTS on wdt:P569; instead bound an interval [day, next day) with xsd:dateTime to include all precisions. On QLever, add hint:Prior hint:rangeSafe true to improve performance on time ranges.

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/
qlss: <https://qlever.cs.uni-freiburg.de/spatialSearch/
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. Search for the 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. Execute intermediate queries to get feedback and to verify your assumptions. You may need to refine or rethink your current plan based on the query results and go back to step 2 if needed, possibly multiple times.
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 just use or make up entity or property identifiers without verifying their existence in the knowledge graphs first.
3. Always execute your final SPARQL query before giving an answer to make sure it returns the expected results.
4. 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.
5. 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.
6. 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.
7. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
8. 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 men's singles tennis events that do not have a winner indicated and are part of a tournament that belongs to either the ATP Tour or the Grand Prix tennis circuit?

[Assistant]
Let's break down the question:

1. **Target entities:** Men's singles tennis events.
2. **Properties:**
   - Event type: Should be "men's singles" (need to find the correct entity for this).
   - Belongs to a tournament that is part of either the ATP Tour or the Grand Prix tennis circuit (need to find entities for these circuits and the property linking events to tournaments and tournaments to circuits).
   - Event does NOT have a winner indicated (need to find the property for winner and filter for events missing this property).

**Step 1: Find the entity for "men's singles" tennis event.**

[Tool]
Top 10 entity alternatives:
1. men's singles, also known as men's singles in tennis (wd:Q16893072): instance of sports discipline, instance of competition class, instance of men's singles, discipline in tennis
2. wheelchair tennis men's singles, also known as wheelchair men's singles (wd:Q50211922): competition class in wheelchair tennis, instance of competition class, instance of sports discipline, instance of men's singles
3. all-time tennis records – men's singles, also known as all-time tennis records - men's singles, overall tennis records - men's singles, overall tennis records – men's singles (wd:Q17016846)
4. 2011 Dubai Tennis Championships – men's singles (wd:Q1822061): 2011 tennis event results, instance of tennis event
5. 2013 Sony Open Tennis – men's singles (wd:Q7724928): 2013 tennis event results, instance of tennis event
6. 2023 Dubai Tennis Championships – Men's singles (wd:Q116897745): 2023 tennis event results, instance of tennis event
7. 2022 Dubai Tennis Championships – men's singles (wd:Q110953898): 2022 tennis event results, instance of tennis event
8. 2009 Dubai Tennis Championships – men's singles (wd:Q15262709): 2009 tennis event results, instance of tennis event
9. 2020 Dubai Tennis Championships – men's singles (wd:Q85982068): 2020 tennis event results, instance of tennis event
10. 2019 Dubai Tennis Championships – men's singles (wd:Q61856750): instance of tennis event, tennis tournament event

[Assistant]
The general entity for "men's singles" as a discipline or class is wd:Q16893072. Specific events (like "2011 Dubai Tennis Championships – men's singles") are instances of tennis events, but we want all events of the men's singles type, not just one year.

**Step 2: Find the property linking a tennis event to its discipline/class (i.e., that it's a men's singles event).**

I'll search for properties related to "discipline" or "competition class".

[Tool]
Top 10 property alternatives:
1. field of work, also known as scientific discipline, purpose, scientific area, responsible for, research on (wd:P101 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): specialization of a person or organization; see P106 for the occupation, subproperty of interested in
2. sports discipline competed in, also known as discipline of sport, weight class competed in, sports event, sports disciplines competed in, sports discipline (wd:P2416 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): discipline an athlete competed in within a sport, subproperty of field of work
3. penalty, also known as sentence, punishment, judicial sentence (wd:P1596 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): penalty imposed by an authority
4. typing discipline, also known as type system, typing (wd:P7078 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): specifies the typing discipline implemented, used, or mandated in a programming language, subproperty of manifestation of
5. field of this occupation, also known as field of profession, works in, profession's field, practices, practice (wd:P425 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): field corresponding to this occupation or profession (use only f...fessions - for people use Property:P101, for companies use P452)
6. supervised by, also known as has supervisor, is supervised by, is supervisee of, supervisee of, supervisor (wd:P7604 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): natural person who has the authority of giving instructions and/...and is held responsible for the work and actions of subordinates
7. genomic end, also known as Genloc Stop, stop coordinate, stop, Genloc End, genomic stop (wd:P645 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): genomic ending coordinate of the biological sequence (e.g. a gene)
8. implementation of, also known as is implementation of, standard, specification, protocol, is an implementation of (wd:P4428 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): implementation of a standard, program, specification or programming language, subproperty of manifestation of, subproperty of uses
9. doctoral student, also known as doctoral candidate, Ph.D. student, supervised doctoral student, supervisee (wd:P185 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): doctoral student(s) of a professor, subproperty of student
10. main subject, also known as main topic, primary subject, primary keyword, plot keyword, of (wd:P921 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): primary topic of a work, subproperty of depicts

[Tool]
Top 10 property alternatives:
1. competition class, also known as disability sport classifications, weight class, rated at, qualifies for, qualification class (wd:P2094 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): official classification by a regulating body under which the sub...ents, teams, participants, or equipment) qualifies for inclusion
2. league or competition, also known as cup, tournament, sports league, division, competition (wd:P118 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): league or competition in which team or player has played, or in which an event occurs, subproperty of participant in
3. competition won, also known as victory, won event, won, winner of (wd:P2522 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): competition or sports event won by the subject, subproperty of participant in
4. participant in, also known as participated in, present at, takes part, took part, took part in (wd:P1344 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): event in which a person or organization was/is a participant; inverse of P710 or P1923, subproperty of significant event, subproperty of part of
5. school class, also known as stage, school cohort, grade, class, cohort (wd:P7174 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): (qualifier) class of a given year/time period to which the person belonged in an educational institution
6. class, also known as type (wd:P2308 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): qualifier to define a property constraint in combination with "property constraint" (P2302)
7. sports competition competed at (wd:P5249 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): edition of sports competitions at which the club or team that pl...ple: 2012–13 FC Barcelona season → 2012–13 UEFA Champions League
8. points for, also known as pf, PTS, points, league points, competition points (wd:P1358 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): number of points in a league table or decathlon. (Use P1351 for goals/points in a match)
9. participant, also known as suspect, player, party, participants, has participant (wd:P710 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): person, group of people or organization (object) that actively t...ct has role" (P3831). Use P1923 for participants that are teams., subproperty of significant person
10. sports discipline competed in, also known as discipline of sport, weight class competed in, sports event, sports disciplines competed in, sports discipline (wd:P2416 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): discipline an athlete competed in within a sport, subproperty of field of work

[Tool]
Got 10,257 rows and 3 columns, showing the first 10 rows below:
| subject                                                            | property                      | object                       |
| ------------------------------------------------------------------ | ----------------------------- | ---------------------------- |
| tennis at the 2024 Summer Olympics – men's singles (wd:Q117156618) | competition class (wdt:P2094) | men's singles (wd:Q16893072) |
| tennis at the 2016 Summer Olympics – men's singles (wd:Q23747965)  | competition class (wdt:P2094) | men's singles (wd:Q16893072) |
| tennis at the 2020 Summer Olympics – men's singles (wd:Q65242345)  | competition class (wdt:P2094) | men's singles (wd:Q16893072) |
| 2011 French Open – men's singles (wd:Q681986)                      | competition class (wdt:P2094) | men's singles (wd:Q16893072) |
| 2011 Wimbledon Championships – men's singles (wd:Q751102)          | competition class (wdt:P2094) | men's singles (wd:Q16893072) |
| 2009 Wimbledon Championships – men's singles (wd:Q751798)          | competition class (wdt:P2094) | men's singles (wd:Q16893072) |
| 2012 Wimbledon Championships – gentlemen's singles (wd:Q753300)    | competition class (wdt:P2094) | men's singles (wd:Q16893072) |
| 2008 US Open – men's singles (wd:Q304072)                          | competition class (wdt:P2094) | men's singles (wd:Q16893072) |
| 2011 US Open – men's singles (wd:Q734138)                          | competition class (wdt:P2094) | men's singles (wd:Q16893072) |
| 2009 French Open – men's singles (wd:Q741573)                      | competition class (wdt:P2094) | men's singles (wd:Q16893072) |
| ...                                                                | ...                           | ...                          |

[Assistant]
We can use `wdt:P2094` (competition class) with value `wd:Q16893072` (men's singles) to get all men's singles tennis events.

**Step 3: Find the property linking an event to its tournament, and the property linking a tournament to a circuit (ATP Tour or Grand Prix tennis circuit).**

Let's search for properties related to "tournament", "part of", or "circuit".

[Tool]
Top 10 property alternatives:
1. part of, also known as meronym of, contained within, of, part of-property, section of (wd:P361 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): 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))
2. parent organization, also known as parent company, parent institution, parent organisation, parent unit, part of (wd:P749 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): parent organization of an organization, opposite of subsidiaries (P355), subproperty of owned by, subproperty of part of
3. partially coincident with, also known as partially include, overlaps, partially in, partial concurrency, overlaps with (wd:P1382 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): object that partially overlaps with the subject in its instances, parts, or members, subproperty of different from
4. applies to part, also known as applies to aspect, applied to, when viewed as, valid for part, section (wd:P518 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): part, aspect, or form of the item to which the claim applies
5. proportion, also known as %, part, percent, ratio, share (wd:P1107 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): to be used as a qualifier, value must be between 0 and 1
6. has part(s), also known as has ingredient, has ingredients, had part, has member, has part (wd:P527 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): part of this subject; inverse property of "part of" (P361). See also "has parts of the class" (P2670).
7. located in the present-day administrative territorial entity, also known as present-day administrative territorial entity, located in the current administrative territorial entity, located in the modern-day administrative territorial entity, located in the present-day administrative territorial entity, located in present day administrative territorial entity (wd:P3842 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): the item was located in the territory of this present-day administrative unit; however the two did not at any point coexist in time, subproperty of location, subproperty of part of
8. depicted part, also known as part depicted, part shown, shown part (wd:P5961 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): use as qualifier for "depicts" (P180)
9. based on, also known as modelled after, inspired by, iteration of, modeled after, input (wd:P144 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): the work(s) or inputs used as the basis for subject item; for fictional analog use P1074, subproperty of references work, tradition or theory, subproperty of inspired by
10. territory overlaps, also known as partially located in territorial entity, partly overlaps, partly located in territorial entity, partly coincident with, partially overlaps (wd:P3179 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): part or all of the area associated with (this) entity overlaps part or all of the area associated with that entity, subproperty of partially coincident with

[Tool]
Top 10 property alternatives:
1. schematic, also known as diagram, line drawing, schematic diagram (wd:P5555 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): illustration of the structure or operation of an object, system, or process, subproperty of image
2. avionics, also known as electronics, sensors (wd:P878 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): notable sensors, electronics, and other avionics installed in the subject aircraft, subproperty of has facility
3. Find a Grave memorial ID, also known as Find A Grave memorial ID, memorial IDーFind A Grave, GRid, Find A Grave person ID, Findagrave ID (wd:P535 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): identifier of an individual's burial place in the Find a Grave database
4. connecting line, also known as railway line, rail line connected to, line connected to, is on (wd:P81 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): railway line(s) subject is directly connected to, subproperty of part of
5. mouth of the watercourse, also known as outlet, watercourse outflow, watercourse ends in, watercourse drain, tributary of (wd:P403 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): the body of water to which the watercourse drains
6. original broadcaster, also known as original channel, original network, radio network, radio station, television channel (wd:P449 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): network(s) or service(s) that originally broadcast a radio or television program, subproperty of broadcast by
7. transport network, also known as routes system, transport network, transit network, tram network, trail system (wd:P16 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): network the infrastructure is a part of, subproperty of part of
8. railway signalling system, also known as type of signalling, signalling type, signalling system (wd:P3019 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): type of signalling used on this railway line
9. image, also known as img, infobox image, photo, photograph, picture (wd:P18 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): image of relevant illustration of the subject; if available, als...tor map, flag image, signature image, logo image, collage image)
10. connects with, also known as intersects at grade, meets at grade, couples with, contacts, links to (wd:P2789 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): item with which the item is physically connected, subproperty of physically interacts with

[Tool]
Top 10 entity alternatives:
1. ATP Tour, also known as ATP World Tour (wd:Q300008)
2. ATP World Tour 250 series, also known as ATP 250 Series, International Series Tournaments, International Series tennis tournaments, International Series events, ATP World Tour 250 (wd:Q300017)
3. ATP Tour Awards (wd:Q434468): ATP tennis awards for men, instance of tennis award
4. ATP Challenger Tour, also known as Challenger tennis tournament, Challenger event, Challenger tennis events, Challenger tennis event, Challenger tennis (wd:Q299345)
5. 2011 ATP World Tour, also known as 2011 atp tour (wd:Q300013): instance of tennis tour edition, men's tennis circuit
6. 2010 ATP World Tour, also known as 2010 atp tour (wd:Q300012): instance of tennis tour edition, tennis circuit
7. 2023 ATP Tour (wd:Q111441127): instance of tennis tour edition, men's tennis circuit
8. 2009 ATP World Tour, also known as Juego 2000 Calendar, Tennis 2009 Calendare ATP ITF, ATP Tour 2009, 2009 ATP Tour, 2009 atp tour (wd:Q300011): instance of tennis tour edition, tennis circuit
9. 2022 ATP Tour (wd:Q109743038): instance of tennis tour edition, men's tennis circuit
10. 2020 ATP Tour (wd:Q62083037): instance of tennis tour edition, men's tennis circuit

[Tool]
Top 10 entity alternatives:
1. Grand Prix tennis circuit (wd:Q3775082)
2. Grand Prix Circuit (wd:Q2444507): instance of video game, 1988 video game
3. Grand Prix Tennis (wd:Q30896069): instance of video game
4. Albert Park Circuit, also known as Australian Grand Prix Circuit, Melbourne Grand Prix Circuit (wd:Q171288): street circuit in Melbourne, Victoria, Australia, instance of street circuit
5. Kyalami, also known as Kyalami Grand Prix Circuit (wd:Q171667): instance of motorsport racing track, Race track in South Africa
6. Porsche Tennis Grand Prix (wd:Q311783)
7. Dallas Grand Prix Circuit (wd:Q16040264): Formula One circuit in Dallas, Texas, instance of motorsport racing track
8. Madrid Tennis Grand Prix (wd:Q299532)
9. 1970 Grand Prix circuit (wd:Q3465182): instance of tennis tour edition, tennis circuit
10. 1989 Grand Prix circuit (wd:Q3465367): instance of tennis tour edition, tennis circuit edition

[Tool]
Top 10 property alternatives:
1. ground level 360 degree view URL, also known as tour URL, virtual tour URL, street view URL, Mapy.CZ, Mapillary (wd:P5282 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): URL to access a service that allows to visually navigate through images at ground level in the proximity of the item, subproperty of URL
2. number of representations, also known as concerts, no. of shows, number of concerts, number of performances, number of shows (wd:P5027 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): number of shows (including the premiere) of a concert tour or a performing arts production
3. depicts, also known as reproduces, portrays, represents, quotes, preserves (wd:P180 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): entity visually depicted in an image, literarily described in a ...o an audiovisual or other medium; see also P921,  'main subject', subproperty of has part(s)
4. detail map, also known as map (wd:P1621 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): map containing details about the entire location, subproperty of locator map image
5. locator map image, also known as map image, map, locator map (wd:P242 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): geographic map image which highlights the location of the subject within some larger entity, subproperty of image
6. work location, also known as worked from, work place, working from, working at, worked at (wd:P937 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): location where persons or organisations were actively participating in employment, business or other work, subproperty of significant place, subproperty of location
7. location, also known as neighborhood, locale, neighbourhood, place, place held (wd:P276 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): location of the object, structure or event. In the case of an ad...ity use P706. Use P7153 for locations associated with the object
8. coordinate location, also known as gps co-ordinates, wgs 84, gps coordinates, gps location, latitude (wd:P625 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): geocoordinates of the subject. For Earth, please note that only WGS84 coordinating system is supported at the moment
9. official map URL, also known as map link, official GIS URL, map URL, maps URL, maps page (wd:P9601 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): URL of an official map, plan or geographic information system (GIS) for the place, subproperty of URL
10. image, also known as img, infobox image, photo, photograph, picture (wd:P18 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): image of relevant illustration of the subject; if available, als...tor map, flag image, signature image, logo image, collage image)

[Tool]
Top 10 property alternatives:
1. edition or translation of, also known as translation or edition of, version of, translation of, is a translation of, is an edition of (wd:P629 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): is an edition or translation of this entity
2. edition/version, also known as designation of edition, designation of version, edition, edition designation, edition or version (wd:P9767 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): the official edition or version name of a resource; this name is not considered part of the title or subtitle of the resource
3. has edition or translation, also known as released as, version, translation(s), modified as, has version (wd:P747 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): item that is an edition or translation of this item
4. distribution format, also known as media format, media type, medium, method of distribution, publication format (wd:P437 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): method (or type) of distribution for the subject
5. modified version of, also known as adaptation of, version of, revision of, revised version of, modification of (wd:P5059 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): indicates the work or one of its versions which served as a basi...tation or arrangement resulting in the given version of the work, subproperty of based on
6. edition number, also known as number of event, software version number, version number (wd:P393 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): number of an edition (first, second, ... as 1, 2, ...) or event, subproperty of series ordinal
7. reissue of, also known as repackage, re-release, re-edition (wd:P9237 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): reissue of musical work, release
8. software version identifier, also known as software release number, software release version, software update identifier, software version number, software update number (wd:P348 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): numeric or nominal identifier of a version of a software program or file format, current or past, subproperty of has edition or translation, subproperty of edition number
9. related image, also known as other version, backup image, placeholder image, related picture, replacement image (wd:P6802 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): less fitting image, used only because a better alternative is no...ble, use P18 instead. Value should not be a generic placeholder., subproperty of image
10. ISBN-10, also known as International Standard Book Number-10, isbn, isbn-10, ISBN10 (wd:P957 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): former identifier for a book (edition), ten digits. Used for all...gs; useful for old books or fac-similes not reedited since 2007)

[Tool]
Top 10 property alternatives:
1. instance of, also known as example of, has type, is a, is an, is of type (wd:P31 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): type to which this subject corresponds/belongs. Different from P...tains, and the volcano is a type (instance) of volcanic landform
2. Wikidata property example, also known as example of property, Wikidata property sample, property sample, property example, for example (wd:P1855 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): example where this Wikidata property is used; target item is one...ualifier the property being described given the associated value
3. quantity, also known as number of instances, total number, total, qty, occurrences (wd:P1114 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): number of instances of this subject in the universe of the subje...e actual number of instances in Wikidata may be lower or higher)
4. subproperty of, also known as parent property, superproperty, subPropertyOf, subclass of property, rdfs:subPropertyOf (wd:P1647 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): all resources related by this property are also related by that property, subproperty of related property
5. partially coincident with, also known as partially include, overlaps, partially in, partial concurrency, overlaps with (wd:P1382 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): object that partially overlaps with the subject in its instances, parts, or members, subproperty of different from
6. model item, also known as best example, example item, featured item, for example, sample (wd:P5869 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): defines which item is a best practice example of modelling a sub...lue of this property, usage instructions at Wikidata:Model items
7. permanent duplicated item, also known as identical to, same concept as, same as, permanently duplicated item, duplicate of item (wd:P2959 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): this item duplicates another item and the two can't be merged, a... cdowiki, gomwiki, nanwiki).  Use P31=Q17362920 for other wikis.
8. exemplar of, also known as includes work, contents, contains work (wd:P1574 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): Links an individual copy of a work to the item for that work or edition, subproperty of instance of
9. usage example, also known as example sentence, sentence, use in a sentence (wd:P5831 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): example of how a lexeme (sense) might be used
10. fictional or mythical analog of, also known as mythical analog of, fictional version of, fictionalization of, fictionalisation of, analog of (wd:P1074 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): used to link an entity or class of entities appearing in a creat...with the analogous entity or class of entities in the real world, subproperty of inspired by

[Tool]
Top 10 property alternatives:
1. part of the series, also known as video game series, subseries, series, part of series, listed in (wd:P179 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): series which contains the subject, subproperty of part of
2. collection, also known as series, repository, museum collection, held by, GLAM (wd:P195 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): art, museum, archival, or bibliographic collection of which the subject is part, subproperty of part of
3. season, also known as television season, TV series, TV season, television series, series of television program (wd:P4908 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): season of a series (televison, web, podcast), subproperty of part of
4. number of episodes, also known as episodes, series length, no. of episodes, episode count (wd:P1113 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): number of episodes in a film/TV/radio series, subproperty of number of parts of this work
5. series ordinal, also known as unit number, sort order, sorting order, ordinal, series number (wd:P1545 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): position of an item in its parent series (most frequently a 1-ba...d from "ranking" defined as a property for evaluating a quality)
6. MusicBrainz series ID, also known as MBS, MB series ID, MusicBrainz ID, Series ID, Series MBID (wd:P1407 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): identifier for a series per the MusicBrainz open music encyclopedia
7. number of representations, also known as concerts, no. of shows, number of concerts, number of performances, number of shows (wd:P5027 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): number of shows (including the premiere) of a concert tour or a performing arts production
8. depicts, also known as reproduces, portrays, represents, quotes, preserves (wd:P180 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): entity visually depicted in an image, literarily described in a ...o an audiovisual or other medium; see also P921,  'main subject', subproperty of has part(s)
9. number of seasons, also known as number of series, seasons, no. of series, no. of seasons (wd:P2437 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): number of seasons a television or radio series has had, subproperty of number of parts of this work
10. volume, also known as number of part, volume of serial, volume of a book, volume number, vol. (wd:P478 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): volume of a book or music release in a collection/series or a published collection of journal issues in a serial publication

[Tool]
Got 12 rows and 3 columns, showing the first 10 rows below:
| subject                                                | property           | object                |
| ------------------------------------------------------ | ------------------ | --------------------- |
| ATP Finals (wd:Q270907)                                | part of (wdt:P361) | ATP Tour (wd:Q300008) |
| ATP Tour Masters 1000 (wd:Q300029)                     | part of (wdt:P361) | ATP Tour (wd:Q300008) |
| ATP World Tour 250 series (wd:Q300017)                 | part of (wdt:P361) | ATP Tour (wd:Q300008) |
| ATP World Tour 500 series (wd:Q300018)                 | part of (wdt:P361) | ATP Tour (wd:Q300008) |
| Laver Cup (wd:Q26694763)                               | part of (wdt:P361) | ATP Tour (wd:Q300008) |
| Washington Open (wd:Q299950)                           | part of (wdt:P361) | ATP Tour (wd:Q300008) |
| ATP Challenger Tour (wd:Q299345)                       | part of (wdt:P361) | ATP Tour (wd:Q300008) |
| Gijón Open (wd:Q113950895)                             | part of (wdt:P361) | ATP Tour (wd:Q300008) |
| Hangzhou Open (wd:Q130237551)                          | part of (wdt:P361) | ATP Tour (wd:Q300008) |
| 2011 U.S. Men's Clay Court Championships (wd:Q1575064) | part of (wdt:P361) | ATP Tour (wd:Q300008) |
| ...                                                    | ...                | ...                   |

[Tool]
Got 6 rows and 3 columns:
| subject                                  | property           | object                                  |
| ---------------------------------------- | ------------------ | --------------------------------------- |
| Milan Indoor (wd:Q125337761)             | part of (wdt:P361) | Grand Prix tennis circuit (wd:Q3775082) |
| Donnay Indoor Championships (wd:Q299206) | part of (wdt:P361) | Grand Prix tennis circuit (wd:Q3775082) |
| Milan Indoor (wd:Q299543)                | part of (wdt:P361) | Grand Prix tennis circuit (wd:Q3775082) |
| Sydney Indoor (wd:Q299783)               | part of (wdt:P361) | Grand Prix tennis circuit (wd:Q3775082) |
| Tokyo Indoor (wd:Q299814)                | part of (wdt:P361) | Grand Prix tennis circuit (wd:Q3775082) |
| wd:Q3663286                              | part of (wdt:P361) | Grand Prix tennis circuit (wd:Q3775082) |

[Tool]
Top 10 property alternatives:
1. winner, also known as nominee, prizewinner, titleholder, top dog, victor (wd:P1346 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): winner of a competition or similar event, not to be used for awa...ssibly qualified with "for work" (P1686)) or for wars or battles, subproperty of participating team, subproperty of participant
2. award received, also known as winner of, win, recognition title, received award, award won (wd:P166 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): award or recognition received by a person, organization or creative work
3. competition won, also known as victory, won event, won, winner of (wd:P2522 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): competition or sports event won by the subject, subproperty of participant in
4. number of wins, also known as W, won, wins, victories, sporting wins (wd:P1355 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): number of sporting matches, games or events won
5. has effect, also known as results in, result, outcome, led to, leads to (wd:P1542 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): subproperty of followed by, effect of this item
6. results, also known as output, result (wd:P2501 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): results of a competition such as sports or elections
7. conferred by, also known as presented by, officiated by, issued by, granted by, given by (wd:P1027 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): person or organization who grants an award, certification, grant, or role
8. has cause, also known as implied by, effect of, initial cause, originated due to, outcome of (wd:P828 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): underlying cause, entity that ultimately resulted in this effect, subproperty of follows
9. significant event, also known as significant occurrence, significant incident, significant achievment, sign. event, outcome (wd:P793 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): significant or notable events associated with the subject
10. successful candidate, also known as election winner, winning candidate, winner of election, election won by, elected (wd:P991 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): person(s) or political organization(s) elected after the election, subproperty of candidate, subproperty of winner

[Tool]
Got 2 rows and 1 column:
| event                                                                       |
| --------------------------------------------------------------------------- |
| 2012 Apia International Sydney (men) (wd:Q2057401)                          |
| 2011 U.S. Men's Clay Court Championships – singles qualifying (wd:Q4001574) |

[Tool]
Got 2 rows and 4 columns:
| event                                                                       | eventLabel                                                         | tournament                                             | tournamentLabel                               |
| --------------------------------------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------ | --------------------------------------------- |
| 2011 U.S. Men's Clay Court Championships – singles qualifying (wd:Q4001574) | 2011 U.S. Men's Clay Court Championships – singles qualifying (en) | 2011 U.S. Men's Clay Court Championships (wd:Q1575064) | 2011 U.S. Men's Clay Court Championships (en) |
| 2012 Apia International Sydney (men) (wd:Q2057401)                          | 2012 Apia International Sydney (men) (en)                          | ATP World Tour 250 series (wd:Q300017)                 | ATP World Tour 250 series (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 ?institution ( COUNT( DISTINCT ?thesis ) AS ?thesisCount ) ( SAMPLE( ?label ) AS ?institutionLabel ) WHERE {
  ?thesis wdt:P31 / wdt:P279 * ?thesisType .
  VALUES ?thesisType {
    wd:Q1266946 wd:Q3030630
  }
  ?thesis wdt:P4101 ?institution .
  OPTIONAL {
    ?institution rdfs:label ?label FILTER ( LANG( ?label ) = "en" )
  }
}
GROUP BY ?institution
ORDER BY DESC ( ?thesisCount )
LIMIT 50

Got 50 rows and 3 columns, showing the first 5 and last 5 rows below:
| institution                                                                    | thesisCount     | institutionLabel                                                    |
| ------------------------------------------------------------------------------ | --------------- | ------------------------------------------------------------------- |
| University of Oxford (wd:Q34433)                                               | 16828 (xsd:int) | University of Oxford (en)                                           |
| University of Auckland (wd:Q492467)                                            | 14832 (xsd:int) | University of Auckland (en)                                         |
| Massey University (wd:Q1134606)                                                | 11881 (xsd:int) | Massey University (en)                                              |
| University of Canterbury (wd:Q432475)                                          | 11286 (xsd:int) | University of Canterbury (en)                                       |
| Delft University of Technology (wd:Q752663)                                    | 10779 (xsd:int) | Delft University of Technology (en)                                 |
| ...                                                                            | ...             | ...                                                                 |
| Illinois State University School of Biological Sciences (wd:Q109321032)        | 92 (xsd:int)    | Illinois State University School of Biological Sciences (en)        |
| Illinois State University School of Kinesiology and Recreation (wd:Q109320549) | 90 (xsd:int)    | Illinois State University School of Kinesiology and Recreation (en) |
| Illinois State University School of Communication (wd:Q109321034)              | 84 (xsd:int)    | Illinois State University School of Communication (en)              |
| University of Paris (wd:Q209842)                                               | 74 (xsd:int)    | University of Paris (en)                                            |
| University of Göttingen (wd:Q152838)                                           | 69 (xsd:int)    | University of Göttingen (en)                                        |

The institutions with the highest number of theses or dissertations submitted to them are:
1. University of Oxford (wd:Q34433) with 16,828 theses/dissertations
2. University of Auckland (wd:Q492467) with 14,832
3. Massey University (wd:Q1134606) with 11,881
4. University of Canterbury (wd:Q432475) with 11,286
5. Delft University of Technology (wd:Q752663) with 10,779
...and more as shown in the query results. The list is ordered by the count of distinct theses or dissertations in descending order.

Which institutions have the highest number of theses or dissertations submitted to them, ordered by the count of distinct theses or dissertations in descending order?

[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 with notes:
1. For P39 legislative memberships, filter by pq:P2937 (legislative term) on the p:P39 statement; don’t use P793 for term filtering. For UK MPs, avoid a generic Q16707842-only scan; rely on term qualifiers and proper date overlap on pq:P580/pq:P582.
2. For residence (P551), time bounds are qualifiers on the statement: p:P551/ps:P551 place, pq:P580 start, pq:P582 end. To include containing areas (e.g., NYC boroughs), expand via wdt:P551/wdt:P131*. Durations usually need client-side calc on QLever.
3. Ticker symbols are pq:P249 on p:P414 statements; query via the statement node (?org p:P414 ?st . ?st ps:P414 ?ex ; pq:P249 ?ticker). Use VALUES to pre-limit orgs/exchanges. Don’t expect wdt:P249 on the org. Prefer qualifiers for time-bound tickers.
4. Archives: use p:P485/ps:P485 for the holding institution. Inventory numbers are qualifiers pq:P217 on that P485 statement. Don’t expect wdt:P217 directly on the person/work. “Archive descriptions” may be separate collection items (P195).
5. When listing contained municipalities or similar, prefer wdt:P150* (has parts) from the parent to enumerate children, then join other relations (e.g., twin towns via wdt:P190). Avoid broad wdt:P131+ scans from children; they are slow and can timeout.
6. On QLever, avoid SERVICE wikibase:label (frequent 301). Use OPTIONAL rdfs:label with LANG filters or fetch QIDs then labels separately. For property mapping, (?prop wikibase:directClaim ?p). Pre-limit with subselect/VALUES to avoid timeouts.
7. Employer constraints: to find people employed by UN or international orgs, use wdt:P108 directly for UN (wd:Q1065), or traverse employer to part of (wdt:P361*) UN, or employer wdt:P31 wd:Q484652 (international organization). Combine with other occupations.
8. For sports/events/editions, prefer explicit edition items (e.g., Q47345468) with wdt:P361 linking to the parent series/tour and filter by wdt:P585/P571 for year; avoid P641/P2139 that model sports played or participants, not the edition metadata.
9. For author/creator queries, use occupation wdt:P106 (e.g., author/writer) rather than P31 typing. To list works, prefer the reverse path ^wdt:P50 ?work; P800 (notable work) is incomplete and curated, not a full bibliography.
10. Awards: use p:P166/ps:P166 and constrain award via wdt:P31/wdt:P279* to a target class (e.g., Cannes awards Q28444913). Recipients can be films or people; don’t assume film-specific properties exist. Count/group by recipient type if needed.
11. To select current/active codes or memberships on QLever, use statement nodes (p:/ps:) and MINUS { ?st pq:P582 [] }. For time series counts (e.g., daily members), generate a date series (VALUES/UNNEST), then test overlap with pq:P580/pq:P582 per date.
12. For people’s native names, use wdt:P1559 (name in native language) on the person, not rdfs:label. Return multiple if multiple native languages exist; pick a preferred language client-side if needed.
13. For multi-valued props (e.g., P1082), GROUP BY entity and aggregate (MAX/MIN/SAMPLE) to avoid duplicates; DISTINCT won’t collapse multiple statements. For category/gender counts, prefer indicator sums: SUM(IF(cond,1,0)) over COUNT on OPTIONAL vars.
14. Avoid SERVICE wikibase:label on QLever; it often 301s. Use OPTIONAL rdfs:label with LANG filters, or fetch QIDs first and labels in a follow-up. Pre-limit with subselect/VALUES to avoid timeouts when joining many labels.
15. For P551 duration comparisons, avoid unsupported date arithmetic. If needed, compute overlaps client-side. On-endpoint, you can only compare presence/counts or use simple MIN/MAX of dates (casting and arithmetic are limited in QLever).
16. When excluding specific entities from a relation (e.g., siblings), use FILTER to drop explicit QIDs or FILTER NOT EXISTS with a VALUES list. Ensure you use the exact sibling QIDs returned by the KG, not assumed ones.

General notes for all knowledge graphs:
1. When checking date interval overlaps, handle open intervals (missing start/end) and use xsd:dateTime. Use OR conditions to cover start within, end within, or spanning the whole range.
2. For P39 queries, qualifiers (e.g., P2937 term, P768 electoral district, P4100 parliamentary group) live on the p:P39 statement node. Do not expect them as wdt: properties on the person or use ps: for non-main values.
3. To get sitelink counts, use wikibase:sitelinks on the entity; it returns a single numeric value, so GROUP BY the entity and avoid COUNT over ?sitelink.
4. Use subclass expansion for types: wdt:P31/wdt:P279* target (e.g., dams, educational institutions). This captures items modeled with subclasses.
5. For locations, prefer hierarchies via wdt:P131+ to reach a containing region/state, and wdt:P17 for country. If HQ is a building, P159 ps points to a city; specific site is qualifier pq:P276 on the P159 statement.
6. When excluding or selecting by a legislative term on P39, check pq:P2937 on the relevant statement. Use FILTER NOT EXISTS over p:P39 with ps:P39 target and pq:P2937 value to exclude a term.
7. QLever endpoints may not support Wikidata’s “WITH {…} AS %name” and “INCLUDE %name” syntax. Avoid named subqueries; use nested SELECTs or VALUES instead.
8. The wikibase:label SERVICE often fails on QLever. Prefer rdfs:label with FILTER(LANG(..)="en") or get QIDs only and resolve labels client-side.
9. Avoid COUNT over OPTIONAL variables that may be unbound for all rows; prefer EXISTS/BOUND checks or aggregate over DISTINCT entities to prevent misleading zeros.
10. On QLever, heavy OPTIONAL label/property joins often time out. Pre-limit with a subselect/VALUES over IDs (ORDER BY + LIMIT), then join labels/properties. Or fetch QIDs first and labels in a second, smaller query.
11. For precise date filtering on Wikidata (birth/death), prefer p/psv time nodes and wikibase:timeValue plus timePrecision checks over wdt:P569/P570 to include values with year/month precision and avoid silent drops.
12. When filtering by exact day of birth or event, avoid STRSTARTS on wdt:P569; instead bound an interval [day, next day) with xsd:dateTime to include all precisions. On QLever, add hint:Prior hint:rangeSafe true to improve performance on time ranges.

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/
qlss: <https://qlever.cs.uni-freiburg.de/spatialSearch/
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. Search for the 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. Execute intermediate queries to get feedback and to verify your assumptions. You may need to refine or rethink your current plan based on the query results and go back to step 2 if needed, possibly multiple times.
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 just use or make up entity or property identifiers without verifying their existence in the knowledge graphs first.
3. Always execute your final SPARQL query before giving an answer to make sure it returns the expected results.
4. 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.
5. 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.
6. 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.
7. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
8. 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] Which institutions have the highest number of theses or dissertations submitted to them, ordered by the count of distinct theses or dissertations in descending order?

[Assistant]
Let's break down the question:

1. We are looking for institutions (universities, colleges, etc.).
2. We want to count the number of distinct theses or dissertations submitted to each institution.
3. We want to order the institutions by this count in descending order.

First, let's identify:
- The entity for "thesis" or "dissertation" in Wikidata.
- The property for "submitted to" or "institution" for a thesis/dissertation.

Let's start by searching for the entity for "thesis" or "dissertation".

[Tool]
Top 10 entity alternatives:
1. thesis, also known as dissertation, theses, academic thesis, academic dissertation (wd:Q1266946)
2. Tesis, also known as Thesis (wd:Q1636502): 1996 film directed by Alejandro Amenábar, instance of film
3. Thesis (wd:Q3822612): instance of Greek primordial deity, goddess of Greek mythology
4. Thesis (wd:Q2420274)
5. thesis, also known as article, dissertation, paper, treatise (wd:Q124212544)
6. thesis (wd:Q4453731)
7. Thesis (wd:Q7783439): album by Jimmy Giuffre, instance of album
8. Thesis, also known as thesisband, Thesis band, Thesis (zespół rocka progresywnego) (wd:Q9358417): instance of rock band, Polish rock band
9. thesis (wd:Q123397500): for BFA, MFA or similar, instance of art genre
10. thesis (wd:Q20194793): weaker part of a musical feature, instance of musical concept

[Tool]
Top 10 entity alternatives:
1. thesis, also known as dissertation, theses, academic thesis, academic dissertation (wd:Q1266946)
2. dissertation (wd:Q3030630)
3. thesis, also known as article, dissertation, paper, treatise (wd:Q124212544)
4. Dissertation, also known as Dissertation - Department of Computer Science, Lund University (wd:Q80450470): instance of periodical, periodical
5. Dissertation (wd:Q80968035): scientific article published on 01 June 2007, instance of scholarly article
6. Dissertation (wd:Q78899964): instance of periodical, Swedish periodical
7. dissertation (wd:Q1385450): instance of conflation, conflation of concepts
8. academic thesis, also known as Ph.D. thesis, Ph. D. thesis, masters thesis, master's thesis, dissertation (wd:P1026): instance of Wikidata property related to theses and dissertations, instance of Wikidata property for items about people, instance of Wikidata property related to education, thesis or dissertation written for a degree, instance of Wikidata qualifier
9. dissertation (wd:L227853)
10. dissertation (wd:L397415-S1)

[Tool]
Top 10 property alternatives:
1. thesis submitted to, also known as dissertation submitted to, submitted to (wd:P4101 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): institution to whom a thesis or dissertation is submitted
2. applies to part, also known as applies to aspect, applied to, when viewed as, valid for part, section (wd:P518 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): part, aspect, or form of the item to which the claim applies
3. addressee, also known as to:, To:, addressed to, sent to, recipient (wd:P1817 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): person or organization to whom a letter or note is addressed, subproperty of destination of transfer
4. subject lexeme form, also known as form demonstrated, subject form, demonstrates form, applies to form (wd:P5830 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): (qualifier) statement applies only to listed lexeme forms of statement's subject
5. announcement date, also known as date teased, made public on, public announcement date, published, released (wd:P6949 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): time of the first public presentation of a subject by the creator, of information by the media, subproperty of point in time
6. publication date, also known as published, publication time, publication, pubdate, launched (wd:P577 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): date or point in time when a work was first published or released, subproperty of point in time
7. number of submissions (wd:P12655 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): number of submissions, e.g., submitted papers to a conference
8. inception, also known as inception date, founding date, founded in, founded on date, founded on (wd:P571 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): time when an entity begins to exist; for date of official opening use P1619, subproperty of start time
9. contributed to creative work, also known as collaborator on, contributed to, contributed to work, contributor, contributor to (wd:P3919 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): person is cited as contributing to some creative or published work or series (qualify with "subject has role", P2868)
10. destination of transfer, also known as destination, to, target, recipient, receiver (wd:P12694 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): entity that a transferred item comes to be associated with as a result of this process

[Tool]
Top 10 property alternatives:
1. instance of, also known as example of, has type, is a, is an, is of type (wd:P31 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): type to which this subject corresponds/belongs. Different from P...tains, and the volcano is a type (instance) of volcanic landform
2. Wikidata property example, also known as example of property, Wikidata property sample, property sample, property example, for example (wd:P1855 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): example where this Wikidata property is used; target item is one...ualifier the property being described given the associated value
3. quantity, also known as number of instances, total number, total, qty, occurrences (wd:P1114 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): number of instances of this subject in the universe of the subje...e actual number of instances in Wikidata may be lower or higher)
4. subproperty of, also known as parent property, superproperty, subPropertyOf, subclass of property, rdfs:subPropertyOf (wd:P1647 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): all resources related by this property are also related by that property, subproperty of related property
5. partially coincident with, also known as partially include, overlaps, partially in, partial concurrency, overlaps with (wd:P1382 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): object that partially overlaps with the subject in its instances, parts, or members, subproperty of different from
6. model item, also known as best example, example item, featured item, for example, sample (wd:P5869 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): defines which item is a best practice example of modelling a sub...lue of this property, usage instructions at Wikidata:Model items
7. permanent duplicated item, also known as identical to, same concept as, same as, permanently duplicated item, duplicate of item (wd:P2959 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): this item duplicates another item and the two can't be merged, a... cdowiki, gomwiki, nanwiki).  Use P31=Q17362920 for other wikis.
8. exemplar of, also known as includes work, contents, contains work (wd:P1574 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): Links an individual copy of a work to the item for that work or edition, subproperty of instance of
9. usage example, also known as example sentence, sentence, use in a sentence (wd:P5831 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): example of how a lexeme (sense) might be used
10. fictional or mythical analog of, also known as mythical analog of, fictional version of, fictionalization of, fictionalisation of, analog of (wd:P1074 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): used to link an entity or class of entities appearing in a creat...with the analogous entity or class of entities in the real world, subproperty of inspired by

[Tool]
Top 10 property alternatives:
1. U.S. National Archives Identifier, also known as NAID, NARA identifier, National Archives Identifier, Organization Name NAID, United States National Archives Identifier (wd:P1225 as wdt/p): identifier for the United States National Archives and Records Administration's online catalog
2. instance of, also known as example of, has type, is a, is an, is of type (wd:P31 as wdt/p): type to which this subject corresponds/belongs. Different from P...tains, and the volcano is a type (instance) of volcanic landform
3. Wikidata property, also known as has property, main property, property, property for this item (wd:P1687 as wdt/p): main Wikidata property for this item
4. equivalent class, also known as schema.org type, same kind of thing, external class, same grouping, same class (wd:P1709 as wdt/p): equivalent class in other ontologies (use property URI), subproperty of exact match, subproperty of URL
5. facet of, also known as subject in, topic of, subtopic of, subitem of, section in (wd:P1269 as wdt/p): topic of which this item is an aspect; item that offers a broader perspective on the same topic
6. MeSH descriptor ID, also known as MeSH ID, MeSH Unique ID, UI (wd:P486 as wdt/p/wdtn): identifier for Descriptor or Supplementary concept in the Medical Subject Headings controlled vocabulary
7. subclass of, also known as subcategory of, subgenre of, sort of, subtype of, type 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
8. NL CR AUT ID, also known as Czech National Authority Database, NLCR AUT ID (wd:P691 as wdt/p): identifier in the Czech National Authority Database of National Library of the Czech Republic (NL CR)
9. Library of Congress authority ID, also known as LCSH Authority File ID, Library of Congress Control Number (Subject Authority), LCSH ID, LCSH LCCN, LC Subject Heading ID (wd:P244 as wdt/p/wdtn): Library of Congress name authority (persons, families, corporate...lowed by 8-10 digits (see regex). For manifestations, use P1144]
10. Freebase ID, also known as FID, Freebase, Freebase identifier, MID (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

[Tool]
Got 65,536 rows and 3 columns, showing the first 10 rows below:
| subject                                                                             | property                        | object                                            |
| ----------------------------------------------------------------------------------- | ------------------------------- | ------------------------------------------------- |
| Exploring the Kingdom of Brychei...h in an Early Medieval Landscape (wd:Q100272640) | thesis submitted to (wdt:P4101) | University of Oxford (wd:Q34433)                  |
| The Early-Middle Bronze Age Tran...ex, Sussex and the Thames Valley (wd:Q104127077) | thesis submitted to (wdt:P4101) | University of Cambridge (wd:Q35794)               |
| Magnetism and Electron Transport...tive Lanthanum Calcium Manganite (wd:Q104889226) | thesis submitted to (wdt:P4101) | Stanford University (wd:Q41506)                   |
| Magnetic fields in the early solar system (wd:Q104536323)                           | thesis submitted to (wdt:P4101) | Massachusetts Institute of Technology (wd:Q49108) |
| The Riemann theory of trigonometric series (wd:Q100552965)                          | thesis submitted to (wdt:P4101) | Moscow State University (wd:Q13164)               |
| Coleção de bustos-relicários da ... de 30 esculturas do Século XVII (wd:Q105423991) | thesis submitted to (wdt:P4101) | Federal University of Minas Gerais (wd:Q132140)   |
| Entre tinteiros e palanques: A t... Feira de Santana-BA (1909-1930) (wd:Q107198442) | thesis submitted to (wdt:P4101) | State University of Feira de Santana (wd:Q156406) |
| Carybé e a legitimação de um dis...integração das artes em Salvador (wd:Q105303955) | thesis submitted to (wdt:P4101) | Federal University of Bahia (wd:Q159102)          |
| The smoothing of data (wd:Q104144515)                                               | thesis submitted to (wdt:P4101) | University of Edinburgh (wd:Q160302)              |
| The Polynomial Solutions of the ...quation A f(x+1) + B f(x) = Φ(x) (wd:Q104175639) | thesis submitted to (wdt:P4101) | Cornell University (wd:Q49115)                    |
| ...                                                                                | ...                             | ...                                               |

[Tool]
Got 4,798 rows and 3 columns, showing the first 10 rows below:
| subject                                                                             | property              | object               |
| ----------------------------------------------------------------------------------- | --------------------- | -------------------- |
| Chinese Accounts of the Strange:...tudy in the History of Religions (wd:Q100146585) | instance of (wdt:P31) | thesis (wd:Q1266946) |
| From Protecting Life to Defendin...lic Health in Tianjin, 1859-1953 (wd:Q100153211) | instance of (wdt:P31) | thesis (wd:Q1266946) |
| wd:Q100154437                                                                       | instance of (wdt:P31) | thesis (wd:Q1266946) |
| Earthquake Behavior and Structure of Oceanic Transform Faults (wd:Q100251212)       | instance of (wdt:P31) | thesis (wd:Q1266946) |
| The Dynamics of Productivity Cha... Theoretical and Empirical Study (wd:Q100273087) | instance of (wdt:P31) | thesis (wd:Q1266946) |
| Essays on optimal economic growth (wd:Q100274631)                                   | instance of (wdt:P31) | thesis (wd:Q1266946) |
| Restricted Tangent Bundle of Space Curves (wd:Q100295794)                           | instance of (wdt:P31) | thesis (wd:Q1266946) |
| Imagining History: Discourses of...tics in Japan, 1930's and 1960's (wd:Q100394016) | instance of (wdt:P31) | thesis (wd:Q1266946) |
| The Observational Significance o...ndations of Analytical Economics (wd:Q100589085) | instance of (wdt:P31) | thesis (wd:Q1266946) |
| wd:Q100869512                                                                       | instance of (wdt:P31) | thesis (wd:Q1266946) |
| ...                                                                                | ...                   | ...                  |

[Tool]
Got 3 rows and 3 columns:
| subject                                                                             | property              | object                     |
| ----------------------------------------------------------------------------------- | --------------------- | -------------------------- |
| Nation gegen Hinterland — Der Kr...skursives Ereignis (1874 – 1903) (wd:Q131276079) | instance of (wdt:P31) | dissertation (wd:Q3030630) |
| wd:Q133230628                                                                       | instance of (wdt:P31) | dissertation (wd:Q3030630) |
| Joachim Raff und Hans von Bülow (wd:Q133445235)                                     | instance of (wdt:P31) | dissertation (wd:Q3030630) |

[Tool]
Got 65,536 rows and 3 columns, showing the first 10 rows below:
| subject                                                                             | property                        | object                                            |
| ----------------------------------------------------------------------------------- | ------------------------------- | ------------------------------------------------- |
| Exploring the Kingdom of Brychei...h in an Early Medieval Landscape (wd:Q100272640) | thesis submitted to (wdt:P4101) | University of Oxford (wd:Q34433)                  |
| The Early-Middle Bronze Age Tran...ex, Sussex and the Thames Valley (wd:Q104127077) | thesis submitted to (wdt:P4101) | University of Cambridge (wd:Q35794)               |
| Magnetism and Electron Transport...tive Lanthanum Calcium Manganite (wd:Q104889226) | thesis submitted to (wdt:P4101) | Stanford University (wd:Q41506)                   |
| Magnetic fields in the early solar system (wd:Q104536323)                           | thesis submitted to (wdt:P4101) | Massachusetts Institute of Technology (wd:Q49108) |
| The Riemann theory of trigonometric series (wd:Q100552965)                          | thesis submitted to (wdt:P4101) | Moscow State University (wd:Q13164)               |
| Coleção de bustos-relicários da ... de 30 esculturas do Século XVII (wd:Q105423991) | thesis submitted to (wdt:P4101) | Federal University of Minas Gerais (wd:Q132140)   |
| Entre tinteiros e palanques: A t... Feira de Santana-BA (1909-1930) (wd:Q107198442) | thesis submitted to (wdt:P4101) | State University of Feira de Santana (wd:Q156406) |
| Carybé e a legitimação de um dis...integração das artes em Salvador (wd:Q105303955) | thesis submitted to (wdt:P4101) | Federal University of Bahia (wd:Q159102)          |
| The smoothing of data (wd:Q104144515)                                               | thesis submitted to (wdt:P4101) | University of Edinburgh (wd:Q160302)              |
| The Polynomial Solutions of the ...quation A f(x+1) + B f(x) = Φ(x) (wd:Q104175639) | thesis submitted to (wdt:P4101) | Cornell University (wd:Q49115)                    |
| ...                                                                                | ...                             | ...                                               |

[Tool]
Got 50 rows and 2 columns, showing the first 5 and last 5 rows below:
| institution                                                                    | thesisCount     |
| ------------------------------------------------------------------------------ | --------------- |
| University of Oxford (wd:Q34433)                                               | 16828 (xsd:int) |
| University of Auckland (wd:Q492467)                                            | 14832 (xsd:int) |
| Massey University (wd:Q1134606)                                                | 11881 (xsd:int) |
| University of Canterbury (wd:Q432475)                                          | 11286 (xsd:int) |
| Delft University of Technology (wd:Q752663)                                    | 10779 (xsd:int) |
| ...                                                                            | ...             |
| Illinois State University School of Biological Sciences (wd:Q109321032)        | 92 (xsd:int)    |
| Illinois State University School of Kinesiology and Recreation (wd:Q109320549) | 90 (xsd:int)    |
| Illinois State University School of Communication (wd:Q109321034)              | 84 (xsd:int)    |
| University of Paris (wd:Q209842)                                               | 74 (xsd:int)    |
| University of Göttingen (wd:Q152838)                                           | 69 (xsd:int)    |

[Tool]
Got 50 rows and 3 columns, showing the first 5 and last 5 rows below:
| institution                                                                    | thesisCount     | institutionLabel                                                    |
| ------------------------------------------------------------------------------ | --------------- | ------------------------------------------------------------------- |
| University of Oxford (wd:Q34433)                                               | 16828 (xsd:int) | University of Oxford (en)                                           |
| University of Auckland (wd:Q492467)                                            | 14832 (xsd:int) | University of Auckland (en)                                         |
| Massey University (wd:Q1134606)                                                | 11881 (xsd:int) | Massey University (en)                                              |
| University of Canterbury (wd:Q432475)                                          | 11286 (xsd:int) | University of Canterbury (en)                                       |
| Delft University of Technology (wd:Q752663)                                    | 10779 (xsd:int) | Delft University of Technology (en)                                 |
| ...                                                                            | ...             | ...                                                                 |
| Illinois State University School of Biological Sciences (wd:Q109321032)        | 92 (xsd:int)    | Illinois State University School of Biological Sciences (en)        |
| Illinois State University School of Kinesiology and Recreation (wd:Q109320549) | 90 (xsd:int)    | Illinois State University School of Kinesiology and Recreation (en) |
| Illinois State University School of Communication (wd:Q109321034)              | 84 (xsd:int)    | Illinois State University School of Communication (en)              |
| University of Paris (wd:Q209842)                                               | 74 (xsd:int)    | University of Paris (en)                                            |
| University of Göttingen (wd:Q152838)                                           | 69 (xsd:int)    | University of Göttingen (en)                                        |

[Tool] Stopped generation process


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?year ( COUNT( ?ensemble ) AS ?ensembleCount ) WHERE {
  ?ensemble wdt:P31 / wdt:P279 * wd:Q2088357 .
  ?ensemble wdt:P571 ?inception .
  BIND( YEAR( ?inception ) AS ?year )
}
GROUP BY ?year
ORDER BY ?year

The number of musical ensembles formed each year (grouped by year of inception and sorted by year) can be retrieved using this query. Note that some years may be erroneous or missing due to data quality issues in Wikidata (e.g., blank or implausible years).

How many musical ensembles were formed each year, grouped by the year of their inception and sorted by year?

[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 with notes:
1. For P39 legislative memberships, filter by pq:P2937 (legislative term) on the p:P39 statement; don’t use P793 for term filtering. For UK MPs, avoid a generic Q16707842-only scan; rely on term qualifiers and proper date overlap on pq:P580/pq:P582.
2. For residence (P551), time bounds are qualifiers on the statement: p:P551/ps:P551 place, pq:P580 start, pq:P582 end. To include containing areas (e.g., NYC boroughs), expand via wdt:P551/wdt:P131*. Durations usually need client-side calc on QLever.
3. Ticker symbols are pq:P249 on p:P414 statements; query via the statement node (?org p:P414 ?st . ?st ps:P414 ?ex ; pq:P249 ?ticker). Use VALUES to pre-limit orgs/exchanges. Don’t expect wdt:P249 on the org. Prefer qualifiers for time-bound tickers.
4. Archives: use p:P485/ps:P485 for the holding institution. Inventory numbers are qualifiers pq:P217 on that P485 statement. Don’t expect wdt:P217 directly on the person/work. “Archive descriptions” may be separate collection items (P195).
5. When listing contained municipalities or similar, prefer wdt:P150* (has parts) from the parent to enumerate children, then join other relations (e.g., twin towns via wdt:P190). Avoid broad wdt:P131+ scans from children; they are slow and can timeout.
6. On QLever, avoid SERVICE wikibase:label (frequent 301). Use OPTIONAL rdfs:label with LANG filters or fetch QIDs then labels separately. For property mapping, (?prop wikibase:directClaim ?p). Pre-limit with subselect/VALUES to avoid timeouts.
7. Employer constraints: to find people employed by UN or international orgs, use wdt:P108 directly for UN (wd:Q1065), or traverse employer to part of (wdt:P361*) UN, or employer wdt:P31 wd:Q484652 (international organization). Combine with other occupations.
8. For sports/events/editions, prefer explicit edition items (e.g., Q47345468) with wdt:P361 linking to the parent series/tour and filter by wdt:P585/P571 for year; avoid P641/P2139 that model sports played or participants, not the edition metadata.
9. For author/creator queries, use occupation wdt:P106 (e.g., author/writer) rather than P31 typing. To list works, prefer the reverse path ^wdt:P50 ?work; P800 (notable work) is incomplete and curated, not a full bibliography.
10. Awards: use p:P166/ps:P166 and constrain award via wdt:P31/wdt:P279* to a target class (e.g., Cannes awards Q28444913). Recipients can be films or people; don’t assume film-specific properties exist. Count/group by recipient type if needed.
11. To select current/active codes or memberships on QLever, use statement nodes (p:/ps:) and MINUS { ?st pq:P582 [] }. For time series counts (e.g., daily members), generate a date series (VALUES/UNNEST), then test overlap with pq:P580/pq:P582 per date.
12. For people’s native names, use wdt:P1559 (name in native language) on the person, not rdfs:label. Return multiple if multiple native languages exist; pick a preferred language client-side if needed.
13. For multi-valued props (e.g., P1082), GROUP BY entity and aggregate (MAX/MIN/SAMPLE) to avoid duplicates; DISTINCT won’t collapse multiple statements. For category/gender counts, prefer indicator sums: SUM(IF(cond,1,0)) over COUNT on OPTIONAL vars.
14. Avoid SERVICE wikibase:label on QLever; it often 301s. Use OPTIONAL rdfs:label with LANG filters, or fetch QIDs first and labels in a follow-up. Pre-limit with subselect/VALUES to avoid timeouts when joining many labels.
15. For P551 duration comparisons, avoid unsupported date arithmetic. If needed, compute overlaps client-side. On-endpoint, you can only compare presence/counts or use simple MIN/MAX of dates (casting and arithmetic are limited in QLever).
16. When excluding specific entities from a relation (e.g., siblings), use FILTER to drop explicit QIDs or FILTER NOT EXISTS with a VALUES list. Ensure you use the exact sibling QIDs returned by the KG, not assumed ones.

General notes for all knowledge graphs:
1. When checking date interval overlaps, handle open intervals (missing start/end) and use xsd:dateTime. Use OR conditions to cover start within, end within, or spanning the whole range.
2. For P39 queries, qualifiers (e.g., P2937 term, P768 electoral district, P4100 parliamentary group) live on the p:P39 statement node. Do not expect them as wdt: properties on the person or use ps: for non-main values.
3. To get sitelink counts, use wikibase:sitelinks on the entity; it returns a single numeric value, so GROUP BY the entity and avoid COUNT over ?sitelink.
4. Use subclass expansion for types: wdt:P31/wdt:P279* target (e.g., dams, educational institutions). This captures items modeled with subclasses.
5. For locations, prefer hierarchies via wdt:P131+ to reach a containing region/state, and wdt:P17 for country. If HQ is a building, P159 ps points to a city; specific site is qualifier pq:P276 on the P159 statement.
6. When excluding or selecting by a legislative term on P39, check pq:P2937 on the relevant statement. Use FILTER NOT EXISTS over p:P39 with ps:P39 target and pq:P2937 value to exclude a term.
7. QLever endpoints may not support Wikidata’s “WITH {…} AS %name” and “INCLUDE %name” syntax. Avoid named subqueries; use nested SELECTs or VALUES instead.
8. The wikibase:label SERVICE often fails on QLever. Prefer rdfs:label with FILTER(LANG(..)="en") or get QIDs only and resolve labels client-side.
9. Avoid COUNT over OPTIONAL variables that may be unbound for all rows; prefer EXISTS/BOUND checks or aggregate over DISTINCT entities to prevent misleading zeros.
10. On QLever, heavy OPTIONAL label/property joins often time out. Pre-limit with a subselect/VALUES over IDs (ORDER BY + LIMIT), then join labels/properties. Or fetch QIDs first and labels in a second, smaller query.
11. For precise date filtering on Wikidata (birth/death), prefer p/psv time nodes and wikibase:timeValue plus timePrecision checks over wdt:P569/P570 to include values with year/month precision and avoid silent drops.
12. When filtering by exact day of birth or event, avoid STRSTARTS on wdt:P569; instead bound an interval [day, next day) with xsd:dateTime to include all precisions. On QLever, add hint:Prior hint:rangeSafe true to improve performance on time ranges.

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/
qlss: <https://qlever.cs.uni-freiburg.de/spatialSearch/
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. Search for the 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. Execute intermediate queries to get feedback and to verify your assumptions. You may need to refine or rethink your current plan based on the query results and go back to step 2 if needed, possibly multiple times.
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 just use or make up entity or property identifiers without verifying their existence in the knowledge graphs first.
3. Always execute your final SPARQL query before giving an answer to make sure it returns the expected results.
4. 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.
5. 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.
6. 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.
7. For questions with a "True" or "False" answer the SPARQL query should be an ASK query.
8. 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 musical ensembles were formed each year, grouped by the year of their inception and sorted by year?

[Assistant]
Let's break down the question:

1. We are interested in "musical ensembles"—so we need to identify the entity for "musical ensemble" in Wikidata.
2. We want to know how many were formed each year, so we need the property for "inception" (formation date).
3. We need to group the results by year and count the number of ensembles per year, then sort by year.

Step 1: Find the entity for "musical ensemble".
Step 2: Find the property for "inception".
Step 3: Build a query that finds all instances (and subclasses) of musical ensemble, gets their inception date, extracts the year, groups and counts, and sorts by year.

Let's start by searching for the entity "musical ensemble".

[Tool]
Top 10 entity alternatives:
1. musical ensemble, also known as music ensemble, ensemble (wd:Q2088357)
2. vocal-musical ensemble, also known as musical ensemble (wd:Q29881657)
3. musical ensemble (wd:L34511-S1)
4. Kantele (musical ensemble), also known as Kantele (wd:Q4212623): instance of musical ensemble
5. instrumental ensemble, also known as instrumental musical ensemble (wd:Q11072804)
6. fictional musical ensemble, also known as fictional band, fictional music group, fictional music ensemble, fictional music band, fictional musical group (wd:Q6619719)
7. composition for concertina ensemble, also known as concertina ensemble (musical work), concertina ensemble (wd:Q108040793)
8. Fondateur d'un ensemble musical (wd:Q105103965): instance of human
9. Musical Ensemble Erft e.V. (wd:Q122855895): amateur theater in North Rhine-Westphalia (Germany), instance of theatre troupe
10. member of this band, musical group, also known as member of this musical ensemble, member of this musical group, member of this band, band members by band (wd:Q65966973)

[Tool]
Top 10 property alternatives:
1. inception, also known as inception date, founding date, founded in, founded on date, founded on (wd:P571 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): time when an entity begins to exist; for date of official opening use P1619, subproperty of start time
2. location of first performance, also known as first performance place, world premiere location, world premiere held at, world premiere, premiere location (wd:P4647 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): location where a work was first debuted, performed or broadcasted, subproperty of significant place
3. date of first performance, also known as world premiere date, world premiere, time of first performance, premiere date, premiere (wd:P1191 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): date a work was first debuted, performed or live-broadcasted, subproperty of publication date
4. announcement date, also known as date teased, made public on, public announcement date, published, released (wd:P6949 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): time of the first public presentation of a subject by the creator, of information by the media, subproperty of point in time
5. aperture (wd:P7863 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): aperture of a camera lens
6. Israel Museum Jerusalem artist ID, also known as IMAGINE (wd:P7681 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): identifier of a person (artist) in the Israel Museum Jerusalem collection
7. language style, also known as obsolete, register, sense register, sense usage, style (wd:P6191 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): to denote of the way a sense of a word is used, e.g., slang, vulgarism, babytalk, colloquialism, etc.
8. torque, also known as moment, moment of force (wd:P2230 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): torque of a machine, a motor/engine/powerplant, or a vehicle
9. catchphrase, also known as has catchphrase, mantra, slogan, tagline, uses catchphrase (wd:P6251 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): commonly used phrase by which someone or something may be recognized
10. has goal, also known as intention, mission, objective, objective of project or action, project of (wd:P3712 as pqv/prv/psn/pqn/wdt/pr/p/psv/wdtn/prn/ps/pq): desired result or outcome

[Tool]
SPARQL execution failed:
Invalid SPARQL query: The expression "YEAR ( ?inception )" does not aggregate ?inception. All non-aggregated variables must be part of the GROUP BY clause.

[Tool]
Got 302 rows and 2 columns, showing the first 5 and last 5 rows below:
| year             | ensembleCount |
| ---------------- | ------------- |
|                  | 24 (xsd:int)  |
| 1 (xsd:int)      | 1 (xsd:int)   |
| 19 (xsd:int)     | 1 (xsd:int)   |
| 198 (xsd:int)    | 1 (xsd:int)   |
| 785 (xsd:int)    | 1 (xsd:int)   |
| ...              | ...           |
| 2022 (xsd:int)   | 146 (xsd:int) |
| 2023 (xsd:int)   | 90 (xsd:int)  |
| 2024 (xsd:int)   | 48 (xsd:int)  |
| 2025 (xsd:int)   | 11 (xsd:int)  |
| 806868 (xsd:int) | 1 (xsd:int)   |

[Tool] Stopped generation process