Changes

Jump to navigation Jump to search

Module:Authority control

2,111 bytes added, 02:45, 29 July 2019
+d:Property:P949 (NLI), d:Property:P1695 (NLP), d:Property:P3065 (RERO), d:Property:P1003 (NLR), d:Property:P1006 (NTA), d:Property:P1890 (BNC), per talk; --/ws/wl ce; from sandbox
local catName = ''
if namespace == 0 then
catName = 'Wikipedia articles with ' .. id .. ' identifiers'
elseif namespace == 2 and not title.isSubpage then
catName = 'User pages with ' .. id .. ' identifiers'
else
catName = 'Miscellaneous pages with ' .. id .. ' identifiers'
end
return '[[Category:' .. catName .. ']]' .. p.redCatLink(catName)
end
end
return '[https://www.semanticscholar.org/author/'..id..' '..id..']'..p.getCatForId( 'Semantic Scholar author' ) --special category name
end
 
function p.nliLink( id )
--P949's format regex: \d{9} (e.g. 123456789)
if not string.match( id, '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://aleph.nli.org.il/F/?func=find-b&local_base=NNL10&find_code=SYS&con_lng=eng&request='..id..' '..id..']'..p.getCatForId( 'NLI' )
end
 
function p.nlpLink( id )
--P1695's format regex: 9810[0-9]\d* (e.g. 9810123456789012345)
if not string.match( id, '^9810%d+$' ) then
return false
end
return '[http://mak.bn.org.pl/cgi-bin/KHW/makwww.exe?BM=01&IM=04&NU=01&WI='..id..' '..id..']'..p.getCatForId( 'NLP' )
end
 
function p.reroLink( id )
--P3065's format regex: 0[1-2]-[A-Z][0-9]{1,9} (e.g. 02-A012345678)
if not string.match( id, '^0[1-2]-[A-Z][0-9]%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://data.rero.ch/'..id..' '..id..']'..p.getCatForId( 'RERO' )
end
 
function p.nlrLink( id )
--P1003's format regex: \d{9} (e.g. 123456789)
if not string.match( id, '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://alephnew.bibnat.ro:8991/F?func=find-b&request='..id..'&find_code=SYS&adjacent=Y&local_base=NLR10 '..id..']'..p.getCatForId( 'NLR' )
end
 
function p.ntaLink( id )
--P1006's format regex: \d{8}[\dX] (e.g. 12345678X)
if not string.match( id, '^%d%d%d%d%d%d%d%d[%dX]$' ) then
return false
end
return '[http://data.bibliotheken.nl/id/thes/p'..id..' '..id..']'..p.getCatForId( 'NTA' )
end
 
function p.bncLink( id )
--P1890's format regex: \d{9} (e.g. 123456789)
if not string.match( id, '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://www.bncatalogo.cl/F?func=direct&local_base=red10&doc_number='..id..' '..id..']'..p.getCatForId( 'BNC' )
end
function p.matchesWikidataRequirements( itemId, reqs )
for _, group in ipairs( reqs ) do
local property = 'P' .. group[1]
local qid = group[2]
local statements = mw.wikibase.getBestStatements( itemId, property )
-- Creates a human-readable standalone wikitable version of p.conf, and tracking categories with page counts, for use in the documentation
function p.docConfTable( frame )
local wikiTable = '{| class="wikitable sortable"\n' .. '! rowspan=2 | Parameter\n' .. '! rowspan=2 | Label\n' .. '! rowspan=2; data-sort-type=number | Wikidata property\n' .. '! colspan=4 | Tracking categories and page counts\n' .. '|-\n' .. '! Articles\n' .. '! User pages\n' .. '! Misc. pages\n' .. '! Faulty IDs\n' ..
'|-\n'
'||style="text-align: right;"|[[:Category:'.. faultyCat..'|'.. faultyCount..']]'
end
return wikiTable .. '\n|}'
end
{ 'ACM-DL', '[[ACM Digital Library|ACM DL]]', 864, p.acmLink },
{ 'autores.uy', '[[autores.uy]]', 2558, p.autoresuyLink },
{ 'BALaT', '[[:d:Q2876688Royal Institute for Cultural Heritage#Online artworks pages|BALaT]]', 3293, p.balatLink },
{ 'BIBSYS', '[[Bibsys|BIBSYS]]', 1015, p.bibsysLink },
{ 'Bildindex', '[[Marburg Picture Index|Bildindex]]', 2092, p.bildLink },
{ 'BNC', '[[Biblioteca Nacional de Chile|BNC]]', 1890, p.bncLink },
{ 'BNE', '[[Biblioteca Nacional de España|BNE]]', 950, p.bneLink },
{ 'BNF', '[[Bibliothèque nationale de France|BNF]]', 268, p.bnfLink },
{ 'ICIA', '[[Information Center for Israeli Art|ICIA]]', 1736, p.iciaLink },
{ 'ISNI', '[[International Standard Name Identifier|ISNI]]', 213, p.isniLink },
{ 'Joconde', '[[Joconde|Joconde]]' , 347, p.jocondeLink },
{ 'KULTURNAV', '[[KulturNav]]', 1248, p.kulturnavLink },
{ 'LCCN', '[[Library of Congress Control Number|LCCN]]', 244, p.lccnLink },
{ 'NKC', '[[National Library of the Czech Republic|NKC]]', 691, p.nkcLink },
{ 'NLA', '[[National Library of Australia|NLA]]', 409, p.nlaLink },
{ 'NLI', '[[National Library of Israel|NLI]]', 949, p.nliLink },
{ 'NLP', '[[National Library of Poland|NLP]]', 1695, p.nlpLink },
{ 'NLR', '[[National Library of Romania|NLR]]', 1003, p.nlrLink },
{ 'NSK', '[[National and University Library in Zagreb|NSK]]', 1375, p.nskLink },
{ 'NTA', '[[Royal Library of the Netherlands|NTA]]', 1006, p.ntaLink },
{ 'ORCID', '[[ORCID]]', 496, p.orcidLink },
{ 'PIC', '[[:d:Q23892012|PIC]]', 2750, p.picLink },
{ 'RID', '[[ResearcherID]]', 1053, p.ridLink },
{ 'RERO', '[[RERO (Library Network of Western Switzerland)|RERO]]', 3065, p.reroLink },
{ 'RKDartists', '[[Netherlands Institute for Art History#Online artist pages|RKD]]', 650, p.rkdartistsLink },
{ 'RKDID', '[[:d:Q17299580|RKDimages ID]]', 350, p.rkdidLink },
if testcases or talkspace then
if parentArgs['QID'] then
itemId = 'Q' .. mw.ustring.gsub(parentArgs['QID'], '^[Qq]', '')
itemId = resolveEntity._id(itemId) --nil if unresolvable
end
end
if canUseWikidata then
local wikidataIds = p.getIdsFromWikidata( itemId, 'P' .. params[3] )
if wikidataIds[1] then
if val == '' and (namespace == 0 or testcases) then
local val = parentArgs[params[1]]
if val and val ~= '' then
table.insert( elements, p.createRow( params[1], params[2] .. ':', val, params[4]( val ), true ) )
rct = rct + 1
end
--WorldCat
local worldcatId = parentArgs['WORLDCATID']
if worldcatId and worldcatId ~= '' then --if present & unsuppressed & present
table.insert( elements, p.createRow( 'WORLDCATID', '', worldcatId, '[[WorldCat Identities]]: [https://www.worldcat.org/identities/'..worldcatId..' '..worldcatId..']', false ) ) --Validation?
worldcatCat = '[[Category:Wikipedia articles with WorldCat identifiers]]'
elseif worldcatId == nil then --if absent & unsuppressed & absent
local viafId = parentArgs['VIAF']
local lccnId = parentArgs['LCCN']
if viafId and viafId ~= '' and p.viafLink( viafId ) then --VIAF must be present, unsuppressed , & validated
table.insert( elements, p.createRow( 'VIAF', '', viafId, '[[WorldCat Identities]] (via VIAF): [https://www.worldcat.org/identities/containsVIAFID/'..viafId..' '..viafId..']', false ) )
if namespace == 0 then
worldcatCat = '[[Category:Wikipedia articles with WorldCat-VIAF identifiers]]'
end
elseif lccnId and lccnId ~= '' and p.lccnLink( lccnId ) then --LCCN must be present, unsuppressed , & validated
local lccnParts = p.splitLccn( lccnId )
if lccnParts and lccnParts[1] ~= 'sh' then
local lccnIdFmtd = lccnParts[1] .. lccnParts[2] .. '-' .. lccnParts[3]
table.insert( elements, p.createRow( 'LCCN', '', lccnId, '[[WorldCat Identities]] (via LCCN): [https://www.worldcat.org/identities/lccn-'..lccnIdFmtd..' '..lccnIdFmtd..']', false ) )
if namespace == 0 then
local elementsCat = ''
if rct > 13 then
local catName = 'AC with ' .. rct .. ' elements' elementsCat = '[[Category:' .. catName .. ']]' .. p.redCatLink(catName)
end
name = 'Authority control',
bodyclass = 'hlist',
group1 = '[[Help:Authority control|Authority control]]' .. pencil,
list1 = table.concat( elements )
} )
Anonymous user

Navigation menu