Property talk:P31
Add topicDocumentation
type to which this subject corresponds/belongs. Different from P279 (subclass of); for example: K2 is an instance of mountain; volcano is a subclass of mountain
{{Complex constraint |label = Multiple P31 claims lead to duplicate tuples |description = Multiple P31 claims are unnecessary in most cases with Wikimedia-related items. Consider {{P|1269}} instead of second P31 value. |sparql = SELECT ?item #?class ?class2 ?itemLabel WHERE{ VALUES ?class{ wd:Q4167836 wd:Q11266439 wd:Q17362920 }?item wdt:P31 ?class. ?item wdt:P31 ?class2 FILTER(?class2!=?class). MINUS{VALUES ?whitelist{ wd:Q4115189 wd:Q15397819 #placeholders }?item wdt:P31 ?whitelist} #SERVICE wikibase:label{bd:serviceParam wikibase:language "en"} } LIMIT 1000 }} {{Complex constraint |label = P31=samevalue and P279=samevalue (indirect P279) |description = In most cases, this is an oversight or item that needs update after child item(s) were added |sparql = SELECT ?item(COUNT(*) AS ?count)WHERE{ ?class wdt:P31 ?item FILTER(?item NOT IN(wd:Q7187,wd:Q8054)). ?class wdt:P279/wdt:P279 ?item. }GROUP BY ?item ORDER BY DESC(?count) LIMIT 1000 }} {{Complex constraint |label = Strange P31 link between parents in P279 |description = |sparql = SELECT ?item(COUNT(*)AS ?count)WHERE{ ?classC wdt:P279 ?item;wdt:P279 ?classB. ?classB wdt:P31 ?item }GROUP BY ?item ORDER BY DESC(?count) LIMIT 1000 }} {{Complex constraint |label = Avoid P31 of P279 of Q5 (P106 or other properties should be created) |description = |sparql = SELECT ?item WHERE{?item wdt:P31/wdt:P279+ wd:Q5} LIMIT 1000 }} {{Complex constraint |label = Second claim and unspecific |description = is most cases unspecific could be replaced with specific variant |sparql = SELECT ?item WHERE{ ?item wdt:P31 ?claim1 FILTER(?claim1=wd:Q95074). ?item wdt:P31 ?claim2 FILTER(?claim2!=?claim1)} LIMIT 1000 }} {{Complex constraint |label = Can't be human and possibly fictional |description = keep only one claim |sparql = SELECT ?item WHERE{ ?item wdt:P31 wd:Q5. # real ?item wdt:P31/wdt:P279* wd:Q21070568.} # possibly fictional LIMIT 1000 }} {{Complex constraint |label = Can't be one thing and group of things |description = keep only one claim, split into several items: Q1880543, Q161678, Q232009 |sparql = SELECT ?item WHERE { ?item wdt:P31/wdt:P279* wd:Q15619176. # one ?item wdt:P31/wdt:P279* wd:Q17519152.} # group LIMIT 1000 }} {{Complex constraint |label = Can't be ?item P31 ?item |description = impossible claim or it should be a separate item |sparql = SELECT ?item WHERE{?item wdt:P31 ?item} LIMIT 1000 }} {{Complex constraint |label = Cannot be an instance of an individual human |description = Can't be ?item wdt:P31/wdt:P31 wd:Q5. |sparql = SELECT ?item WHERE{?item wdt:P31/wdt:P31 wd:Q5} LIMIT 1000 }} {{Complex constraint |label = Can't be instance of both human and occupation |description = Should not an {{P|31}} both a {{Q|5}} and an {{Q|12737077}}. Consider using {{P|106}}. |sparql = SELECT DISTINCT ?item WHERE { ?occupation wdt:P279*/wdt:P31+ wd:Q12737077. ?item wdt:P31 wd:Q5. ?item wdt:P31 ?occupation. } GROUP BY ?item }} {{Complex constraint |label = Can't be instance of both human and position |description = Should not be an {{P|31}} both a {{Q|5}} and an {{Q|4164871}}. Consider using {{P|39}}. |sparql = SELECT ?item WHERE { ?position wdt:P279*/wdt:P31+ wd:Q4164871. ?item wdt:P31 wd:Q5. ?item wdt:P31 ?position. } GROUP BY ?item LIMIT 1000 }} {{Complex constraint |label = Can't be instance of song and single |description = Items should not be an {{P|31}} both a {{Q|7366}} and a {{Q|134556}}; the {{Q|2031291}} (single) should be separate from the {{Q|17537576}} (song). Sitelinks should usually be attached to items about songs. Consider removing one statement (probably {{Q|134556}}), and creating a new item for the other entity. Songs and singles can be linked with {{P|658}} and {{P|361}}. |sparql = SELECT ?item WHERE{ ?item wdt:P31 wd:Q7366. ?item wdt:P31 wd:Q134556.} LIMIT 1000 }} {{Complex constraint |label = Can't be instance of both fictional character and literary work. |description = Should not be an {{P|31}} both a {{Q|95074}} and an {{Q|7725634}}. This is usually caused by conflation between a literary work and the main character that it is named after. |sparql = SELECT ?item WHERE{ ?item (wdt:P31/(wdt:P279*)) wd:Q95074, wd:Q7725634. }GROUP BY ?item LIMIT 1000 }} {{Complex constraint |label = Can't be instance of both fictional character and narrative. |description = Should not be an {{P|31}} both a {{Q|95074}} and an {{Q|1318295}}. This is usually caused by conflation between a narrative and the main character that it is named after. |sparql = SELECT ?item WHERE{ ?item (wdt:P31/(wdt:P279*)) wd:Q95074, wd:Q1318295. }GROUP BY ?item LIMIT 1000 }} {{Complex constraint |label = Can't be instance of both a disambiguation page and a human. |description = Should not be an {{P|31}} both a {{Q|4167410}} and a {{Q|5}}. This can be caused caused by an incorrect merge or a sitelink that is attached to a wrong item. |sparql = SELECT ?item WHERE{ ?item (wdt:P31/(wdt:P279*)) wd:Q4167410, wd:Q5. }GROUP BY ?item LIMIT 1000 }} {{Complex constraint |label = should have P31=category |description = TODO: add P31 |sparql = SELECT ?item ?n{ hint:Query hint:optimizer "None". ?item wikibase:statements 0 . [] schema:about ?item; schema:name ?n; schema:isPartOf ?part. ?part wikibase:wikiGroup "wikipedia". FILTER(strstarts(?n, "Category:")) }LIMIT 100 }} {{Complex constraint |label = should have P31=template |description = TODO: add P31 |sparql = SELECT ?item ?n{ hint:Query hint:optimizer "None". ?item wikibase:statements 0 . [] schema:about ?item; schema:name ?n. FILTER(strstarts(?n , "Template:")) }LIMIT 100 }} {{Complex constraint |label = should have P31=module |description = TODO: add P31 |sparql = SELECT ?item ?n{ hint:Query hint:optimizer "None". ?item wikibase:statements 0 . [] schema:about ?item; schema:name ?n. FILTER(strstarts(?n, "Module:")) FILTER(!strstarts(?n, "Module:zh/data")) FILTER(!strstarts(?n, "Module:Zh/data")) }LIMIT 100 }} {{Complex constraint |label = should have P31=portal |description = TODO: add P31 |sparql = SELECT ?item ?n{ hint:Query hint:optimizer "None". ?item wikibase:statements 0 . [] schema:about ?item ; schema:name ?n. FILTER(strstarts(?n, "Portal:")) }LIMIT 100 }} {{Complex constraint |label = default P31 values for frwiki (claimless items) |description = TODO: add P31 |sparql = SELECT ?item ?n ?pref ?inst WHERE{ VALUES(?pref ?inst){ ("Modèle:" wd:Q11266439) ("Module:" wd:Q15184295) ("Catégorie:" wd:Q4167836) ("Projet:" wd:Q14204246) ("Wikipédia:" wd:Q14204246) ("Aide:" wd:Q56005592) ("Liste de" wd:Q13406463) ("Glossaire d" wd:Q859161) ("Vocabulaire d" wd:Q859161) } ?item wikibase:statements 0 . [] schema:about ?item; schema:isPartOf <https://fr.wikipedia.org/>; schema:name ?n. FILTER(strstarts(?n, ?pref)) }LIMIT 1000 }} {{Complex constraint |label = default P31 values for eswiki (claimless items) |description = TODO: add P31 |sparql =SELECT ?item ?n ?pref ?inst WHERE{ VALUES(?pref ?inst){ ("Plantilla:" wd:Q11266439) ("Módulo:" wd:Q15184295) ("Categoría:" wd:Q4167836) ("Wikipedia:" wd:Q14204246) ("Anexo:" wd:Q13406463) } ?item wikibase:statements 0 . [] schema:about ?item; schema:isPartOf <https://es.wikipedia.org/>; schema:name ?n . FILTER( strstarts(?n, ?pref)) }LIMIT 1000 }} {{Complex constraint |label = use {{P|10241}} to identify taxon |description = Where the item is an individual organism, {{P|10241}} should be used to identify its taxon, e.g. species. |sparql = SELECT DISTINCT ?item ?itemLabel WHERE{ ?item wdt:P31/wdt:P279* wd:Q110224119. ?item wdt:P31 ?taxon. ?taxon wdt:P31 wd:Q16521. SERVICE wikibase:label{bd:serviceParam wikibase:language "en"}.} LIMIT 100 }} {{Complex constraint |label = Redundant instance of statement |description = should not be instance of a superclass and one of its subclass. When an item have 2 P31 statements of a class together with a statement to one of its direct subclass |sparql = SELECT ?item ?a ?b{ ?item wdt:P31 ?a, ?b. ?a wdt:P279 ?b. }LIMIT 1000 }} {{Complex constraint |label = Photos aren't genres |description = Photos are not instances of photographic genres. Replace with {{P|136}}. |sparql = SELECT ?item ?itemLabel WHERE{ ?item wdt:P31/wdt:P279 wd:Q11633. SERVICE wikibase:label{bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en"} # Helps get the label in your language, if not, then en language } LIMIT 1000 }} {{Complex constraint |label = Possible archaeological sites misidentified as excavations (activity) |description = Items with P31 = Q959782 (archaeological excavation), but without P710 (participant), P580 (start time), or certain words in the label, are likely to be misidentified instances of Q839954 (archaeological site) |sparql = SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q959782; rdfs:label ?itemLabel. FILTER NOT EXISTS {?item wdt:P710 ?participant.} FILTER NOT EXISTS {?item wdt:P580 ?start_time.} FILTER (lang(?itemLabel) = "en"). FILTER (!regex(?itemLabel, "([Ee]xcavation|[Ee]xploration|[Cc]ampaign|[Pp]roject)")). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language } LIMIT 1000 }} {{Complex constraint |label = Items that are stated to be both proposed buildings/structures and actual (existing) structures |description = Structures that are complete or under construction should not be identified as "proposed". |sparql= SELECT DISTINCT ?item ?itemLabel WHERE { ?item wdt:P31/wdt:P279?/wdt:P279? wd:Q811683; wdt:P31/wdt:P279?/wdt:P279? wd:Q811979. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language } LIMIT 1000 }} <nowiki>{{Autofix|pattern=Q213051|replacement=Q27801|move_to=P136}} {{Autofix|pattern=Q20540385|replacement=Q27801|move_to=P136}}
</nowiki>
| Value short story (Q49084) will be automatically replaced to value short story (Q49084) and moved to form of creative work (P7937) property. Testing: TODO list |
| Value novel (Q8261) will be automatically replaced to value novel (Q8261) and moved to form of creative work (P7937) property. Testing: TODO list |
| Value play (Q25379) will be automatically replaced to value play (Q25379) and moved to form of creative work (P7937) property. Testing: TODO list |
| Value narration (Q3328821) will be automatically replaced to value narration (Q3328821) and moved to form of creative work (P7937) property. Testing: TODO list |
| Value short story collection (Q1279564) will be automatically replaced to value short story collection (Q1279564) and moved to form of creative work (P7937) property. Testing: TODO list |
| Value novel collection (Q133500522) will be automatically replaced to value novel collection (Q133500522) and moved to form of creative work (P7937) property. Testing: TODO list |
| Value drama collection (Q119318561) will be automatically replaced to value drama collection (Q119318561) and moved to form of creative work (P7937) property. Testing: TODO list |
| Value poem (Q5185279) will be automatically replaced to value poem (Q5185279) and moved to form of creative work (P7937) property. Testing: TODO list |
| Value poetry collection (Q12106333) will be automatically replaced to value poetry collection (Q12106333) and moved to form of creative work (P7937) property. Testing: TODO list |
| Value essay collection (Q16324495) will be automatically replaced to value essay collection (Q16324495) and moved to form of creative work (P7937) property. Testing: TODO list |
{{Autofix|pattern=Q15780329|replacement=Q15773347}} {{Autofix|pattern=Q795052|replacement=Q5}} {{Autofix|pattern=Q395685|replacement=Q5}} {{Autofix|pattern=Q43115|replacement=Q43115|move_to=P411}} {{Autofix|pattern=Q3464126|replacement=Q3464126|move_to=P411}} {{Autofix|pattern=Q6581072|replacement=Q6581072|move_to=P21}} {{Autofix|pattern=Q467|replacement=Q6581072|move_to=P21}} {{Autofix|pattern=Q6581097|replacement=Q6581097|move_to=P21}} {{Autofix|pattern=Q8441|replacement=Q6581097|move_to=P21}} {{Autofix|pattern=Q131123|replacement=Q131123|move_to=P1269}} {{Autofix|pattern=Q33999|replacement=Q33999|move_to=P106}} {{Autofix|pattern=Q169470|replacement=Q169470|move_to=P106}} {{Autofix|pattern=Q1650915|replacement=Q1650915|move_to=P106}} {{Autofix|pattern=Q18216771|replacement=Q18216771|move_to=P106}} {{Autofix|pattern=Q33231|replacement=Q33231|move_to=P106}} {{Autofix|pattern=Q483501|replacement=Q483501|move_to=P106}} {{Autofix|pattern=Q49757|replacement=Q49757|move_to=P106}} {{Autofix|pattern=Q36180|replacement=Q36180|move_to=P106}} {{Autofix|pattern=Q10841764|replacement=Q10841764|move_to=P106}} {{Autofix|pattern=Q10871364|replacement=Q10871364|move_to=P106}} {{Autofix|pattern=Q55296227|replacement=Q55296227|move_to=P106}} {{Autofix|pattern=Q1186921|replacement=Q1186921|move_to=P106}} {{Autofix|pattern=Q40348|replacement=Q40348|move_to=P106}} {{Autofix|pattern=Q10873124|replacement=Q10873124|move_to=P106}} {{Autofix|pattern=Q1779650|replacement=Q1779650|move_to=P106}} {{Autofix|pattern=Q333634|replacement=Q333634|move_to=P106}} {{Autofix|pattern=Q11163999|replacement=Q11163999|move_to=P136}} {{Autofix|pattern=Q103184|replacement=Q191067}} <!-- check afterwards --> {{Autofix|pattern=Q1946|replacement=Q61702557}} {{Autofix|pattern=Q12409870|replacement=Q12409870|move_to=P2868}} {{Autofix|pattern=Q215972|replacement=Q215972|move_to=P5800}} {{Autofix|pattern=Q526231|replacement=Q526231|move_to=P5800}} {{Autofix|pattern=Q245204|replacement=Q245204|move_to=P5800}} {{Autofix|pattern=Q55712911|replacement=Q55712911|move_to=P5800}} {{Autofix|pattern=Q2595584|replacement=Q2595584|move_to=P5800}} {{Autofix|pattern=Q12317360|replacement=Q12317360|move_to=P5800}} {{Autofix|pattern=Q27623618|replacement=Q27623618|move_to=P5800}} {{Autofix|pattern=Q3246821|replacement=Q3246821|move_to=P5800}} {{Autofix|pattern=Q105078199|replacement=Q105078199|move_to=P5800}} {{Autofix|pattern=Q162244|replacement=Q162244|move_to=P9071}} {{Autofix|pattern=Q290691|replacement=Q290691|move_to=P9071}} {{Autofix|pattern=Q6498903|replacement=Q6498903|move_to=P9071}} {{Autofix|pattern=Q110910|replacement=Q110910|move_to=P9071}} {{Autofix|pattern=Q12218723|replacement=Q12218723|move_to=P9071}} {{Autofix|pattern=Q188784|replacement=Q526231|move_to=P9071}} {{Autofix|pattern=Q503106|replacement=Q503106|move_to=P2360}} {{Autofix|pattern=Q242492|replacement=Q242492|move_to=P2360}} {{Autofix|pattern=Q478804|replacement=Q478804|move_to=P2360}} {{Autofix|pattern=Q231302|replacement=Q231302|move_to=P2360}} {{Autofix|pattern=Q237338|replacement=Q237338|move_to=P2360}} {{Autofix|pattern=Q5883980|replacement=Q2763|move_to=P793}} {{Autofix|pattern=Q20899|replacement=Q24634210}} {{Autofix|pattern=Q24633474|replacement=Q24634210}} {{Autofix|pattern=Q3276244|replacement=Q24634210}} {{Autofix|pattern=Q29471320|replacement=Q7889}} {{Autofix|pattern=Q7283|replacement=Q2223653}} {{Autofix|pattern=Q5889469|replacement=Q112044283}} {{Autofix|pattern=Q5383567|replacement=Q90181054}} {{Autofix|pattern=Q8148|replacement=Q268592}} {{Autofix|pattern=Q15795637|create_property=P1080|create_item=Q17562848}} {{Autofix|pattern=Q15795637|create_property=P8345|create_item=Q864}} {{Autofix|pattern=Q15795637|create_property=P360|create_item=Q3966183}} {{Autofix|pattern=Q15795637|create_property=P1441|create_item=Q864}} {{Autofix|pattern=Q81113235|create_property=P1080|create_item=Q59475808}} {{Autofix|pattern=Q114772035|create_property=P1080|create_item=Q112865887}} {{Autofix|pattern=Q114771973|create_property=P1080|create_item=Q112865887}} {{Autofix|pattern=Q2286914|create_property=P1080|create_item=Q59785404}} {{Autofix|pattern=Q77643435|create_property=P1080|create_item=Q17562848}} {{Autofix|pattern=Q77643435|create_property=P8345|create_item=Q864}} {{Autofix|pattern=Q32860792|create_property=P1080|create_item=Q17562848}} {{Autofix|pattern=Q32860792|create_property=P8345|create_item=Q864}} {{Autofix|pattern=Q339925|move_to=P1269|replacement=Q339925}} {{Autofix|pattern=Q1608017|create_property=P1080|create_item=Q108461595}} {{Autofix|pattern=Q1608017|create_property=P8345|create_item=Q193884}} {{Autofix|pattern=Q111369260|replacement=Q865493}} {{Autofix|pattern=Q7318358|replacement=Q7318358|move_to=P13046}} {{Autofix|pattern=Q1504425|replacement=Q1504425|move_to=P13046}}
| Value hardcover (Q193955) will be automatically replaced to value hardcover (Q193955) and moved to distribution format (P437) property. Testing: TODO list |
| Value paperback (Q193934) will be automatically replaced to value paperback (Q193934) and moved to distribution format (P437) property. Testing: TODO list |
| Value ebook (Q128093) will be automatically replaced to value ebook (Q128093) and moved to distribution format (P437) property. Testing: TODO list |
| Value softcover (Q990683) will be automatically replaced to value softcover (Q990683) and moved to distribution format (P437) property. Testing: TODO list |
Template:ExternalUse Template:Wikidata property documentation properties Template:Tree properties
Archive
[edit]Older discussions archived under Property talk:P31/Archive and Property talk:P31/Archive 2.
Usage note
[edit]Usage is detailed in Help:Basic membership properties.
requiring references for values Template:Q and Template:Q
[edit]we require sources for Template:P and for Template:P, so why not this one?
draft requirement: Template:Statement+ — Arlo Barnes ([[User talk:Arlo Barnes|int:Talkpagelinktext]]) 03:03, 16 November 2025 (UTC)