PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?municipality ?type ?enLabel ?esLabel WHERE {
  ?municipality wdt:P131 * wd:Q7194 .
  ?municipality wdt:P31 ?type .
  ?type wdt:P279 * wd:Q2074737 .
  OPTIONAL {
    ?municipality rdfs:label ?enLabel .
    FILTER ( LANG( ?enLabel ) = "en" )
  }
  OPTIONAL {
    ?municipality rdfs:label ?esLabel .
    FILTER ( LANG( ?esLabel ) = "es" )
  }
}
ORDER BY COALESCE ( ?enLabel , ?esLabel )

Using entities:
- municipality of Spain (wd:Q2074737), also known as Municipality of Spain, municipio de España, Spanish municipality: is subclass of LAU 2 / is subclass of municipality / is subclass of municipio / is subclass of administrative territorial entity of Spain / is subclass of third-order administrative division / administrative territorial entity of Spain
- Province of Girona (wd:Q7194): is instance of province of Spain / is instance of Spanish provinces / province of Catalonia, Spain

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

Got 233 rows and 4 columns, showing the first 5 and last 5 rows below:
| municipality               | type                                     | enLabel                  | esLabel                  |
| -------------------------- | ---------------------------------------- | ------------------------ | ------------------------ |
| Agullana (wd:Q6622)        | municipality of Catalonia (wd:Q33146843) | Agullana (lang:en)       | Agullana (lang:es)       |
| Aiguaviva (wd:Q13412)      | municipality of Catalonia (wd:Q33146843) | Aiguaviva (lang:en)      | Aiguaviva (lang:es)      |
| Albanyà (wd:Q10973)        | municipality of Catalonia (wd:Q33146843) | Albanyà (lang:en)        | Albañá (lang:es)         |
| Albons (wd:Q13463)         | municipality of Catalonia (wd:Q33146843) | Albons (lang:en)         | Albons (lang:es)         |
| Alp (wd:Q13731)            | municipality of Catalonia (wd:Q33146843) | Alp (lang:en)            | Alp (lang:es)            |
| ...                        | ...                                      | ...                      | ...                      |
| Vilanant (wd:Q12173)       | municipality of Catalonia (wd:Q33146843) | Vilanant (lang:en)       | Vilanant (lang:es)       |
| Vila-sacra (wd:Q1043496)   | municipality of Catalonia (wd:Q33146843) | Vila-sacra (lang:en)     | Vilasacra (lang:es)      |
| Vilaür (wd:Q12177)         | municipality of Catalonia (wd:Q33146843) | Vilaür (lang:en)         | Vilahur (lang:es)        |
| Vilobí d'Onyar (wd:Q13718) | municipality of Catalonia (wd:Q33146843) | Vilobí d'Onyar (lang:en) | Viloví de Oñar (lang:es) |
| Vilopriu (wd:Q13585)       | municipality of Catalonia (wd:Q33146843) | Vilopriu (lang:en)       | Vilopriu (lang:es)       |

Answer: I found 233 municipalities in the Province of Girona, Spain. The SPARQL query above returns their Wikidata IRIs and optional English and Spanish labels; when executed it returned 233 rows. If you’d like, I can return just the list of municipality names (English or Spanish), provide the IRIs only, or export the results as CSV.

I found 233 municipalities in the Province of Girona, Spain. The SPARQL query above returns their Wikidata IRIs and optional English and Spanish labels; when executed it returned 233 rows. If you’d like, I can return just the list of municipality names (English or Spanish), provide the IRIs only, or export the results as CSV.

SPARQL query over wikidata:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?municipality ?type ?enLabel ?esLabel WHERE {
  ?municipality wdt:P131 * wd:Q7194 .
  ?municipality wdt:P31 ?type .
  ?type wdt:P279 * wd:Q2074737 .
  OPTIONAL {
    ?municipality rdfs:label ?enLabel .
    FILTER ( LANG( ?enLabel ) = "en" )
  }
  OPTIONAL {
    ?municipality rdfs:label ?esLabel .
    FILTER ( LANG( ?esLabel ) = "es" )
  }
}
ORDER BY COALESCE ( ?enLabel , ?esLabel )

Using entities:
- municipality of Spain (wd:Q2074737), also known as Municipality of Spain, municipio de España, Spanish municipality: is subclass of LAU 2 / is subclass of municipality / is subclass of municipio / is subclass of administrative territorial entity of Spain / is subclass of third-order administrative division / administrative territorial entity of Spain
- Province of Girona (wd:Q7194): is instance of province of Spain / is instance of Spanish provinces / province of Catalonia, Spain

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

Execution result:
Got 233 rows and 4 columns, showing the first 5 and last 5 rows below:
| municipality               | type                                     | enLabel                  | esLabel                  |
| -------------------------- | ---------------------------------------- | ------------------------ | ------------------------ |
| Agullana (wd:Q6622)        | municipality of Catalonia (wd:Q33146843) | Agullana (lang:en)       | Agullana (lang:es)       |
| Aiguaviva (wd:Q13412)      | municipality of Catalonia (wd:Q33146843) | Aiguaviva (lang:en)      | Aiguaviva (lang:es)      |
| Albanyà (wd:Q10973)        | municipality of Catalonia (wd:Q33146843) | Albanyà (lang:en)        | Albañá (lang:es)         |
| Albons (wd:Q13463)         | municipality of Catalonia (wd:Q33146843) | Albons (lang:en)         | Albons (lang:es)         |
| Alp (wd:Q13731)            | municipality of Catalonia (wd:Q33146843) | Alp (lang:en)            | Alp (lang:es)            |
| ...                        | ...                                      | ...                      | ...                      |
| Vilanant (wd:Q12173)       | municipality of Catalonia (wd:Q33146843) | Vilanant (lang:en)       | Vilanant (lang:es)       |
| Vila-sacra (wd:Q1043496)   | municipality of Catalonia (wd:Q33146843) | Vila-sacra (lang:en)     | Vilasacra (lang:es)      |
| Vilaür (wd:Q12177)         | municipality of Catalonia (wd:Q33146843) | Vilaür (lang:en)         | Vilahur (lang:es)        |
| Vilobí d'Onyar (wd:Q13718) | municipality of Catalonia (wd:Q33146843) | Vilobí d'Onyar (lang:en) | Viloví de Oñar (lang:es) |
| Vilopriu (wd:Q13585)       | municipality of Catalonia (wd:Q33146843) | Vilopriu (lang:en)       | Vilopriu (lang:es)       |

[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 municipalities in the Province of Girona, Spain?

[Assistant]
Step 1 — identify candidate entities/properties:
- I need the entity for the Province of Girona (Spain) and the property that links municipalities to provinces (administrative territorial entity). Candidate properties: P17 (country), P31 (instance of), P131 (located in administrative territorial entity), P131* for admin hierarchy. In Spain municipalities are "municipality" wd:Q15284 or "municipality of Spain"? Common pattern: ?municipality wdt:P31 wd:Q15284 and ?municipality wdt:P131* wd:Q8278 (Girona province). I'll search for the Girona province entity first.

I'll now search Wikidata for "Girona" to find the correct entity.

Question: Girona province

Top 10 entity alternatives:
1. Province of Girona (wd:Q7194): is instance of Spanish provinces / is instance of province of Spain / province of Catalonia, Spain
2. flag of Girona Province (wd:Q41534500, matched via Girona Province flag), also known as flag of the province of Girona, Girona Province flag: flag used by the province of Girona, Catalonia / is instance of flag of a country subdivision
3. Province Court of Girona (wd:Q11907202), also known as Audiencia Provincial de Girona, Audiencia Provincial of Girona: is instance of province court of Spain
4. Jakarta (wd:Q3630, matched via Jakarta Province), also known as Djakarta, DKI Jakarta, Jakarta, Indonesia, Jakarta Province, Special Capital Region of Jakarta, etc.: city and smallest province of Indonesia / is instance of former national capital / is instance of province of Indonesia / is instance of largest city / is instance of global city / is instance of metropolis / is instance of Metropolis / is instance of megacity
5. Quebec (wd:Q176, matched via Quebec Province), also known as CA-QC, P.Q., PQ, Province of Quebec, QC, etc.: is instance of province of Canada / province of Canada / province of Canada
6. Xinjiang (wd:Q34800, matched via Xinjiang Province), also known as Chinese Northwest, Chinese Turkestan, CN-65, Hsin-chiang, Northwest, etc.: is instance of autonomous region / autonomous region in China
7. province (wd:Q34876), also known as provinces: administrative division in several countries or states / is instance of administrative territorial entity type / is subclass of administrative territorial entity / administrative division in several countries
8. New Brunswick (wd:Q1965, matched via Picture Province), also known as CA-NB, N.B., NB, Picture Province, Province of New Brunswick: is instance of province of Canada / province of Canada / province of Canada
9. Sichuan (wd:Q19770, matched via Sichuan Province), also known as Ba, Hua-hsi, Huahsi, Huaxi, Province of Sichuan, etc.: province of China, previously inclusive of the present Chongqing Municipality / is instance of province of China / is instance of province
10. Hainan (wd:Q42200, matched via Hainan province), also known as Hainan province: is instance of first-level administrative division / is instance of province of China / is instance of province / province of China

[Assistant]
I'll run a SPARQL query that finds items which are instance of (P31) "municipality of Spain" (wd:Q15284) and that are located in the administrative hierarchy (wdt:P131*) of the Province of Girona (wd:Q7194). I'll return the item IRIs plus optional English and Spanish labels so we have readable names even when an English label is missing. I'll order by label. Now I'll execute the query to get the actual list.

execute

SELECT ?municipality ?enLabel ?esLabel WHERE {
  ?municipality wdt:P31 wd:Q15284 .
  ?municipality wdt:P131* wd:Q7194 .
  OPTIONAL { ?municipality rdfs:label ?enLabel . FILTER(LANG(?enLabel) = "en") }
  OPTIONAL { ?municipality rdfs:label ?esLabel . FILTER(LANG(?esLabel) = "es") }
}
ORDER BY COALESCE(?enLabel, ?esLabel)

[Assistant]
The previous query returned no rows — perhaps the items use a different instance-of for Spanish municipalities. I'll search for suitable class for municipalities (e.g., "municipality", "municipality of Spain"). I'll look up the entity for Spanish municipality.

Question: municipality of Spain

Top 10 entity alternatives:
1. municipality of Spain (wd:Q2074737), also known as Municipality of Spain, municipio de España, Spanish municipality: is subclass of administrative territorial entity of Spain / is subclass of third-order administrative division / administrative territorial entity of Spain / is subclass of municipality / is subclass of municipio / is subclass of LAU 2
2. former municipality of Spain (wd:Q55863584): is subclass of former administrative territorial entity / is subclass of municipality of Spain / is subclass of former municipality
3. Spain (wd:Q29, matched via Kingdom of Spain), also known as Kingdom of Spain: country in southwestern Europe with territories in Africa / constitutional monarchy in Southwest Europe / constitutional monarchy in Southwest Europe / is instance of Mediterranean country / is instance of sovereign state / is instance of country / is instance of realm
4. Shanghai (wd:Q8686, matched via Municipality of Shanghai), also known as Hu, Municipality of Shanghai, Pearl of the Orient, Shanghae, Shang-hai, etc.: is instance of Economic and Technological Development Zones / is instance of direct-administered municipality / provincial-level municipality in China / is instance of national central city / is instance of largest city / is instance of global city / is instance of metropolis / is instance of Metropolis / is instance of port city / is instance of big city / is instance of megacity
5. Tianjin (wd:Q11736, matched via Municipality of Tianjin), also known as Municipality of Tianjin, Tianjin Municipality, Tien-tsin, Tientsin: is instance of Economic and Technological Development Zones / is instance of direct-administered municipality / is instance of national central city / is instance of port city / is instance of big city / is instance of megacity / municipality of China / is instance of city
6. Córdoba (wd:Q5818, matched via Municipality of Cordova), also known as Cordoba, Cordova, Cordova municipality, Municipality of Cordova: municipality in the province of Córdoba, Spain / is instance of municipality of Spain / city in Andalusia, southern Spain
7. Port of Spain (wd:Q39178), also known as Cumucurapo, Port-of-Spain, Puerto España: is instance of regional corporation or municipality of Trinidad and Tobago / is instance of political territorial entity / capital of Trinidad and Tobago / is instance of city
8. Anchorage (wd:Q39450, matched via Municipality of Anchorage), also known as Anchorage, Alaska, Municipality of Anchorage, The City of Lights and Flowers: consolidated city-borough in Alaska, United States of America / is instance of city in the United States / is instance of city of the United States / is instance of consolidated city-county / is instance of big city
9. Toledo (wd:Q5836, matched via Municipality of Toledo), also known as Municipality of Toledo, Toledo, Castile-La Mancha, Toledo municipality, Toledo Municipality, Toledo, Spain: is instance of municipality of Spain / municipality in central Spain / municipality in central Spain / municipality in central Spain / is instance of city
10. Nijmegen (wd:Q47887, matched via Municipality of Nijmegen), also known as Gemeente Nijmegen, Municipality of Nijmegen, Nimeguen: is instance of municipality of the Netherlands / municipality in Gelderland, Netherlands / is instance of government department / is instance of government agency

[Assistant]
I'll run a refined query using the class "municipality of Spain" (wd:Q2074737) and the Province of Girona (wd:Q7194). I'm including optional English and Spanish labels and ordering by whichever label exists.

SELECT ?municipality ?enLabel ?esLabel WHERE {
  ?municipality wdt:P31 wd:Q2074737 .
  ?municipality wdt:P131* wd:Q7194 .
  OPTIONAL { ?municipality rdfs:label ?enLabel . FILTER(LANG(?enLabel) = "en") }
  OPTIONAL { ?municipality rdfs:label ?esLabel . FILTER(LANG(?esLabel) = "es") }
}
ORDER BY COALESCE(?enLabel, ?esLabel)

Got 7 rows and 3 columns:
| municipality                         | enLabel                            | esLabel                           |
| ------------------------------------ | ---------------------------------- | --------------------------------- |
| Camós (wd:Q5495)                     | Camós (lang:en)                    | Camós (lang:es)                   |
| Les Llosses (wd:Q12275)              | Les Llosses (lang:en)              | Las Llosas (lang:es)              |
| Sales de Llierca (wd:Q12643)         | Sales de Llierca (lang:en)         | Sales de Llierca (lang:es)        |
| Sant Ferriol (wd:Q12671)             | Sant Ferriol (lang:en)             | San Ferreol (lang:es)             |
| Sant Miquel de Campmajor (wd:Q13612) | Sant Miquel de Campmajor (lang:en) | San Miguel de Campmajor (lang:es) |
| Vall-llobrega (wd:Q13587)            | Vall-llobrega (lang:en)            | Vall-llobrega (lang:es)           |
| Vilablareix (wd:Q13457)              | Vilablareix (lang:en)              | Vilablareix (lang:es)             |

[Assistant]
I'll run a query that finds items located (P131*) in Girona (wd:Q7194) whose P31 (instance of) type is itself a subclass (P279*) of "municipality of Spain" (wd:Q2074737). This should capture municipalities that use varying P31 values. I'll execute it now.

SELECT DISTINCT ?municipality ?type ?enLabel ?esLabel WHERE {
  ?municipality wdt:P131* wd:Q7194 .
  ?municipality wdt:P31 ?type .
  ?type wdt:P279* wd:Q2074737 .
  OPTIONAL { ?municipality rdfs:label ?enLabel . FILTER(LANG(?enLabel) = "en") }
  OPTIONAL { ?municipality rdfs:label ?esLabel . FILTER(LANG(?esLabel) = "es") }
}
ORDER BY COALESCE(?enLabel, ?esLabel)

Got 233 rows and 4 columns, showing the first 5 and last 5 rows below:
| municipality               | type                                     | enLabel                  | esLabel                  |
| -------------------------- | ---------------------------------------- | ------------------------ | ------------------------ |
| Agullana (wd:Q6622)        | municipality of Catalonia (wd:Q33146843) | Agullana (lang:en)       | Agullana (lang:es)       |
| Aiguaviva (wd:Q13412)      | municipality of Catalonia (wd:Q33146843) | Aiguaviva (lang:en)      | Aiguaviva (lang:es)      |
| Albanyà (wd:Q10973)        | municipality of Catalonia (wd:Q33146843) | Albanyà (lang:en)        | Albañá (lang:es)         |
| Albons (wd:Q13463)         | municipality of Catalonia (wd:Q33146843) | Albons (lang:en)         | Albons (lang:es)         |
| Alp (wd:Q13731)            | municipality of Catalonia (wd:Q33146843) | Alp (lang:en)            | Alp (lang:es)            |
| ...                        | ...                                      | ...                      | ...                      |
| Vilanant (wd:Q12173)       | municipality of Catalonia (wd:Q33146843) | Vilanant (lang:en)       | Vilanant (lang:es)       |
| Vila-sacra (wd:Q1043496)   | municipality of Catalonia (wd:Q33146843) | Vila-sacra (lang:en)     | Vilasacra (lang:es)      |
| Vilaür (wd:Q12177)         | municipality of Catalonia (wd:Q33146843) | Vilaür (lang:en)         | Vilahur (lang:es)        |
| Vilobí d'Onyar (wd:Q13718) | municipality of Catalonia (wd:Q33146843) | Vilobí d'Onyar (lang:en) | Viloví de Oñar (lang:es) |
| Vilopriu (wd:Q13585)       | municipality of Catalonia (wd:Q33146843) | Vilopriu (lang:en)       | Vilopriu (lang:es)       |

[Assistant]
Final query returns 233 municipalities (Wikidata IRIs plus optional English/Spanish labels). I'll provide the SPARQL I executed and summarize the result. If you want the plain list of names or a CSV, I can produce that next.

answer

SELECT DISTINCT ?municipality ?type ?enLabel ?esLabel WHERE {
  ?municipality wdt:P131* wd:Q7194 .
  ?municipality wdt:P31 ?type .
  ?type wdt:P279* wd:Q2074737 .
  OPTIONAL { ?municipality rdfs:label ?enLabel . FILTER(LANG(?enLabel) = "en") }
  OPTIONAL { ?municipality rdfs:label ?esLabel . FILTER(LANG(?esLabel) = "es") }
}
ORDER BY COALESCE(?enLabel, ?esLabel)

Answer: I found 233 municipalities in the Province of Girona, Spain. The SPARQL query above returns their Wikidata IRIs and optional English and Spanish labels; when executed it returned 233 rows. If you’d like, I can return just the list of municipality names (English or Spanish), provide the IRIs only, or export the results as CSV.


PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?class ?classLabel ?prop ?propLabel ?propType ?propTypeLabel ?propSubjectItem ?propSubjectItemLabel ?constraint ?constraintLabel WHERE {
  ?class wdt:P1963 ?prop .
  OPTIONAL {
    ?class rdfs:label ?classLabel .
    FILTER ( LANG( ?classLabel ) = "en" )
  }
  OPTIONAL {
    ?prop rdfs:label ?propLabel .
    FILTER ( LANG( ?propLabel ) = "en" )
  }
  OPTIONAL {
    ?prop wdt:P31 ?propType .
    OPTIONAL {
      ?propType rdfs:label ?propTypeLabel .
      FILTER ( LANG( ?propTypeLabel ) = "en" )
    }
  }
  OPTIONAL {
    ?prop wdt:P1629 ?propSubjectItem .
    OPTIONAL {
      ?propSubjectItem rdfs:label ?propSubjectItemLabel .
      FILTER ( LANG( ?propSubjectItemLabel ) = "en" )
    }
  }
  OPTIONAL {
    ?prop wdt:P2302 ?constraint .
    OPTIONAL {
      ?constraint rdfs:label ?constraintLabel .
      FILTER ( LANG( ?constraintLabel ) = "en" )
    }
  }
}
LIMIT 500

Using properties:
- Wikidata item of this property (wd:P1629 as wdt), also known as associated item, item, item for this property, item of this property, property's subject item, etc.: item corresponding to the concept represented by the property / relationship represented by the property
- properties for this type (wd:P1963 as wdt), also known as has properties, has property, properties for this class, property for this class, property for this type, etc.: when this subject is used as object of “instance of”, the following properties normally apply / when this subject is used as object of “instance of”, the following properties normally apply
- property constraint (wd:P2302 as wdt), also known as constraint, rdfs:domain, rdfs:range, P2302: constraint applicable to a Wikidata property / constraint applicable to this Wikidata property / constraint applicable to this Wikidata property
- 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 500 rows and 10 columns, showing the first 5 and last 5 rows below:
| class                    | classLabel           | prop     | propLabel                          | propType                                                             | propTypeLabel                                                   | propSubjectItem          | propSubjectItemLabel | constraint                                        | constraintLabel                              |
| ------------------------ | -------------------- | -------- | ---------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------ | -------------------- | ------------------------------------------------- | -------------------------------------------- |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | item-requires-statement constraint (wd:Q21503247) | item-requires-statement constraint (lang:en) |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | allowed qualifiers constraint (wd:Q21510851)      | allowed qualifiers constraint (lang:en)      |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | value-type constraint (wd:Q21510865)              | value-type constraint (lang:en)              |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | allowed-entity-types constraint (wd:Q52004125)    | allowed-entity-types constraint (lang:en)    |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | property scope constraint (wd:Q53869507)          | property scope constraint (lang:en)          |
| ...                      | ...                  | ...      | ...                                | ...                                                                  | ...                                                             | ...                      | ...                  | ...                                               | ...                                          |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | item-requires-statement constraint (wd:Q21503247) | item-requires-statement constraint (lang:en) |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | subject type constraint (wd:Q21503250)            | subject type constraint (lang:en)            |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | allowed-entity-types constraint (wd:Q52004125)    | allowed-entity-types constraint (lang:en)    |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | property scope constraint (wd:Q53869507)          | property scope constraint (lang:en)          |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2896 | publication interval (lang:en)     | Wikidata property related to time and duration (wd:Q51077473)        | Wikidata property related to time and duration (lang:en)        | frequency (wd:Q65772587) | frequency (lang:en)  | subject type constraint (wd:Q21503250)            | subject type constraint (lang:en)            |

Answer:
Final SPARQL query (above) executed successfully. Summary of findings:

- The property "properties for this type" is P1963 (wdt:P1963). The query returns items (?class) that use this property and, for each value (?prop), retrieves characteristics of that property where available:
  - ?propType (wdt:P31) — the instance-of/type of the property item, with English label (e.g., "Wikidata property about Wikidata entities themselves");
  - ?propSubjectItem (wdt:P1629) — the Wikidata item associated with the property (when present), with label;
  - ?constraint (wdt:P2302) — property constraints declared on the property (when present), with English label (e.g., "value-type constraint", "allowed-entity-types constraint", "item-requires-statement constraint").

- Example rows from the results (illustrative):
  - periodical (wd:Q1002697) — has P1963 values including:
    - wd:P2768 ("BNE periodical OID"): its P31 indicates it is a Wikidata property for authority control; constraints on it include item-requires-statement, subject type constraint, allowed-entity-types constraint, and property scope constraint.
    - wd:P2896 ("publication interval"): the property has a P31 indicating relation to time/duration and a P1629 pointing to frequency (wd:Q65772587); it has subject type constraint, etc.
  - Several property items list constraint types via P2302 such as "item-requires-statement constraint", "allowed qualifiers constraint", "value-type constraint", "allowed-entity-types constraint", and "property scope constraint".

Notes and interpretation guidance:
- ?class is the item that states which properties normally apply to instances of that class via P1963.
- ?prop is the property item that is recommended/related for that class.
- Constraints (P2302) describe usage rules or validation checks for the property; these are themselves items (the query returns their labels).
- Not all properties have all characteristics; the query uses OPTIONAL to return what is available.

If you want any of the following, I can refine the query:
- Remove rows where ?class has no English label, or only return classes with English labels.
- Expand to include more property characteristics (e.g., property creation date, property proposals, or qualifiers attached to the P2302 statements).
- Return results grouped by class with GROUP_CONCAT for compact output.

Would you like the full result table (CSV) for further inspection or a refined view (e.g., grouped by class)?

Final SPARQL query (above) executed successfully. Summary of findings:

- The property "properties for this type" is P1963 (wdt:P1963). The query returns items (?class) that use this property and, for each value (?prop), retrieves characteristics of that property where available:
  - ?propType (wdt:P31) — the instance-of/type of the property item, with English label (e.g., "Wikidata property about Wikidata entities themselves");
  - ?propSubjectItem (wdt:P1629) — the Wikidata item associated with the property (when present), with label;
  - ?constraint (wdt:P2302) — property constraints declared on the property (when present), with English label (e.g., "value-type constraint", "allowed-entity-types constraint", "item-requires-statement constraint").

- Example rows from the results (illustrative):
  - periodical (wd:Q1002697) — has P1963 values including:
    - wd:P2768 ("BNE periodical OID"): its P31 indicates it is a Wikidata property for authority control; constraints on it include item-requires-statement, subject type constraint, allowed-entity-types constraint, and property scope constraint.
    - wd:P2896 ("publication interval"): the property has a P31 indicating relation to time/duration and a P1629 pointing to frequency (wd:Q65772587); it has subject type constraint, etc.
  - Several property items list constraint types via P2302 such as "item-requires-statement constraint", "allowed qualifiers constraint", "value-type constraint", "allowed-entity-types constraint", and "property scope constraint".

Notes and interpretation guidance:
- ?class is the item that states which properties normally apply to instances of that class via P1963.
- ?prop is the property item that is recommended/related for that class.
- Constraints (P2302) describe usage rules or validation checks for the property; these are themselves items (the query returns their labels).
- Not all properties have all characteristics; the query uses OPTIONAL to return what is available.

If you want any of the following, I can refine the query:
- Remove rows where ?class has no English label, or only return classes with English labels.
- Expand to include more property characteristics (e.g., property creation date, property proposals, or qualifiers attached to the P2302 statements).
- Return results grouped by class with GROUP_CONCAT for compact output.

Would you like the full result table (CSV) for further inspection or a refined view (e.g., grouped by class)?

SPARQL query over wikidata:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?class ?classLabel ?prop ?propLabel ?propType ?propTypeLabel ?propSubjectItem ?propSubjectItemLabel ?constraint ?constraintLabel WHERE {
  ?class wdt:P1963 ?prop .
  OPTIONAL {
    ?class rdfs:label ?classLabel .
    FILTER ( LANG( ?classLabel ) = "en" )
  }
  OPTIONAL {
    ?prop rdfs:label ?propLabel .
    FILTER ( LANG( ?propLabel ) = "en" )
  }
  OPTIONAL {
    ?prop wdt:P31 ?propType .
    OPTIONAL {
      ?propType rdfs:label ?propTypeLabel .
      FILTER ( LANG( ?propTypeLabel ) = "en" )
    }
  }
  OPTIONAL {
    ?prop wdt:P1629 ?propSubjectItem .
    OPTIONAL {
      ?propSubjectItem rdfs:label ?propSubjectItemLabel .
      FILTER ( LANG( ?propSubjectItemLabel ) = "en" )
    }
  }
  OPTIONAL {
    ?prop wdt:P2302 ?constraint .
    OPTIONAL {
      ?constraint rdfs:label ?constraintLabel .
      FILTER ( LANG( ?constraintLabel ) = "en" )
    }
  }
}
LIMIT 500

Using properties:
- Wikidata item of this property (wd:P1629 as wdt), also known as associated item, item, item for this property, item of this property, property's subject item, etc.: item corresponding to the concept represented by the property / relationship represented by the property
- properties for this type (wd:P1963 as wdt), also known as has properties, has property, properties for this class, property for this class, property for this type, etc.: when this subject is used as object of “instance of”, the following properties normally apply / when this subject is used as object of “instance of”, the following properties normally apply
- property constraint (wd:P2302 as wdt), also known as constraint, rdfs:domain, rdfs:range, P2302: constraint applicable to a Wikidata property / constraint applicable to this Wikidata property / constraint applicable to this Wikidata property
- 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 500 rows and 10 columns, showing the first 5 and last 5 rows below:
| class                    | classLabel           | prop     | propLabel                          | propType                                                             | propTypeLabel                                                   | propSubjectItem          | propSubjectItemLabel | constraint                                        | constraintLabel                              |
| ------------------------ | -------------------- | -------- | ---------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------ | -------------------- | ------------------------------------------------- | -------------------------------------------- |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | item-requires-statement constraint (wd:Q21503247) | item-requires-statement constraint (lang:en) |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | allowed qualifiers constraint (wd:Q21510851)      | allowed qualifiers constraint (lang:en)      |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | value-type constraint (wd:Q21510865)              | value-type constraint (lang:en)              |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | allowed-entity-types constraint (wd:Q52004125)    | allowed-entity-types constraint (lang:en)    |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | property scope constraint (wd:Q53869507)          | property scope constraint (lang:en)          |
| ...                      | ...                  | ...      | ...                                | ...                                                                  | ...                                                             | ...                      | ...                  | ...                                               | ...                                          |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | item-requires-statement constraint (wd:Q21503247) | item-requires-statement constraint (lang:en) |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | subject type constraint (wd:Q21503250)            | subject type constraint (lang:en)            |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | allowed-entity-types constraint (wd:Q52004125)    | allowed-entity-types constraint (lang:en)    |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | property scope constraint (wd:Q53869507)          | property scope constraint (lang:en)          |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2896 | publication interval (lang:en)     | Wikidata property related to time and duration (wd:Q51077473)        | Wikidata property related to time and duration (lang:en)        | frequency (wd:Q65772587) | frequency (lang:en)  | subject type constraint (wd:Q21503250)            | subject type constraint (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 items where the property "properties for this type" is used, along with the associated properties and their characteristics?

[Assistant]
Step 1 — find the property "properties for this type" in Wikidata (its P-id). I'll search the property index for that label. I'll confirm the exact property identifier before using it in queries.

Question: properties for this type

Top 10 property alternatives:
1. properties for this type (wd:P1963 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as has properties, has property, properties for this class, property for this class, property for this type, etc.: when this subject is used as object of “instance of”, the following properties normally apply / when this subject is used as object of “instance of”, the following properties normally apply
2. Wikidata property (wd:P1687 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via property for this item), also known as has property, main property, property, property for this item, P1687: main Wikidata property for this item / main Wikidata property for this item
3. uses property (wd:P3176 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as analyzes property, analyzes Wikidata property, discusses property, discusses Wikidata property, property used, etc.: Wikidata property used, discussed, or otherwise analyzed in this work (not the meaning of the property itself) / Wikidata property used, discussed, or otherwise analyzed in this work (not the meaning of the property itself) / is subproperty of uses
4. Wikidata property example (wd:P1855 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via property sample), also known as e.g., eg, example, Example item for this property, example of property, etc.: example where this Wikidata property is used; target item is ... the property being described given the associated value / example where this Wikidata property is used / Example where this Wikidata property is used
5. Wikidata property example for properties (wd:P2271 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via example for properties), also known as example for properties, property example, P2271: examples of using a property in an item statement / is subproperty of Wikidata property example
6. characteristic of (wd:P13044 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via property of), also known as inheres in, of, property of, quality of, P13044: (qualifier only) statement value is a characteristic, quality, property, or state of this qualifier value
7. type of unit for this property (wd:P2876 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as P2876: units for this property are all instances of this item
8. external superproperty (wd:P2235 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via subproperty of external property), also known as subproperty of (external), subproperty of external property, P2235: all resources related by this property are also related to that property from an external vocabulary
9. external subproperty (wd:P2236 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via subproperty of external property), also known as subproperty (external), subproperty of external property, P2236: all resources related by the property from external vocabularies are also related to this property
10. subproperty of (wd:P1647 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via subclass of property), also known as has parent property, instance of property, parent property, rdfs:subPropertyOf, subclass of property, etc.: all resources related by this property are also related by that property / is subproperty of related property / is subproperty of see also

[Assistant]
I'll search for properties that describe properties themselves—likely candidates are "property constraint" (P2302), "data type" (P1629), and "property type" — I'll search for these property identifiers to confirm.

Question: property constraint

Top 10 property alternatives:
1. property constraint (wd:P2302 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as constraint, rdfs:domain, rdfs:range, P2302: constraint applicable to this Wikidata property / constraint applicable to this Wikidata property / constraint applicable to a Wikidata property
2. constraint clarification (wd:P6607 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via property constraint comment), also known as constraint explanation, constraint note, constraint rationale, constraint reason, explanation, etc.: qualifier to provide details on the function or purpose of a property constraint on a given property / is subproperty of Wikidata usage instructions
3. item of property constraint (wd:P2305 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as allowed entity types, allowed unit, claim value, item, item of constraint, etc.: qualifier to define a property constraint in combination with "property constraint" (P2302)
4. has characteristic (wd:P1552 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via required property), also known as aspect, attribute, characteristic, characterized by, defined by, etc.: inherent or distinguishing quality or feature of the entity. Use a more specific property when possible. / inherent or distinguishing quality or feature of the entity. Use a more specific property when possible / the entity has an inherent or distinguishing characteristic / the entity has an inherent or distinguishing characteristic
5. characteristic of (wd:P13044 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via property of), also known as inheres in, of, property of, quality of, P13044: (qualifier only) statement value is a characteristic, quality, property, or state of this qualifier value
6. constraint scope (wd:P4680 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via scope of constraint), also known as scope of constraint, P4680: defines the scope where a constraint is checked – can specify ... and the datatype (Wikibase item, property, lexeme, etc.)
7. subproperty of (wd:P1647 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via superproperty), also known as has parent property, instance of property, parent property, rdfs:subPropertyOf, subclass of property, etc.: all resources related by this property are also related by that property / is subproperty of related property / is subproperty of see also
8. property (wd:P2306 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as allowed qualifier, P2306: qualifier to define a property constraint in combination with ... or to limit the scope of Q44292881 (wikidata statement)
9. Wikidata property (wd:P1687 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via property), also known as has property, main property, property, property for this item, P1687: main Wikidata property for this item / main Wikidata property for this item
10. properties for this type (wd:P1963 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via has property), also known as has properties, has property, properties for this class, property for this class, property for this type, etc.: when this subject is used as object of “instance of”, the following properties normally apply / when this subject is used as object of “instance of”, the following properties normally apply

[Assistant]
I'll search for "data type" and "datatype" properties to find which property records a property's data type.

Question: data type

Top 10 property alternatives:
1. instance of (wd:P31 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via has type), 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)
2. storage device (wd:P4788 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via data storage type), also known as data storage type, memory card, storage type, uses data storage type, P4788: data storage device supported by a machine (e.g. camera or mobile phone)
3. representation type (wd:P12692 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as visual presentation, P12692: property to indicate the representation type as a qualifier for Wikimedia Commons SDC Depicts statements of such Wikidata items
4. working memory type (wd:P12323 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via memory type), also known as memory type, RAM type, RAM used, P12323: specifies the type of working memory of this data object
5. class (wd:P2308 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via type), also known as type, P2308: qualifier to define a property constraint in combination with "property constraint" (P2302) / qualifier to define a property constraint in combination with "property constraint" (P2302)
6. taxonomic type (wd:P427 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via type), also known as genotype, species typica, type, type genus, type species, etc.: type genus or species: [in zoology:] nominal genus or species ... the name-bearing type of this nominal species or subspecies
7. type of variable star (wd:P881 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via variable type), also known as variable type, P881: type of star
8. subclass of (wd:P279 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via type of), 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
9. external data available at URL (wd:P1325 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via data), also known as data, external data URL, URL with external data, P1325: URL where external data on this item can be found / URL where external data on this item can be found
10. media type (wd:P1163 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via content type), also known as content type, Internet media type, MIME type, P1163: IANA-registered identifier for a file type

[Assistant]
I'll search for a property that indicates a Wikidata property's data type (the property used on property items to state their datatype).

Question: data type Wikidata property datatype property

Top 10 property alternatives:
1. uses property (wd:P3176 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via analyzes Wikidata property), also known as analyzes property, analyzes Wikidata property, discusses property, discusses Wikidata property, property used, etc.: Wikidata property used, discussed, or otherwise analyzed in this work (not the meaning of the property itself) / Wikidata property used, discussed, or otherwise analyzed in this work (not the meaning of the property itself) / is subproperty of uses
2. properties for this type (wd:P1963 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via Wikidata properties for this type), also known as has properties, has property, properties for this class, property for this class, property for this type, etc.: when this subject is used as object of “instance of”, the following properties normally apply / when this subject is used as object of “instance of”, the following properties normally apply
3. Wikidata property example (wd:P1855 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via Wikidata property sample), also known as e.g., eg, example, Example item for this property, example of property, etc.: example where this Wikidata property is used; target item is ... the property being described given the associated value / example where this Wikidata property is used / Example where this Wikidata property is used
4. Wikidata property example for properties (wd:P2271 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as example for properties, property example, P2271: examples of using a property in an item statement / is subproperty of Wikidata property example
5. source website for the property (wd:P1896 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via Wikidata property source), also known as property source, source, source of property, source URL for the property, source website of the property, etc.: URL of website acting as source of data for this Wikidata property / is subproperty of URL
6. Wikidata property (wd:P1687 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as has property, main property, property, property for this item, P1687: main Wikidata property for this item / main Wikidata property for this item
7. property proposal discussion (wd:P3254 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via Wikidata property proposal), also known as discussion, discussion URL, property discussion, property discussion URL, proposal, etc.: URL of the page (or page section) on which the creation of the property was discussed / is subproperty of Wikimedia community discussion URL
8. Wikidata item of this property (wd:P1629 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via Wikidata property subject item), also known as associated item, item, item for this property, item of this property, property's subject item, etc.: item corresponding to the concept represented by the property / relationship represented by the property
9. maintained by WikiProject (wd:P6104 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p, matched via Wikidata project), also known as Wikidata project, Wikimedia project, WikiProject, P6104: WikiProject that maintains this property, item, or linked ... of Wikidata, define the scope using the qualifier "of (P642)" / is subproperty of maintained by / is subproperty of maintenance
10. Wikidata property example for forms (wd:P5193 as pq/pqn/prv/ps/psn/pqv/prn/wdt/psv/wdtn/pr/p), also known as example of form property, P5193: example where this Wikidata property is used; target form is ... the property being described given the associated value

[Assistant]
I'll run a SPARQL SELECT that finds subjects (?class) using wdt:P1963 (properties for this type), lists the property values (?prop), and retrieves several characteristics of each property when available:
- instance-of of the property (?prop wdt:P31 ?propType)
- the Wikidata item associated with the property (?prop wdt:P1629 ?propSubjectItem)
- any property constraints (?prop wdt:P2302 ?constraint)

I'll include English labels for readability. I'll limit results to 500 rows to avoid overly large outputs; we can increase or refine if needed. Now I'll execute that query.

execute

SELECT DISTINCT ?class ?classLabel ?prop ?propLabel ?propType ?propTypeLabel ?propSubjectItem ?propSubjectItemLabel ?constraint ?constraintLabel WHERE {
  ?class wdt:P1963 ?prop .
  # English label for the class
  OPTIONAL { ?class rdfs:label ?classLabel . FILTER(LANG(?classLabel)="en") }
  # property label
  OPTIONAL { ?prop rdfs:label ?propLabel . FILTER(LANG(?propLabel)="en") }
  # property instance-of (type)
  OPTIONAL {
    ?prop wdt:P31 ?propType .
    OPTIONAL { ?propType rdfs:label ?propTypeLabel . FILTER(LANG(?propTypeLabel)="en") }
  }
  # associated Wikidata item for the property
  OPTIONAL {
    ?prop wdt:P1629 ?propSubjectItem .
    OPTIONAL { ?propSubjectItem rdfs:label ?propSubjectItemLabel . FILTER(LANG(?propSubjectItemLabel)="en") }
  }
  # property constraints
  OPTIONAL {
    ?prop wdt:P2302 ?constraint .
    OPTIONAL { ?constraint rdfs:label ?constraintLabel . FILTER(LANG(?constraintLabel)="en") }
  }
} LIMIT 500

Got 500 rows and 10 columns, showing the first 5 and last 5 rows below:
| class                    | classLabel           | prop     | propLabel                          | propType                                                             | propTypeLabel                                                   | propSubjectItem          | propSubjectItemLabel | constraint                                        | constraintLabel                              |
| ------------------------ | -------------------- | -------- | ---------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------ | -------------------- | ------------------------------------------------- | -------------------------------------------- |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | item-requires-statement constraint (wd:Q21503247) | item-requires-statement constraint (lang:en) |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | allowed qualifiers constraint (wd:Q21510851)      | allowed qualifiers constraint (lang:en)      |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | value-type constraint (wd:Q21510865)              | value-type constraint (lang:en)              |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | allowed-entity-types constraint (wd:Q52004125)    | allowed-entity-types constraint (lang:en)    |
| wd:L692149               |                      | wd:P1963 | properties for this type (lang:en) | Wikidata property about Wikidata entities themselves (wd:Q103824108) | Wikidata property about Wikidata entities themselves (lang:en)  |                          |                      | property scope constraint (wd:Q53869507)          | property scope constraint (lang:en)          |
| ...                      | ...                  | ...      | ...                                | ...                                                                  | ...                                                             | ...                      | ...                  | ...                                               | ...                                          |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | item-requires-statement constraint (wd:Q21503247) | item-requires-statement constraint (lang:en) |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | subject type constraint (wd:Q21503250)            | subject type constraint (lang:en)            |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | allowed-entity-types constraint (wd:Q52004125)    | allowed-entity-types constraint (lang:en)    |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2768 | BNE periodical OID (lang:en)       | Wikidata property for authority control for the media (wd:Q55999460) | Wikidata property for authority control for the media (lang:en) |                          |                      | property scope constraint (wd:Q53869507)          | property scope constraint (lang:en)          |
| periodical (wd:Q1002697) | periodical (lang:en) | wd:P2896 | publication interval (lang:en)     | Wikidata property related to time and duration (wd:Q51077473)        | Wikidata property related to time and duration (lang:en)        | frequency (wd:Q65772587) | frequency (lang:en)  | subject type constraint (wd:Q21503250)            | subject type constraint (lang:en)            |

[Assistant]
I'll now finalize by providing the final SPARQL query I executed and a concise summary of the results and observations.

answer

SELECT DISTINCT ?class ?classLabel ?prop ?propLabel ?propType ?propTypeLabel ?propSubjectItem ?propSubjectItemLabel ?constraint ?constraintLabel WHERE {
  ?class wdt:P1963 ?prop .
  # English label for the class
  OPTIONAL { ?class rdfs:label ?classLabel . FILTER(LANG(?classLabel)="en") }
  # property label
  OPTIONAL { ?prop rdfs:label ?propLabel . FILTER(LANG(?propLabel)="en") }
  # property instance-of (type)
  OPTIONAL {
    ?prop wdt:P31 ?propType .
    OPTIONAL { ?propType rdfs:label ?propTypeLabel . FILTER(LANG(?propTypeLabel)="en") }
  }
  # associated Wikidata item for the property
  OPTIONAL {
    ?prop wdt:P1629 ?propSubjectItem .
    OPTIONAL { ?propSubjectItem rdfs:label ?propSubjectItemLabel . FILTER(LANG(?propSubjectItemLabel)="en") }
  }
  # property constraints
  OPTIONAL {
    ?prop wdt:P2302 ?constraint .
    OPTIONAL { ?constraint rdfs:label ?constraintLabel . FILTER(LANG(?constraintLabel)="en") }
  }
} LIMIT 500

Answer:
Final SPARQL query (above) executed successfully. Summary of findings:

- The property "properties for this type" is P1963 (wdt:P1963). The query returns items (?class) that use this property and, for each value (?prop), retrieves characteristics of that property where available:
  - ?propType (wdt:P31) — the instance-of/type of the property item, with English label (e.g., "Wikidata property about Wikidata entities themselves");
  - ?propSubjectItem (wdt:P1629) — the Wikidata item associated with the property (when present), with label;
  - ?constraint (wdt:P2302) — property constraints declared on the property (when present), with English label (e.g., "value-type constraint", "allowed-entity-types constraint", "item-requires-statement constraint").

- Example rows from the results (illustrative):
  - periodical (wd:Q1002697) — has P1963 values including:
    - wd:P2768 ("BNE periodical OID"): its P31 indicates it is a Wikidata property for authority control; constraints on it include item-requires-statement, subject type constraint, allowed-entity-types constraint, and property scope constraint.
    - wd:P2896 ("publication interval"): the property has a P31 indicating relation to time/duration and a P1629 pointing to frequency (wd:Q65772587); it has subject type constraint, etc.
  - Several property items list constraint types via P2302 such as "item-requires-statement constraint", "allowed qualifiers constraint", "value-type constraint", "allowed-entity-types constraint", and "property scope constraint".

Notes and interpretation guidance:
- ?class is the item that states which properties normally apply to instances of that class via P1963.
- ?prop is the property item that is recommended/related for that class.
- Constraints (P2302) describe usage rules or validation checks for the property; these are themselves items (the query returns their labels).
- Not all properties have all characteristics; the query uses OPTIONAL to return what is available.

If you want any of the following, I can refine the query:
- Remove rows where ?class has no English label, or only return classes with English labels.
- Expand to include more property characteristics (e.g., property creation date, property proposals, or qualifiers attached to the P2302 statements).
- Return results grouped by class with GROUP_CONCAT for compact output.

Would you like the full result table (CSV) for further inspection or a refined view (e.g., grouped by class)?