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 ?unit ?unitLabel ( GROUP_CONCAT( DISTINCT ?part ; SEPARATOR = "|" ) AS ?parts ) ( GROUP_CONCAT( DISTINCT ?partLabel ; SEPARATOR = "; " ) AS ?partsLabel ) ( GROUP_CONCAT( DISTINCT ?parent ; SEPARATOR = "|" ) AS ?parents ) ( GROUP_CONCAT( DISTINCT ?parentLabel ; SEPARATOR = "; " ) AS ?parentsLabel ) ( GROUP_CONCAT( DISTINCT ?geolexID ; SEPARATOR = "; " ) AS ?geolexIDs ) WHERE {
  ?unit wdt:P31 / wdt:P279 * wd:Q3550897 .
  {
    ?unit wdt:P131 * wd:Q816 .
  } UNION {
    ?unit wdt:P276 ?loc .
    ?loc wdt:P131 * wd:Q816 .
  }
  OPTIONAL {
    ?unit wdt:P527 ?part .
    ?part rdfs:label ?partLabel .
    FILTER ( LANG( ?partLabel ) = "en" )
  }
  OPTIONAL {
    ?unit wdt:P361 ?parent .
    ?parent rdfs:label ?parentLabel .
    FILTER ( LANG( ?parentLabel ) = "en" )
  }
  OPTIONAL {
    ?unit wdt:P6202 ?geolexID .
  }
  ?unit rdfs:label ?unitLabel .
  FILTER ( LANG( ?unitLabel ) = "en" )
}
GROUP BY ?unit ?unitLabel
ORDER BY ?unitLabel
LIMIT 1000

Using entities:
- lithostratigraphic unit (wd:Q3550897), also known as rock unit: is subclass of stratigraphic unit / geologic unit denoting a specific body of rock based on its lithologic or stratigraphic characteristics
- Arizona (wd:Q816), also known as Ariz., Arizona, United States, AZ, Grand Canyon State, State of Arizona, etc.: is instance of state of the United States / is instance of U.S. state / state of the United States of America / state of the United States of America / state of the United States of America

Using properties:
- located in the administrative territorial entity (wd:P131 as wdt), also known as administrative territorial entity, administrative territory, city, happens in, in, etc.: is subproperty of location / is subproperty of part of / the item is located on the territory of the following administrative entity / the item is located on the territory of the following administrative entity / the item is located on the territory of the following ... the item falls only partially into the administrative entity. / the item is located on the territory of the following ... the item falls only partially into the administrative entity.
- location (wd:P276 as wdt), also known as based in, city, from, held by, in, etc.: location of the item, physical object or event is within. In ... use P131. In case of a distinct terrain feature use P706. / location of the item, physical object or event is within. In ... use P131. In case of a distinct terrain feature use P706. / location of the object, structure or event. In the case of an ... use P706. Use P7153 for locations associated with the object
- 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
- 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))
- has part(s) (wd:P527 as wdt), also known as amalgamation of, assembled from, assembled out of, composed of, comprised of, etc.: part of this subject, also valuable subclass or exemplar. Inverse property of "part of". / part of this subject; inverse property of "part of" (P361). See also "has parts of the class" (P2670). / part of this subject; inverse property of "part of" (P361). See also "has parts of the class" (P2670).
- Geolex ID (wd:P6202 as wdt), also known as GEOLEX ID, Geolex identifier, P6202: ID for every stratigraphic unit in the United States of America (USA) given by the United States Geological Survey / ID for every stratigraphic unit in the United States of America (USA) given by the United States Geological Survey / ID for every stratigraphic unit in the United States of America (USA) given by the United States Geological Survey

Got 143 rows and 7 columns, showing the first 5 and last 5 rows below:
| unit                                 | unitLabel                       | parts | partsLabel                 | parents | parentsLabel                 | geolexIDs        |
| ------------------------------------ | ------------------------------- | ----- | -------------------------- | ------- | ---------------------------- | ---------------- |
| Abrigo Formation (wd:Q75041040)      | Abrigo Formation (lang:en)      |       |                            |         |                              | Abrigo_4501      |
| Amole Arkose (wd:Q17511820)          | Amole Arkose (lang:en)          |       |                            |         |                              |                  |
| Amole Formation (wd:Q4747496)        | Amole Formation (lang:en)       |       |                            |         |                              | Amole_6443       |
| Apache Group (wd:Q65553467)          | Apache Group (lang:en)          |       | Mescal Limestone (lang:en) |         |                              | Apache_6495      |
| Awatubi Member (wd:Q64341523)        | Awatubi Member (lang:en)        |       |                            |         | Kwagunt Formation (lang:en)  | Awatubi_4623     |
| ...                                  | ...                             | ...   | ...                        | ...     | ...                          | ...              |
| West Water Formation (wd:Q98923927)  | West Water Formation (lang:en)  |       |                            |         |                              | WestWater_12326  |
| Wingate Sandstone (wd:Q8025150)      | Wingate Sandstone (lang:en)     |       |                            |         | Glen Canyon Group (lang:en)  | Wingate_11202    |
| Winslow Member (wd:Q61045581)        | Winslow Member (lang:en)        |       |                            |         | Moenkopi Formation (lang:en) | Winslow_11208    |
| Winterhaven Formation (wd:Q97007987) | Winterhaven Formation (lang:en) |       |                            |         |                              | Winterhaven_6295 |
| Wupatki Member (wd:Q61045598)        | Wupatki Member (lang:en)        |       |                            |         | Moenkopi Formation (lang:en) | Wupatki_11243    |

Answer:
I executed the SPARQL query above on Wikidata.

Summary of results:
- Number of distinct lithostratigraphic units returned: 143 rows.
- Columns returned per row:
  - unit: the Wikidata item IRI for the lithostratigraphic unit (e.g., wd:Q1074382)
  - unitLabel: English label for the unit
  - parts: pipe-separated IRIs of items that are 'has part' (P527) of the unit (if any)
  - partsLabel: English labels of those parts (semicolon-separated)
  - parents: pipe-separated IRIs of items that the unit is 'part of' (P361) (if any)
  - parentsLabel: English labels of those parent units (semicolon-separated)
  - geolexIDs: Geolex ID(s) from property P6202 (semicolon-separated if multiple)

Notes and caveats:
- Location detection used administrative-location and location properties: items that have an administrative parent chain (P131*) to Arizona (wd:Q816) or that have a location (P276) whose administrative parent chain includes Arizona. Some geological units that are relevant to Arizona may lack P131/P276 statements and thus might not appear.
- The query selects items that are instance of (P31) or subclassed instances of the class 'lithostratigraphic unit' (wd:Q3550897). This captures formations, members, groups, etc., but some items might be classified differently in Wikidata and could be missed.
- Geolex IDs are present for many US stratigraphic units (property P6202), but not every unit has this property populated.

If you want:
- I can return the full result table as CSV/TSV.
- I can expand the location matching (for example, include units with coordinates inside Arizona’s bounding box) to try to find additional units that lack P131/P276.
- I can filter for a specific subtype (e.g., only formations or only members) or sort by whether they have Geolex IDs.

If you’d like the raw results file (CSV) or further refinements, tell me which format or filter you prefer.

I executed the SPARQL query above on Wikidata.

Summary of results:
- Number of distinct lithostratigraphic units returned: 143 rows.
- Columns returned per row:
  - unit: the Wikidata item IRI for the lithostratigraphic unit (e.g., wd:Q1074382)
  - unitLabel: English label for the unit
  - parts: pipe-separated IRIs of items that are 'has part' (P527) of the unit (if any)
  - partsLabel: English labels of those parts (semicolon-separated)
  - parents: pipe-separated IRIs of items that the unit is 'part of' (P361) (if any)
  - parentsLabel: English labels of those parent units (semicolon-separated)
  - geolexIDs: Geolex ID(s) from property P6202 (semicolon-separated if multiple)

Notes and caveats:
- Location detection used administrative-location and location properties: items that have an administrative parent chain (P131*) to Arizona (wd:Q816) or that have a location (P276) whose administrative parent chain includes Arizona. Some geological units that are relevant to Arizona may lack P131/P276 statements and thus might not appear.
- The query selects items that are instance of (P31) or subclassed instances of the class 'lithostratigraphic unit' (wd:Q3550897). This captures formations, members, groups, etc., but some items might be classified differently in Wikidata and could be missed.
- Geolex IDs are present for many US stratigraphic units (property P6202), but not every unit has this property populated.

If you want:
- I can return the full result table as CSV/TSV.
- I can expand the location matching (for example, include units with coordinates inside Arizona’s bounding box) to try to find additional units that lack P131/P276.
- I can filter for a specific subtype (e.g., only formations or only members) or sort by whether they have Geolex IDs.

If you’d like the raw results file (CSV) or further refinements, tell me which format or filter you prefer.

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 ?unit ?unitLabel ( GROUP_CONCAT( DISTINCT ?part ; SEPARATOR = "|" ) AS ?parts ) ( GROUP_CONCAT( DISTINCT ?partLabel ; SEPARATOR = "; " ) AS ?partsLabel ) ( GROUP_CONCAT( DISTINCT ?parent ; SEPARATOR = "|" ) AS ?parents ) ( GROUP_CONCAT( DISTINCT ?parentLabel ; SEPARATOR = "; " ) AS ?parentsLabel ) ( GROUP_CONCAT( DISTINCT ?geolexID ; SEPARATOR = "; " ) AS ?geolexIDs ) WHERE {
  ?unit wdt:P31 / wdt:P279 * wd:Q3550897 .
  {
    ?unit wdt:P131 * wd:Q816 .
  } UNION {
    ?unit wdt:P276 ?loc .
    ?loc wdt:P131 * wd:Q816 .
  }
  OPTIONAL {
    ?unit wdt:P527 ?part .
    ?part rdfs:label ?partLabel .
    FILTER ( LANG( ?partLabel ) = "en" )
  }
  OPTIONAL {
    ?unit wdt:P361 ?parent .
    ?parent rdfs:label ?parentLabel .
    FILTER ( LANG( ?parentLabel ) = "en" )
  }
  OPTIONAL {
    ?unit wdt:P6202 ?geolexID .
  }
  ?unit rdfs:label ?unitLabel .
  FILTER ( LANG( ?unitLabel ) = "en" )
}
GROUP BY ?unit ?unitLabel
ORDER BY ?unitLabel
LIMIT 1000

Using entities:
- lithostratigraphic unit (wd:Q3550897), also known as rock unit: is subclass of stratigraphic unit / geologic unit denoting a specific body of rock based on its lithologic or stratigraphic characteristics
- Arizona (wd:Q816), also known as Ariz., Arizona, United States, AZ, Grand Canyon State, State of Arizona, etc.: is instance of state of the United States / is instance of U.S. state / state of the United States of America / state of the United States of America / state of the United States of America

Using properties:
- located in the administrative territorial entity (wd:P131 as wdt), also known as administrative territorial entity, administrative territory, city, happens in, in, etc.: is subproperty of location / is subproperty of part of / the item is located on the territory of the following administrative entity / the item is located on the territory of the following administrative entity / the item is located on the territory of the following ... the item falls only partially into the administrative entity. / the item is located on the territory of the following ... the item falls only partially into the administrative entity.
- location (wd:P276 as wdt), also known as based in, city, from, held by, in, etc.: location of the item, physical object or event is within. In ... use P131. In case of a distinct terrain feature use P706. / location of the item, physical object or event is within. In ... use P131. In case of a distinct terrain feature use P706. / location of the object, structure or event. In the case of an ... use P706. Use P7153 for locations associated with the object
- 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
- 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))
- has part(s) (wd:P527 as wdt), also known as amalgamation of, assembled from, assembled out of, composed of, comprised of, etc.: part of this subject, also valuable subclass or exemplar. Inverse property of "part of". / part of this subject; inverse property of "part of" (P361). See also "has parts of the class" (P2670). / part of this subject; inverse property of "part of" (P361). See also "has parts of the class" (P2670).
- Geolex ID (wd:P6202 as wdt), also known as GEOLEX ID, Geolex identifier, P6202: ID for every stratigraphic unit in the United States of America (USA) given by the United States Geological Survey / ID for every stratigraphic unit in the United States of America (USA) given by the United States Geological Survey / ID for every stratigraphic unit in the United States of America (USA) given by the United States Geological Survey

Execution result:
Got 143 rows and 7 columns, showing the first 5 and last 5 rows below:
| unit                                 | unitLabel                       | parts | partsLabel                 | parents | parentsLabel                 | geolexIDs        |
| ------------------------------------ | ------------------------------- | ----- | -------------------------- | ------- | ---------------------------- | ---------------- |
| Abrigo Formation (wd:Q75041040)      | Abrigo Formation (lang:en)      |       |                            |         |                              | Abrigo_4501      |
| Amole Arkose (wd:Q17511820)          | Amole Arkose (lang:en)          |       |                            |         |                              |                  |
| Amole Formation (wd:Q4747496)        | Amole Formation (lang:en)       |       |                            |         |                              | Amole_6443       |
| Apache Group (wd:Q65553467)          | Apache Group (lang:en)          |       | Mescal Limestone (lang:en) |         |                              | Apache_6495      |
| Awatubi Member (wd:Q64341523)        | Awatubi Member (lang:en)        |       |                            |         | Kwagunt Formation (lang:en)  | Awatubi_4623     |
| ...                                  | ...                             | ...   | ...                        | ...     | ...                          | ...              |
| West Water Formation (wd:Q98923927)  | West Water Formation (lang:en)  |       |                            |         |                              | WestWater_12326  |
| Wingate Sandstone (wd:Q8025150)      | Wingate Sandstone (lang:en)     |       |                            |         | Glen Canyon Group (lang:en)  | Wingate_11202    |
| Winslow Member (wd:Q61045581)        | Winslow Member (lang:en)        |       |                            |         | Moenkopi Formation (lang:en) | Winslow_11208    |
| Winterhaven Formation (wd:Q97007987) | Winterhaven Formation (lang:en) |       |                            |         |                              | Winterhaven_6295 |
| Wupatki Member (wd:Q61045598)        | Wupatki Member (lang:en)        |       |                            |         | Moenkopi Formation (lang:en) | Wupatki_11243    |

[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 distinct lithostratigraphic units located in Arizona? Please include any parts they have (if available, the larger units they are part of (if available), and their Geolex IDs (if available).

[Assistant]
Plan:
1. Find the Wikidata item for Arizona.
2. Find the class/item for "lithostratigraphic unit" or related (e.g., formation, group, member) to identify relevant instances.
3. Search for properties to detect Geolex ID and for relationships: "has part" (P527) or "part of" (P361), and location properties P131/P17/P276 to constrain to Arizona.
4. Build a SPARQL query that finds lithostratigraphic units with location in Arizona (via P131/P17/P276 or via their geographic coordinates in Arizona), returns their parts (P527), their parent units (P361), and any Geolex ID property found.
I'll start by looking up Arizona and the "lithostratigraphic unit" class, then search for a property for Geolex ID.

Question: Arizona

Top 10 entity alternatives:
1. Arizona (wd:Q816), also known as Ariz., Arizona, United States, AZ, Grand Canyon State, State of Arizona, etc.: is instance of state of the United States / state of the United States of America / state of the United States of America / state of the United States of America / is instance of U.S. state
2. University of Arizona (wd:Q503419, matched via Arizona), also known as Arizona, arizona.edu, Arizona University, AZ, The University of Arizona, etc.: is instance of public educational institution of the United States / public university in Tucson, Arizona, United States / is instance of open-access publisher / is instance of land-grant university / is instance of public university
3. Arizona (wd:Q2254748): municipality in Atlántida Department, Honduras / is instance of municipality of Honduras / human settlement in Honduras / human settlement in Honduras
4. Arizona (wd:Q670059): 1940 film by Wesley Ruggles / is instance of film
5. Arizona (wd:Q634389): 1918 silent film drama / is instance of film
6. Arizona (wd:Q14089080), also known as Glossy snake: is instance of taxon / genus of reptiles
7. Arizona (wd:Q2861452): 1913 film by Augustus Thomas / is instance of Silent film / is instance of silent film / is instance of film
8. Arizona (wd:Q3196815), also known as Men Are Like That: 1931 film by George B. Seitz / is instance of film
9. Arizona (wd:Q4791227): municipality and village in San Luis, Argentina / is instance of municipality / is instance of locality
10. Marcial Lafuente Estefanía (wd:Q2918630, matched via Arizona), also known as Arizona, Cecilia de Iraluce, Dan Lewis, Dan Luce, Marcial Antonio Lafuente Estefanía, etc.: has occupation industrial engineer / has occupation military personnel / has occupation Military personnel / Spanish writer (1903-1984) / has occupation politician / has occupation novelist / has occupation writer / is instance of human

[Assistant]
Now I'll search for the Wikidata item for "lithostratigraphic unit" (and related classes like formation, group, member) to know which items to look for. I'll use search_entity for relevant terms.

Question: lithostratigraphic unit

Top 10 entity alternatives:
1. lithostratigraphic unit (wd:Q3550897), also known as rock unit: geologic unit denoting a specific body of rock based on its lithologic or stratigraphic characteristics / is subclass of stratigraphic unit
2. former lithostratigraphic unit (wd:Q109902873): lithostratigraphic unit that has been superseded by a different unit / is subclass of lithostratigraphic unit / is subclass of former entity
3. sedimentary lithostratigraphic unit (wd:Q28021934): is subclass of complex
4. 1 (wd:Q199, matched via unit), also known as +1, ١, ১, ๑, ①, etc.: is instance of centered dodecahedral number / is instance of pentagonal pyramidal number / is instance of heptagonal pyramidal number / is instance of centered tetrahedral number / is instance of centered icosahedral number / is instance of centered pentachoric number / is instance of centered heptagonal number / is instance of centered octahedral number / is instance of centered triangular number / is instance of hexagonal pyramidal number / is instance of centered pentagonal number / is instance of centered hexagonal number / is instance of centered octagonal number / is instance of centered decagonal number / is instance of centered nonagonal number / is instance of square triangular number / is instance of stella octangula number / is instance of multiplicative identity / is instance of square pyramidal number / is instance of centered square number / is instance of non-negative integer / is instance of centered cube number / is instance of dodecahedral number / is instance of automorphic number / is instance of tetrahedral number / is instance of icosahedral number / is instance of dodecagonal number / is instance of dimensionless unit / is instance of triangular number / is instance of pentagonal number / is instance of heptagonal number / is instance of Fibonacci number / is instance of nonagonal number / is instance of octagonal number / is instance of coherent SI unit / is instance of decagonal number / is instance of pentatope number / is instance of hexagonal number / is instance of Mersenne number / is instance of harshad number / is instance of unit of amount / is instance of natural number / is instance of seventh power / is instance of power of 1000 / is instance of square number / is instance of eighth power / is instance of fourth power / is instance of Power of two / is instance of power of two / is instance of sixth power / is instance of star number / is instance of ninth power / is instance of fifth power / is instance of power of 10 / is instance of odd number / is instance of Repunit / is instance of repunit / is instance of unit / is instance of cube / is instance of {1} / natural number one / natural number / natural number / natural number
5. currency (wd:Q8142, matched via monetary unit), also known as currencies, monetary unit, money unit, unit of money: generally accepted medium of exchange for goods or services / generally accepted medium of exchange for goods or services / generally accepted medium of exchange / is subclass of unit of measurement / is subclass of medium of exchange / is subclass of means of payment / is subclass of money
6. astronomical unit (wd:Q1811), also known as astronomic unit, AU, ua: mean distance between Earth and the Sun, common length reference in astronomy / is instance of non-SI unit mentioned in and accepted with the SI / is instance of SI-accepted non-SI unit / is instance of UCUM derived unit / is instance of Unit of length / is instance of unit of length
7. unit of measurement (wd:Q47574, matched via measurement unit), also known as measurement unit, unit, unit of measure: real scalar quantity, defined and adopted by convention, with ... to express the ratio of the two quantities as a number (VIM) / is subclass of individual quantity / is subclass of scalar quantity / is subclass of measure
8. taxon (wd:Q16521, matched via taxonomic unit), also known as taxa, taxonomic unit: group of one or more organism(s), which a taxonomist adjudges to be a unit / group of one or more organism(s), which a taxonomist adjudges to be a unit / group of one or more organism(s), which a taxonomist adjudges to be a unit / group of one or more organism(s), which a taxonomist adjudges to be a unit / is subclass of group or class of organisms / is instance of second-order class
9. apartment (wd:Q188507, matched via unit), also known as dwelling, flat, flats, unit: self-contained housing unit occupying part of a building / self-contained housing unit occupying part of a building / is subclass of building part / is subclass of residence / is instance of housing
10. warship (wd:Q2031121, matched via naval unit), also known as combatant ship, combatant vessel, naval military unit, naval unit, navy military unit, etc.: a watercraft that is built and primarily intended for naval warfare / is subclass of weapons platform / is subclass of naval vessel / is instance of ship type / is subclass of ship

[Assistant]
I'll search for a Wikidata property that corresponds to Geolex ID (USGS Geolex lexicon identifier).

Question: Geolex

Top 10 property alternatives:
1. Geolex ID (wd:P6202 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as GEOLEX ID, Geolex identifier, P6202: ID for every stratigraphic unit in the United States of America (USA) given by the United States Geological Survey / ID for every stratigraphic unit in the United States of America (USA) given by the United States Geological Survey / ID for every stratigraphic unit in the United States of America (USA) given by the United States Geological Survey
2. type locality (geology) (wd:P2695 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as (co)-type locality, P2695: the locality where a particular rock type, stratigraphic unit ... is defined from (can coincide but not the same as p189)
3. USGS Thesaurus ID (wd:P11095 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via U.S. Geological Survey Thesaurus identifier), also known as United States Geological Survey Thesaurus ID, United States Geological Survey Thesaurus identifier, U.S. Geological Survey Thesaurus ID, US Geological Survey Thesaurus ID, U.S. Geological Survey Thesaurus identifier, etc.: identifier for a term in the USGS Thesaurus
4. Mindat.org Glossary of Mineralogical Terms ID (wd:P11051 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via Mindat Glossary of Mineralogical Terms ID), also known as Glossary of Mineralogical Terms ID, Mindat Glossary of Mineralogical Terms ID, Mindat term ID, P11051: identifier for an entry in the Mindat.org Glossary of Mineralogical Terms
5. GeolISSTerm ID (wd:P10748 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via Geological Terminology and Nomenclature identifier), also known as GeolISSTerm identifier, Geological Terminology and Nomenclature ID, Geological Terminology and Nomenclature identifier, Geološka terminologija i nomenklatura ID, Geološka terminologija i nomenklatura identifier, etc.: identifier for a term in the GeolISSTerm terminology dictionary
6. Geokod (wd:P1172 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as P1172: identifier for historical administrative division of Sweden (1862-1951) / identifier for historical administrative division of Sweden (1862-1951)
7. Trismegistos Geo ID (wd:P1958 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn), also known as TM Geo ID, TM Place ID, TM Places, Trismegistos place ID, P1958: identifier of an ancient place on trismegistos.org
8. Getty Thesaurus of Geographic Names ID (wd:P1667 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via Thesaurus of Geographic Names), also known as TGN ID, TGN identifier, Thesaurus of Geographic Names, P1667: identifier in the Getty Thesaurus of Geographic Names / identifier in the Getty Thesaurus of Geographic Names
9. GSS code (2011) (wd:P836 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via GEOGCD), also known as GEOGCD, GSS code (2009), ONS GSS code (2009), ONS GSS code (2011), ONS ID, etc.: nine-character UK Government Statistical Service code, introduced in 2009 to replace older ONS codes / nine-character UK Government Statistical Service code, introduced in 2009 to replace older ONS codes
10. A Dictionary of Geology and Earth Sciences entry ID (wd:P13266 as pr/psn/wdtn/ps/prn/p/pq/pqv/wdt/prv/psv/pqn, matched via Dictionary of Geology and Earth Sciences entry ID), also known as Dictionary of Geology and Earth Sciences entry ID, P13266: identifier for an entry in online fifth edition of A Dictionary of Geology and Earth Sciences

[Assistant]
I'll search for "geological formation" to see typical classes used for stratigraphic units on Wikidata (so I can include formation/group/member classes if needed).

Question: formation (geology)

Top 10 entity alternatives:
1. Geology of the Kiwikiwi Formation (wd:Q112903066): 2013 doctoral thesis by Andreas Auer at University of Otago / is instance of doctoral thesis / is instance of Thesis
2. Geology of the Uinta formation (wd:Q60706881): scholarly article by E. DOUGLASS published in January 1914 / is instance of scholarly article / is instance of academic article
3. geology (wd:Q1069): study of the composition, structure, physical properties, and ... components, and the processes by which they are shaped / is instance of academic discipline / is instance of branch of science / is subclass of natural science / is instance of field of study / is subclass of earth science / is subclass of Earth science / is instance of specialism / is instance of discipline / is instance of specialty
4. rock (wd:Q8063, matched via rock (geology)), also known as rock (geology), rocks: naturally occurring solid aggregate of one or more minerals or mineraloids / naturally occurring solid aggregate of one or more minerals or mineraloids / is subclass of natural material / is subclass of aggregate
5. cliff (wd:Q107679, matched via cliff formation), also known as bluff, cliff formation, mountain rim, precipice, rock face, etc.: significant vertical, or near vertical, rock exposure / significant vertical, or near vertical, rock exposure / significant vertical, or near vertical, rock exposure / is subclass of escarpment / is subclass of Escarpment / is subclass of landform / is subclass of Landform
6. fertilization (wd:Q14890574, matched via zygote formation), also known as conception, fecundation, fertilisation, generative fertilisation, GO:0009566, etc.: union of gametes of opposite sexes during the process of sexual reproduction to form a zygote / is subclass of reproductive process / is instance of biological process / is subclass of anisogamy
7. glaciology (wd:Q52120, matched via glacial geology), also known as glacial geology: is instance of branch of geology / is instance of field of study / is instance of academic major / is subclass of hydrology / is subclass of geology / study of glaciers
8. cosmogony (wd:Q170835, matched via universe formation), also known as origin of the universe, universe formation, universe origin: branch of science or a theory concerning the origin of the universe / is instance of branch of science / is subclass of aspect of history / is instance of source type / is subclass of Cosmology / is subclass of mythology / is subclass of cosmology
9. protein biosynthesis (wd:Q211935, matched via protein formation), also known as GO:0006412, protein anabolism, protein biosynthetic process, protein formation, protein synthesis, etc.: cellular metabolic process in which a protein is formed, ... to specify the sequence of amino acids in a polypeptide chain / is subclass of cellular macromolecule biosynthetic process / is subclass of peptide biosynthetic process / is subclass of protein metabolic process / is instance of biological process / is subclass of polymerization / is subclass of polymerisation
10. fold (wd:Q81659, matched via folding (geology)), also known as folding (geology), folds (geology): is subclass of geological structure / geological structure / geological structure / is subclass of fold

[Assistant]
I'll run an initial SPARQL query to retrieve lithostratigraphic units (instance of or subclass of "lithostratigraphic unit") that are located in Arizona, along with optional parts, parent units, and Geolex ID. This will check how many results we get and whether P6202 (Geolex ID) is populated.

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#>

SELECT DISTINCT ?unit ?unitLabel ?part ?partLabel ?parent ?parentLabel ?geolexID WHERE {
  ?unit wdt:P31/wdt:P279* wd:Q3550897 .
  {
    ?unit wdt:P131* wd:Q816 .
  } UNION {
    ?unit wdt:P276 ?loc . ?loc wdt:P131* wd:Q816 .
  }
  OPTIONAL {
    ?unit wdt:P527 ?part .
    ?part rdfs:label ?partLabel . FILTER(LANG(?partLabel)="en")
  }
  OPTIONAL {
    ?unit wdt:P361 ?parent .
    ?parent rdfs:label ?parentLabel . FILTER(LANG(?parentLabel)="en")
  }
  OPTIONAL { ?unit wdt:P6202 ?geolexID . }
  ?unit rdfs:label ?unitLabel . FILTER(LANG(?unitLabel)="en")
}
LIMIT 500

Got 205 rows and 7 columns, showing the first 5 and last 5 rows below:
| unit                                       | unitLabel                            | part                                       | partLabel                            | parent                           | parentLabel                | geolexID            |
| ------------------------------------------ | ------------------------------------ | ------------------------------------------ | ------------------------------------ | -------------------------------- | -------------------------- | ------------------- |
| Ignacio Quartzite (wd:Q100366128)          | Ignacio Quartzite (lang:en)          |                                            |                                      |                                  |                            | Ignacio_8917        |
| McCracken Sandstone Member (wd:Q100366180) | McCracken Sandstone Member (lang:en) |                                            |                                      | Elbert Formation (wd:Q100366213) | Elbert Formation (lang:en) |                     |
| Elbert Formation (wd:Q100366213)           | Elbert Formation (lang:en)           | McCracken Sandstone Member (wd:Q100366180) | McCracken Sandstone Member (lang:en) |                                  |                            | Elbert_7602         |
| Mazatzal Quartzite (wd:Q104772138)         | Mazatzal Quartzite (lang:en)         |                                            |                                      |                                  |                            | Mazatzal_16177      |
| Chinle Formation (wd:Q1074382)             | Chinle Formation (lang:en)           | Petrified Forest Member (wd:Q18158472)     | Petrified Forest Member (lang:en)    |                                  |                            | Chinle_4997         |
| ...                                        | ...                                  | ...                                        | ...                                  | ...                              | ...                        | ...                 |
| Mount Wrightson Formation (wd:Q96623554)   | Mount Wrightson Formation (lang:en)  |                                            |                                      |                                  |                            | MountWrightson_6082 |
| McCoy Mountains Formation (wd:Q97000922)   | McCoy Mountains Formation (lang:en)  |                                            |                                      |                                  |                            | McCoyMountains_8765 |
| Winterhaven Formation (wd:Q97007987)       | Winterhaven Formation (lang:en)      |                                            |                                      |                                  |                            | Winterhaven_6295    |
| Hualapai Limestone (wd:Q97376061)          | Hualapai Limestone (lang:en)         |                                            |                                      |                                  |                            | Hualapai_8570       |
| West Water Formation (wd:Q98923927)        | West Water Formation (lang:en)       |                                            |                                      |                                  |                            | WestWater_12326     |

[Assistant]
I will run a refined SPARQL query that groups results per lithostratigraphic unit, concatenating the IRIs and English labels of their parts and parent units, and aggregating Geolex IDs. This returns one row per unit (with its IRI) and includes the requested fields. I'll run the query now.

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#>

SELECT ?unit ?unitLabel
       (GROUP_CONCAT(DISTINCT ?part; SEPARATOR="|") AS ?parts)
       (GROUP_CONCAT(DISTINCT ?partLabel; SEPARATOR="; ") AS ?partsLabel)
       (GROUP_CONCAT(DISTINCT ?parent; SEPARATOR="|") AS ?parents)
       (GROUP_CONCAT(DISTINCT ?parentLabel; SEPARATOR="; ") AS ?parentsLabel)
       (GROUP_CONCAT(DISTINCT ?geolexID; SEPARATOR="; ") AS ?geolexIDs)
WHERE {
  ?unit wdt:P31/wdt:P279* wd:Q3550897 .
  {
    ?unit wdt:P131* wd:Q816 .
  } UNION {
    ?unit wdt:P276 ?loc . ?loc wdt:P131* wd:Q816 .
  }
  OPTIONAL {
    ?unit wdt:P527 ?part .
    ?part rdfs:label ?partLabel . FILTER(LANG(?partLabel)="en")
  }
  OPTIONAL {
    ?unit wdt:P361 ?parent .
    ?parent rdfs:label ?parentLabel . FILTER(LANG(?parentLabel)="en")
  }
  OPTIONAL { ?unit wdt:P6202 ?geolexID . }
  ?unit rdfs:label ?unitLabel . FILTER(LANG(?unitLabel)="en")
}
GROUP BY ?unit ?unitLabel
ORDER BY ?unitLabel
LIMIT 1000

Got 143 rows and 7 columns, showing the first 5 and last 5 rows below:
| unit                                 | unitLabel                       | parts | partsLabel                 | parents | parentsLabel                 | geolexIDs        |
| ------------------------------------ | ------------------------------- | ----- | -------------------------- | ------- | ---------------------------- | ---------------- |
| Abrigo Formation (wd:Q75041040)      | Abrigo Formation (lang:en)      |       |                            |         |                              | Abrigo_4501      |
| Amole Arkose (wd:Q17511820)          | Amole Arkose (lang:en)          |       |                            |         |                              |                  |
| Amole Formation (wd:Q4747496)        | Amole Formation (lang:en)       |       |                            |         |                              | Amole_6443       |
| Apache Group (wd:Q65553467)          | Apache Group (lang:en)          |       | Mescal Limestone (lang:en) |         |                              | Apache_6495      |
| Awatubi Member (wd:Q64341523)        | Awatubi Member (lang:en)        |       |                            |         | Kwagunt Formation (lang:en)  | Awatubi_4623     |
| ...                                  | ...                             | ...   | ...                        | ...     | ...                          | ...              |
| West Water Formation (wd:Q98923927)  | West Water Formation (lang:en)  |       |                            |         |                              | WestWater_12326  |
| Wingate Sandstone (wd:Q8025150)      | Wingate Sandstone (lang:en)     |       |                            |         | Glen Canyon Group (lang:en)  | Wingate_11202    |
| Winslow Member (wd:Q61045581)        | Winslow Member (lang:en)        |       |                            |         | Moenkopi Formation (lang:en) | Winslow_11208    |
| Winterhaven Formation (wd:Q97007987) | Winterhaven Formation (lang:en) |       |                            |         |                              | Winterhaven_6295 |
| Wupatki Member (wd:Q61045598)        | Wupatki Member (lang:en)        |       |                            |         | Moenkopi Formation (lang:en) | Wupatki_11243    |

[Assistant]
I'll finalize by returning the final SPARQL query I executed and a short summary of the results (count, columns returned, and caveats).

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#>

SELECT ?unit ?unitLabel
       (GROUP_CONCAT(DISTINCT ?part; SEPARATOR="|") AS ?parts)
       (GROUP_CONCAT(DISTINCT ?partLabel; SEPARATOR="; ") AS ?partsLabel)
       (GROUP_CONCAT(DISTINCT ?parent; SEPARATOR="|") AS ?parents)
       (GROUP_CONCAT(DISTINCT ?parentLabel; SEPARATOR="; ") AS ?parentsLabel)
       (GROUP_CONCAT(DISTINCT ?geolexID; SEPARATOR="; ") AS ?geolexIDs)
WHERE {
  ?unit wdt:P31/wdt:P279* wd:Q3550897 .
  {
    ?unit wdt:P131* wd:Q816 .
  } UNION {
    ?unit wdt:P276 ?loc . ?loc wdt:P131* wd:Q816 .
  }
  OPTIONAL {
    ?unit wdt:P527 ?part .
    ?part rdfs:label ?partLabel . FILTER(LANG(?partLabel)="en")
  }
  OPTIONAL {
    ?unit wdt:P361 ?parent .
    ?parent rdfs:label ?parentLabel . FILTER(LANG(?parentLabel)="en")
  }
  OPTIONAL { ?unit wdt:P6202 ?geolexID . }
  ?unit rdfs:label ?unitLabel . FILTER(LANG(?unitLabel)="en")
}
GROUP BY ?unit ?unitLabel
ORDER BY ?unitLabel
LIMIT 1000

Answer:
I executed the SPARQL query above on Wikidata.

Summary of results:
- Number of distinct lithostratigraphic units returned: 143 rows.
- Columns returned per row:
  - unit: the Wikidata item IRI for the lithostratigraphic unit (e.g., wd:Q1074382)
  - unitLabel: English label for the unit
  - parts: pipe-separated IRIs of items that are 'has part' (P527) of the unit (if any)
  - partsLabel: English labels of those parts (semicolon-separated)
  - parents: pipe-separated IRIs of items that the unit is 'part of' (P361) (if any)
  - parentsLabel: English labels of those parent units (semicolon-separated)
  - geolexIDs: Geolex ID(s) from property P6202 (semicolon-separated if multiple)

Notes and caveats:
- Location detection used administrative-location and location properties: items that have an administrative parent chain (P131*) to Arizona (wd:Q816) or that have a location (P276) whose administrative parent chain includes Arizona. Some geological units that are relevant to Arizona may lack P131/P276 statements and thus might not appear.
- The query selects items that are instance of (P31) or subclassed instances of the class 'lithostratigraphic unit' (wd:Q3550897). This captures formations, members, groups, etc., but some items might be classified differently in Wikidata and could be missed.
- Geolex IDs are present for many US stratigraphic units (property P6202), but not every unit has this property populated.

If you want:
- I can return the full result table as CSV/TSV.
- I can expand the location matching (for example, include units with coordinates inside Arizona’s bounding box) to try to find additional units that lack P131/P276.
- I can filter for a specific subtype (e.g., only formations or only members) or sort by whether they have Geolex IDs.

If you’d like the raw results file (CSV) or further refinements, tell me which format or filter you prefer.