मोड्युल:Authority control
स्वरूप
![](http://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Test_Template_Info-Icon_-_Version_%282%29.svg/50px-Test_Template_Info-Icon_-_Version_%282%29.svg.png)
![]() | This Lua module is used on many pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
Related pages |
---|
![](http://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Wikidata-logo.svg/40px-Wikidata-logo.svg.png)
This module uses one or more Wikidata properties; see § Parameters for details.
![]() | यो मोड्युल निम्न अन्य मोड्युलहरूमा निर्भर छ: |
This module contains the code of the {{Authority control}} and {{Pages with authority control identifiers}} templates.
Parameters, Wikidata properties, and tracking categories
[सम्पादन गर्नुहोस्]Code | Identifier | Wikidata property | Section | Appears as | Remarks | Tracking categories and page counts | |
---|---|---|---|---|---|---|---|
Articles | Faulty IDs | ||||||
AAG | P3372 | कला दीर्घाओं र संग्रहालयहरू | अकल्याण्ड | ० [create] | ० [create] | ||
ACM-DL | ACM Digital Library | P864 | वैज्ञानिक डेटाबेसहरू | कम्प्युटिङ मेसिनरी संघ | ० [create] | ० [create] | |
ADB | Australian Dictionary of Biography | P1907 | जीवनी शब्दकोशहरू | अस्ट्रेलिया | ० [create] | ० [create] | |
admiralty | Admiralty List of Lights and Fog Signals | P3562 | लाइटहाउस पहिचानकर्ताहरू | D1204.1 | ० [create] | ० [create] | |
AGSA | P6804 | कला दीर्घाओं र संग्रहालयहरू | दक्षिण अस्ट्रेलिया | ० [create] | ० [create] | ||
ARLHS | P2980 | लाइटहाउस पहिचानकर्ताहरू | एआरएलएचएस | ० [create] | ० [create] | ||
autores.uy | Autores.uy | P2558 | जीवनी शब्दकोशहरू | उरुग्वे | autores.uy is an author's database, that focus on Uruguayan authors. It was created and maintained by the Uruguayan chapter of Creative Commons. It also provides access to digitized works of the authors in public domain. | ० [create] | ० [create] |
AWR | Australian Women's Register | P4186 | जीवनी शब्दकोशहरू | अष्ट्रेलियाली महिला दर्ता | ० [create] | ० [create] | |
BIBSYS | Norwegian Authority File: Persons and Corporate Bodies | P1015 | राष्ट्रिय पुस्तकालयहरू | नर्वे | BIBSYS is a supplier of library and information systems for all Norwegian university Libraries, the National Library of Norway, college libraries, and a number of research libraries and institutions. | १३ [create] | ० [create] |
Bildindex | Bildindex der Kunst und Architektur | P2092 | कला अनुसन्धान संस्थानहरू | बिल्डिन्डेक्स (जर्मनी) | ० [create] | ० [create] | |
BNC | Collective Catalog of Bibliographic Authorities of Chile | P1890 | राष्ट्रिय पुस्तकालयहरू | चिली | १ [create] | ० [create] | |
BNE | datos.bne.es | P950 | राष्ट्रिय पुस्तकालयहरू | स्पेन | National Library of Spain (BNE: Biblioteca Nacional de España) is a major public library, the largest in Spain. | १३ | ० [create] |
BNF | BnF authorities | P268 | राष्ट्रिय पुस्तकालयहरू | फ्रान्स (तथ्याङ्क) | Authority data of people listed in the general catalogue of the National Library of France | २८ | ० [create] |
BNMM | Catálogo de autoridades BNMM | P3788 | राष्ट्रिय पुस्तकालयहरू | अर्जेन्टिना | १ [create] | ० [create] | |
Botanist | International Plant Names Index | P428 | वैज्ञानिक डेटाबेसहरू | अन्तर्राष्ट्रिय वनस्पति नाम सूचकांक | Author citation (botany): standard form (official abbreviation) of a personal name for use in an author citation (only for names of algae, fungi and plants). Links to page at International Plant Names Index (IPNI). | ० [create] | ० [create] |
BPN | Biografisch Portaal | P651 | जीवनी शब्दकोशहरू | नेदरल्यान्ड | Dutch project with material for 40,000 digitized biographies, including former colonies of the Netherlands. | ० [create] | ० [create] |
CANTICN | Name and Title Authority File of Catalonia | P9984 | राष्ट्रिय पुस्तकालयहरू | क्याटालोनिया | ९ [create] | ० [create] | |
CCG | P3920 | लाइटहाउस पहिचानकर्ताहरू | A1761 | ० [create] | ० [create] | ||
CINII | NACSIS-CAT | P271 | वैज्ञानिक डेटाबेसहरू | सिनि (जापान) | CiNii is a bibliographic database service for material in Japanese academic libraries. It is maintained by the National Institute of Informatics. | १० [create] | ० [create] |
CWGC | Commonwealth War Graves Commission database | P1908 | अन्य | राष्ट्रमंडल युद्ध ग्रेभ्स आयोग | ० [create] | ० [create] | |
DAAO | Design & Art Australia Online | P1707 | कला अनुसन्धान संस्थानहरू | अष्ट्रेलियाका कलाकारहरू | ० [create] | ० [create] | |
DBI | Dizionario Biografico degli Italiani | P1986 | जीवनी शब्दकोशहरू | इटालियन मानिसहरू | ० [create] | ० [create] | |
DBLP | dblp computer science bibliography | P2456 | वैज्ञानिक डेटाबेसहरू | कम्प्युटर विज्ञान (DBLP) | १ [create] | ० [create] | |
DIB | Dictionary of Irish Biography | P6829 | जीवनी शब्दकोशहरू | आयरल्यान्ड | ० [create] | ० [create] | |
DSI | The Stuttgart Database of Scientific Illustrators 1450–1950 | P2349 | कला अनुसन्धान संस्थानहरू | वैज्ञानिक चित्रकारहरू | ० [create] | ० [create] | |
DTBIO | Deutsche Biographie | P7902 | जीवनी शब्दकोशहरू | जर्मनी | ८ [create] | ० [create] | |
EMU | Encyclopedia of Modern Ukraine | P4613 | राष्ट्रिय पुस्तकालयहरू | युक्रेन | ३ | ० [create] | |
FAST | Faceted Application of Subject Terminology | P2163 | अन्य | फास्ट | २७ [create] | ० [create] | |
FNZA | Find New Zealand Artists | P6792 | कला अनुसन्धान संस्थानहरू | न्यूजील्याण्ड कलाकारहरू | ० [create] | ० [create] | |
GND | Integrated Authority File | P227: जिएनडी आइडी | राष्ट्रिय पुस्तकालयहरू | जर्मनी | Authority data on people, corporations and subjects from the German National Library (DNB) | ४२ | १ [create] |
Google Scholar | Google Scholar | P1960 | वैज्ञानिक डेटाबेसहरू | गुगल स्कॉलर | ० [create] | ० [create] | |
HDS | Historical Dictionary of Switzerland | P902 | अन्य | स्विट्जरल्याण्ड को ऐतिहासिक शब्दकोश | Historical Dictionary of Switzerland is an encyclopedia on the history of Switzerland. | २ [create] | ० [create] |
IAAF | World Athletics database | P1146 | अन्य | विश्व एथलेटिक्स | The IAAF athlete database lists information about sport of athletics competitors. | ० [create] | ० [create] |
ICCU | OPAC SBN | P396 | राष्ट्रिय पुस्तकालयहरू | इटाली | Central Institute for the Union Catalogue (ICCU: Istituto Centrale per il Catalogo Unico) is an Italian government agency created to build a single catalog of all the libraries in the nation. It manages National Library Service (Servizio bibliotecario nazionale). | ३ [create] | ० [create] |
ICIA | Information Center for Israeli Art | P1736 | कला अनुसन्धान संस्थानहरू | आईसीआईए (इजरायल) | ० [create] | ० [create] | |
IEU | Internet Encyclopedia of Ukraine | P9070 | अन्य | युक्रेनको इन्टरनेट इन्साइक्लोपीडिया | ० [create] | ० [create] | |
ISNI | इन्टरनेसनल स्ट्यान्डर्ड नेम आइडेन्टिफायर | P213 | साधारण | 1 | ISNI is a method for uniquely identifying the public identities of contributors to media content such as books, TV programmes, and newspaper articles. Please take care not to confuse ISNI and ORCID identifiers. | ५८ | ० [create] |
J9U | National Library of Israel Names and Subjects Authority File | P8189 | राष्ट्रिय पुस्तकालयहरू | इजरायल | ३२ | ० [create] | |
Joconde | Joconde | P347 | कला अनुसन्धान संस्थानहरू | जोकोन्डे (फ्रान्स) | ० [create] | ० [create] | |
KULTURNAV | KulturNav | P1248 | कला अनुसन्धान संस्थानहरू | कल्चरनाभ (नर्वे) | KulturNav is a Norwegian cloud-based software service, allowing users to create, manage and distribute name authorities and terminology, focusing on the needs of museums and other cultural heritage institutions. The software is developed by KulturIT ANS and the development project is funded by the Arts Council Norway. | ० [create] | ० [create] |
LCCN | Library of Congress Authorities | P244 | राष्ट्रिय पुस्तकालयहरू | संयुक्त राज्य अमेरिका | See Wikipedia:Authority control#LCCN for formatting instructions | ७८ | ० [create] |
LIR | Lexicon istoric retic | P886 | अन्य | लेक्सिकन इस्टोरिक रेटिक (स्विट्जरल्याण्ड) | Lexicon Istoric Retic (LIR) is a two volume version with a selection of articles published in Romansh. | ० [create] | ० [create] |
LNB | Electronic Union Catalogue of Latvian Libraries of National Significance | P1368 | राष्ट्रिय पुस्तकालयहरू | लाटभिया | ६ [create] | ० [create] | |
Marina Militare | Fari e Segnalamenti | P3863 | लाइटहाउस पहिचानकर्ताहरू | इटाली | ० [create] | ० [create] | |
MarineTraffic | P3601 | लाइटहाउस पहिचानकर्ताहरू | समुद्री यातायात | ० [create] | ० [create] | ||
MATHSN | Mathematical Reviews | P4955 | वैज्ञानिक डेटाबेसहरू | माथ सचि नेट | ० [create] | ० [create] | |
MBA | MusicBrainz | P434 | अन्य | कलाकार | MusicBrainz is an open music encyclopedia that collects music metadata and makes it available to the public. | २९ [create] | ० [create] |
MBAREA | MusicBrainz | P982: MusicBrainz क्षेत्र आइडी | अन्य | क्षेत्र | २ [create] | ० [create] | |
MBI | MusicBrainz | P1330 | अन्य | साधन | ० [create] | ० [create] | |
MBL | MusicBrainz | P966 | अन्य | लेबल | १ [create] | ० [create] | |
MBP | MusicBrainz | P1004 | अन्य | ठाउँ | ० [create] | ० [create] | |
MBRG | MusicBrainz | P436 | अन्य | रिलिज समूह | १ [create] | ० [create] | |
MBS | MusicBrainz | P1407 | अन्य | श्रृंखला | ० [create] | ० [create] | |
MBW | MusicBrainz | P435 | अन्य | काम | १ [create] | ० [create] | |
MGP | Mathematics Genealogy Project | P549 | वैज्ञानिक डेटाबेसहरू | गणित वंशावली परियोजना | Mathematics Genealogy Project is a web-based database for the academic genealogy of mathematicians. | ० [create] | ० [create] |
NARA | National Archives Identifier | P1225 | अन्य | राष्ट्रिय अभिलेख (अमेरिका) | National Archives and Records Administration (NARA) is an independent agency of the United States government charged with preserving and documenting government and historical records. | २ [create] | ० [create] |
NCL | P1048 | राष्ट्रिय पुस्तकालयहरू | ताइवान | National Central Library is the national library of Taiwan, Republic of China. | ० [create] | ० [create] | |
NDL | Web NDL Authorities | P349: NDL पहिचानसङ्केत | राष्ट्रिय पुस्तकालयहरू | जापान | Authority data listed in the catalog of the national library of Japan. Search also available via VIAF. | ९ [create] | ० [create] |
NGA | NGA List of Lights, Radio Aids and Fog Signals | P3563 | लाइटहाउस पहिचानकर्ताहरू | एनजीए | ० [create] | ० [create] | |
NGV | P2041 | कला दीर्घाओं र संग्रहालयहरू | भिक्टोरिया | ० [create] | ० [create] | ||
NKC | Czech National Authority Database | P691 | राष्ट्रिय पुस्तकालयहरू | चेक गणतन्त्र | National Library of the Czech Republic (Národní knihovna České republiky) is the central library of the Czech Republic. | २० | ० [create] |
NLA | Libraries Australia Authorities | P409 | राष्ट्रिय पुस्तकालयहरू | अस्ट्रेलिया | NLA Trove's People and Organisation view allows the discovery of biographical and other contextual information about people and organisations. Search also available via VIAF. | १२ | ० [create] |
NLG | Catalogue of the National Library of Greece | P3348 | राष्ट्रिय पुस्तकालयहरू | ग्रीस | ५ [create] | ० [create] | |
NLK | Korean Authority File | P5034 | राष्ट्रिय पुस्तकालयहरू | कोरिया | ९ [create] | ० [create] | |
NLR | National Library of Romania authority file | P1003 | राष्ट्रिय पुस्तकालयहरू | रोमानिया | ० [create] | ० [create] | |
NSK | NSK | P1375 | राष्ट्रिय पुस्तकालयहरू | क्रोएसिया | ७ [create] | ० [create] | |
NTA | data.bibliotheken.nl | P1006 | राष्ट्रिय पुस्तकालयहरू | नेदरल्याण्ड | १७ | ० [create] | |
ORCID | ORCID iD | P496 | साधारण | 1 | Authority data on researchers, academics, etc. The ID range is a subset of the ISNI range. For free text links (for example when mentioning a person on page which is not about them), it is also possible to use {{ORCID}}. Authors—including Wikipedia editors—may obtain an ORCID by signing up at orcid.org/register. Please take care not to confuse ORCID and ISNI identifiers. | १ [create] | ० [create] |
PIC | Photographers’ Identities Catalog | P2750 | कला अनुसन्धान संस्थानहरू | फोटोग्राफरको पहिचान | PIC is a photographer's database. It is maintained by the New York Public Library. | ० [create] | ० [create] |
PLWABN | MAK | P7293 | राष्ट्रिय पुस्तकालयहरू | पोल्याण्ड | १३ [create] | ० [create] | |
NLP | P1695 | राष्ट्रिय पुस्तकालयहरू | पोल्याण्ड | ० [create] | ० [create] | ||
Publons | Publons | P3829 | वैज्ञानिक डेटाबेसहरू | पब्लन (अनुसन्धानकर्ताहरू) | १ [create] | ० [create] | |
RID | ResearcherID | P1053 | वैज्ञानिक डेटाबेसहरू | अनुसन्धानकर्ता आईडी | An identifying system for scientific authors. The system was introduced in January 2008 by Thomson Reuters. The combined use of the digital object identifier with the ResearcherID allows for a unique association of authors and scientific articles. | १ [create] | ० [create] |
RISM | Répertoire International des Sources Musicales | P5504 | अन्य | 1 | ० [create] | ० [create] | |
RERO | RERO | P3065 | अन्य | 1 | ८ [create] | ० [create] | |
RKDartists | RKDartists | P650 | कला अनुसन्धान संस्थानहरू | आरकेडी कलाकार (नेदरल्याण्ड) | RKDartists is an online database using a controlled vocabulary currently containing around 200,000+ names and other information about artists. Names in RKDartists may include given names, pseudonyms, variant spellings, names in multiple languages, and names that have changed over time (e.g., married names). | ० [create] | ० [create] |
RKDID | RKDimages | P350 | कला अनुसन्धान संस्थानहरू | आरकेडी कलाकार (नेदरल्याण्ड) | ० [create] | ० [create] | |
RSL | Russian State Library | P947 | राष्ट्रिय पुस्तकालयहरू | रुस | Russian State Library (Российская государственная библиотека) is the national library of Russia. | ० [create] | ० [create] |
Scopus | Scopus | P1153 | वैज्ञानिक डेटाबेसहरू | स्कोपस लेखक | SciVerse Scopus is a bibliographic database containing abstracts and citations for academic journal articles. It covers nearly 19,500 titles from over 5,000 international publishers, of which 16,500 are peer-reviewed journals in the scientific, technical, medical, and social sciences (including arts and humanities). | ० [create] | ० [create] |
SELIBR | LIBRIS | P906 | राष्ट्रिय पुस्तकालयहरू | स्वीडेन | Authority data from the National Library of Sweden | ७ [create] | ० [create] |
SIKART | SIKART | P781 | कला अनुसन्धान संस्थानहरू | सिकार्ट (स्विजरल्याण्ड) | SIKART is a biographical dictionary and a database on visual art in Switzerland and Liechtenstein. It is published online by the Swiss Institute for Art Research (SIAR). | ० [create] | ० [create] |
SNAC-ID | SNAC | P3430 | अन्य | सामाजिक सञ्जाल र अभिलेखीय सन्दर्भ | ५ [create] | ० [create] | |
SUDOC | IdRef | P269 | अन्य | 1 | Authority data of people listed in the general catalogue of the University Documentation System of France. Also available from English-speaking catalog (search author, click one book, click author name, take PPN= value of the URL) | २५ [create] | ० [create] |
TA98 | Terminologia Anatomica | P1323 | वैज्ञानिक डेटाबेसहरू | टर्मिनोलोजिया एनाटोमिका | ० [create] | ० [create] | |
TDVİA | TDV İslam Ansiklopedisi | P7314 | अन्य | इस्लाम अन्सिकलोपेडिसी | १ [create] | ० [create] | |
TePapa | Museum of New Zealand Te Papa Tongarewa Collections Online | P3544 | कला दीर्घाओं र संग्रहालयहरू | ते पापा (न्युजिल्याण्ड) | ० [create] | ० [create] | |
TLS | Theaterlexikon der Schweiz | P1362 | अन्य | थिएटरलेक्सिकन (स्विजरल्याण्ड) | Theaterlexikon der Schweiz (TLS) is an encyclopedia about theatre in Switzerland. It was developed by the Institute of Theatre Studies of the University of Berne. | ० [create] | ० [create] |
Trove | Trove | P1315 | अन्य | 1 | ९ [create] | ० [create] | |
UKPARL | P6213 | अन्य | बेलायत संसद | UK parliament member data | ३ [create] | ० [create] | |
ULAN | Union List of Artist Names | P245 | कला अनुसन्धान संस्थानहरू | कलाकारको नाम (गेटी) | ULAN is an online database using a controlled vocabulary currently containing around 293,000 names and other information about artists. Names in ULAN may include given names, pseudonyms, variant spellings, names in multiple languages, and names that have changed over time (e.g., married names). | २ [create] | ० [create] |
USCG | United States Coast Guard Light List | P3723 | लाइटहाउस पहिचानकर्ताहरू | 6-0695 | ० [create] | ० [create] | |
USCongress | Biographical Directory of the United States Congress | P1157 | अन्य | अमेरिकी कांग्रेस | Biographical Directory of the United States Congress is a biographical dictionary of all present and former members of the United States Congress and its predecessor, the Continental Congress. Also included are Delegates from territories and the District of Columbia and Resident Commissioners from the Philippines and Puerto Rico. | ० [create] | ० [create] |
VcBA | opac.vatlib.it | P8034 | राष्ट्रिय पुस्तकालयहरू | भ्याटिकन | Vatican Library document data | २ [create] | ० [create] |
VIAF | Virtual International Authority File | P214: VIAF पहिचान सङ्केत | साधारण | 1 | International authority data from the Online Computer Library Center (OCLC) | ८५ | ० [create] |
WORLDCATID | WorldCat Identities | P7859 | साधारण | वर्ल्डक्याट | ९ | ० [create] | |
VIAF | Virtual International Authority File | P214: VIAF पहिचान सङ्केत | साधारण | वर्ल्डक्याट (पुस्तकालय अफ कांग्रेस मार्फत) | ७६ | ० [create] | |
ZBMATH | zbMATH Open Database | P1556 | वैज्ञानिक डेटाबेसहरू | zbMATH | ० [create] | ० [create] | |
Totals | ९७ | ६९८ | १ |
Additional tracking categories
[सम्पादन गर्नुहोस्]This module also implements the following hidden tracking categories:
- श्रेणी:Pages with red-linked authority control categories (१०२) – error category to identify missing categories
- श्रेणी:Articles with suppressed authority control identifiers (१) – tracking only (no error)
- श्रेणी:Pages using authority control with parameters (१६) – migrate IDs to Wikidata, if possible (no error)
- श्रेणी:Pages using authority control with parameters different on Wikidata (२) – determine/remove incorrect IDs & migrate to Wikidata
- श्रेणी:Pages using authority control with parameters all matching Wikidata (१०) – template parameters may safely be removed
State parameter
[सम्पादन गर्नुहोस्]- श्रेणी:AC using state parameter: collapsed (०)
- श्रेणी:AC using state parameter: expanded (१)
- श्रेणी:AC using state parameter: autocollapse (०)
- श्रेणी:AC using state parameter: other (०)
See also
[सम्पादन गर्नुहोस्]- m:Interwiki map – definition of global custom interwiki prefixes
require('strict')
local p = {}
local title = mw.title.getCurrentTitle()
local namespace = title.namespace
local testcases = (string.sub(title.subpageText,1,9) == 'testcases')
local function addCat(cat)
if cat and cat ~= '' then
local redlinkcat = ''
if testcases == false and mw.title.new(cat, 14).exists == false then
redlinkcat = '[[Category:Pages with red-linked authority control categories]]'
end
return '[[Category:'..cat..']]'..redlinkcat
else
return ''
end
end
local function getCatForId(id)
local cat = ''
if namespace == 0 then
cat = 'Articles with '..id..' identifiers'
end
return addCat(cat)
end
local function getIdsFromWikidata(qid,property)
local ids = {}
if not mw.wikibase or not qid then
return ids
end
local statements = mw.wikibase.getBestStatements(qid,property)
if statements then
for _, statement in ipairs( statements ) do
if statement.mainsnak.datavalue then
table.insert( ids, statement.mainsnak.datavalue.value )
end
end
end
return ids
end
local function makelink(conf,val,nextid) --validate values and create a link
local link
if conf.link2 then -- use function to validate and generate link
link = conf.link2(val)
else
local valid_value
if conf.pattern then -- use pattern to determine validity if defined
valid_value = val:match(conf.pattern)
elseif conf.patterns then
for i = 1,#conf.patterns do
valid_value = val:match(conf.patterns[i])
if valid_value then break end
end
elseif conf.valid then -- otherwise use function to determine validity
valid_value = conf.valid(val)
else -- no validation possible
valid_value = val
end
if valid_value then
local label = conf.label
if not label or nextid>1 then
label = tostring(nextid)
end
if conf.link then
valid_value = valid_value:gsub('%%', '%%%%')
link = '[' .. mw.ustring.gsub(conf.link,'%$1',valid_value) .. ' ' .. label .. ']'
else
link = valid_value
end
else
link = false
end
end
if link then
link = '<span class="uid">'..link..'</span>'
else
local faultyCat = 'Articles with faulty '..(conf.errorcat or conf.category or conf[1])..' identifiers'
link = '<span class="error">The '..conf[1]..' id '..val..' is not valid.</span>'..addCat(faultyCat)
end
return link
end
--[[==========================================================================]]
--[[ Main ]]
--[[==========================================================================]]
function p.authorityControl(frame)
local config = require("Module:Authority control/config")
local conf = config.config
local sectionNames = config.sectionNames
local resolveEntity = require( 'Module:ResolveEntityId' )
local parentArgs = frame:getParent().args --WD IDs added here later
local iParentArgs = 0 --count original/manual parent args only later
local iMatches,suppressedIdCount = 0,0
local auxCats = ''
local rct = 0 -- total number of links returned
local numqids = 4 -- support for 4 additional qids
local totsect = #sectionNames + numqids
local sections = {}
for _ = 1,totsect do table.insert(sections,{}) end
-- check for suppressed identifiers
local suppress = {}
if parentArgs.suppress then
local suppresslist = mw.text.split(parentArgs.suppress,"%s*,%s*") -- split parameter by comma
for _,v in ipairs(suppresslist) do
if v:match("^%d+$") then
v = "P"..tostring(v)
else
v = string.upper(v)
end
suppress[v] = true -- index table by identifier name
end
end
local function makeSections(qid,additional)
local tval = {}
local function parameter_is_used(property)
local used = false
if property then
if tval[property] then
if tval[property][1] then
used = true
end
elseif tval[property] == false then -- property has been manually suppressed
used = true
end
end
return used
end
for _, params in ipairs(conf) do
tval[params.property] = getIdsFromWikidata(qid, 'P' .. params.property) -- setup table for values with property number as key
if additional then
if suppress["P"..tostring(params.property)] or suppress[string.upper(params[1])] then
tval[params.property] = false -- indicates the identifier is suppressed
end
else
local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]
if suppress["P"..tostring(params.property)] or suppress[string.upper(params[1])] or val == '' then
if tval[params.property][1] and (namespace == 0 or testcases) then
suppressedIdCount = suppressedIdCount + 1
if parentArgs['arts'] ~= 'arts' then
auxCats = auxCats .. '[[Category:Articles with suppressed authority control identifiers|'..params[1]..']]'
end
end
tval[params.property] = false -- indicates the identifier is suppressed
elseif val then -- add local parameter to wikidata
iParentArgs = iParentArgs + 1
local bnew = true
for _, w in pairs(tval[params.property]) do
if val == w then
bnew = false
end
end
if bnew then -- add new value to table
if tval[params.property][1] then
auxCats = auxCats .. '[[Category:Pages using authority control with parameters different on Wikidata|'..params[1]..']]'
end
table.insert(tval[params.property],val)
else
iMatches = iMatches+1
end
end
end
local suppress = false
if params.suppressedbyproperty then
for _,sc in ipairs(params.suppressedbyproperty) do
if parameter_is_used(sc) then
suppress = true
end
end
end
if not tval[params.property] == false and not suppress then
local tlinks = {} -- setup table for links
local nextIdVal = 1
for _,val in ipairs(tval[params.property]) do
local link = makelink(params,val,nextIdVal)
local cat = params.category or params[1]
if link then -- add category unless link==false
link = link .. getCatForId(cat)
end
table.insert(tlinks,link)
nextIdVal = nextIdVal + 1
end
if tval[params.property][1] then -- assemble
local row = ''
if params.prefix then
row = row..'*'..params.prefix
end
for i, l in ipairs(tlinks) do
if i==1 and not params.prefix then
row = row..'*'
else
row = row..'\n**'
end
row = row .. l
end
row = row..'\n'
local sec = additional or params.section -- uses section 9 for qid2, section 10 for qid3, etc.
table.insert(sections[sec],row)
rct = rct + 1
end
end
end
end
local function pencil(qid)
if not qid then
return ''
end
local args = { pid = 'identifiers' } -- #target the list of identifiers
args.qid = qid
return require('Module:EditAtWikidata')._showMessage(args)
end
local function resolveQID(qid)
if qid then
qid = 'Q'..mw.ustring.gsub(qid, '^[Qq]', '')
qid = resolveEntity._id(qid) --nil if unresolvable
end
return qid
end
local qids = {}
if namespace == 0 then
qids[1] = mw.wikibase.getEntityIdForCurrentPage()
end
if not qids[1] then
qids[1] = resolveQID(parentArgs['qid']) --use qid parameter if no wikidata item is connected
end
makeSections(qids[1],false)
for c = 2,5 do
qids[c] = resolveQID(parentArgs['qid' .. c])
if qids[c] then makeSections(qids[c],totsect-numqids+c-1) end
end
if iMatches > 0 and iMatches == iParentArgs then
auxCats = auxCats .. '[[Category:Pages using authority control with parameters all matching Wikidata]]'
end
if parentArgs['arts'] == 'arts' and suppressedIdCount > 0 then
if namespace == 0 or testcases then
local s = 's'
if suppressedIdCount == 1 then s = '' end
auxCats = auxCats .. addCat('ACArt with '..suppressedIdCount..' suppressed element'..s)
end
end
--configure Navbox
local outString = ''
if rct > 0 then -- there is at least one link to display
local Navbox = require('Module:Navbox')
local sect,lastsect = 0,0
local navboxArgs = {
name = 'Authority control',
navboxclass = 'authority-control',
bodyclass = 'hlist',
state = parentArgs.state or 'autocollapse',
navbar = 'off'
}
for c=1,totsect do
if #sections[c] ~= 0 then -- section is non-empty
sect = sect + 1
lastsect = c
local sectname
if c <= totsect - numqids then -- regular section
sectname = sectionNames[c]
else -- section from additional qid
sectname = mw.wikibase.getLabel(qids[c-totsect+numqids+1]) .. pencil(qids[c-totsect+numqids +1])
end
navboxArgs['group' .. c] = sectname
navboxArgs['list' .. c] = table.concat(sections[c])
end
end
local aclink = '[[Help:प्राधिकरण नियन्त्रण|प्राधिकरण नियन्त्रण]]'
if sect == 1 then -- special display when only one section
if lastsect == 1 or lastsect == 8 then -- no special label when only general or other IDs are present
navboxArgs['group' .. lastsect] = aclink .. pencil(qids[1])
elseif lastsect <= totsect - numqids then -- other regular section
navboxArgs['group' .. lastsect] = aclink .. ': ' .. sectionNames[lastsect] .. pencil(qids[1])
else -- section from additional qid
navboxArgs['group' .. lastsect] = aclink .. ': ' .. navboxArgs['group' .. lastsect]
end
else -- add title to navbox
navboxArgs.title = aclink .. pencil(qids[1])
end
outString = Navbox._navbox(navboxArgs)
end
--auxCats
if rct == 0 or rct >= 25 then
if namespace == 0 or testcases then
auxCats = auxCats .. addCat('AC with '..rct..' elements')
end
end
if parentArgs.state then
if namespace == 0 or testcases then
local sCat
if parentArgs.state == 'collapsed' then sCat = 'AC using state parameter: collapsed'
elseif parentArgs.state == 'expanded' then sCat = 'AC using state parameter: expanded'
elseif parentArgs.state == 'autocollapse' then sCat = 'AC using state parameter: autocollapse'
else sCat = 'AC using state parameter: other'
end
auxCats = auxCats .. addCat(sCat)
end
end
if testcases then
auxCats = mw.ustring.gsub(auxCats, '(%[%[)(Category)', '%1:%2') --for easier checking
end
--out
outString = outString..auxCats
if namespace ~= 0 then
outString = mw.ustring.gsub(outString, '(%[%[)(Category:Articles)', '%1:%2') --by definition
end
return outString
end
-- Creates a human-readable standalone wikitable version of conf, and tracking categories with page counts, for use in the documentation
function p.docConfTable(frame)
local wikiTable = '<table class="wikitable sortable">'..
'<tr><th rowspan=2>Code</th>'..
'<th rowspan=2>Identifier</th>'..
'<th rowspan=2 data-sort-type=number>Wikidata property</th>'..
'<th rowspan=2>Section</th>'..
'<th rowspan=2>Appears as</th>'..
'<th rowspan=2>Remarks</th>'..
'<th colspan=2>Tracking categories and page counts</th></tr>'..
'<tr><th>[[:Category:Articles with authority control information|Articles]]</th>'..
'<th>[[:Category:Articles with faulty authority control information|Faulty IDs]]</th></tr>'
local lang = mw.getContentLanguage()
local a, f, P = 0, 0, 0 --cumulative sums
local config = require("Module:Authority control/config")
local conf = config.config
local sectionNames = config.sectionNames
local getlink = require("Module:Wikidata table")._getLink
local function checkcat(category,label)
local ret='[[:Category:'..category..'|'..label..']]'
if mw.title.new(category, 14).exists == false then
ret = ret..' <span class="plainlinks" style="font-size:85%;">[['..tostring(mw.uri.fullUrl('Category:'..category,'action=edit&preload=Template:Authority_control/preload'))..' create]]</span>'
end
return ret
end
for _, conf in pairs(conf) do
local category = conf.category or conf[1]
local articleCat = 'Articles with '..category..' identifiers'
local wpl = frame:expandTemplate{ title = 'Wikidata property link', args = { id = 'f', conf.property } }
local faultyCat = 'Articles with faulty '.. (conf.errorcat or category) ..' identifiers'
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, 'pages') )
local faultyCount = lang:formatNum( mw.site.stats.pagesInCategory(faultyCat, 'pages') )
P = P + 1 --property count
a = a + lang:parseFormattedNumber(articleCount)
f = f + lang:parseFormattedNumber(faultyCount)
local name = mw.wikibase.getBestStatements('P'..conf.property,"P9073")
if name then
if name[1] then
name = name[1].mainsnak.datavalue.value.id
if name then
name = getlink(name)
end
else
name = false
end
end
wikiTable = wikiTable..'<tr><td>[['..(conf.idlink or conf[1]..' (identifier)')..'|'..conf[1]..']]</td>'..
'<td>'..(name or '')..'</td>'..
'<td data-sort-value='..conf.property..'>'..wpl..'</td>'..
'<td>'..sectionNames[conf.section]..'</td>'..
'<td>'..makelink(conf,conf.example,1)..'</td>'..
'<td>'..(conf.remark or '')..'</td>'..
'<td style="text-align: right;">'..checkcat(articleCat,articleCount)..'</td>'..
'<td style="text-align: right;">'..checkcat(faultyCat,faultyCount)..'</td></tr>'
end
wikiTable = wikiTable..'<tr><th style="text-align: right;" colspan=5>Totals</th>'..
'<th style="text-align: right;">'..lang:formatNum(P)..'</th>'..
'<th style="text-align: right;">'..lang:formatNum(a)..'</th>'..
'<th style="text-align: right;">'..lang:formatNum(f)..'</th></tr></table>'
return require('Module:Suppress categories').main(wikiTable)
end
return p