Diferencia entre revisiones de «Módulo:Authority control»

Ir a la navegación Ir a la búsqueda
m (1 revision imported)
Brad Pitt>Tom.Reding
Línea 251: Línea 251:
end
end
return '[http://www.uni-stuttgart.de/hi/gnt/dsi2/index.php?table_name=dsi&function=details&where_field=id&where_value='..id..' '..id..']'..p.getCatForId( 'DSI' )
return '[http://www.uni-stuttgart.de/hi/gnt/dsi2/index.php?table_name=dsi&function=details&where_field=id&where_value='..id..' '..id..']'..p.getCatForId( 'DSI' )
end
function p.fastLink( id )
--P2163's format regex: [1-9]\d{0,7} (e.g. 1916996)
if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[http://id.worldcat.org/fast/'..id..'/ '..id..']'..p.getCatForId( 'FAST' )
end
end


Línea 378: Línea 386:
return false
return false
end
end
return '[https://musicbrainz.org/artist/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz' ) --special category name
return '[https://musicbrainz.org/artist/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz' ) --special cat name
end
end


Línea 386: Línea 394:
return false
return false
end
end
return '[https://musicbrainz.org/area/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz area' ) --special category name
return '[https://musicbrainz.org/area/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz area' ) --special cat name
end
end


Línea 394: Línea 402:
return false
return false
end
end
return '[https://musicbrainz.org/instrument/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz instrument' ) --special category name
return '[https://musicbrainz.org/instrument/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz instrument' ) --special cat name
end
end


Línea 402: Línea 410:
return false
return false
end
end
return '[https://musicbrainz.org/label/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz label' ) --special category name
return '[https://musicbrainz.org/label/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz label' ) --special cat name
end
end


Línea 410: Línea 418:
return false
return false
end
end
return '[https://musicbrainz.org/place/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz place' ) --special category name
return '[https://musicbrainz.org/place/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz place' ) --special cat name
end
end


Línea 418: Línea 426:
return false
return false
end
end
return '[https://musicbrainz.org/release-group/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz release group' ) --special category name
return '[https://musicbrainz.org/release-group/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz release group' ) --special cat name
end
end


Línea 426: Línea 434:
return false
return false
end
end
return '[https://musicbrainz.org/series/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz series' ) --special category name
return '[https://musicbrainz.org/series/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz series' ) --special cat name
end
end


Línea 434: Línea 442:
return false
return false
end
end
return '[https://musicbrainz.org/work/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz work' ) --special category name
return '[https://musicbrainz.org/work/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz work' ) --special cat name
end
end


Línea 591: Línea 599:
end
end
return '[https://www.researcherid.com/rid/'..id..' '..id..']'..p.getCatForId( 'RID' )
return '[https://www.researcherid.com/rid/'..id..' '..id..']'..p.getCatForId( 'RID' )
end
function p.rismLink( id )
--P5504's format regex: (pe|ks)?\[1-9]d* (e.g. pe30006410)
if not id:match( '^pe[1-9]%d*$' ) and --99% start with 'pe'
  not id:match( '^ks[1-9]%d*$' ) and
  not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://opac.rism.info/search?id='..id..' '..id..']'..p.getCatForId( 'RISM' )
end
end


Línea 631: Línea 649:
return false
return false
end
end
return '[https://opac.sbn.it/opacsbn/opac/iccu/scheda_authority.jsp?bid='..id..' '..id..']'..p.getCatForId( 'ICCU' ) end
return '[https://opac.sbn.it/opacsbn/opac/iccu/scheda_authority.jsp?bid='..id..' '..id..']'..p.getCatForId( 'ICCU' )
end


function p.selibrLink( id )
function p.selibrLink( id )
Línea 670: Línea 689:
return false
return false
end
end
return '[https://www.semanticscholar.org/author/'..id..' '..id..']'..p.getCatForId( 'Semantic Scholar author' ) --special category name
return '[https://www.semanticscholar.org/author/'..id..' '..id..']'..p.getCatForId( 'Semantic Scholar author' ) --special cat name
end
end


Línea 848: Línea 867:
end
end
return ids
return ids
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 )
if statements then
for _, statement in ipairs( statements ) do
if statement.mainsnak.datavalue then
if statement.mainsnak.datavalue.value['numeric-id'] == qid then
return true
end end end end end
return false
end
end


Línea 930: Línea 935:


-- If a specific "(identifier) redirect" exists for an identifier, please route through this particular redirect rather than linking directly to the target page. This reduces clutter in "What links here" and improves reverse lookup of articles where a manifestation of this particular identifier is used.
-- If a specific "(identifier) redirect" exists for an identifier, please route through this particular redirect rather than linking directly to the target page. This reduces clutter in "What links here" and improves reverse lookup of articles where a manifestation of this particular identifier is used.
-- Check that the Wikidata item has this property-->value before adding it
local reqs = {}


-- Parameter format: { 'parameter name', 'label', propertyId # in Wikidata, formatting/validation function }
-- Parameter format: { 'parameter name', 'label', propertyId # in Wikidata, formatting/validation function }
Línea 957: Línea 959:
{ 'DIB', '[[DIB (identifier)|DIB]]', 6829, p.dibLink },
{ 'DIB', '[[DIB (identifier)|DIB]]', 6829, p.dibLink },
{ 'DSI', '[[DSI (identifier)|DSI]]', 2349, p.dsiLink },
{ 'DSI', '[[DSI (identifier)|DSI]]', 2349, p.dsiLink },
{ 'FNZA', '[[FNZA (identifier)|FNZA]]', 6792, p.fnzaLink }, --wd
{ 'FAST', '[[FAST (identifier)|FAST]]', 2163, p.fastLink },
{ 'FNZA', '[[FNZA (identifier)|FNZA]]', 6792, p.fnzaLink },
{ 'GND', '[[GND (identifier)|GND]]', 227, p.gndLink },
{ 'GND', '[[GND (identifier)|GND]]', 227, p.gndLink },
{ 'HDS', '[[HDS (identifier)|HDS]]', 902, p.hdsLink },
{ 'HDS', '[[HDS (identifier)|HDS]]', 902, p.hdsLink },
Línea 972: Línea 975:
{ 'Léonore', '[[Léonore (identifier)|Léonore]]', 640, p.leonoreLink },
{ 'Léonore', '[[Léonore (identifier)|Léonore]]', 640, p.leonoreLink },
{ 'MA', '[[MA (identifier)|MA]]', 6366, p.maLink },
{ 'MA', '[[MA (identifier)|MA]]', 6366, p.maLink },
{ 'MBA', '[[MBA (identifier)|MBA]]', 434, p.mbaLink, category = 'MusicBrainz' }, --special category name
{ 'MBA', '[[MBA (identifier)|MBA]]', 434, p.mbaLink, category = 'MusicBrainz' }, --special cat name
{ 'MBAREA', '[[MBAREA (identifier)|MBAREA]]', 982, p.mbareaLink, category = 'MusicBrainz area' }, --special category name
{ 'MBAREA', '[[MBAREA (identifier)|MBAREA]]', 982, p.mbareaLink, category = 'MusicBrainz area' }, --special cat name
{ 'MBI', '[[MBI (identifier)|MBI]]', 1330, p.mbiLink, category = 'MusicBrainz instrument' }, --special category name
{ 'MBI', '[[MBI (identifier)|MBI]]', 1330, p.mbiLink, category = 'MusicBrainz instrument' }, --special cat name
{ 'MBL', '[[MBL (identifier)|MBL]]', 966, p.mblLink, category = 'MusicBrainz label' }, --special category name
{ 'MBL', '[[MBL (identifier)|MBL]]', 966, p.mblLink, category = 'MusicBrainz label' }, --special cat name
{ 'MBP', '[[MBP (identifier)|MBP]]', 1004, p.mbpLink, category = 'MusicBrainz place' }, --special category name
{ 'MBP', '[[MBP (identifier)|MBP]]', 1004, p.mbpLink, category = 'MusicBrainz place' }, --special cat name
{ 'MBRG', '[[MBRG (identifier)|MBRG]]', 436, p.mbrgLink, category = 'MusicBrainz release group' }, --special category name
{ 'MBRG', '[[MBRG (identifier)|MBRG]]', 436, p.mbrgLink, category = 'MusicBrainz release group' }, --special cat name
{ 'MBS', '[[MBS (identifier)|MBS]]', 1407, p.mbsLink, category = 'MusicBrainz series' }, --special category name
{ 'MBS', '[[MBS (identifier)|MBS]]', 1407, p.mbsLink, category = 'MusicBrainz series' }, --special cat name
{ 'MBW', '[[MBW (identifier)|MBW]] work', 435, p.mbwLink, category = 'MusicBrainz work' }, --special category name
{ 'MBW', '[[MBW (identifier)|MBW]] work', 435, p.mbwLink, category = 'MusicBrainz work' }, --special cat name
{ 'MGP', '[[MGP (identifier)|MGP]]', 549, p.mgpLink },
{ 'MGP', '[[MGP (identifier)|MGP]]', 549, p.mgpLink },
{ 'NARA', '[[NARA (identifier)|NARA]]', 1225, p.naraLink },
{ 'NARA', '[[NARA (identifier)|NARA]]', 1225, p.naraLink },
Línea 995: Línea 998:
{ 'NTA', '[[NTA (identifier)|NTA]]', 1006, p.ntaLink },
{ 'NTA', '[[NTA (identifier)|NTA]]', 1006, p.ntaLink },
{ 'ORCID', '[[ORCID (identifier)|ORCID]]', 496, p.orcidLink },
{ 'ORCID', '[[ORCID (identifier)|ORCID]]', 496, p.orcidLink },
{ 'PIC', '[[PIC (identifier)|PIC]]', 2750, p.picLink }, --wd
{ 'PIC', '[[PIC (identifier)|PIC]]', 2750, p.picLink },
{ 'PLWABN', '[[PLWABN (identifier)|PLWABN]]', 7293, p.plwabnLink },
{ 'PLWABN', '[[PLWABN (identifier)|PLWABN]]', 7293, p.plwabnLink },
{ 'Publons', '[[Publons (identifier)|Publons]]', 3829, p.publonsLink },
{ 'Publons', '[[Publons (identifier)|Publons]]', 3829, p.publonsLink },
{ 'RERO', '[[RERO (identifier)|RERO]]', 3065, p.reroLink },
{ 'RID', '[[RID (identifier)|ResearcherID]]', 1053, p.ridLink },
{ 'RID', '[[RID (identifier)|ResearcherID]]', 1053, p.ridLink },
{ 'RERO', '[[RERO (identifier)|RERO]]', 3065, p.reroLink },
{ 'RISM', '[[RISM (identifier)|RISM]]', 5504, p.rismLink },
{ 'RKDartists', '[[RKDartists (identifier)|RKD]]', 650, p.rkdartistsLink },
{ 'RKDartists', '[[RKDartists (identifier)|RKD]]', 650, p.rkdartistsLink },
{ 'RKDID', '[[RKDID (identifier)|RKDimages ID]]', 350, p.rkdidLink },
{ 'RKDID', '[[RKDID (identifier)|RKDimages ID]]', 350, p.rkdidLink },
Línea 1007: Línea 1011:
{ 'SNAC-ID', '[[SNAC-ID (identifier)|SNAC]]', 3430, p.snacLink },
{ 'SNAC-ID', '[[SNAC-ID (identifier)|SNAC]]', 3430, p.snacLink },
{ 'SUDOC', '[[SUDOC (identifier)|SUDOC]]', 269, p.sudocLink },
{ 'SUDOC', '[[SUDOC (identifier)|SUDOC]]', 269, p.sudocLink },
{ 'S2AuthorId', '[[S2AuthorId (identifier)|S2AuthorId]]', 4012, p.s2authoridLink, category = 'Semantic Scholar author' }, --special category name
{ 'S2AuthorId', '[[S2AuthorId (identifier)|S2AuthorId]]', 4012, p.s2authoridLink, category = 'Semantic Scholar author' }, --special cat name
{ 'TA98', '[[TA98 (identifier)|TA98]]', 1323, p.ta98Link },
{ 'TA98', '[[TA98 (identifier)|TA98]]', 1323, p.ta98Link },
{ 'TDVİA', '[[TDVİA (identifier)|TDVİA]]', 7314, p.tdviaLink },
{ 'TDVİA', '[[TDVİA (identifier)|TDVİA]]', 7314, p.tdviaLink },
Línea 1104: Línea 1108:
local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]
local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]
if val == nil or val == '' then
if val == nil or val == '' then
local canUseWikidata = nil
local wikidataIds = p.getIdsFromWikidata( itemId, 'P'..params[3] )
if reqs[params[1]] then
if wikidataIds[1] then
--since reqs{} has been nil afaicr, p.matchesWikidataRequirements will never be called
if val == '' and (namespace == 0 or testcases) then
--TODO: reqs{} doesn't seem useful/necessary; appendage of early WD incorporation?
suppressedIdCat = '[[Category:Wikipedia articles with suppressed authority control identifiers|'..params[1]..']]'
canUseWikidata = p.matchesWikidataRequirements( itemId, reqs[params[1]] )
else
else
parentArgs[params[1]] = wikidataIds[1] --add ID from WD
canUseWikidata = true
end
if canUseWikidata then
local wikidataIds = p.getIdsFromWikidata( itemId, 'P'..params[3] )
if wikidataIds[1] then
if val == '' and (namespace == 0 or testcases) then
suppressedIdCat = '[[Category:Wikipedia articles with suppressed authority control identifiers|'..params[1]..']]'
else
parentArgs[params[1]] = wikidataIds[1] --add ID from WD
end
end
end
end
end
Usuario anónimo
Las cookies nos ayudan a ofrecer nuestros servicios. Al utilizar nuestros servicios, aceptas nuestro uso de cookies.

Menú de navegación