Txantiloi:Control de autoridades

Wikipedia, Entziklopedia askea

-- es:Módulo:Control de autoridades orrialdetik kopiatua require('Modulu:No globals')

local function generic ( id, link, parameter ) local idlink = mw.ustring.gsub( id, ' ', '%%%%20' ) link = mw.ustring.gsub( link, '$1', idlink ) return '[' .. link .. ' ' .. id .. ']' end

local function bncLink ( id, link, parameter ) -- filtro local del BNC, para evadir multitud de identificadores de Wikidata que no se enlazan adecuadamente -- véase https://www.wikidata.org/wiki/Wikidata:Database_reports/Constraint_violations/P1890#%22Format%22_violations if ( string.match( id, '^%d%d%d%d%d%d%d%d%d$' ) ) then return generic ( id, link, parameter ) end return false end

local function bnfLink ( id, link, parameter ) -- representación local del BNF, con doble enlace return generic( id, link, parameter ) .. ' .. id .. ' (data)' end

local function ineLink ( id, link, parameter ) -- representación especial del INE, enlace no estándar con cinco parámetros utilizados local ineMainRE, ineTailRE = '^(%d%d)(%d%d%d)', '(%d%d)(%d%d)(%d%d)' local codProv, codMuni, codEC, codES, codNUC = string.match( id, ineMainRE .. ineTailRE .. '$' ) if not codEC or not codES or not codNUC then codProv, codMuni = string.match( id, ineMainRE .. '$' ) if codProv and codMuni then codEC, codES, codNUC = '00', '00', '00' else codProv, codMuni = string.match( id, ineMainRE ) codEC, codES, codNUC = , , end end if codProv and codMuni then link = 'http://www.ine.es/nomen2/inicio_a.do?accion=busquedaAvanzada&inicio=inicio_a&subaccion=&botonBusquedaAvanzada=Consultar+selecci%C3%B3n&numPag=0&ordenAnios=ASC&comunidad=00&entidad_amb=no&poblacion_amb=T&poblacion_op=%3D&poblacion_txt=&denominacion_op=like&denominacion_txt=&codProv=$1&codMuni=$2&codEC=$3&codES=$4&codNUC=$5' link = link:gsub('$1', codProv):gsub('$2', codMuni):gsub('$3', codEC):gsub('$4', codES):gsub('$5', codNUC) return generic( id, link, parameter ) end return id end

local function commonscat ( id, link, parameter ) -- representación especial del enlace a las Kategorias de Commons, para mantener el formato de enlace interwiki local idlink = mw.ustring.gsub( id, ' ', '_' ) link = mw.ustring.gsub( link, '$1', idlink ) return '[' .. link .. ' ' .. id .. ']' end

local function sisterprojects ( id, link, parameter ) -- enlaces interproyecto local prefix = { -- Ejemplo: -- enwiki = 'w:en', commonswiki = 'c', euwiktionary = 'wikt', euwikibooks = 'b', euwikiquote = 'q', euwikisource = 's', mediawikiwiki = 'mw', metawiki = 'm', specieswiki = 'species', } if prefix[ parameter ] then return '[['..prefix[ parameter ]..':'..id..'|'..id..']]' end return false end

function getCommonsValue ( item ) local commonslink = local categories =

local property = getIdsFromWikidata( item, 'P373' ) if property and property[1] then property = property[1] commonslink = commonslink .. getLink( 373, property, commonscat ) else property = end

local sitelink = getIdsFromSitelinks( item, 'commonswiki' ) if sitelink and sitelink[1] then sitelink = sitelink[1] if sitelink ~= 'Kategoria:' .. property then if commonslink == then commonslink = commonslink .. sisterprojects( sitelink, nil, 'commonswiki' ) end end else sitelink = end

if property and sitelink then if sitelink ~= 'Kategoria:' .. property then -- categories = categories .. end elseif sitelink then -- not property -- categories = categories .. elseif property then -- not sitelink -- categories = categories .. else -- not property and not sitelink -- categories = categories .. end if commonslink ~= then return { commonslink .. categories } end return {} end

local conf = {} --In this order: name of the parameter, label, propertyId in Wikidata, formatting function, Kategoria id -- -- name of the parameter: unique name -- -- label: internal link in wiki format -- -- propertyId in Wikidata: number without 'P' suffix -- -- formatting function: one of these four options -- -- -- local function (like 'generic') -- -- -- string 'y' (yes), to show a default identifier 'ID' -- -- -- string 'n' (no), to show the real identifier -- -- -- any other string, to show this string as identifier ('id', 'url', 'link', ...) -- -- Kategoria id: one of these tree options -- -- -- number 0, to not add Kategoria -- -- -- number 1, to add a Kategoria based on the name of the parameter -- -- -- any string, to add a Kategoria based on this string conf.databases = {} conf.databases[1] = {} conf.databases[1].name = 'Autoritate kontrola' conf.databases[1].list = { { title = 'Wikimedia proiektuak', group = { { 'Wikidata', 'Wd Datuak', 'Wikidata:$1', 'n', 0 }, { 'Commons', 'Commonscat Multimedia', getCommonsValue, 'n', 0 }, { 'Wikivoyage', 'Wikivoyage turismo gida', 'euwikivoyage', sisterprojects, 0 }, { 'Wiktionary', 'Wiktionary Hiztegia', 'euwiktionary', sisterprojects, 0 }, { 'Wikibooks', 'Wikibooks Liburuak', 'euwikibooks', sisterprojects, 0 }, { 'Wikinews', 'Wikinews Albisteak', 'euwikinews', sisterprojects, 0 }, { 'Wikiversity', 'Wikiversity Baliabide didaktikoak', 'euwikiversity', sisterprojects, 0 }, { 'Wikiquote', 'Wikiquote Aipu famatuak', 'euwikiquote', sisterprojects, 0 }, { 'Wikisource', 'Wikisource Jatorrizko testuak', 'euwikisource', sisterprojects, 0 }, { 'MediaWiki', 'MediaWiki MediaWiki', 'mediawikiwiki', sisterprojects, 0 }, { 'Meta-Wiki', 'Meta-Wiki Koordinazioa', 'metawiki', sisterprojects, 0 }, { 'Wikispecies', 'Wikispecies Espezieak', 'specieswiki', sisterprojects, 0 }, }, }, { title = 'Identifikadoreak', group = { { 'ISSN', 'ISSN', 236, 'n', 1 }, { 'VIAF', 'VIAF', 214, 'n', 1 }, { 'ISNI', 'ISNI', 213, 'n', 1 }, { 'Literaturaren Zubitegia', 'Literaturaren Zubitegia', 5985, 'n', 1 }, { 'BCN', 'BCN', 2879, 'n', 1 }, { 'BNA', 'BNA', 3788, 'n', 1 }, { 'BNE', 'BNE', 950, 'n', 1 }, { 'BNF', 'BNF', 268, bnfLink, 1 }, { 'BNM', 'BNM', 4440, 'n', 1 }, { 'BNC', 'BNC', 1890, bncLink, 1 }, { 'CANTIC', 'CANTIC', 1273, 'n', 1 }, { 'GND', 'GND', 227, 'n', 1 }, { 'LCCN', 'LCCN', 244, 'n', 1 }, { 'NCL', 'NCL', 1048, 'n', 0 }, { 'NDL', 'NDL', 349, 'n', 0 }, { 'NKC', 'NKC', 691, 'n', 0 }, { 'NLA', 'NLA', 409, 'n', 1 }, { 'RLS', 'BER', 947, 'n', 0 }, { 'Tabakalera', 'Tabakalera ID', 10069, 'n', 1 },

{ 'CINII', 'CiNii', 271, 'n', 0 }, { 'NARA', 'NARA', 1225, 'n', 0 }, { 'LCCNLCOC', 'LCCN', 1144, 'n', 0 }, { 'SNAC', 'SNAC', 3430, 'n', 1 }, { 'S2', 'S2', 4012, 'n', 0 }, { 'SUDOC', 'SUDOC', 269, 'n', 0 }, { 'ULAN', 'ULAN', 245, 'n', 1 }, { 'ORCID', 'ORCID', 496, 'n', 1 }, -- { 'SELIBR', 'SELIBR', 906, 'n', 1 }, { 'BIBSYS', 'BIBSYS', 1015, 'n', 1 }, { 'UB', 'UB', 1580, 'n', 1 }, { 'IPNIaut', 'IPNI', 586, 'n', 'IPNI' }, { 'MGP', 'MGP', 549, 'n', 0 }, { 'autores.uy', 'autores.uy', 2558, 'n', 1 }, { 'Slovenska biografija', 'Slovenska biografija', 1254, 'n', 0 }, { 'SBN', 'ICCU', 396, 'n', 1 },

{ 'CCBAE', 'CCBAE', 6493, 'n', 1 }, -- { 'DIR3', 'DIR3', 6222, 'n', 1 }, { 'CensoGuia', 'Censo-Guía de Archivos de España e Iberoamérica', 3998, 'n', 'Censo-Guía' }, { 'Libraries.org', 'Libraries.org', 4848, 'n', 1 }, { 'Directorio de Museos y Colecciones de España', 'Directorio de Museos y Colecciones de España', 5763, 'n', 1 }, { 'SUCA', 'SUCA', 5946, 'n', 1 },

{ 'BOE', 'BOE', 4256, 'n', 1 },

{ 'RoyalSociety', 'Royal Society', 2070, 'url', 'Royal Society' }, { 'HAW', 'HAW', 2273, 'n', 1 }, { 'SAW', 'SAW', 3411, 'n', 1 }, { 'KNAW', 'KNAW', 2454, 'n', 1 }, -- { 'KVAB', 'KVAB', 3887, 'n', 1 }, { 'Leopoldina', 'Leopoldina', 3413, 'n', 1 }, { 'CONICET', 'CONICET', 3900, 'n', 1 }, { 'Grierson', 'Grierson', 3946, 'n', 1 }, { 'RANM', 'RANM', 3945, 'n', 1 }, -- { 'ANMF', 'ANMF', 3956, 'n', 1 }, { 'Léonore', 'Léonore', 640, 'n', 0 }, { 'USCongress', 'US Congress', 1157, 'n', 0 }, { 'BPN', 'BPN', 651, 'n', 1 },

-- { 'ISCO', 'ISCO', 952, 'n', 1 }, { 'AAT', 'AAT', 1014, 'n', 1 }, { 'OpenLibrary', 'Open Library', 648, 'n', 'Open Library' }, { 'PARES', 'PARES', 4813, 'n', 1 }, { 'SSRN', 'SSRN', 3747, 'n', 'SSRN autor' }, { 'SIKART', 'SIKART', 781, 'n', 0 }, { 'KULTURNAV', 'KulturNav', 1248, 'id', 0 }, { 'RKDartists', 'RKD', 650, 'n', 1 }, { 'GoogleScholar', 'Google Scholar', 1960, 'n', 'Google Scholar' }, { 'RID', 'ResearcherID', 1053, 'n', 1 }, { 'NLM', 'NLM', 1055, 'n', 1 }, { 'Latindex', 'Latindex', 3127, 'n', 1 }, { 'ERIH PLUS', 'ERIH PLUS', 3434, 'n', 1 }, { 'IPNIpub', 'IPNI', 2008, 'n', 1 }, { 'SUDOCcat', 'SUDOC', 1025, 'n', 'SUDOC catálogo' }, { 'ZDB', 'ZDB', 1042, 'n', 1 }, { 'NorwegianRegister', 'Norwegian Register', 1270, 'n', 'Norwegian Register' }, { 'DOAJ', 'DOAJ', 5115, 'n', 1 }, { 'ACNP', 'ACNP', 6981, 'n', 1 },

{ 'HCDN', 'Estadísticas HCDN', 4693, 'n', 1 }, { 'HCDNbio', 'Biografía HCDN', 5225, 'n', 1 }, { 'Directorio Legislativo', 'Directorio Legislativo', 6585, 'n', 0 }, -- { 'Legislatura CABA', 'Legislatura CABA', 4667, 'n', 1 }, { 'Asamblea de Madrid', 'Asamblea de Madrid', 4797, 'n', 1 }, { 'BCNCL', 'Biografías BCN', 5442, 'url', 0 }, { 'RBD', 'RBD MINEDUC', 1919, 'n', 0 }, { 'CineChile', 'CineChile', 6750, 'url', 0 }, { 'Tebeosfera-autor', 'Tebeosfera', 5562, 'n', 1 }, }, }, { title = 'Hiztegiak eta entziklopediak', group = { { 'Auñamendi', 'Auñamendi', 3218, 'n', 1 }, { 'Lur', 'Lur', 10242, 'n', 1 }, { 'Gran Enciclopedia de Navarra', 'GEN', 7388, 'n', 1 }, { 'Badok', 'Badok', 9558, 'n', 1 }, { 'GEA', 'GEA', 1807, 'n', 1 }, { 'DBSE', 'DBSE', 2985, 'url', 1 }, { 'DBE', 'DBE', 4459, 'url', 1 }, { 'HDS', 'HDS', 902, 'n', 0 }, { 'LIR', 'LIR', 886, 'n', 0 }, { 'TLS', 'TLS', 1362, 'n', 0 }, { 'Britannica', 'Britannica', 1417, 'url', 0 }, }, }, { title = 'Bilduma digitalak', group = { { 'PerséeRevista', 'Persée', 2733, 'n', 'Persée revista' }, { 'DialnetRevista', 'Dialnet', 1609, 'n', 'Dialnet revista' }, { 'Redalyc', 'Redalyc', 3131, 'n', 1 }, -- { 'UNZrevista', 'UNZ', 2735, 'n', 0 }, -- { 'JSTORrevista', 'JSTOR', 1230, 'n', 'JSTOR revista' }, { 'HathiTrust', 'HathiTrust', 1844, 'n', 1 }, { 'Galicianaobra', 'Galiciana', 3004, 'n', 'Galiciana obra' }, { 'Trove', 'Trove', 5603, 'n', 1 }, { 'BVMCobra', 'BVMC', 3976, 'n', 'BVMC obra' }, { 'BVMCpersona', 'BVMC', 2799, 'n', 'BVMC persona' }, { 'Persée', 'Persée', 2732, 'n', 1 }, { 'Dialnet', 'Dialnet', 1607, 'n', 1 }, { 'GutenbergAutor', 'Gutenberg proiektua', 1938, 'n', 'Gutenberg proiektuko autore' }, { 'BHL-bibliografia', 'BHL', 4327, 'n', 0 }, -- { 'UNZautor', 'UNZ', 2734, 'n', 'UNZ' },

{ 'BDCYL', 'BDCYL', 3964, 'n', 1 }, { 'BVPB', 'BVPB', 4802, 'n', 1 }, { 'BIDICAM', 'BIDICAM', 6490, 'n', 1 }, { 'BVANDALUCIA', 'BVA', 6496, 'n', 1 }, { 'BVPHautoridad', 'BVPH', 6492, 'n', 1 }, { 'BivaldiAutor', 'BiValDi', 3932, 'n', 'Bivaldi autor' }, { 'GalicianaAutor', 'Galiciana', 3307, 'n', 'Galiciana autor' },

{ 'Europeana', 'Europeana', 727, 'url', 1 }, { 'DOI', 'DOI', 356, 'n', 1 }, { 'Handle', 'Handle', 1184, 'url', 1 }, { 'MNCARS', 'MNCARS', 4439, 'url', 1 }, { 'MuseoDelPrado', 'Museo del Prado', 5321, 'n', 'Museo del Prado' }, { 'Billboard', 'Billboard', 4208, 'n', 0 }, }, }, { title = 'Hemeroteka ditigalak', group = { { 'HemBNE', 'Hemeroteca digital de la BNE', 2768, 'n', 1 }, { 'BVPH', 'Biblioteca Virtual de Prensa Histórica', 2961, 'n', 1 }, { 'Memoriademadrid', 'Memoriademadrid', 7372, 'n', 1 }, }, }, { title = 'Astronomia', group = { { 'Simbad', 'SIMBAD', 3083, 'n', 0 }, { 'JPL-Small-Body-Database', 'JPL', 716, 'n', 0 }, { 'MPC', 'MPC', 5736, 'n', 0 }, { 'NASA-Exoplanet-Archive', 'NASA Exoplanet Archive', 5667, 'n', 0 }, { 'GazPlaNom', 'Gazetteer of Planetary Nomenclature', 2824, 'n', 0 }, }, }, { title = 'Lekuak', group = { { 'OSM', 'OSM', 402, 'n', 'OSM zenbakia' }, { 'TGN', 'TGN', 1667, 'n', 1 }, { 'AtlasIR', 'Atlas Digital del Imperio Romano', 1936, 'n', 0 }, { 'SNCZI-IPE-EMBALSE', 'SNCZI-IPE', 4568, 'n', 'SNCZI-IPE embalse' }, { 'SNCZI-IPE-PRESA', 'SNCZI-IPE', 4558, 'n', 'SNCZI-IPE presa' }, { 'NATURA2000', 'Natura 2000', 3425, 'n', 'Natura 2000' }, { 'WWF', 'WWF', 1294, 'n', 1 }, { 'IDESCAT', 'IDESCAT', 4335, 'n', 1 }, { 'INE', 'INE', 772, ineLink, 1 }, { 'INE Portugal', 'INE', 6324, 'n', 1 }, { 'IBGE', 'IBGE', 1585, 'n', 1 }, { 'INSEE-commune', 'INSEE', 374, 'n', 'INSEE (udalerria)' }, { 'INSEE-departamento', 'INSEE', 2586, 'n', 'INSEE (departamendua)' }, { 'INSEE-region', 'INSEE', 2585, 'n', 'INSEE (eskualdea)' }, { 'INSEE-canton', 'INSEE', 2506, 'n', 'INSEE (kantonamendua)' }, { 'SIRUTA', 'SIRUTA', 843, 'n', 1 }, { 'LAU', 'LAU', 782, 'n', 1 }, { 'KSH', 'KSH', 939, 'n', 1 }, { 'OKATO', 'OKATO', 721, 'n', 1 }, { 'OSTAT', 'ÖSTAT-Nummer', 964, 'n', 'ÖSTAT-Nr'}, }, }, { title = 'Arkitektura', group = { { 'DocomomoIberico', 'Docomomo Ibérico', 3758, 'n', 'Docomomo Ibérico' }, { 'COAMinmueble', 'COAM', 2917, 'n', 'COAM inmueble' }, { 'COAMpersona', 'COAM', 4488, 'n', 'COAM persona' }, }, }, { title = 'Itsasargiak', group = { { 'ARHLS', 'ARHLS', 2980, 'n', 0 }, { 'NGA', 'NGA', 3563, 'n', 0 }, { 'UKHO', 'UKHO', 3562, 'n', 'COAM persona' }, { 'MarineTraffic', 'MarineTraffic', 3601, 'n', 0 }, { 'OnlineListofLights', 'Online List of Lights', 3223, 'n', 0 }, }, }, { title = 'Ondare historikoa', group = { { 'World Heritage Site', 'Gizateriaren ondare', 757, 'n', 'Centro del Patrimonio Mundial' }, { 'CNMLBH', 'CNMLBH', 4587, 'n', 'cnmlbh' }, { 'IGESPAR', 'IGESPAR', 1702, 'n', 1 }, { 'SIPA', 'SIPA', 1700, 'n', 1 }, { 'Infopatrimonio', 'Infopatrimônio', 4372, 'n', 'Infopatrimônio' }, { 'AustriaObjektID', 'Austria ObjektID', 2951, 'n', 'Austria ObjektID' }, { 'FBBID', 'FBB', 2783, 'n', 'FBB' }, { 'Fornminnesregistret', 'FMIS', 1260, 'n', 'FMIS' }, { 'BerlinerKulturdenkmal', 'Berliner Kulturdenkmal', 2424, 'n', 'Berliner Kulturdenkmal' }, { 'NHLE', 'NHLE', 1216, 'n', 1 }, { 'NRHP', 'NRHP', 649, 'n', 1 }, { 'KULTURMINNE', 'Kulturminne', 758, 'n', 'Kulturminne' }, { 'CRHP', 'CRHP', 477, 'n', 1 }, { 'MERIMEE', 'Mérimée', 380, 'n', 'Mérimée' }, { 'CADW', 'Cadw', 1459, 'n', 'Cadw' }, { 'Památkový Katalog', 'Památkový katalog', 762, 'n', 'Památkový katalog' }, { 'PatrimonioIran', 'Patrimonio Nacional de Irán', 1369, 'n', 'Patrimonio Nacional de Irán' }, { 'Rijksmonument', 'Rijksmonument', 359, 'n', 'Rijksmonument' }, { 'BIC', 'BIC', 808, 'n', 1 }, { 'BCIN', 'BCIN', 1586, 'n', 1 }, { 'IPAC', 'IPAC', 1600, 'n', 1 }, { 'IGPCV', 'IGPCV', 2473, 'n', 1 }, { 'BDI-IAPH', 'IAPH', 3318, 'n', 1 }, { 'SIPCA', 'SIPCA', 3580, 'n', 1 }, { 'PWJCYL', 'Patrimonio Web JCyL', 3177, 'n', 'Patrimonio Web JCyL' }, { 'CPCCLM', 'Catálogo de Patrimonio Cultural de Castilla-La Mancha', 6539, 'n', 1 }, { 'HispaniaNostra', 'Hispania Nostraren zerrenda gorria', 4868, 'url', 'Lista Roja Hispania Nostra' }, { 'HGC', 'Heritage Gazetteer for Cyprus', 6916, 'n', 1 }, { 'HGL', 'Heritage Gazetteer of Libya', 6751, 'n', 1 }, }, }, { title = 'Kirolariak', group = { { 'COI', 'COI', 3171, 'n', 0 }, { 'IAAF', 'IAAF', 1146, 'n', 0 }, }, }, { title = 'Datu taxonomikoak', group = { { 'Algabase', 'AlgaeBase', 1348, 'n', 0 }, { 'ADW', 'ADW', 4024, 'n', 0 }, { 'AmphibiaWeb', 'AmphibiaWeb', 5036, 'n', 0 }, { 'BOLD', 'BOLD', 3606, 'n', 0 }, { 'APD', 'African Plant DB', 2036, 'n', 0 }, { 'Avibase', 'Avibase', 2026, 'n', 0 }, { 'BHL', 'BHL', 687, 'n', 0 }, { 'BioLib', 'BioLib', 838, 'n', 0 }, { 'BirdLife', 'BirdLife', 5257, 'n', 0 }, { 'CatalogueOfLife', 'Catalogue of Life', 3088, 'n', 0 }, { 'CONABIO', CONABIO, 4902, 'n', 0 }, { 'Dyntaxa', 'Dyntaxa', 1939, 'n', 0 }, { 'eBird', 'eBird', 3444, 'n', 0 }, { 'EOL', 'EOL', 830, 'n', 0 }, { 'FaunaEuropaea', 'Fauna Europaea', 1895, 'n', 0 }, { 'FishBase', 'FishBase', 938, 'n', 0 }, { 'FOC', 'Fl. China', 1747, 'n', 0 }, { 'GBIF', 'GBIF', 846, 'n', 0 }, { 'GlobalSpecies', 'GlobalSpecies', 6433, 'n', 0 }, { 'GRIN', 'GRIN', 1421, 'n', 0 }, { 'IBC', IBC, 3099, 'n', 0 }, { 'IndexFungorum', 'Index Fungorum', 1391, 'n', 0 }, { 'IOBIS', 'OBIS', 6754, 'n', 0 }, { 'IPNI', 'IPNI', 961, 'n', 0 }, { 'ITIS', 'ITIS', 815, 'n', 0 }, { 'UICN', 'UICN', 627, 'n', 0 }, { 'MSW', 'MSW', 959, 'n', 0 }, { 'MycoBank', 'MycoBank', 962, 'n', 0 }, { 'NCBI', 'NCBI', 685, 'n', 0 }, { 'FossilWorks', 'Paleobiology Database', 842, 'n', 0 }, { 'PlantList', 'PlantList', 1070, 'n', 0 }, { 'SpeciesPlus', 'Species+', 2040, 'n', 0 }, { 'Taxonomicon', 'Taxonomicon', 7066, 'n', 0 }, { 'Tropicos', 'W3TROPICOS', 960, 'n', 0 }, { 'USDAP', 'USDA Plants', 1772, 'n', 0 }, { 'VASCAN', 'VASCAN', 1745, 'n', 0 }, { 'WoRMS', 'WoRMS', 850, 'n', 0 }, { 'uBio', 'uBio', 4728, 'n', 0 }, { 'Xeno-canto', 'Xeno-canto', 2426, 'n', 0 }, { 'Zoobank', 'Zoobank', 1746, 'n', 0 }, }, }, { title = 'Medikuntzako identifikadoreak', group = { { 'DOID', 'DOID', 699, 'n', 0 }, { 'CIE10', 'CIE-10', 4229, 'n', 0 }, { 'CIE9', 'CIE-9', 1692, 'n', 0 }, { 'CIAP2', 'ICPC-2', 667, 'n', 0 }, { 'OMIM', 'OMIM', 492, 'n', 0 }, { 'DiseasesDB', 'DiseasesDB', 557, 'n', 0 }, { 'MedlinePlus', 'MedlinePlus', 604, 'n', 0 }, { 'eMedicine', 'eMedicine', 673, 'n', 0 }, { 'MeSH', 'MeSH', 486, 'n', 0 }, { 'Orphanet', 'Orphanet', 1550, 'n', 0 }, { 'TA98', 'TA', 1323, 'n', 1 }, { 'FMA', 'FMA', 1402, 'n', 0 }, } }, { title = 'Kimikako identifikadoreak', group = { { 'CAS', 'Número CAS', 231, 'n', 0 }, { 'ATC', 'ATC', 267, 'n', 0 }, { 'RTECS', 'RTECS', 657, 'n', 0 }, { 'ChEBI', 'ChEBI', 683, 'n', 0 }, { 'ChEMBL', 'ChEMBL', 592, 'n', 0 }, { 'ChemSpider', 'ChemSpider', 661, 'n', 0 }, { 'DrugBank', 'DrugBank', 715, 'n', 0 }, { 'PubChem', 'PubChem', 662, 'n', 0 }, { 'UNII', 'UNII', 652, 'n', 0 }, { 'KEGG', 'KEGG', 665, 'n', 0 }, { 'SMILES', 'SMILES', 233, 'y', 0 }, { 'InChI', 'InChI', 234, 'y', 0 }, { 'InChIKey', 'InChI key', 235, 'y', 0 }, } }, { title = 'Biologiako identifikadoreak', group = { { 'MGI', 'MGI', 231, 'n', 0 }, { 'HomoloGene', 'HomoloGene', 593, 'n', 0 }, } } } -- -- Example row: -- -- conf.databases[2] = {} -- conf.databases[2].name = 'External links' -- conf.databases[2].list = { -- { -- title = , -- group = { -- { 'Website', 'Website', 856, 'n', 0 }, -- }, -- }, -- }

--In this order: alternate name, name of parameter from databases table conf.aliases = { { 'Wd', 'Wikidata' }, { 'PND', 'GND' }, { 'Commonscat', 'Commons' }, }

local function getCatForId( parameter, Kategoria ) local title = mw.title.getCurrentTitle() local namespace = title.namespace if Kategoria == 0 then return elseif Kategoria == 1 then Kategoria = parameter end if namespace == 0 then return '\n' elseif namespace == 2 and not title.isSubpage then return '\n' else return '\n' end end

function getIdsFromSitelinks( item, property ) local ids = {} if item and item.sitelinks and item.sitelinks[ property ] then table.insert( ids, item.sitelinks[ property ].title ) end return ids end

function getIdsFromWikidata( item, property ) local ids = {} if not item.claims[property] then return ids end for _, statement in pairs( item:getBestStatements( property )) do if statement.mainsnak.datavalue then table.insert( ids, statement.mainsnak.datavalue.value ) end end return ids end

function getLink( property, val, mask ) local link = if mw.ustring.find( val, '//' ) then link = val else if type(property) == 'number' then local entityObject = mw.wikibase.getEntityObject('P'..property) local dataType = entityObject.datatype if dataType == 'external-id' then local allStatements = entityObject:getAllStatements('P1630') if allStatements then for pos = 1, #allStatements, 1 do local q = allStatements[pos].qualifiers if q and q.P407 and q.P407[1].datavalue.value.id == 'Q8752' then link = allStatements[pos].mainsnak.datavalue.value end end end if link == then local formatterURL = entityObject:getBestStatements('P1630')[1] if formatterURL then link = formatterURL.mainsnak.datavalue.value else local formatterURL = entityObject:getBestStatements('P3303')[1] if formatterURL then link = formatterURL.mainsnak.datavalue.value end end end elseif dataType == 'url' then local subjectItem = entityObject:getBestStatements('P1629')[1] if subjectItem then local officialWebsite = mw.wikibase.getEntityObject(subjectItem.mainsnak.datavalue.value.id):getBestStatements('P856')[1] if officialWebsite then link = officialWebsite.mainsnak.datavalue.value end end elseif dataType == 'string' then local formatterURL = entityObject:getBestStatements('P1630')[1] if formatterURL then link = formatterURL.mainsnak.datavalue.value else local formatterURL = entityObject:getBestStatements('P3303')[1] if formatterURL then link = formatterURL.mainsnak.datavalue.value else local subjectItem = entityObject:getBestStatements('P1629')[1] if subjectItem then local officialWebsite = mw.wikibase.getEntityObject(subjectItem.mainsnak.datavalue.value.id):getBestStatements('P856')[1] if officialWebsite then link = officialWebsite.mainsnak.datavalue.value end end end end end elseif type(property) == 'string' then link = property end end link = mw.ustring.gsub(link, '^[Hh][Tt][Tt][Pp]([Ss]?)://', 'http%1://') -- fix wikidata URL if type(mask) == 'function' then return mask( val, link, property ) end link = mw.ustring.gsub(link, '$1', mw.ustring.gsub( val, ' ', '%%%%20' ) or val ) if mw.ustring.find( link, '//' ) then if type(mask) == 'string' then if mask == 'y' then return '['..link..' ID]' elseif mask == 'n' then return '['..link..' '..val..']' end return '['..link..' '..mask..']' end elseif link == then return val else return ''..val..'' end end

local function createRow( id, label, rawValue, link, withUid ) if link then if label and label ~= then label = ''..label .. ': ' end if withUid then return '* ' .. label .. '' .. link .. '\n' else return '* ' .. label .. link .. '\n' end else return '* El ' .. id .. ' id ' .. rawValue .. ' ez da baliagarria\n' end end

local function copyTable(inTable) if type(inTable) ~= 'table' then return inTable end local outTable = setmetatable({}, getmetatable(inTable)) for key, value in pairs (inTable) do outTable[copyTable(key)] = copyTable(value) end return outTable end

local function splitLccn( id ) if id:match( '^%l%l?%l?%d%d%d%d%d%d%d%d%d?%d?$' ) then id = id:gsub( '^(%l+)(%d+)(%d%d%d%d%d%d)$', '%1/%2/%3' ) end if id:match( '^%l%l?%l?/%d%d%d?%d?/%d+$' ) then return mw.text.split( id, '/' ) end return false end

local p = {}

function p.authorityControl( frame ) local parentArgs = copyTable(frame:getParent().args) local stringArgs = false local fromForCount, itemCount, rowCount = 1, 0, 0 local mobileContent = --Cleanup args for k, v in pairs( frame:getParent().args ) do if type(k) == 'string' then --make args case insensitive local lowerk = mw.ustring.lower(k) if not parentArgs[lowerk] or parentArgs[lowerk] == then parentArgs[lowerk] = v parentArgs[k] = nil end --remap abc to abc1 if not mw.ustring.find(lowerk, '%d$') then --if no number at end of param if not parentArgs[lowerk..'1'] or parentArgs[lowerk..'1'] == then parentArgs[lowerk..'1'] = v parentArgs[lowerk] = nil end end if v and v ~= then --find highest from param if mw.ustring.sub(lowerk,1,4) == 'from' then local fromNumber = tonumber(mw.ustring.sub(lowerk,5,-1)) if fromNumber and fromNumber >= fromForCount then fromForCount = fromNumber end elseif mw.ustring.sub(lowerk,1,3) == 'for' then local forNumber = tonumber(mw.ustring.sub(lowerk,4,-1)) if forNumber and forNumber >= fromForCount then fromForCount = forNumber end elseif mw.ustring.lower(v) ~= 'no' and lowerk ~= 'for' then stringArgs = true end end end end

--Setup navbox local navboxParams = { name = 'Control de autoridades', bodyclass = 'hlist', groupstyle = 'width: 12%; text-align:center;', } for f = 1, fromForCount, 1 do local title = {} --cleanup parameters if parentArgs['from'..f] == then parentArgs['from'..f] = nil end if parentArgs['for'..f] == then parentArgs['for'..f] = nil end --remap aliases for _, a in pairs( conf.aliases ) do local alias, name = mw.ustring.lower(a[1]), mw.ustring.lower(a[2]) if parentArgs[alias..f] and not parentArgs[name..f] then parentArgs[name..f] = parentArgs[alias..f] parentArgs[alias..f] = nil end end

--Fetch Wikidata item local item = mw.wikibase.getEntity(parentArgs['from'..f]) local label = item and item:getLabel() if label and label ~= then title = mw.title.new(label) if not title then title = mw.title.getCurrentTitle() end else title = mw.title.getCurrentTitle() end

if (not parentArgs['wikidata'..f] or parentArgs['wikidata'..f] == ) and (title.namespace == 0) then parentArgs['wikidata'..f] = parentArgs['from'..f] or (item and item.id) or end if title.namespace == 0 or stringArgs then --Only in the main namespace or if there are manual overrides

if fromForCount > 1 and #conf.databases > 1 then if parentArgs['for'..f] and parentArgs['for'..f] ~= then navboxParams['list'..(rowCount + 1)] = "" .. parentArgs['for'..f] .. "" else navboxParams['list'..(rowCount + 1)] = "" .. title.text .. "" end navboxParams['list'..(rowCount + 1)..'style'] = 'background-color: #ddf;' rowCount = rowCount + 1 end for _, db in pairs( conf.databases ) do if db.list and #db.list > 0 then local listElements = {} for n, gr in pairs( db.list ) do local groupElements = {} if gr.group and #gr.group > 0 then for _, params in pairs( gr.group ) do local id = mw.ustring.lower( params[1] ) -- Wikidata fallback if requested if (item ~= nil and item.claims ~= nil) and params[3] ~= 0 and (not parentArgs[id..f] or parentArgs[id..f] == ) then local wikidataIds = {} if type( params[3] ) == 'function' then wikidataIds = params[3]( item ) elseif type( params[3] ) == 'string' then wikidataIds = getIdsFromSitelinks( item, params[3] ) else wikidataIds = getIdsFromWikidata( item, 'P' .. params[3] ) end if wikidataIds[1] then parentArgs[id..f] = wikidataIds[1] end end -- Worldcat if id == 'issn' and parentArgs['worldcatid'..f] and parentArgs['worldcatid'..f] ~= then -- 'issn' is the first element following the 'wikidata' item table.insert( groupElements, createRow( id, , parentArgs['worldcatid'..f], '.. parentArgs['worldcatid'..f .. ' WorldCat]', false ) ) --Validation? elseif id == 'viaf' and parentArgs[id..f] and string.match( parentArgs[id..f], '^%d+$' ) and not parentArgs['worldcatid'..f] then -- Hackishly copy the validation code; this should go away when we move to using P1793 and P1630 table.insert( groupElements, createRow( id, , parentArgs[id..f], '.. parentArgs[id..f .. ' WorldCat]', false ) ) elseif id == 'lccn' and parentArgs[id..f] and parentArgs[id..f] ~= and not parentArgs['viaf'..f] and not parentArgs['worldcatid'..f] then local lccnParts = splitLccn( parentArgs[id..f] ) if lccnParts and lccnParts[1] ~= 'sh' then table.insert( groupElements, createRow( id, , parentArgs[id..f], '.. lccnParts[1 .. lccnParts[2] .. '-' .. lccnParts[3] .. ' WorldCat]', false ) ) end end

local val = parentArgs[id..f] if val and val ~= and mw.ustring.lower(val) ~= 'no' and params[3] ~= 0 then local link if type( params[3] ) == 'function' then link = val else link = getLink( params[3], val, params[4] ) end if link and link ~= then table.insert( groupElements, createRow( id, params[2], val, link, true ) .. getCatForId( params[1], params[5] or 0 ) ) itemCount = itemCount + 1 end end end if #groupElements > 0 then if gr.title and gr.title ~= then table.insert( listElements, "* "..gr.title.."\n" ) end table.insert( listElements, table.concat( groupElements ) ) if n == 1 and #groupElements > 1 then table.insert( listElements, "\n----\n" ) end -- mobile version if n == 1 then mobileContent = table.concat( groupElements ) end end end end -- Generate navbox title if #listElements > 0 then if fromForCount > 1 and #conf.databases == 1 then if parentArgs['for'..f] and parentArgs['for'..f] ~= then navboxParams['group'..(rowCount + 1)] = "" .. parentArgs['for'..f] .. "" else navboxParams['group'..(rowCount + 1)] = "" .. title.text .. "" end else navboxParams['group'..(rowCount + 1)] = db.name or end navboxParams['list'..(rowCount + 1)] = table.concat( listElements ) rowCount = rowCount + 1 end end end end end if rowCount > 0 then local Navbox = require('Modulu:Navbox') if fromForCount > 1 then navboxParams['title'] = 'Autoritate kontrola' --add missing names for r = 1, rowCount, 1 do if navboxParams['group'..r] == then navboxParams['group'..r] = "" .. mw.wikibase.getEntity(parentArgs['wikidata'..r]):getLabel().."" end end if fromForCount > 2 then navboxParams['navbar'] = 'plain' else navboxParams['state'] = 'off' navboxParams['navbar'] = 'off' end end local mainCategories = if stringArgs then mainCategories = mainCategories .. '\n' end if itemCount > 13 then if itemCount > 30 then itemCount = '30 baino gehiago' end mainCategories = mainCategories .. '\n' end navboxParams['style'] = 'width: inherit'; return frame:extensionTag{ name = 'templatestyles', args = { src = 'Txantiloi:autoritate kontrola/styles.css' } } .. tostring( mw.html.create( 'div' ) :addClass( 'mw-authority-control' ) :wikitext( Navbox._navbox( navboxParams ) ) :done() :tag('div') :addClass( 'mw-mf-linked-projects' ) :addClass( 'hlist' ) :newline() :wikitext( mobileContent ) :done() :done() ) .. mainCategories else return end end

return p