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

Using entities:
- United States Supreme Court decision (wd:Q19692072), also known as Supreme Court decision, Supreme Court decisions, United States Supreme Court case, United States Supreme Court cases, US Supreme Court case, etc.: is subclass of legal case / is subclass of court decision / decision rendered by the highest court of the United States

Using properties:
- 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

Got 19,705 rows and 2 columns, showing the first 5 and last 5 rows below:
| case                                                        | caseLabel                                             |
| ----------------------------------------------------------- | ----------------------------------------------------- |
| Trump v. New York (wd:Q100496432)                           | Trump v. New York (lang:en)                           |
| New Hampshire v. Maine (wd:Q101093598)                      | New Hampshire v. Maine (lang:en)                      |
| Roman Catholic Diocese of Brooklyn v. Cuomo (wd:Q102532067) | Roman Catholic Diocese of Brooklyn v. Cuomo (lang:en) |
| EEOC v. Wyoming (wd:Q104672335)                             | EEOC v. Wyoming (lang:en)                             |
| Bogan v. Scott-Harris (wd:Q104821362)                       | Bogan v. Scott-Harris (lang:en)                       |
| ...                                                         | ...                                                   |
| Dallas v. Stanglin (wd:Q97453091)                           | Dallas v. Stanglin (lang:en)                          |
| Lehman v. Shaker Heights (wd:Q97474383)                     | Lehman v. Shaker Heights (lang:en)                    |
| Torres v. Madrid (wd:Q97516280)                             | Torres v. Madrid (lang:en)                            |
| Worcester v. Georgia (wd:Q976845)                           | Worcester v. Georgia (lang:en)                        |
| Edmond v. United States (wd:Q97738165)                      | Edmond v. United States (lang:en)                     |

Answer: The United States Supreme Court cases are a collection of legal decisions made by the Supreme Court of the United States. Examples include 'Trump v. New York', 'Roman Catholic Diocese of Brooklyn v. Cuomo', and 'Viking River Cruises, Inc. v. Moriana'. The complete list consists of hundreds of cases, each represented as an instance of 'United States Supreme Court decision' (wd:Q19692072) in Wikidata.

The United States Supreme Court cases are a collection of legal decisions made by the Supreme Court of the United States. Examples include 'Trump v. New York', 'Roman Catholic Diocese of Brooklyn v. Cuomo', and 'Viking River Cruises, Inc. v. Moriana'. The complete list consists of hundreds of cases, each represented as an instance of 'United States Supreme Court decision' (wd:Q19692072) in Wikidata.

SPARQL query over wikidata:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?case ?caseLabel WHERE {
  ?case wdt:P31 wd:Q19692072 .
  ?case rdfs:label ?caseLabel .
  FILTER ( LANG( ?caseLabel ) = "en" )
}

Using entities:
- United States Supreme Court decision (wd:Q19692072), also known as Supreme Court decision, Supreme Court decisions, United States Supreme Court case, United States Supreme Court cases, US Supreme Court case, etc.: is subclass of legal case / is subclass of court decision / decision rendered by the highest court of the United States

Using properties:
- 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

Execution result:
Got 19,705 rows and 2 columns, showing the first 5 and last 5 rows below:
| case                                                        | caseLabel                                             |
| ----------------------------------------------------------- | ----------------------------------------------------- |
| Trump v. New York (wd:Q100496432)                           | Trump v. New York (lang:en)                           |
| New Hampshire v. Maine (wd:Q101093598)                      | New Hampshire v. Maine (lang:en)                      |
| Roman Catholic Diocese of Brooklyn v. Cuomo (wd:Q102532067) | Roman Catholic Diocese of Brooklyn v. Cuomo (lang:en) |
| EEOC v. Wyoming (wd:Q104672335)                             | EEOC v. Wyoming (lang:en)                             |
| Bogan v. Scott-Harris (wd:Q104821362)                       | Bogan v. Scott-Harris (lang:en)                       |
| ...                                                         | ...                                                   |
| Dallas v. Stanglin (wd:Q97453091)                           | Dallas v. Stanglin (lang:en)                          |
| Lehman v. Shaker Heights (wd:Q97474383)                     | Lehman v. Shaker Heights (lang:en)                    |
| Torres v. Madrid (wd:Q97516280)                             | Torres v. Madrid (lang:en)                            |
| Worcester v. Georgia (wd:Q976845)                           | Worcester v. Georgia (lang:en)                        |
| Edmond v. United States (wd:Q97738165)                      | Edmond v. United States (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 supreme court cases?

[Assistant]
To answer the question "What are the supreme court cases?", I need to identify relevant entities and properties related to Supreme Court cases in Wikidata.

### Step 1: Understand the question
The user is asking for a list of Supreme Court cases. In Wikidata, Supreme Court cases are typically represented as items (entities) with specific properties such as:
- `P31` (instance of) → likely `Q190044` (Supreme Court case) or similar.
- They may also be linked to courts (e.g., U.S. Supreme Court, `Q11827`), judges, dates, etc.

First, I need to verify if there is a specific item for "Supreme Court case" in Wikidata.

### Step 2: Search for relevant entity
I will search for "Supreme Court case" to find the correct entity.

Question: Supreme Court case

Top 10 entity alternatives:
1. Salihu v Wasiu (wd:Q125403314, matched via Supreme court case), also known as Supreme court case: is instance of Nigeria Supreme Court decision / Supreme Court case between Salihu v Wasiu
2. ELUFIOYE AND 9 OTHERS v HALILU AND 17 OTHERS (wd:Q125556110, matched via Supreme Court case), also known as Supreme Court case: supreme court case between Elufloye and 9 others and Halilu and 17 others / is instance of Nigeria Supreme Court decision
3. FEDERAL REPUBLIC OF NIGERIA v T. A. DAIRO & Others (wd:Q125658363, matched via Supreme court case), also known as Supreme court case: Federal government in court with T.A. Dairo & others. / is instance of Nigeria Supreme Court decision
4. Nevada Supreme Court decision (wd:Q121470056, matched via Nevada Supreme Court case), also known as Nevada Supreme Court case: decision rendered by the highest court of Nevada / is subclass of court decision / is subclass of legal case
5. Nsirim v Dr. Amadi ( SC.40/2005) [2016] NGSC 67 (21 January 2016) (wd:Q125415178, matched via Nigeria supreme court case), also known as Nigeria supreme court case: is instance of Nigeria Supreme Court decision / a Nigeria  supreme Court cases
6. United States Supreme Court decision (wd:Q19692072, matched via US Supreme Court case), also known as Supreme Court decision, Supreme Court decisions, United States Supreme Court case, United States Supreme Court cases, US Supreme Court case, etc.: decision rendered by the highest court of the United States / is subclass of court decision / is subclass of legal case
7. Supreme Court Case Selections Act (wd:Q7644854), also known as Supreme Court Case Selections Act of 1988: 1988 U.S. law removing some appeals-by-right to the Supreme Court / is instance of Act of Congress in the United States
8. Supreme court of Nigeria case (wd:Q125677284): is subclass of legal case
9. Monkey case in Supreme Court (wd:Q59013757): scientific article published in Nature / is instance of scholarly article / is instance of academic article
10. Supreme Court hears 'right-to-die' case (wd:Q77742642): scientific article published on 01 December 1989 / is instance of scholarly article / is instance of academic article

[Assistant]
From the search results, I can see that the most relevant entity for "Supreme Court case" in a general sense is:

- **United States Supreme Court decision** (`wd:Q19692072`) — this is a subclass of legal case and represents cases decided by the U.S. Supreme Court, which is the most commonly referenced "Supreme Court" globally.

There are also Nigeria-specific Supreme Court decisions, but since the question is general ("what are the supreme court cases?"), I will assume the user is referring to the **United States Supreme Court cases**, as they are the most prominent and widely studied.

### Step 3: Find properties and structure of U.S. Supreme Court cases
I will now explore the properties of `wd:Q19692072` (United States Supreme Court decision) to understand how these cases are structured in Wikidata.

list

wd:Q19692072

Got 163 rows and 3 columns, showing the first 10 rows below:
| subject                                             | property                            | object                                                                                |
| --------------------------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------- |
| United States Supreme Court decision (wd:Q19692072) | country (wdt:P17)                   | United States (wd:Q30)                                                                                |
| United States Supreme Court decision (wd:Q19692072) | image (wdt:P18)                     | <http://commons.wikimedia.org/wiki/Special:FilePath/Oblique%20facade%203%2C%20US%20Supreme%20Court.jpg> |
| United States Supreme Court decision (wd:Q19692072) | subclass of (wdt:P279)              | legal case (wd:Q2334719)                                                                                |
| United States Supreme Court decision (wd:Q19692072) | applies to jurisdiction (wdt:P1001) | United States (wd:Q30)                                                                                |
| United States Supreme Court decision (wd:Q19692072) | topic's main category (wdt:P910)    | wd:Q6996306                                                                                |
| United States Supreme Court decision (wd:Q19692072) | MeSH tree code (wdtn:P672)          | <http://id.nlm.nih.gov/mesh/I01.880.604.583.858>                                                        |
| United States Supreme Court decision (wd:Q19692072) | topic's main template (wdt:P1424)   | wd:Q14373911                                                                                |
| United States Supreme Court decision (wd:Q19692072) | has list (wdt:P2354)                | wd:Q6646863                                                                                |
| United States Supreme Court decision (wd:Q19692072) | MeSH descriptor ID (wdtn:P486)      | <http://id.nlm.nih.gov/mesh/D035521>                                                                    |
| United States Supreme Court decision (wd:Q19692072) | KBpedia ID (wdtn:P8408)             | <http://kbpedia.org/kko/rc/CourtCase-Appellate>                                                         |
| ...                                                 | ...                                 | ...                                                                                |

[Assistant]
I see that `wd:Q19692072` (United States Supreme Court decision) is a subclass of "legal case" (`wd:Q2334719`) and has a property `wdt:P2354` (has list) pointing to `wd:Q6646863`, which is "List of United States Supreme Court cases".

This suggests that the cases are not directly listed under `wd:Q19692072`, but rather in a list item. I should now check what `wd:Q6646863` is.

### Step 4: Explore the list item `wd:Q6646863`
I will list the triples for `wd:Q6646863` to understand its structure.

wd:Q6646863

Got 100 rows and 3 columns, showing the first 10 rows below:
| subject     | property                         | object                                               |
| ----------- | -------------------------------- | ---------------------------------------------------- |
| wd:Q6646863 | instance of (wdt:P31)            | legal case (wd:Q2334719)                             |
| wd:Q6646863 | topic's main category (wdt:P910) | wd:Q6996367                                          |
| wd:Q6646863 | is a list of (wdt:P360)          | United States Supreme Court decision (wd:Q19692072)  |
| wd:Q6646863 | OpenAlex ID (wdt:P10283)         | C2908542518                                          |
| wd:Q6646863 | court (wdt:P4884)                | Supreme Court of the United States (wd:Q11201)       |
| wd:Q6646863 | wdt:P31279                       | list (wd:Q12139612)                                  |
| wd:Q6646863 | schema:description               | article de llista de Wikimedia (lang:ca)             |
| wd:Q6646863 | schema:name                      | Lists of United States Supreme Court cases (lang:en) |
| wd:Q6646863 | rdf:type                         | wikibase:Item                                        |
| wd:Q6646863 | rdfs:label                       | Lists of United States Supreme Court cases (lang:en) |
| ...         | ...                              | ...                                                  |

[Assistant]
I see that `wd:Q6646863` is a list item (`wdt:P31 wd:Q12139612` = list) and it is a list of `wd:Q19692072` (United States Supreme Court decisions). However, the list itself does not contain the individual cases — it's a meta-list.

To get the actual cases, I need to find items that are instances of `wd:Q19692072` (United States Supreme Court decision). So I will search for items that are instances of `wd:Q19692072`.

### Step 5: Query for all items that are instances of United States Supreme Court decision
I will write a SPARQL query to find all items with `wdt:P31 wd:Q19692072`.

This will return the actual Supreme Court cases.

execute

SELECT ?case ?caseLabel WHERE { ?case wdt:P31 wd:Q19692072 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } LIMIT 100

SPARQL execution failed:
Error while executing a SERVICE request to <http://wikiba.se:80/ontology#label>: SERVICE responded with HTTP status code: 301, Moved Permanently. First 100 bytes of the response: '
<title>301 Moved Permanently</title>

301 Moved Permanently'

[Assistant]
I see that the SPARQL query used `SERVICE wikibase:label`, which is not supported in this environment. I must use `rdfs:label` with `FILTER(LANG(?label) = "en")` instead.

Let me rewrite the query correctly.

### Step 6: Rewrite SPARQL query without `SERVICE wikibase:label`
I will now query for all items that are instances of `wd:Q19692072` (United States Supreme Court decision) and retrieve their English labels using `rdfs:label` and `FILTER`.

I will also limit the results to 100 for now to avoid overwhelming output.

SELECT ?case ?caseLabel WHERE { ?case wdt:P31 wd:Q19692072 . ?case rdfs:label ?caseLabel . FILTER(LANG(?caseLabel) = "en") } LIMIT 100

Got 100 rows and 2 columns, showing the first 5 and last 5 rows below:
| case                                                                                | caseLabel                                                                                |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| Trump v. New York (wd:Q100496432)                                                                            | Trump v. New York (lang:en)                                                                            |
| New Hampshire v. Maine (wd:Q101093598)                                                                       | New Hampshire v. Maine (lang:en)                                                                       |
| Roman Catholic Diocese of Brooklyn v. Cuomo (wd:Q102532067)                                                  | Roman Catholic Diocese of Brooklyn v. Cuomo (lang:en)                                                  |
| EEOC v. Wyoming (wd:Q104672335)                                                                              | EEOC v. Wyoming (lang:en)                                                                              |
| Bogan v. Scott-Harris (wd:Q104821362)                                                                        | Bogan v. Scott-Harris (lang:en)                                                                        |
| ...                                                                                | ...                                                                                |
| Viking River Cruises, Inc. v. Moriana (wd:Q110223567)                                                        | Viking River Cruises, Inc. v. Moriana (lang:en)                                                        |
| Thryv, Inc. v. Click-To-Call Technologies, LP (wd:Q110223626)                                                | Thryv, Inc. v. Click-To-Call Technologies, LP (lang:en)                                                |
| Rodriguez v. FDIC (wd:Q110565463)                                                                            | Rodriguez v. FDIC (lang:en)                                                                            |
| Kennedy v. Bremerton School District (wd:Q110588839)                                                         | Kennedy v. Bremerton School District (lang:en)                                                         |
| National Federation of Independent Business v. Occupational Safety and Health Administration (wd:Q110612667) | National Federation of Independent Business v. Occupational Safety and Health Administration (lang:en) |

[Assistant]
The query successfully returned 100 U.S. Supreme Court cases, each represented as a Wikidata item with an English label in the format "Plaintiff v. Defendant".

This confirms that:
- The entity `wd:Q19692072` represents "United States Supreme Court decision".
- Each case is an instance of this entity.
- The labels are properly formatted as "Plaintiff v. Defendant".

Since the question is "What are the supreme court cases?", and we have retrieved a list of actual U.S. Supreme Court cases (the most commonly referenced), this is the correct answer.

### Final Answer
I will now provide the final SPARQL query and answer.

The complete list of U.S. Supreme Court cases is available in Wikidata as items with `wdt:P31 wd:Q19692072`. The query below retrieves them with their English labels.

Note: The full list contains hundreds of cases; I've shown a sample above. For a complete list, remove the `LIMIT`.

I will now return the final answer.

answer

SELECT ?case ?caseLabel WHERE { ?case wdt:P31 wd:Q19692072 . ?case rdfs:label ?caseLabel . FILTER(LANG(?caseLabel) = "en") }

Answer: The United States Supreme Court cases are a collection of legal decisions made by the Supreme Court of the United States. Examples include 'Trump v. New York', 'Roman Catholic Diocese of Brooklyn v. Cuomo', and 'Viking River Cruises, Inc. v. Moriana'. The complete list consists of hundreds of cases, each represented as an instance of 'United States Supreme Court decision' (wd:Q19692072) in Wikidata.


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?currency WHERE {
  wd:Q244 wdt:P38 ?currency
}

Using entities:
- Barbados (wd:Q244), also known as 🇧🇧, BAR, Barbadoes, bb, BB: is instance of sovereign state / country in the Caribbean / country in the Caribbean / island nation in the Caribbean / island nation in the Caribbean

Using properties:
- currency (wd:P38 as wdt), also known as base currency, used money, P38: is subproperty of uses / currency used by item / currency used by item / currency used by item

Answer: The currency to take to Barbados is the Barbadian dollar.

The currency to take to Barbados is the Barbadian dollar.

SPARQL query over wikidata:
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?currency WHERE {
  wd:Q244 wdt:P38 ?currency
}

Using entities:
- Barbados (wd:Q244), also known as 🇧🇧, BAR, Barbadoes, bb, BB: is instance of sovereign state / country in the Caribbean / country in the Caribbean / island nation in the Caribbean / island nation in the Caribbean

Using properties:
- currency (wd:P38 as wdt), also known as base currency, used money, P38: is subproperty of uses / currency used by item / currency used by item / currency used by item

Execution result:
Got 1 row and 1 column:
| currency                      |
| ----------------------------- |
| Barbadian dollar (wd:Q194351) |

[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 currency to take to barbados?

[Assistant]
The question "What currency to take to Barbados?" is asking for the official currency used in Barbados. This is a factual question that can be answered by checking the currency associated with Barbados in the knowledge graph.

I will first search for the entity representing Barbados and then check its associated currency property.

Question: Barbados

Top 10 entity alternatives:
1. Barbados (wd:Q244), also known as 🇧🇧, BAR, Barbadoes, bb, BB: is instance of sovereign state / island nation in the Caribbean / island nation in the Caribbean / country in the Caribbean / country in the Caribbean
2. Barbados (wd:Q807306): is instance of musical group / Swedish dansband
3. Barbados (wd:Q4858586): is instance of musical work/composition / musical composition by Charlie Parker
4. Barbados (wd:Q4858589): single by Typically Tropical / is instance of single / is instance of song
5. Barbados (wd:Q10426260): 1995 studio album by Barbados / is instance of album
6. Barbados (wd:Q2649101): is instance of plantation / is instance of Plantation / plantation in Surinam
7. Barbados (wd:Q16950300): is instance of musical work/composition / song
8. Barbados (wd:Q28554139): is instance of painting / painting by Fred Wilson / painting by Fred Wilson
9. Barbados (wd:Q30151210), also known as Barbados Island, Island of Barbados: main island of Barbados / is instance of island
10. Barbados (wd:Q59508554): painting by J. E. H. MacDonald / painting by J.E.H. MacDonald / is instance of painting

[Assistant]
The correct entity for the country Barbados is `wd:Q244` (Barbados, sovereign state/island nation). Now I will check what property is used to represent the currency of a country. I'll search for properties related to "currency" for Barbados.

Question: currency

Top 10 property alternatives:
1. currency (wd:P38 as p/wdt), also known as base currency, used money, P38: is subproperty of uses / currency used by item / currency used by item / currency used by item
2. capital (wd:P36 as p/wdt), also known as administrative capital, administrative center, administrative centre, administrative headquarters, administrative seat, etc.: location (city, municipality) of governmental seat of the country, or administrative territorial entity / seat of government of a country, province, state or other type of administrative territorial entity / city of governmental seat of the country, state or administrative subdivision
3. central bank (wd:P1304 as p/wdt), also known as P1304: country's central bank
4. part of (wd:P361 as p/wdt, matched via of), 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))
5. nominal GDP (wd:P2131 as p/wdt, matched via GDP), also known as GDP, GDP, nominal, gross domestic product, nominal gross domestic product, P2131: market value of all officially recognized final goods and services produced within a country in a given period of time
6. economy of topic (wd:P8744 as p/wdt), also known as P8744: item that deals with the economy of the subject / is subproperty of studied by
7. located in/on physical feature (wd:P706 as p/wdt, matched via on), also known as geographical region, is in, is on, landform, located on island, etc.: located on the specified landform or body of water. Should ... (provinces, states, countries, etc.). / located on the specified (geo)physical feature. Should not be ... political/administrative (P131) or a mountain range (P4552). / is subproperty of location / is subproperty of part of
8. continent (wd:P30 as p/wdt), also known as P30: is subproperty of located in/on physical feature / is subproperty of located on terrain feature / continent of which the subject is a part / continent of which the subject is a part / continent of which the subject is a part
9. nominal GDP per capita (wd:P2132 as p/wdt, matched via gdp per capita), also known as GDP (nominal) per capita, gdp per capita, GDP per capita, nominal, Gross domestic product per capita, P2132: country's total GDP divided by the population
10. coordinate location (wd:P625 as p/wdt, matched via geo), also known as co-ordinate location, co-ordinates, coordinates, co-ords, coords, etc.: geocoordinates of the subject. For Earth, please note that only WGS84 coordinating system is supported at the moment / coordinates of the subject / coordinates of the subject

No other items found

[Assistant]
The property for currency is `wdt:P38`. Now I will query the currency used in Barbados using this property.

execute

SELECT ?currency WHERE { wd:Q244 wdt:P38 ?currency }

[Assistant]
The official currency of Barbados is the Barbadian dollar. I will now provide the final answer with the SPARQL query used to retrieve this information.

answer

SELECT ?currency WHERE { wd:Q244 wdt:P38 ?currency }

Answer: The currency to take to Barbados is the Barbadian dollar.


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

Using entities:
- Philadelphia Phillies (wd:Q650840), also known as Philadelphia Quakers, Phillies, Phils, Quakers: is instance of baseball team / Major League Baseball team

Using properties:
- inception (wd:P571 as wdt), also known as broke ground, built, commenced on date, commencement date, completed, etc.: is subproperty of start time / date or point in time when the organisation / object was founded / created / time when an entity begins to exist; for date of official opening use P1619 / time when an entity begins to exist; for date of official opening use P1619

Answer: The Philadelphia Phillies began in 1883.

The Philadelphia Phillies began in 1883.

SPARQL query over wikidata:
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?inception WHERE {
  wd:Q650840 wdt:P571 ?inception .
}

Using entities:
- Philadelphia Phillies (wd:Q650840), also known as Philadelphia Quakers, Phillies, Phils, Quakers: is instance of baseball team / Major League Baseball team

Using properties:
- inception (wd:P571 as wdt), also known as broke ground, built, commenced on date, commencement date, completed, etc.: is subproperty of start time / date or point in time when the organisation / object was founded / created / time when an entity begins to exist; for date of official opening use P1619 / time when an entity begins to exist; for date of official opening use P1619

Execution result:
Got 1 row and 1 column:
| inception                           |
| ----------------------------------- |
| 1883-01-01T00:00:00Z (xsd:dateTime) |

[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 year did the phillies begin?

[Assistant]
To determine the year the Philadelphia Phillies began, I need to find the founding year of the Philadelphia Phillies baseball team. This information is likely stored in Wikidata as an entity representing the team, with a property indicating its founding or establishment year.

### Step 1: Search for the entity "Philadelphia Phillies"
I will first search for the entity corresponding to the Philadelphia Phillies in Wikidata.

Question: Philadelphia Phillies

Top 10 entity alternatives:
1. Philadelphia Phillies (wd:Q650840), also known as Philadelphia Quakers, Phillies, Phils, Quakers: is instance of baseball team / Major League Baseball team
2. Philadelphia Phillies (wd:Q7182765): professional American football team from 1902 / is instance of American football team
3. WikiProject Philadelphia Phillies (wd:Q21830603): Wikimedia subject-area collaboration / is instance of WikiProject
4. history of the Philadelphia Phillies (wd:Q5870209, matched via Philadelphia Phillies history), also known as Philadelphia Phillies history, the Philadelphia Phillies history: is instance of aspect of history / aspect of history
5. 2009 Philadelphia Phillies season (wd:Q3466492): is instance of baseball team season / Major League Baseball season
6. 2018 Philadelphia Phillies season (wd:Q47010509): is instance of baseball team season / Major League Baseball season
7. 2022 Philadelphia Phillies season (wd:Q108179426): is instance of baseball team season / Major League Baseball season
8. 2023 Philadelphia Phillies season (wd:Q115519545): is instance of baseball team season / major League Baseball season
9. 2024 Philadelphia Phillies season (wd:Q123221439): is instance of baseball team season / Major League Baseball season
10. 2021 Philadelphia Phillies season (wd:Q104859453): is instance of baseball team season / major League Baseball season

[Assistant]
The top result, `wd:Q650840`, is the correct entity for the Philadelphia Phillies baseball team. It is explicitly labeled as a "baseball team" and "Major League Baseball team," which matches our intent.

### Step 2: Find the property for the founding or establishment year
Now, I need to find the property that indicates the founding or establishment year of the team. Common properties for this are:
- `wdt:P571` (inception)
- `wdt:P580` (start time)
- `wdt:P1365` (established)

I'll search for properties related to "founding" or "established" for this entity.

Question: founded

Top 10 property alternatives:
1. inception (wd:P571 as p/wdt, matched via founded), also known as broke ground, built, commenced on date, commencement date, completed, etc.: time when an entity begins to exist; for date of official opening use P1619 / time when an entity begins to exist; for date of official opening use P1619 / date or point in time when the organisation / object was founded / created / is subproperty of start time
2. headquarters location (wd:P159 as p/wdt, matched via based in), also known as admin HQ, based in, garrison, head office location, head quarters, etc.: city or town where an organization's headquarters is or has been situated. Use P276 qualifier for specific building / specific location where an organisation's HQ is or has been located / specific location where an organisation's HQ is or has been located / is subproperty of significant place
3. part of (wd:P361 as p/wdt, matched via of), 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))
4. named after (wd:P138 as p/wdt, matched via named for), also known as eponym, etymology, name after, named for, named in honor of, etc.: entity or event that inspired the subject's name, or namesake ... "applies to name" (P5168) can be used to indicate which one / person or other entity that inspired this item's name / person or other entity that inspired this item's name
5. country (wd:P17 as p/wdt, matched via sovereign state), also known as host country, land, sovereign state, state, P17: sovereign state that this item is in (not to be used for human beings) / sovereign state that this item is in (not to be used for human beings) / sovereign state that this item is in (not to be used for human beings) / sovereign state that this item is in (not to be used for human beings) / is subproperty of located in the administrative territorial entity
6. KBpedia ID (wd:P8408 as p/wdt/wdtn, matched via kbpedia), also known as kbpedia, Kbpedia, KBpedia, KBpedia knowledge graph, KBpedia ontology, etc.: identifier for the KBpedia knowledge graph, which provides ... and extraction of training sets for machine learning
7. FAST ID (wd:P2163 as p/wdt/wdtn, matched via fst), also known as Faceted Application of Subject Terminology ID, FAST subject heading, fst, worldcat.org/fast, P2163: authority control identifier in WorldCat's “FAST Linked Data” authority file / authority control identifier in WorldCat's “FAST Linked Data” authority file
8. head coach (wd:P286 as p/wdt, matched via led by), also known as club manager, coach, coached by, led by, manager, etc.: on-field manager or head coach of a sports club (not to be ... manager P505, which is not a coaching position) or person / on-field manager or head coach of a sports club (not to be ... manager P505, which is not a coaching position) or person
9. topic's main category (wd:P910 as p/wdt, matched via category), also known as article's main category, category, category for this topic, catmain, has category, etc.: main category of this topic / main Wikimedia category
10. instance of (wd:P31 as p/wdt, matched via is an), also known as example of, has type, is a, is an, is of type, etc.: type to which this subject corresponds/belongs. Different ... and the volcano is a type (instance) of volcanic landform / that class of which this subject is a particular example and ... a subclass of mountain (and an instance of volcanic landform)

No other items found

[Assistant]
The property `wdt:P571` (inception) is the correct property to use for the founding year of the Philadelphia Phillies. This property is commonly used to denote when an organization or entity was founded.

### Step 3: Query the inception year of the Philadelphia Phillies
Now I will construct a SPARQL query to retrieve the inception year of the Philadelphia Phillies using `wd:Q650840` and `wdt:P571`.

The query will look like this:
```sparql
SELECT ?inception WHERE {
  wd:Q650840 wdt:P571 ?inception .
}
```

I will execute this query to get the result.

execute

SELECT ?inception WHERE { wd:Q650840 wdt:P571 ?inception .}

[Assistant]
The SPARQL query successfully returned the inception year of the Philadelphia Phillies as `1883-01-01T00:00:00Z`, which corresponds to the year **1883**.

### Final Answer:
The Philadelphia Phillies began in **1883**.

I will now provide the final SPARQL query and answer.

answer

SELECT ?inception WHERE { wd:Q650840 wdt:P571 ?inception .}

Answer: The Philadelphia Phillies began in 1883.