This Lua module is used on approximately 457,000 pages, or roughly 2432% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module depends on the following other modules: |
Related pages |
---|
About
This template is designed to be called from {{Taxobox/core}} or a related template, and tracks pages which may be candidates for a {{Taxonbar}}.
If no {{Taxonbar}} exists on the transcluded page, the page's Wikidata item is checked against this whitelist of acceptable (P31)s/ (P279)s, and this blacklist of unacceptable properties.
If an acceptable instance/subclass is found, then the page is categorized as:
If no acceptables nor unacceptables are found, then it is categorized as:
If no acceptables & at least 1 unacceptable is found, then no categorization is performed.
Usage
Associated lists
Whitelist
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q16521)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q310890)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q47487597)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q2568288)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q23038290)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q59278506)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q98961713)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q58051350)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q42621)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q235536)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q713623)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q848328)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q857968)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q17487588)
Blacklist
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q913170)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q55983715)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q937228)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q14712)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q163233)
- Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (Q747463)
local p = {}
function p.check(frame)
local taxonbarExists = require('Module:Taxonbar/exists').check
if taxonbarExists(frame) then
return ''
else
local resolveEntity = require( 'Module:ResolveEntityId' )
local currentTitle = mw.title.getCurrentTitle()
local currentItem = nil
local categories = {
'[[Category:Taxobox articles possibly missing a taxonbar]]' --unset if acceptable or unacceptable found
}
--preliminary exclusion criteria
if string.match( currentTitle.text, '^List of ') then
return ''
end
--find Wikidata item
if currentTitle.namespace == 0 then --mainspace
local currentEntityId = mw.wikibase.getEntityIdForCurrentPage()
if resolveEntity._id(currentEntityId) then
currentItem = mw.wikibase.getEntity(currentEntityId)
else --currentEntityId == nil/unresolvable
return categories[1]
end
else
return ''
end
if currentItem then --currentItem should not be nil here, but check just in case
--determine if {{Taxonbar}} is *definitely* missing, *possibly* missing, or not missing at all
local whitelist = require( 'Module:Taxonbar/whitelist' ).whitelist
local blacklist = require( 'Module:Taxonbar/blacklist' ).blacklist
local acceptableInstanceOf_All = whitelist{ args = { 'all' } }
local unacceptableInstanceOf = blacklist{ args = {} }
local acceptableCount = 0
local unacceptableCount = 0
for _, instanceOfState in pairs ( currentItem:getBestStatements('P31') ) do --instance of
local instanceOf = instanceOfState.mainsnak.datavalue.value.id
if acceptableInstanceOf_All[instanceOf] then
acceptableCount = acceptableCount + 1
elseif unacceptableInstanceOf[instanceOf] then
unacceptableCount = unacceptableCount + 1
end
end
for _, subclassOfState in pairs ( currentItem:getBestStatements('P279') ) do --subclass of
local subclassOf = subclassOfState.mainsnak.datavalue.value.id
if acceptableInstanceOf_All[subclassOf] then
acceptableCount = acceptableCount + 1
elseif unacceptableInstanceOf[subclassOf] then
unacceptableCount = unacceptableCount + 1
end
end
if acceptableCount > 0 then
categories[1] = ''
categories[2] = '[[Category:Taxobox articles missing a taxonbar]]'
elseif unacceptableCount > 0 then
categories[1] = ''
categories[2] = ''
end
return table.concat(categories)
else
return ''
end
end
end
return p