PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?event ?eventLabel ?tourneyEdition ?tourneyEditionLabel WHERE {
  VALUES ?mensClass {
    wd:Q16893072
  }
  VALUES ?circuit {
    wd:Q300008 wd:Q3775082
  }
  ?event wdt:P2094 ?mensClass .
  ?event wdt:P361 ?tourneyEdition .
  FILTER NOT EXISTS {
    ?event wdt:P1346 ?winner
  }
  .
  ?tourneyEdition wdt:P361 * ?circuit .
  OPTIONAL {
    ?event rdfs:label ?eventLabel FILTER ( LANG( ?eventLabel ) = "en" )
  }
  OPTIONAL {
    ?tourneyEdition rdfs:label ?tourneyEditionLabel FILTER ( LANG( ?tourneyEditionLabel ) = "en" )
  }
}
ORDER BY ?eventLabel

Using entities:
- men's singles (wd:Q16893072), also known as men's singles in tennis: is instance of competition class / is instance of sports discipline / is instance of men's singles / discipline in tennis
- ATP Tour (wd:Q300008), also known as ATP World Tour: is instance of recurring sporting event / is instance of tennis tour with multiple editions / is subclass of tennis tour / series of men's tennis tournaments / tennis tournament / tennis tournament
- Grand Prix tennis circuit (wd:Q3775082): is instance of recurring sporting event / is instance of tennis tour with multiple editions / is subclass of tennis tour / professional tennis tour

Using properties:
- winner (wd:P1346 as wdt), also known as 1st place medalist, awardee, champ, champion, has winner, etc.: is subproperty of participating team / is subproperty of participant / winner of a competition or similar event, not to be used for ... qualified with "for work" (P1686)) or for wars or battles / winner of an event - do not use for awards (use P166 instead), nor for wars or battles
- competition class (wd:P2094 as wdt), also known as class for competition, compclass, disability sport classifications, qualification class, qualifies for, etc.: official classification by a regulating body under which the ... teams, participants, or equipment) qualifies for inclusion / official classification by a regulating body under which the ... teams, participants, or equipment) qualifies for inclusion
- part of (wd:P361 as wdt), also known as assembly of, branch of, chain, collateral branch of, component of, etc.: object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670)) / object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670)) / object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670)) / object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670))

Answer:
I ran the query above against Wikidata. It finds items that: (1) have competition class "men's singles" (wd:Q16893072), (2) are part of a tournament edition (?tourneyEdition) that (transitively via P361*) is part of either the ATP Tour (wd:Q300008) or the Grand Prix tennis circuit (wd:Q3775082), and (3) do not have a winner stated (no wdt:P1346 triple).

The query returns the event IRIs and their tournament edition IRIs (with English labels when available). Example results include:
- wd:Q131993315 — "2025 Dallas Open – Singles" (part of wd:Q131725182 — "2025 Dallas Open")
- wd:Q132173771 — "2025 Delray Beach Open – Singles" (part of wd:Q131917965 — "2025 Delray Beach Open")
- wd:Q132173811 — "2025 Open 13 Provence – Singles" (part of wd:Q131860197 — "2025 Open 13 Provence")
- wd:Q132360522 — "2025 Qatar ExxonMobil Open – Singles" (part of wd:Q131933979 — "2025 Qatar ExxonMobil Open")
- wd:Q132360560 — "2025 Rio Open – Singles" (part of wd:Q125836535 — "2025 Rio Open")

(There are additional event items returned — the full set is produced by the SPARQL query above.)

If you want, I can (a) return the full list of event IRIs and labels here, (b) export the results as CSV, or (c) narrow the query further (for example restrict to a particular year range or to only ATP Tour vs only Grand Prix).

I ran the query above against Wikidata. It finds items that: (1) have competition class "men's singles" (wd:Q16893072), (2) are part of a tournament edition (?tourneyEdition) that (transitively via P361*) is part of either the ATP Tour (wd:Q300008) or the Grand Prix tennis circuit (wd:Q3775082), and (3) do not have a winner stated (no wdt:P1346 triple).

The query returns the event IRIs and their tournament edition IRIs (with English labels when available). Example results include:
- wd:Q131993315 — "2025 Dallas Open – Singles" (part of wd:Q131725182 — "2025 Dallas Open")
- wd:Q132173771 — "2025 Delray Beach Open – Singles" (part of wd:Q131917965 — "2025 Delray Beach Open")
- wd:Q132173811 — "2025 Open 13 Provence – Singles" (part of wd:Q131860197 — "2025 Open 13 Provence")
- wd:Q132360522 — "2025 Qatar ExxonMobil Open – Singles" (part of wd:Q131933979 — "2025 Qatar ExxonMobil Open")
- wd:Q132360560 — "2025 Rio Open – Singles" (part of wd:Q125836535 — "2025 Rio Open")

(There are additional event items returned — the full set is produced by the SPARQL query above.)

If you want, I can (a) return the full list of event IRIs and labels here, (b) export the results as CSV, or (c) narrow the query further (for example restrict to a particular year range or to only ATP Tour vs only Grand Prix).

SPARQL query over wikidata:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?event ?eventLabel ?tourneyEdition ?tourneyEditionLabel WHERE {
  VALUES ?mensClass {
    wd:Q16893072
  }
  VALUES ?circuit {
    wd:Q300008 wd:Q3775082
  }
  ?event wdt:P2094 ?mensClass .
  ?event wdt:P361 ?tourneyEdition .
  FILTER NOT EXISTS {
    ?event wdt:P1346 ?winner
  }
  .
  ?tourneyEdition wdt:P361 * ?circuit .
  OPTIONAL {
    ?event rdfs:label ?eventLabel FILTER ( LANG( ?eventLabel ) = "en" )
  }
  OPTIONAL {
    ?tourneyEdition rdfs:label ?tourneyEditionLabel FILTER ( LANG( ?tourneyEditionLabel ) = "en" )
  }
}
ORDER BY ?eventLabel

Using entities:
- men's singles (wd:Q16893072), also known as men's singles in tennis: is instance of competition class / is instance of sports discipline / is instance of men's singles / discipline in tennis
- ATP Tour (wd:Q300008), also known as ATP World Tour: is instance of recurring sporting event / is instance of tennis tour with multiple editions / is subclass of tennis tour / series of men's tennis tournaments / tennis tournament / tennis tournament
- Grand Prix tennis circuit (wd:Q3775082): is instance of recurring sporting event / is instance of tennis tour with multiple editions / is subclass of tennis tour / professional tennis tour

Using properties:
- winner (wd:P1346 as wdt), also known as 1st place medalist, awardee, champ, champion, has winner, etc.: is subproperty of participating team / is subproperty of participant / winner of a competition or similar event, not to be used for ... qualified with "for work" (P1686)) or for wars or battles / winner of an event - do not use for awards (use P166 instead), nor for wars or battles
- competition class (wd:P2094 as wdt), also known as class for competition, compclass, disability sport classifications, qualification class, qualifies for, etc.: official classification by a regulating body under which the ... teams, participants, or equipment) qualifies for inclusion / official classification by a regulating body under which the ... teams, participants, or equipment) qualifies for inclusion
- part of (wd:P361 as wdt), also known as assembly of, branch of, chain, collateral branch of, component of, etc.: object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670)) / object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670)) / object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670)) / object of which the subject is a part (if this subject is ... "has part" (P527, see also "has parts of the class" (P2670))

Execution result:
Got 162 rows and 4 columns, showing the first 5 and last 5 rows below:
| event                                                | eventLabel                                     | tourneyEdition                             | tourneyEditionLabel                  |
| ---------------------------------------------------- | ---------------------------------------------- | ------------------------------------------ | ------------------------------------ |
| wd:Q16616617                                         |                                                | 2005 Torneo Godó (wd:Q2392191)             | 2005 Torneo Godó (lang:en)           |
| wd:Q16577935                                         |                                                | 2000 Mercedes Cup (wd:Q1556788)            | 2000 Mercedes Cup (lang:en)          |
| wd:Q16580322                                         |                                                | 2009 Movistar Open (wd:Q594830)            | 2009 Movistar Open (lang:en)         |
| wd:Q16610587                                         |                                                | 2009 Stockholm Open (wd:Q1657030)          | 2009 Stockholm Open (lang:en)        |
| wd:Q16610590                                         |                                                | 2010 Stockholm Open (wd:Q1657036)          | 2010 Stockholm Open (lang:en)        |
| ...                                                  | ...                                            | ...                                        | ...                                  |
| 2025 Dallas Open – Singles (wd:Q131993315)           | 2025 Dallas Open – Singles (lang:en)           | 2025 Dallas Open (wd:Q131725182)           | 2025 Dallas Open (lang:en)           |
| 2025 Delray Beach Open – Singles (wd:Q132173771)     | 2025 Delray Beach Open – Singles (lang:en)     | 2025 Delray Beach Open (wd:Q131917965)     | 2025 Delray Beach Open (lang:en)     |
| 2025 Open 13 Provence – Singles (wd:Q132173811)      | 2025 Open 13 Provence – Singles (lang:en)      | 2025 Open 13 Provence (wd:Q131860197)      | 2025 Open 13 Provence (lang:en)      |
| 2025 Qatar ExxonMobil Open – Singles (wd:Q132360522) | 2025 Qatar ExxonMobil Open – Singles (lang:en) | 2025 Qatar ExxonMobil Open (wd:Q131933979) | 2025 Qatar ExxonMobil Open (lang:en) |
| 2025 Rio Open – Singles (wd:Q132360560)              | 2025 Rio Open – Singles (lang:en)              | 2025 Rio Open (wd:Q125836535)              | 2025 Rio Open (lang:en)              |

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

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.

Available knowledge graphs:
- wikidata at http://localhost:7001 with prefix index for entities and similarity index for properties, and notes:
  - P106 = occupation. Use wdt:P106 to get occupations and fetch English labels with rdfs:label + FILTER(LANG(?label)="en"). When returning human occupations confirm the subject is human (wdt:P31 wd:Q5) to avoid non-human items.
  - Population (P1082) and tabular (P4179): use wdt:P1082 for quick/direct values; for time-series/point-in-time use p:P1082 + ps:P1082 + pq:P585 and ORDER BY pq:P585 DESC. Inspect statement qualifiers (e.g., 'applies to part') and prov:wasDerivedFrom references (pr:P854 etc.) to detect city-proper vs metro/prefecture scopes before using values.
  - Common person properties: P31 (instance of human Q5), P106 (occupation), P569 (date of birth), P19 (place of birth), P27 (country of citizenship), P21 (sex/gender), P166 (award received). Use wdt: for direct values when possible.
  - P17 (country) can be incomplete/misleading for places (historical/overseas tags). To get modern cities in a country combine: instance-of city (P31=Q515) + wdt:P17 OR use wdt:P131* to find an admin parent whose wdt:P17 = the country. Also cross-check coordinates (P625) or admin hierarchy to spot outliers.
  - When filtering by date of birth (P569) use xsd:dateTime comparisons (e.g. >= "1900-01-01T00:00:00Z"^^xsd:dateTime). Be aware many items have year-only or imprecise dates and coverage is biased toward notable/public figures (sportspeople, politicians, artists).
  - To retrieve qualifiers (e.g., award year) use the statement/qualifier pattern: p:Pxxx / ps:Pxxx / pq:P585. Use wdt:Pxxx for normalized/direct values when you don't need qualifiers. Example: p:P166 + pq:P585 gives award year.
  - To get a person's occupations: use wdt:P106 for direct/normalized values and rdfs:label for human-readable names (FILTER(LANG(...))). Example: wd:Q... wdt:P106 ?occ . ?occ rdfs:label ?occLabel . FILTER(LANG(?occLabel)="en").
  - P166 = award received. Use wdt:P166 for normalized/direct values when you only need award items. To get award years or qualifiers use p:P166 / ps:P166 / pq:P585. Many statements lack pq:P585 — use OPTIONAL { ?stmt pq:P585 ?date } and ORDER BY DESC(?date). When listing award winners, filter ?person wdt:P31 wd:Q5 to ensure humans.
  - Population time-series pattern: wd:Q... p:P1082 ?stmt . ?stmt ps:P1082 ?pop . OPTIONAL { ?stmt pq:P585 ?date } . ORDER BY DESC(?date). pq:P585 is the point-in-time qualifier. IMPORTANT: time-series may mix scopes (city proper vs metro) — e.g., Tokyo has a 2016 entry ~38,140,000 likely metro vs smaller city figures. Inspect qualifiers/references for scope before use.
  - Use wdt:P131* to traverse the admin hierarchy and compare wdt:P17 on the place vs an admin parent to detect historical/colonial country assignments. When mismatches appear, inspect the admin parent's instance-of (P31), labels, qualifiers and references to interpret the historical scope.
  - wdt:P106 often yields multiple occupations for a person. Use GROUP_CONCAT(DISTINCT ?occLabel; separator=", ") or return multiple rows. Always fetch labels with rdfs:label + FILTER(LANG(?label)="en") to get readable occupation names.
  - When a search_entity returns multiple hits (person vs sculpture vs memorial), confirm you selected the human/statements by checking wdt:P31 (instance of) and relevant wdt: properties (e.g., wdt:P106). This avoids using a non-human QID by mistake.
  - search_autocomplete can be constrained with a SPARQL pattern containing ?search (e.g., SELECT * WHERE { ?search wdt:P31 wd:Q5 }). Use constraints to focus results (e.g., humans) and avoid ambiguous fallbacks; if it returns no results, fallback to search_entity and verify wdt:P31.
  - Use search_property_of_entity to find relevant properties for an entity (e.g., 'award' -> P166) and search_object_of_property to discover candidate objects (e.g., 'physicist' for P106). This reduces guessing P/Q ids and surfaces qualifiers.
  - Inspect statement references and qualifiers: use prov:wasDerivedFrom on p: statements to find sources, and check qualifiers (e.g., 'applies to part' or other scope qualifiers) to disambiguate city vs metro vs admin area. Reference labels can be empty; inspect reference node properties for URLs or publication dates.

Index types used for entities and properties:
- Prefix index: Retrieves items by overlap between query keywords and item words. The query keywords can match item words exactly or as prefixes.
- Similarity index: Retrieves items by cosine similarity between their embeddings and the query embedding.

General notes across knowledge graphs:
- Use rdfs:label + FILTER(LANG(?label)="en") for labels; avoid SERVICE wikibase:label. Use wdt:Pxxx for normalized/direct values when qualifiers aren't needed. Use p:Pxxx / ps:Pxxx / pq:Pxxx to access statement qualifiers (e.g., award year via pq:P585). When dates matter, prefer xsd:dateTime and watch for year-only precision.
- Practical query patterns: use rdfs:label + FILTER(LANG(...)) for labels. Use wdt:Pxxx for direct/normalized values when qualifiers aren't needed. Use p:Pxxx / ps:Pxxx / pq:Pxxx to access qualifiers (dates via pq:P585). For dates use xsd:dateTime and expect year-only precision. For places: combine P17 with P131 or coordinate (P625) filters to avoid historical/overseas mismatches.
- Use OPTIONAL for pq: qualifiers (e.g., pq:P585), sort by qualifier (ORDER BY pq:P585 DESC) to prefer recent values. Use GROUP_CONCAT to combine multiple labels/values in one row. Watch for typed literals (xsd:dateTime, xsd:decimal) when filtering or sorting.
- Before querying, use search_entity to resolve human-friendly names to wd:Q identifiers and verify instance-of (e.g., check wdt:P31 = wd:Q5 for humans) to avoid ambiguous matches. Prefer the top match but programmatically confirm P31 before using its data.
- Use search_property to confirm property identifiers (e.g., "country" -> P17) before embedding them in queries. This prevents mistakes from assuming an ID and helps pick the best property if multiple choices exist.
- search_autocomplete can fall back to an unconstrained search or error when there are too many candidates. If this happens (e.g., "more than the maximum supported number of subject candidates"), retry with narrower constraints such as instance-of (wdt:P31), additional type filters, or short prefixes to reduce the candidate set; otherwise fallback to search_entity and verify wdt:P31.
- Use list(...) to inspect all triples on an entity for exploration, but expect large results for notable items. Prefer wdt: properties or targeted p:/ps:/pq: patterns in SPARQL when you need normalized values or qualifiers, respectively.
- Before embedding property or item IDs in SPARQL, use search_property, search_property_of_entity, and search_object_of_property to discover the appropriate P/PID or object QIDs. This reduces errors from guessing IDs and surfaces better property alternatives and qualifiers.
- search_constrained and search_autocomplete can return no results for constrained queries or when the index is large. If they fail, fallback to search_entity + verify P31 (or use search_property_of_entity). Constrain with instance-of (wdt:P31) or other properties in the SPARQL to improve matches.
- When selecting awards by year, prefer xsd:dateTime range filters (e.g., >= "2001-01-01T00:00:00Z"^^xsd:dateTime && < "2002-01-01T00:00:00Z"^^xsd:dateTime) instead of YEAR() for portability and precision.
- When selecting award winners via wdt:P166, filter ?person wdt:P31 wd:Q5 to ensure humans — fictional characters or non-humans may have award claims. If you need award years use p:P166 / ps:P166 / pq:P585 and OPTIONAL { ?stmt pq:P585 ?year } to retrieve qualifier years.
- Use wdt:P625 (coordinates) together with wdt:P131* and wdt:P17 checks to validate a place's modern country or to filter by geography. When country labels mismatch historically, inspect admin parents and coordinates to resolve whether the item refers to historical/colonial scope or current boundaries.
- Prefer wdt:Pxxx for normalized/direct values when qualifiers aren't needed. Use p:Pxxx / ps:Pxxx / pq:Pxxx to access qualifiers (e.g., pq:P585 for award year). Always fetch labels with rdfs:label + FILTER(LANG(?label) = "en").
- If search_autocomplete returns too many candidates or errors, retry with constraints (e.g., SELECT * WHERE { ?search wdt:P31 wd:Q5 }) or narrower query text. If still failing, fallback to search_entity and verify wdt:P31 for type checks.
- For award-year queries use p:P166 / ps:P166 / pq:P585 to access award statements and year qualifiers. Filter by xsd:dateTime ranges (e.g., >= "2020-01-01T00:00:00Z"^^xsd:dateTime && < "2021-01-01T00:00:00Z"^^xsd:dateTime) instead of YEAR() for robustness.
- Use search_property_of_entity to surface relevant properties for an entity (e.g., 'birth' -> P569/P19). list(...) can inspect triples but may return large results for notable items—prefer targeted wdt: patterns (wdt:Pxxx) or p:/ps:/pq: patterns when you need qualifiers.

SPARQL prefixes for use in function calls:
- bd: <http://www.bigdata.com/rdf#
- cc: <http://creativecommons.org/ns#
- data: <https://www.wikidata.org/wiki/Special:EntityData/
- dc: <http://purl.org/dc/elements/1.1/
- dct: <http://purl.org/dc/terms/
- foaf: <http://xmlns.com/foaf/0.1/
- geo: <http://www.opengis.net/ont/geosparql#
- geof: <http://www.opengis.net/def/function/geosparql/
- gn: <http://www.geonames.org/ontology#
- hint: <http://www.bigdata.com/queryHints#
- 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/
- qb: <http://purl.org/linked-data/cube#
- 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/
- void: <http://rdfs.org/ns/void#
- 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#

Additional rules to follow:
- Explain your thought process before and after each step and function call.
- Do not just use or make up entity or property identifiers without verifying their existence in the knowledge graphs first.
- Do not ask the user for clarifications without first attempting to complete the task. If the task input is incomplete or ambiguous, try to make reasonable assumptions and document them.
- 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.
- Always execute your final SPARQL query before giving an answer to make sure it returns the expected results.
- 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.
- 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.
- 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.
- For questions with a "True" or "False" answer the SPARQL query should be an ASK query.

[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]
I'll search Wikidata for entities related to "men's singles" and for properties like "winner" (P1346) and membership/part of tournament series (P361? or "part of" wdt:P361 / "part of the series" P179 / or "competition" P3450?). I'll look for the relevant item for "Grand Prix tennis circuit" and "ATP Tour" to use as filters. I'll explain each search and verify instance-of human constraint where needed.

Question: men's singles

Top 10 entity alternatives:
1. men's singles (wd:Q4305887), also known as men single skating: competition class in figure skating / is instance of competition class / is instance of sports discipline / is subclass of single skating
2. men's singles (wd:Q16893072), also known as men's singles in tennis: is instance of competition class / is instance of sports discipline / is instance of men's singles / discipline in tennis
3. single luge (wd:Q28913513, matched via men's singles), also known as men's singles, single luger, singles (luge), women's singles: men and women luge individual discipline / is subclass of sports discipline
4. men's singles (wd:Q28105722), also known as men's singles in badminton: is instance of competition class / is instance of sports discipline / sports discipline in badminton / is instance of men's singles
5. men's singles (wd:Q61588168), also known as men's individual: term referring to men's individual events in various types of sport / is instance of competition class / is subclass of men's sports / is instance of term
6. men's singles (wd:Q55581668): three-cushion billiards competition class / is instance of competition class
7. senior men's singles (wd:Q116481567): competition class of figure skating / is instance of competition class
8. wheelchair tennis men's singles (wd:Q50211922, matched via wheelchair men's singles), also known as wheelchair men's singles: competition class in wheelchair tennis / is instance of competition class / is instance of sports discipline / is instance of men's singles
9. senior men's singles (wd:Q50825939), also known as champions men's singles, legends men's singles: is instance of competition class / tennis discipline
10. 2022 French Open – men's singles (wd:Q107126329, matched via 2022 Roland-Garros – Men's singles), also known as 2022 Roland-Garros – Men's singles: is instance of tennis event / tennis championship

[Assistant]
I'll look up the items for "ATP Tour" and "Grand Prix tennis circuit" to use them as filters. Then I'll search for properties indicating a tournament belongs to these circuits (likely "part of" P361 or "competition" P3450 or "tour" property). I'll inspect common properties on a tournament like Australian Open? But better: search for tournaments (instance of tennis tournament) that have property linking them to ATP Tour or Grand Prix. I'll search for "ATP Tour" first.

Question: ATP Tour

Top 10 entity alternatives:
1. ATP Tour (wd:Q300008), also known as ATP World Tour: is instance of tennis tour with multiple editions / is instance of recurring sporting event / series of men's tennis tournaments / is subclass of tennis tour / tennis tournament / tennis tournament
2. ATP World Tour 250 series (wd:Q300017, matched via ATP Tour 250), also known as ATP 250, ATP 250 Series, ATP Tour 250, ATP World Series, ATP World Tour 250, etc.: is instance of tennis tour with multiple editions / is subclass of tennis tour / tennis tournament category / tennis tournament / tennis tournament
3. ATP Challenger Tour (wd:Q299345), also known as ATP Challenger, ATP Challengers, ATP Challenger Series, ATP Challenger tournament, ATP Challenger Tour/Series, etc.: is instance of tennis tour with multiple editions / international men's tennis tournaments / is subclass of tennis tour
4. ATP Tour Awards (wd:Q434468): is instance of tennis award / ATP tennis awards for men
5. 2011 ATP World Tour (wd:Q300013, matched via 2011 atp tour), also known as 2011 atp tour: is instance of tennis tour edition / men's tennis circuit / tennis tournament / tennis tournament
6. 2010 ATP World Tour (wd:Q300012, matched via 2010 atp tour), also known as 2010 atp tour: is instance of tennis tour edition / tennis tournament / tennis tournament / tennis circuit
7. 2022 ATP Tour (wd:Q109743038): is instance of tennis tour edition / men's tennis circuit
8. 2023 ATP Tour (wd:Q111441127): is instance of tennis tour edition / men's tennis circuit
9. 2009 ATP World Tour (wd:Q300011, matched via 2009 atp tour), also known as 2009 atp tour, 2009 ATP Tour, ATP Tour 2009, Juego 2000 Calendar, Tennis 2009 Calendare ATP ITF: is instance of tennis tour edition / tennis tournament / tennis tournament / tennis circuit
10. 2024 ATP Tour (wd:Q117284577): is instance of tennis tour edition / men's tennis circuit

[Assistant]
I'll search for "Grand Prix tennis circuit".

Question: Grand Prix tennis circuit

Top 10 entity alternatives:
1. Grand Prix tennis circuit (wd:Q3775082): is instance of tennis tour with multiple editions / is instance of recurring sporting event / is subclass of tennis tour / professional tennis tour
2. Albert Park Circuit (wd:Q171288, matched via Australian Grand Prix Circuit), also known as Australian Grand Prix Circuit, Melbourne Grand Prix Circuit: street circuit in Melbourne, Victoria, Australia / is instance of street circuit
3. Kyalami (wd:Q171667, matched via Kyalami Grand Prix Circuit), also known as Kyalami Grand Prix Circuit: is instance of motorsport racing track / Race track in South Africa
4. Porsche Tennis Grand Prix (wd:Q311783): women's tennis tournament at Stuttgart, Germany / is instance of recurring tennis tournament / is subclass of WTA tennis tournament
5. Dallas Grand Prix Circuit (wd:Q16040264): is instance of motorsport racing track / Formula One circuit in Dallas, Texas
6. Grand Prix Circuit (wd:Q2444507): is instance of video game / 1988 video game / 1988 video game / 1988 video game
7. Madrid Tennis Grand Prix (wd:Q299532): defunct men's tennis tournament at Madrid, Spain / is instance of recurring tennis tournament / is subclass of tennis tournament / tennis tournament / tennis tournament
8. 1970 Grand Prix circuit (wd:Q3465182): is instance of tennis tour edition / tennis circuit
9. 1975 Grand Prix circuit (wd:Q3465233): is instance of tennis tour edition / tennis circuit
10. 1976 Grand Prix circuit (wd:Q3465243): is instance of tennis tour edition / tennis circuit

[Assistant]
I will search for entities whose labels contain "men's singles" and that are instances of tennis events/editions, to find candidate event items. I'll constrain the search to subjects and then inspect properties.

Question: men's singles

Top 10 entity alternatives:
1. men's singles (wd:Q4305887), also known as men single skating: competition class in figure skating / is instance of competition class / is instance of sports discipline / is subclass of single skating
2. men's singles (wd:Q16893072), also known as men's singles in tennis: is instance of competition class / is instance of sports discipline / is instance of men's singles / discipline in tennis
3. single luge (wd:Q28913513, matched via men's singles), also known as men's singles, single luger, singles (luge), women's singles: men and women luge individual discipline / is subclass of sports discipline
4. men's singles (wd:Q28105722), also known as men's singles in badminton: is instance of competition class / is instance of sports discipline / sports discipline in badminton / is instance of men's singles
5. men's singles (wd:Q61588168), also known as men's individual: term referring to men's individual events in various types of sport / is instance of competition class / is subclass of men's sports / is instance of term
6. men's singles (wd:Q55581668): three-cushion billiards competition class / is instance of competition class
7. senior men's singles (wd:Q116481567): competition class of figure skating / is instance of competition class
8. wheelchair tennis men's singles (wd:Q50211922, matched via wheelchair men's singles), also known as wheelchair men's singles: competition class in wheelchair tennis / is instance of competition class / is instance of sports discipline / is instance of men's singles
9. senior men's singles (wd:Q50825939), also known as champions men's singles, legends men's singles: is instance of competition class / tennis discipline
10. 2022 French Open – men's singles (wd:Q107126329, matched via 2022 Roland-Garros – Men's singles), also known as 2022 Roland-Garros – Men's singles: is instance of tennis event / tennis championship

No other items found

[Assistant]
I'll inspect the specific event item 2022 French Open – men's singles (wd:Q107126329) to see how such events are modeled (properties for winner, part of tournament, instance of). This will guide the query pattern.

list

wd:Q107126329

Got 95 rows and 3 columns, showing the first 10 rows below:
| subject                                          | property                           | object                                           |
| ------------------------------------------------ | ---------------------------------- | ------------------------------------------------ |
| 2022 French Open – men's singles (wd:Q107126329) | instance of (wdt:P31)              | tennis event (wd:Q46190676)                      |
| 2022 French Open – men's singles (wd:Q107126329) | country (wdt:P17)                  | France (wd:Q142)                                 |
| 2022 French Open – men's singles (wd:Q107126329) | part of (wdt:P361)                 | 2022 French Open (wd:Q107026465)                 |
| 2022 French Open – men's singles (wd:Q107126329) | location (wdt:P276)                | Stade Roland Garros (wd:Q1613027)                |
| 2022 French Open – men's singles (wd:Q107126329) | sport (wdt:P641)                   | tennis (wd:Q847)                                 |
| 2022 French Open – men's singles (wd:Q107126329) | follows (wdt:P155)                 | 2021 French Open – men's singles (wd:Q99526058)  |
| 2022 French Open – men's singles (wd:Q107126329) | followed by (wdt:P156)             | 2023 French Open – Men's singles (wd:Q112433332) |
| 2022 French Open – men's singles (wd:Q107126329) | point in time (wdt:P585)           | 2022-01-01T00:00:00Z (xsd:dateTime)              |
| 2022 French Open – men's singles (wd:Q107126329) | number of participants (wdt:P1132) | 128 (xsd:decimal)                                |
| 2022 French Open – men's singles (wd:Q107126329) | winner (wdt:P1346)                 | Rafael Nadal (wd:Q10132)                         |
| ...                                              | ...                                | ...                                              |

[Assistant]
I'll inspect the tournament edition item (2022 French Open wd:Q107026465) to see how it's linked to ATP Tour or Grand Prix.

wd:Q107026465

[Assistant] I'll search for triples where the object is ATP Tour (wd:Q300008) to find which property is used to link tournaments to the ATP Tour.

[Assistant]
I'll search for triples pointing to Grand Prix tennis circuit (wd:Q3775082) to see which property is used to connect tournaments to the circuit.

Got 64 rows and 3 columns, showing the first 10 rows below:
| subject                                                    | property                                           | object                                  |
| ---------------------------------------------------------- | -------------------------------------------------- | --------------------------------------- |
| Milan Indoor (wd:Q125337761)                               | part of (wdt:P361)                                 | Grand Prix tennis circuit (wd:Q3775082) |
| wd:Q8498673                                                | category's main topic (wdt:P301)                   | Grand Prix tennis circuit (wd:Q3775082) |
| ATP Tour (wd:Q300008)                                      | replaces (wdt:P1365)                               | Grand Prix tennis circuit (wd:Q3775082) |
| 1982 Grand Prix circuit (wd:Q15056435)                     | sports season of league or competition (wdt:P3450) | Grand Prix tennis circuit (wd:Q3775082) |
| <https://da.wikipedia.org/wiki/Grand_prix-serien_i_tennis> | schema:about                                       | 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) |
| ...                                                        | ...                                                | ...                                     |

[Assistant]
I'll search for usage of property P2094 ("competition class") to see if it's used to indicate men's singles for tennis events.

Question: competition class

Top 10 property alternatives:
1. competition class (wd:P2094 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as class for competition, compclass, disability sport classifications, qualification class, qualifies for, etc.: official classification by a regulating body under which the ... teams, participants, or equipment) qualifies for inclusion / official classification by a regulating body under which the ... teams, participants, or equipment) qualifies for inclusion
2. league or competition (wd:P118 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as competition, cup, division, sports league, tournament, etc.: league or competition in which team or player has played, or in which an event occurs / is subproperty of participant in / league in which the team plays / league in which the team plays
3. sports discipline competed in (wd:P2416 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via sport event), also known as discipline of sport, event in sports, sport discipline, sport discipline competed in, sport disciplines competed in, etc.: discipline an athlete competed in within a sport / is subproperty of field of work
4. tournament type (wd:P11964 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as P11964: significance or status of a sports competition for a league, tour, association, etc.
5. competition won (wd:P2522 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as victory, winner of, won, won event, P2522: competition or sports event won by the subject / is subproperty of participant in
6. sports season of league or competition (wd:P3450 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via season of sports competition), also known as athletics meeting item belonging to this instance, edition of annual athletics meeting, is an edition of athletics meeting, is a season of, is season of, etc.: property that shows the competition of which the item is a season. Use P5138 for "season of club or team". / is subproperty of part of
7. participant in (wd:P1344 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via competes in), also known as attended, competed in, competes in, participant of, participant of event, etc.: event in which a person or organisation was/is a participant; inverse of P710 or P1923 / event in which a person or organization was/is a participant; inverse of P710 or P1923 / is subproperty of significant event / is subproperty of part of
8. points for (wd:P1358 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via competition points), also known as championship points, competition points, league points, pf, points, etc.: number of points in a league table or decathlon. (Use P1351 for goals/points in a match)
9. sport (wd:P641 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as play, plays, sport played, sports, P641: sport that the subject participates or participated in or is associated with / sport or discipline in which the entity participates or belongs to
10. Championat ID (wd:P10800 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via championat.com/), also known as championat.com/, Championat.com ID, Championat.com identifier, Championat identifier, https://www.championat.com/, etc.: identifier of a team, sports facility, or player on the Championat website

[Assistant]
I'll search for items that have P2094 set to the "men's singles in tennis" class (wd:Q16893072), which would mark events as men's singles.

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) |
| 2009 Wimbledon Championships – men's singles (wd:Q751798)          | 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) |
| 2011 French Open – men's singles (wd:Q681986)                      | 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]
I'll run a SPARQL query that:
- finds events with competition class "men's singles" (wd:Q16893072),
- ensures the event is "part of" a tournament edition (?tourneyEdition) via P361,
- requires that the tournament edition is (transitively via P361*) part of either ATP Tour (wd:Q300008) or Grand Prix tennis circuit (wd:Q3775082),
- filters out events that have a winner (no wdt:P1346 statement),
- returns event and tournament IRIs and English labels.

Now I'll execute that query.

execute

SELECT DISTINCT ?event ?eventLabel ?tourneyEdition ?tourneyEditionLabel WHERE {
  VALUES ?mensClass { wd:Q16893072 }
  VALUES ?circuit { wd:Q300008 wd:Q3775082 }

  ?event wdt:P2094 ?mensClass .
  ?event wdt:P361 ?tourneyEdition .

  FILTER NOT EXISTS { ?event wdt:P1346 ?winner } .

  ?tourneyEdition wdt:P361* ?circuit .

  OPTIONAL { ?event rdfs:label ?eventLabel FILTER(LANG(?eventLabel) = "en") }
  OPTIONAL { ?tourneyEdition rdfs:label ?tourneyEditionLabel FILTER(LANG(?tourneyEditionLabel) = "en") }
}
ORDER BY ?eventLabel

[Assistant]
I'll finalize with the SPARQL query I executed and a short summary of the results (including a few example events). The query results (event IRIs and their tournament editions) are available by running the provided query.

answer

SELECT DISTINCT ?event ?eventLabel ?tourneyEdition ?tourneyEditionLabel WHERE {
  VALUES ?mensClass { wd:Q16893072 }
  VALUES ?circuit { wd:Q300008 wd:Q3775082 }

  ?event wdt:P2094 ?mensClass .
  ?event wdt:P361 ?tourneyEdition .

  FILTER NOT EXISTS { ?event wdt:P1346 ?winner } .

  ?tourneyEdition wdt:P361* ?circuit .

  OPTIONAL { ?event rdfs:label ?eventLabel FILTER(LANG(?eventLabel) = "en") }
  OPTIONAL { ?tourneyEdition rdfs:label ?tourneyEditionLabel FILTER(LANG(?tourneyEditionLabel) = "en") }
}
ORDER BY ?eventLabel

Answer:
I ran the query above against Wikidata. It finds items that: (1) have competition class "men's singles" (wd:Q16893072), (2) are part of a tournament edition (?tourneyEdition) that (transitively via P361*) is part of either the ATP Tour (wd:Q300008) or the Grand Prix tennis circuit (wd:Q3775082), and (3) do not have a winner stated (no wdt:P1346 triple).

The query returns the event IRIs and their tournament edition IRIs (with English labels when available). Example results include:
- wd:Q131993315 — "2025 Dallas Open – Singles" (part of wd:Q131725182 — "2025 Dallas Open")
- wd:Q132173771 — "2025 Delray Beach Open – Singles" (part of wd:Q131917965 — "2025 Delray Beach Open")
- wd:Q132173811 — "2025 Open 13 Provence – Singles" (part of wd:Q131860197 — "2025 Open 13 Provence")
- wd:Q132360522 — "2025 Qatar ExxonMobil Open – Singles" (part of wd:Q131933979 — "2025 Qatar ExxonMobil Open")
- wd:Q132360560 — "2025 Rio Open – Singles" (part of wd:Q125836535 — "2025 Rio Open")

(There are additional event items returned — the full set is produced by the SPARQL query above.)

If you want, I can (a) return the full list of event IRIs and labels here, (b) export the results as CSV, or (c) narrow the query further (for example restrict to a particular year range or to only ATP Tour vs only Grand Prix).


PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?institution ( SAMPLE( ?label ) AS ?institutionLabel ) ( COUNT( DISTINCT ?thesis ) AS ?thesisCount ) WHERE {
  ?thesis wdt:P4101 ?institution .
  ?thesis wdt:P31 ?thesisType .
  ?thesisType wdt:P279 * wd:Q1266946 .
  OPTIONAL {
    ?institution rdfs:label ?label .
    FILTER ( LANG( ?label ) = "en" )
  }
}
GROUP BY ?institution
ORDER BY DESC ( ?thesisCount )
LIMIT 100

Using entities:
- thesis (wd:Q1266946), also known as academic dissertation, academic thesis, dissertation, theses: is instance of literary genre / is subclass of academic work / is subclass of academic writing / is subclass of research / a scholarly work submitted as a requirement to obtain an academic degree; Use Q187685 for PhD thesis

Using properties:
- subclass of (wd:P279 as wdt), also known as all members of this class also belong to, category of, form of, has superclass, is a class of, etc.: this item is a subclass (subset) of that item; ALL instances ... of volcanic landform); Everest is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain
- instance of (wd:P31 as wdt), also known as example of, has type, is a, is an, is of type, etc.: that class of which this subject is a particular example and ... a subclass of mountain (and an instance of volcanic landform) / type to which this subject corresponds/belongs. Different ... and the volcano is a type (instance) of volcanic landform
- thesis submitted to (wd:P4101 as wdt), also known as dissertation submitted to, submitted to, P4101: institution to whom a thesis or dissertation is submitted / institution to whom a thesis or dissertation is submitted

Got 100 rows and 3 columns, showing the first 5 and last 5 rows below:
| institution                                                         | institutionLabel                                               | thesisCount     |
| ------------------------------------------------------------------- | -------------------------------------------------------------- | --------------- |
| University of Oxford (wd:Q34433)                                    | University of Oxford (lang:en)                                 | 16828 (xsd:int) |
| University of Auckland (wd:Q492467)                                 | University of Auckland (lang:en)                               | 14832 (xsd:int) |
| Massey University (wd:Q1134606)                                     | Massey University (lang:en)                                    | 11881 (xsd:int) |
| University of Canterbury (wd:Q432475)                               | University of Canterbury (lang:en)                             | 11286 (xsd:int) |
| Delft University of Technology (wd:Q752663)                         | Delft University of Technology (lang:en)                       | 10779 (xsd:int) |
| ...                                                                 | ...                                                            | ...             |
| University of California, Riverside (wd:Q1075148)                   | University of California, Riverside (lang:en)                  | 31 (xsd:int)    |
| University of Southern California (wd:Q4614)                        | University of Southern California (lang:en)                    | 31 (xsd:int)    |
| Geosciences and Engineering (Department at TU Delft) (wd:Q77049916) | Geosciences and Engineering (Department at TU Delft) (lang:en) | 31 (xsd:int)    |
| University of Manchester (wd:Q230899)                               | University of Manchester (lang:en)                             | 30 (xsd:int)    |
| Leiden University (wd:Q156598)                                      | Leiden University (lang:en)                                    | 30 (xsd:int)    |

Answer:
Summary of results (query returns institutions ordered by number of distinct theses/dissertations submitted to them, descending; limited to top 100):

Top 5 institutions from the query results:
1. University of Oxford — 16828 theses
2. University of Auckland — 14832 theses
3. Massey University — 11881 theses
4. University of Canterbury — 11286 theses
5. Delft University of Technology — 10779 theses

Notes and assumptions:
- I used property P4101 ("thesis submitted to") to find thesis items and counted distinct thesis items per target institution.
- To ensure items counted are theses/dissertations, I required that each ?thesis have an instance-of (P31) type that is a subclass of Q1266946 ("thesis"). This also captures doctoral theses (which are subclasses).
- The query returns the institution IRIs and an English label (when available) and the count of distinct theses. The full query result (limited to 100) was executed against Wikidata and produced the counts above; you can remove or raise the LIMIT if you want more results.
- Limitations: Wikidata coverage is incomplete and biased toward notable works and institutions; not all theses in the world are represented. Some thesis items may lack P31 statements and thus are excluded by the type filter; similarly, some submissions might be recorded via different patterns and thus not counted.

If you want, I can:
- Return the full list (remove the LIMIT or increase it).
- Restrict institutions to particular types (e.g., universities only) by adding an instance-of filter on the institution.
- Provide the raw result table (IRI + label + count) for the top N institutions.

Summary of results (query returns institutions ordered by number of distinct theses/dissertations submitted to them, descending; limited to top 100):

Top 5 institutions from the query results:
1. University of Oxford — 16828 theses
2. University of Auckland — 14832 theses
3. Massey University — 11881 theses
4. University of Canterbury — 11286 theses
5. Delft University of Technology — 10779 theses

Notes and assumptions:
- I used property P4101 ("thesis submitted to") to find thesis items and counted distinct thesis items per target institution.
- To ensure items counted are theses/dissertations, I required that each ?thesis have an instance-of (P31) type that is a subclass of Q1266946 ("thesis"). This also captures doctoral theses (which are subclasses).
- The query returns the institution IRIs and an English label (when available) and the count of distinct theses. The full query result (limited to 100) was executed against Wikidata and produced the counts above; you can remove or raise the LIMIT if you want more results.
- Limitations: Wikidata coverage is incomplete and biased toward notable works and institutions; not all theses in the world are represented. Some thesis items may lack P31 statements and thus are excluded by the type filter; similarly, some submissions might be recorded via different patterns and thus not counted.

If you want, I can:
- Return the full list (remove the LIMIT or increase it).
- Restrict institutions to particular types (e.g., universities only) by adding an instance-of filter on the institution.
- Provide the raw result table (IRI + label + count) for the top N institutions.

SPARQL query over wikidata:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?institution ( SAMPLE( ?label ) AS ?institutionLabel ) ( COUNT( DISTINCT ?thesis ) AS ?thesisCount ) WHERE {
  ?thesis wdt:P4101 ?institution .
  ?thesis wdt:P31 ?thesisType .
  ?thesisType wdt:P279 * wd:Q1266946 .
  OPTIONAL {
    ?institution rdfs:label ?label .
    FILTER ( LANG( ?label ) = "en" )
  }
}
GROUP BY ?institution
ORDER BY DESC ( ?thesisCount )
LIMIT 100

Using entities:
- thesis (wd:Q1266946), also known as academic dissertation, academic thesis, dissertation, theses: is instance of literary genre / is subclass of academic work / is subclass of academic writing / is subclass of research / a scholarly work submitted as a requirement to obtain an academic degree; Use Q187685 for PhD thesis

Using properties:
- subclass of (wd:P279 as wdt), also known as all members of this class also belong to, category of, form of, has superclass, is a class of, etc.: this item is a subclass (subset) of that item; ALL instances ... of volcanic landform); Everest is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain / this item is a subclass (subset) of that item; all instances ... instance of volcanic landform); K2 is an instance of mountain
- instance of (wd:P31 as wdt), also known as example of, has type, is a, is an, is of type, etc.: that class of which this subject is a particular example and ... a subclass of mountain (and an instance of volcanic landform) / type to which this subject corresponds/belongs. Different ... and the volcano is a type (instance) of volcanic landform
- thesis submitted to (wd:P4101 as wdt), also known as dissertation submitted to, submitted to, P4101: institution to whom a thesis or dissertation is submitted / institution to whom a thesis or dissertation is submitted

Execution result:
Got 100 rows and 3 columns, showing the first 5 and last 5 rows below:
| institution                                                         | institutionLabel                                               | thesisCount     |
| ------------------------------------------------------------------- | -------------------------------------------------------------- | --------------- |
| University of Oxford (wd:Q34433)                                    | University of Oxford (lang:en)                                 | 16828 (xsd:int) |
| University of Auckland (wd:Q492467)                                 | University of Auckland (lang:en)                               | 14832 (xsd:int) |
| Massey University (wd:Q1134606)                                     | Massey University (lang:en)                                    | 11881 (xsd:int) |
| University of Canterbury (wd:Q432475)                               | University of Canterbury (lang:en)                             | 11286 (xsd:int) |
| Delft University of Technology (wd:Q752663)                         | Delft University of Technology (lang:en)                       | 10779 (xsd:int) |
| ...                                                                 | ...                                                            | ...             |
| University of California, Riverside (wd:Q1075148)                   | University of California, Riverside (lang:en)                  | 31 (xsd:int)    |
| University of Southern California (wd:Q4614)                        | University of Southern California (lang:en)                    | 31 (xsd:int)    |
| Geosciences and Engineering (Department at TU Delft) (wd:Q77049916) | Geosciences and Engineering (Department at TU Delft) (lang:en) | 31 (xsd:int)    |
| University of Manchester (wd:Q230899)                               | University of Manchester (lang:en)                             | 30 (xsd:int)    |
| Leiden University (wd:Q156598)                                      | Leiden University (lang:en)                                    | 30 (xsd:int)    |

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

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.

Available knowledge graphs:
- wikidata at http://localhost:7001 with prefix index for entities and similarity index for properties, and notes:
  - P106 = occupation. Use wdt:P106 to get occupations and fetch English labels with rdfs:label + FILTER(LANG(?label)="en"). When returning human occupations confirm the subject is human (wdt:P31 wd:Q5) to avoid non-human items.
  - Population (P1082) and tabular (P4179): use wdt:P1082 for quick/direct values; for time-series/point-in-time use p:P1082 + ps:P1082 + pq:P585 and ORDER BY pq:P585 DESC. Inspect statement qualifiers (e.g., 'applies to part') and prov:wasDerivedFrom references (pr:P854 etc.) to detect city-proper vs metro/prefecture scopes before using values.
  - Common person properties: P31 (instance of human Q5), P106 (occupation), P569 (date of birth), P19 (place of birth), P27 (country of citizenship), P21 (sex/gender), P166 (award received). Use wdt: for direct values when possible.
  - P17 (country) can be incomplete/misleading for places (historical/overseas tags). To get modern cities in a country combine: instance-of city (P31=Q515) + wdt:P17 OR use wdt:P131* to find an admin parent whose wdt:P17 = the country. Also cross-check coordinates (P625) or admin hierarchy to spot outliers.
  - When filtering by date of birth (P569) use xsd:dateTime comparisons (e.g. >= "1900-01-01T00:00:00Z"^^xsd:dateTime). Be aware many items have year-only or imprecise dates and coverage is biased toward notable/public figures (sportspeople, politicians, artists).
  - To retrieve qualifiers (e.g., award year) use the statement/qualifier pattern: p:Pxxx / ps:Pxxx / pq:P585. Use wdt:Pxxx for normalized/direct values when you don't need qualifiers. Example: p:P166 + pq:P585 gives award year.
  - To get a person's occupations: use wdt:P106 for direct/normalized values and rdfs:label for human-readable names (FILTER(LANG(...))). Example: wd:Q... wdt:P106 ?occ . ?occ rdfs:label ?occLabel . FILTER(LANG(?occLabel)="en").
  - P166 = award received. Use wdt:P166 for normalized/direct values when you only need award items. To get award years or qualifiers use p:P166 / ps:P166 / pq:P585. Many statements lack pq:P585 — use OPTIONAL { ?stmt pq:P585 ?date } and ORDER BY DESC(?date). When listing award winners, filter ?person wdt:P31 wd:Q5 to ensure humans.
  - Population time-series pattern: wd:Q... p:P1082 ?stmt . ?stmt ps:P1082 ?pop . OPTIONAL { ?stmt pq:P585 ?date } . ORDER BY DESC(?date). pq:P585 is the point-in-time qualifier. IMPORTANT: time-series may mix scopes (city proper vs metro) — e.g., Tokyo has a 2016 entry ~38,140,000 likely metro vs smaller city figures. Inspect qualifiers/references for scope before use.
  - Use wdt:P131* to traverse the admin hierarchy and compare wdt:P17 on the place vs an admin parent to detect historical/colonial country assignments. When mismatches appear, inspect the admin parent's instance-of (P31), labels, qualifiers and references to interpret the historical scope.
  - wdt:P106 often yields multiple occupations for a person. Use GROUP_CONCAT(DISTINCT ?occLabel; separator=", ") or return multiple rows. Always fetch labels with rdfs:label + FILTER(LANG(?label)="en") to get readable occupation names.
  - When a search_entity returns multiple hits (person vs sculpture vs memorial), confirm you selected the human/statements by checking wdt:P31 (instance of) and relevant wdt: properties (e.g., wdt:P106). This avoids using a non-human QID by mistake.
  - search_autocomplete can be constrained with a SPARQL pattern containing ?search (e.g., SELECT * WHERE { ?search wdt:P31 wd:Q5 }). Use constraints to focus results (e.g., humans) and avoid ambiguous fallbacks; if it returns no results, fallback to search_entity and verify wdt:P31.
  - Use search_property_of_entity to find relevant properties for an entity (e.g., 'award' -> P166) and search_object_of_property to discover candidate objects (e.g., 'physicist' for P106). This reduces guessing P/Q ids and surfaces qualifiers.
  - Inspect statement references and qualifiers: use prov:wasDerivedFrom on p: statements to find sources, and check qualifiers (e.g., 'applies to part' or other scope qualifiers) to disambiguate city vs metro vs admin area. Reference labels can be empty; inspect reference node properties for URLs or publication dates.

Index types used for entities and properties:
- Prefix index: Retrieves items by overlap between query keywords and item words. The query keywords can match item words exactly or as prefixes.
- Similarity index: Retrieves items by cosine similarity between their embeddings and the query embedding.

General notes across knowledge graphs:
- Use rdfs:label + FILTER(LANG(?label)="en") for labels; avoid SERVICE wikibase:label. Use wdt:Pxxx for normalized/direct values when qualifiers aren't needed. Use p:Pxxx / ps:Pxxx / pq:Pxxx to access statement qualifiers (e.g., award year via pq:P585). When dates matter, prefer xsd:dateTime and watch for year-only precision.
- Practical query patterns: use rdfs:label + FILTER(LANG(...)) for labels. Use wdt:Pxxx for direct/normalized values when qualifiers aren't needed. Use p:Pxxx / ps:Pxxx / pq:Pxxx to access qualifiers (dates via pq:P585). For dates use xsd:dateTime and expect year-only precision. For places: combine P17 with P131 or coordinate (P625) filters to avoid historical/overseas mismatches.
- Use OPTIONAL for pq: qualifiers (e.g., pq:P585), sort by qualifier (ORDER BY pq:P585 DESC) to prefer recent values. Use GROUP_CONCAT to combine multiple labels/values in one row. Watch for typed literals (xsd:dateTime, xsd:decimal) when filtering or sorting.
- Before querying, use search_entity to resolve human-friendly names to wd:Q identifiers and verify instance-of (e.g., check wdt:P31 = wd:Q5 for humans) to avoid ambiguous matches. Prefer the top match but programmatically confirm P31 before using its data.
- Use search_property to confirm property identifiers (e.g., "country" -> P17) before embedding them in queries. This prevents mistakes from assuming an ID and helps pick the best property if multiple choices exist.
- search_autocomplete can fall back to an unconstrained search or error when there are too many candidates. If this happens (e.g., "more than the maximum supported number of subject candidates"), retry with narrower constraints such as instance-of (wdt:P31), additional type filters, or short prefixes to reduce the candidate set; otherwise fallback to search_entity and verify wdt:P31.
- Use list(...) to inspect all triples on an entity for exploration, but expect large results for notable items. Prefer wdt: properties or targeted p:/ps:/pq: patterns in SPARQL when you need normalized values or qualifiers, respectively.
- Before embedding property or item IDs in SPARQL, use search_property, search_property_of_entity, and search_object_of_property to discover the appropriate P/PID or object QIDs. This reduces errors from guessing IDs and surfaces better property alternatives and qualifiers.
- search_constrained and search_autocomplete can return no results for constrained queries or when the index is large. If they fail, fallback to search_entity + verify P31 (or use search_property_of_entity). Constrain with instance-of (wdt:P31) or other properties in the SPARQL to improve matches.
- When selecting awards by year, prefer xsd:dateTime range filters (e.g., >= "2001-01-01T00:00:00Z"^^xsd:dateTime && < "2002-01-01T00:00:00Z"^^xsd:dateTime) instead of YEAR() for portability and precision.
- When selecting award winners via wdt:P166, filter ?person wdt:P31 wd:Q5 to ensure humans — fictional characters or non-humans may have award claims. If you need award years use p:P166 / ps:P166 / pq:P585 and OPTIONAL { ?stmt pq:P585 ?year } to retrieve qualifier years.
- Use wdt:P625 (coordinates) together with wdt:P131* and wdt:P17 checks to validate a place's modern country or to filter by geography. When country labels mismatch historically, inspect admin parents and coordinates to resolve whether the item refers to historical/colonial scope or current boundaries.
- Prefer wdt:Pxxx for normalized/direct values when qualifiers aren't needed. Use p:Pxxx / ps:Pxxx / pq:Pxxx to access qualifiers (e.g., pq:P585 for award year). Always fetch labels with rdfs:label + FILTER(LANG(?label) = "en").
- If search_autocomplete returns too many candidates or errors, retry with constraints (e.g., SELECT * WHERE { ?search wdt:P31 wd:Q5 }) or narrower query text. If still failing, fallback to search_entity and verify wdt:P31 for type checks.
- For award-year queries use p:P166 / ps:P166 / pq:P585 to access award statements and year qualifiers. Filter by xsd:dateTime ranges (e.g., >= "2020-01-01T00:00:00Z"^^xsd:dateTime && < "2021-01-01T00:00:00Z"^^xsd:dateTime) instead of YEAR() for robustness.
- Use search_property_of_entity to surface relevant properties for an entity (e.g., 'birth' -> P569/P19). list(...) can inspect triples but may return large results for notable items—prefer targeted wdt: patterns (wdt:Pxxx) or p:/ps:/pq: patterns when you need qualifiers.

SPARQL prefixes for use in function calls:
- bd: <http://www.bigdata.com/rdf#
- cc: <http://creativecommons.org/ns#
- data: <https://www.wikidata.org/wiki/Special:EntityData/
- dc: <http://purl.org/dc/elements/1.1/
- dct: <http://purl.org/dc/terms/
- foaf: <http://xmlns.com/foaf/0.1/
- geo: <http://www.opengis.net/ont/geosparql#
- geof: <http://www.opengis.net/def/function/geosparql/
- gn: <http://www.geonames.org/ontology#
- hint: <http://www.bigdata.com/queryHints#
- 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/
- qb: <http://purl.org/linked-data/cube#
- 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/
- void: <http://rdfs.org/ns/void#
- 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#

Additional rules to follow:
- Explain your thought process before and after each step and function call.
- Do not just use or make up entity or property identifiers without verifying their existence in the knowledge graphs first.
- Do not ask the user for clarifications without first attempting to complete the task. If the task input is incomplete or ambiguous, try to make reasonable assumptions and document them.
- 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.
- Always execute your final SPARQL query before giving an answer to make sure it returns the expected results.
- 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.
- 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.
- 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.
- For questions with a "True" or "False" answer the SPARQL query should be an ASK query.

[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]
I'll search for properties related to "thesis" or "dissertation" to identify the correct property IDs (P...); then I'll inspect usage to find how to count theses per institution. I'll start by searching for properties matching "thesis".

Question: thesis

Top 10 property alternatives:
1. academic thesis (wd:P1026 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via thesis), also known as A.B. thesis, bachelor's thesis, bachelor thesis, B.A. thesis, B.S. thesis, etc.: thesis or dissertation written for a degree / thesis or dissertation written for a degree
2. National Thesis Number (France) (wd:P5005 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via thesis number), also known as NNT, sudoc.fr thesis number, SUDOC thesis number, Theses.fr number, thesis number, etc.: identifier usually assigned by the dissertation's library for a published thesis in France / identifier usually assigned by the dissertation's library for a published thesis in France
3. thesis submitted to (wd:P4101 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as dissertation submitted to, submitted to, P4101: institution to whom a thesis or dissertation is submitted / institution to whom a thesis or dissertation is submitted
4. thesis submitted for degree (wd:P13338 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via thesis submitted for academic degree), also known as degree dissertation submitted for, degree thesis submitted for, dissertation submitted for academic degree, dissertation submitted for degree, thesis submitted for academic degree, etc.: the academic degree for which a thesis or dissertation is submitted
5. statement is subject of (wd:P805 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via article), also known as artfor, article, decided by, decided in, decided with, etc.: (qualifier only) item which describes the relation identified in this statement / (qualifier only) item which describes the relation identified in this statement / (qualifying) item that describes the relation identified in this statement
6. is the study of (wd:P2578 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via research), also known as academic field for, is study of, learning what?, research, researches, etc.: the object that an academic field studies; distinct from field of work (P101), which is used for human, organization, etc. / subject item is the academic field studying the object item of this property
7. field of work (wd:P101 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via research), also known as academic area, academic discipline, academic subject, activity, activity domain, etc.: specialisation of a person or organisation; see P106 for the occupation / specialization of a person or organization; see P106 for the occupation / specialization of a person or organization; see P106 for the occupation / specialization of a person or organization; see P106 for the occupation / is subproperty of interested in
8. folio(s) (wd:P7416 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via folio), also known as f., folio, folios, P7416: folio number of reference for statement
9. DOI (wd:P356 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as Digital Object Identifier, doi, P356: serial code used to uniquely identify digital objects like academic papers (use upper case letters only) / serial code used to uniquely identify digital objects like academic papers (use upper case letters only) / identifier for objects / Digital Object Identifier / Digital Object Identifier
10. inscription (wd:P1684 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as epigraph (inscription), inscriptions, legend, legenda, signature, etc.: inscriptions, markings and signatures on an object / inscriptions, markings and signatures on an object / inscriptions, markings and signatures on an object

[Assistant]
I'll search for the entity representing "academic thesis" (class/instance) to constrain items to theses/dissertations and avoid counting unrelated items that might use P4101.

Question: academic thesis

Top 10 entity alternatives:
1. thesis (wd:Q1266946, matched via academic thesis), also known as academic dissertation, academic thesis, dissertation, theses: a scholarly work submitted as a requirement to obtain an academic degree; Use Q187685 for PhD thesis / is subclass of academic writing / is instance of literary genre / is subclass of academic work / is subclass of research
2. academic thesis of (wd:Q115692948): inverse property label for P1026 / is instance of doctoral thesis / is instance of Thesis
3. higher education (wd:Q136822, matched via academic learning), also known as academic learning, academic study, college education, post-secondary education, tertiary education, etc.: academic tertiary education, such as from colleges and universities / academic tertiary education, such as from colleges and universities / is subclass of education and research / is subclass of tertiary education / is subclass of Tertiary education / is instance of educational stage / is instance of economic branch / is instance of industry
4. faculty (wd:Q180958, matched via academic unit), also known as academic unit, college, school, university faculty, university school: division of a university by subject area, sometimes also by level / is subclass of division of an educational institution / is instance of type of educational institution / is subclass of higher education institution / division within a university / division within a university
5. academic degree (wd:Q189533), also known as degree: status awarded for completion of a college or university program of study / status awarded for completion of a college or university program of study / is subclass of intangible asset / is subclass of qualification / is subclass of award
6. academic art (wd:Q189458), also known as academicism, academic style, academism, art pompier, eclecticism: style of painting and sculpture produced under the influence of European academies of art / is instance of architectural style / is instance of Architectural style / is instance of art movement
7. doctoral thesis (wd:Q187685), also known as doctoral dissertation, Ph. D. dissertation, Ph.D. dissertation, PhD dissertation, Ph. D. thesis, etc.: document submitted in support of candidature for a doctorate / document submitted in support of candidature for a doctorate / is instance of literary genre / is subclass of thesis
8. Jeton Kelmendi (wd:Q337614, matched via Albanian Academic), also known as Albanian Academic: has occupation opinion journalist / has occupation university teacher / has occupation translator / has occupation playwright / has occupation journalist / has occupation publisher / has occupation writer / is instance of human / has occupation poet / Kosovar writer / Kosovar writer / Kosovar writer
9. academic discipline (wd:Q11862829), also known as academic branch, academic field, academic specialism, academic specialty, branch (academic), etc.: is instance of knowledge classification / academic field of study or profession / is subclass of field of study / is subclass of specialism / is subclass of specialty
10. grade (wd:Q18185, matched via academic grading), also known as academic grading, grades, grading, grading in education: standardized measurement of academic performance / standardized measurement of academic performance / standardized measurement of academic performance / is subclass of value indicator

[Assistant]
Plan:
- Use property P4101 (thesis submitted to) to find thesis items and their target institutions.
- Restrict counted items to those whose instance (P31) is a subclass of "thesis" (Q1266946) so we count actual theses/dissertations.
- Count distinct thesis items per institution and order descending.
- Return institution IRIs and English labels and the count. I'll limit to the top 100 institutions for practicality; if you want more or all, I can adjust.

I'll run the SPARQL query now to get the results.

execute

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?institution (SAMPLE(?institutionLabel) AS ?institutionLabel) (COUNT(DISTINCT ?thesis) AS ?thesisCount) WHERE {
  ?thesis wdt:P4101 ?institution .
  ?thesis wdt:P31 ?thesisType .
  ?thesisType wdt:P279* wd:Q1266946 .
  OPTIONAL { ?institution rdfs:label ?institutionLabel . FILTER(LANG(?institutionLabel) = "en") }
}
GROUP BY ?institution
ORDER BY DESC(?thesisCount)
LIMIT 100

SPARQL execution failed:
Invalid SPARQL query: The target ?institutionLabel of an AS clause was already used in the query body.

[Assistant]
I'll fix the label variable naming (use ?label) and rerun the query.

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?institution (SAMPLE(?label) AS ?institutionLabel) (COUNT(DISTINCT ?thesis) AS ?thesisCount) WHERE {
  ?thesis wdt:P4101 ?institution .
  ?thesis wdt:P31 ?thesisType .
  ?thesisType wdt:P279* wd:Q1266946 .
  OPTIONAL { ?institution rdfs:label ?label . FILTER(LANG(?label) = "en") }
}
GROUP BY ?institution
ORDER BY DESC(?thesisCount)
LIMIT 100

Got 100 rows and 3 columns, showing the first 5 and last 5 rows below:
| institution                                                         | institutionLabel                                               | thesisCount     |
| ------------------------------------------------------------------- | -------------------------------------------------------------- | --------------- |
| University of Oxford (wd:Q34433)                                    | University of Oxford (lang:en)                                 | 16828 (xsd:int) |
| University of Auckland (wd:Q492467)                                 | University of Auckland (lang:en)                               | 14832 (xsd:int) |
| Massey University (wd:Q1134606)                                     | Massey University (lang:en)                                    | 11881 (xsd:int) |
| University of Canterbury (wd:Q432475)                               | University of Canterbury (lang:en)                             | 11286 (xsd:int) |
| Delft University of Technology (wd:Q752663)                         | Delft University of Technology (lang:en)                       | 10779 (xsd:int) |
| ...                                                                 | ...                                                            | ...             |
| University of California, Riverside (wd:Q1075148)                   | University of California, Riverside (lang:en)                  | 31 (xsd:int)    |
| University of Southern California (wd:Q4614)                        | University of Southern California (lang:en)                    | 31 (xsd:int)    |
| Geosciences and Engineering (Department at TU Delft) (wd:Q77049916) | Geosciences and Engineering (Department at TU Delft) (lang:en) | 31 (xsd:int)    |
| University of Manchester (wd:Q230899)                               | University of Manchester (lang:en)                             | 30 (xsd:int)    |
| Leiden University (wd:Q156598)                                      | Leiden University (lang:en)                                    | 30 (xsd:int)    |

[Assistant]
I'll provide the final SPARQL query (the one I executed) and a short summary of the top institutions found (top 5 by count) and note limitations/assumptions.

answer

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?institution (SAMPLE(?label) AS ?institutionLabel) (COUNT(DISTINCT ?thesis) AS ?thesisCount) WHERE {
  ?thesis wdt:P4101 ?institution .
  ?thesis wdt:P31 ?thesisType .
  ?thesisType wdt:P279* wd:Q1266946 .
  OPTIONAL { ?institution rdfs:label ?label . FILTER(LANG(?label) = "en") }
}
GROUP BY ?institution
ORDER BY DESC(?thesisCount)
LIMIT 100

Answer:
Summary of results (query returns institutions ordered by number of distinct theses/dissertations submitted to them, descending; limited to top 100):

Top 5 institutions from the query results:
1. University of Oxford — 16828 theses
2. University of Auckland — 14832 theses
3. Massey University — 11881 theses
4. University of Canterbury — 11286 theses
5. Delft University of Technology — 10779 theses

Notes and assumptions:
- I used property P4101 ("thesis submitted to") to find thesis items and counted distinct thesis items per target institution.
- To ensure items counted are theses/dissertations, I required that each ?thesis have an instance-of (P31) type that is a subclass of Q1266946 ("thesis"). This also captures doctoral theses (which are subclasses).
- The query returns the institution IRIs and an English label (when available) and the count of distinct theses. The full query result (limited to 100) was executed against Wikidata and produced the counts above; you can remove or raise the LIMIT if you want more results.
- Limitations: Wikidata coverage is incomplete and biased toward notable works and institutions; not all theses in the world are represented. Some thesis items may lack P31 statements and thus are excluded by the type filter; similarly, some submissions might be recorded via different patterns and thus not counted.

If you want, I can:
- Return the full list (remove the LIMIT or increase it).
- Restrict institutions to particular types (e.g., universities only) by adding an instance-of filter on the institution.
- Provide the raw result table (IRI + label + count) for the top N institutions.