コンテンツにスキップ

英文维基 | 中文维基 | 日文维基 | 草榴社区

モジュール:Authority control

半永久的に保護されているモジュール
モジュールの解説[表示] [編集] [履歴] [キャッシュを破棄]

{{Normdaten}}のコードを生成しているモジュールです。

識別子、ウィキデータプロパティと追跡カテゴリ

識別子分類ウィキデータのプロパティ表示例記事数 (エラー発生数)
オークランド美術館芸術家P3372: オークランド美術館芸術家ID 558 (0)
ACM電子図書館学術データベースP864: ACM電子図書館著者識別子 343 (0)
オーストラリア人名事典 人物P1907: オーストラリア人名辞典ID 351 (0)
ベルリン芸術アカデミー芸術家P4114: ADK メンバーID 752 (0)
英国水路部灯台番号地理P3562: 英国水路部灯台番号
5 (0)
南オーストラリア美術館芸術家P6804: 南オーストラリア美術館芸術家ID 634 (0)
ARLHS 灯台 ID 地理P2980: ARLHS灯台ID 4 (0)
Autores.uy人物P2558: autores.uy ID 49 (0)
Remarks: 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.
人物P4186: Australian Women's Register ID 120 (0)
植物園自然保護国際機構地理P5818 93 (0)
国立図書館P1015: BIBSYS識別子 28,557 (0)
Remarks: 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.
その他P2092 106 (0)
人物P865: BMLO 1,432 (0)
国立図書館P1890: チリ書誌典拠収集目録識別子 2,489 (0)
スペイン国立図書館識別子国立図書館P950: スペイン国立図書館識別子 35,824 (0)
Remarks: National Library of Spain (BNE: Biblioteca Nacional de España) is a major public library, the largest in Spain.
フランス国立図書館国立図書館P268: フランス国立図書館識別子 82,586 (0)
Remarks: Authority data of people listed in the general catalogue of the National Library of France
フランス国立図書館国立図書館P268: フランス国立図書館識別子 82,586 (0)
国立図書館P3788 1,542 (0)
International Plant Names Index学術データベースP428: 植物学者の短縮名 1,621 (0)
Remarks: 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).
オランダ人物典拠管理データベース 人物P651 1,365 (0)
Remarks: Dutch project with material for 40,000 digitized biographies, including former colonies of the Netherlands.
芸術家P5226 408 (0)
Remarks: Identifier of an artist in the B.R.A.H.M.S. (Base Relationnelle d'Articles Hypertextes sur la Musique du 20e Siècle database), by the IRCAM
その他P5302 184 (0)
Remarks: Identifier for a musical work in the B.R.A.H.M.S. (Base Relationnelle d'Articles Hypertextes sur la Musique du 20e Siècle database) database, by the IRCAM
カタルーニャ名称・題名典拠ファイル 国立図書館P9984: CANTIC識別子 16,147 (1)
カナダ沿岸警備隊灯台識別子地理P3920: カナダ沿岸警備隊灯台識別子 0 (0)
Remarks: Identifier from one of 4 volumes of List of Lights, Buoys and Fog Signals issued by the Canadian Coast Guard.
NACSIS-CAT著者名典拠ID学術データベースP271: NACSIS-CAT著者名典拠ID 58,788 (0)
Remarks: CiNii is a bibliographic database service for material in Japanese academic libraries. It is maintained by the National Institute of Informatics.
CiNii Research ID学術データベースP11496: CiNii Research ID 59,788 (0)
コモンウェルス戦争墓地委員会データベース人物P1908: CWGC人物識別子 69 (0)
芸術家P1707 106 (0)
その他P8671 55 (0)
Remarks: Deutsche Bahn station code, identifier for train stations and other operating points used by Deutsche Bahn
地理P4038
    • デンマーク
      • 4500
0 (0)
イタリア人名事典 人物P1986: イタリア人名事典識別子 2,279 (0)
DBLP学術データベースP2456: DBLP著者識別子 1,030 (0)
ドイッチェ・シンクロンカルテイ 人物P11646 2,897 (0)
Remarks: Online database of voice actors in film and television productions
アイルランド人名事典人物P6829 654 (0)
芸術家P2349: シュトゥットガルト科学イラストレーター・データベースID 920 (0)
ドイッチェ・ビオグラフィー 人物P7902: ドイッチェ・ビオグラフィー識別子 32,712 (0)
地理P9725 4 (0)
Remarks: Identifier for an entry in the castles inventory database EBIDAT
エミー賞芸術家P8381 1,565 (0)
現代ウクライナ百科事典 その他P4613: 現代ウクライナ百科事典ID 1,750 (0)
地理P4535 121 (0)
人物P4534 142 (0)
全般P2163: FAST識別子 66,800 (0)
地理P4143
    • フィンランド
      • 7243
1 (0)
芸術家P6792 76 (0)
GND識別子国立図書館P227: GND識別子 139,611 (0)
Remarks: Authority data on people, corporations and subjects from the German National Library (DNB)
Google Scholar著者識別子学術データベースP1960: Google Scholar著者識別子 904 (0)
グラミー賞芸術家識別子芸術家P7303: グラミー賞芸術家識別子 3,137 (0)
Global Volcanism Program地理P1886: GVP火山番号 247 (0)
スイス歴史事典その他P902: スイス歴史事典識別子 2,781 (0)
Remarks: Historical Dictionary of Switzerland is an encyclopedia on the history of Switzerland.
ワールド・アスレティックス・データベース人物P1146: ワールド・アスレティックスID 2,738 (0)
Remarks: The IAAF athlete database lists information about sport of athletics competitors.
国立図書館P396: イタリア国立図書館サービス著者識別子 14,747 (0)
Remarks: 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).
芸術家P1736 20 (0)
IEU (識別子)その他P9070: ウクライナ・インターネット百科事典識別子 374 (0)
図書館及び関連組織のための国際標準識別子人物P791: ISIL識別子 1,861 (0)
Remarks: Libraries, museums and archives, decentralized national databases.
国際標準名称識別子全般P213: ISNI 141,628 (0)
Remarks: 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.
イスラエル国立図書館名称・主題典拠ファイル国立図書館P8189: イスラエル国立図書館J9U識別子 110,829 (0)
ジョコンデ その他P347: Joconde 103 (0)
JPL Small-Body Databaseその他P716: JPL小天体データベース SPK-ID 66 (0)
KANTO 国立図書館P8980: KANTO ID 5,596 (0)
ベルギー王立図書館オンライン・カタログ 国立図書館P11249: ベルギー王立図書館 人物ID 15,175 (0)
地理P3407 13 (0)
芸術家P1248 3,293 (0)
Remarks: 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.
アメリカ議会図書館リンクデータサービス 国立図書館P244: アメリカ議会図書館典拠管理識別子 187,320 (0)
Remarks: See Wikipedia:Authority control#LCCN for formatting instructions
www.leopoldina.org 学術データベースP10299: レオポルディーナ会員識別子(新) 1,024 (0)
芸術家P9692 237 (0)
Remarks: Identifier for a musician in the Lexikon verfolgter Musiker und Musikerinnen der NS-Zeit
LIBRIS 国立図書館P5587: Libris-URI 14,257 (0)
Lexicon istoric reticその他P886: Lexicon istoric retic識別子 45 (0)
Remarks: Lexicon Istoric Retic (LIR) is a two volume version with a selection of articles published in Romansh.
国立図書館P1368: LNB識別子 19,511 (0)
Fari e Segnalamenti地理P3863: イタリア海軍ビーコン識別子 0 (0)
マリントラフィック灯台識別子地理P3601: マリントラフィック灯台識別子 5 (0)
学術データベースP4955: MathSciNet著者識別子 2,243 (0)
MusicBrainzアーティスト識別子 芸術家P434: MusicBrainzアーティスト識別子 45,033 (0)
Remarks: MusicBrainz is an open music encyclopedia that collects music metadata and makes it available to the public.
地理P982: MusicBrainz地域ID 15,292 (0)
その他P1330: MusicBrainz楽器ID 420 (0)
その他P966: MusicBrainzレーベルID 1,565 (0)
地理P1004: MusicBrainz 場所 ID 2,192 (0)
その他P436: MusicBrainzリリース・グループ識別子 22,530 (0)
その他P1407: MusicBrainzシリーズID 431 (0)
その他P435: MusicBrainz作品ID 8,383 (0)
フランス登録記念物 地理P380: メリメ識別子 222 (0)
学術データベースP549: Mathematics Genealogy Project ID 2,746 (0)
Remarks: Mathematics Genealogy Project is a web-based database for the academic genealogy of mathematicians.
芸術家P2174: ニューヨーク近代美術館 芸術家ID 2,537 (0)
小惑星センター・データベース その他P5736: 小惑星センター 天体ID 42 (0)
芸術家P2268: オルセー美術館 作者識別子 2,675 (0)
国立公文書館識別子その他P1225: アメリカ国立公文書記録管理局識別子 11,357 (0)
Remarks: National Archives and Records Administration (NARA) is an independent agency of the United States government charged with preserving and documenting government and historical records.
カナダ国立美術館芸術家P5368 885 (0)
地理P2484: NCES 学校ID 14 (0)
国家図書館国立図書館P1048: 国家図書館識別子 460 (0)
Remarks: National Central Library is the national library of Taiwan, Republic of China.
ウェブ版国立国会図書館典拠国立図書館P349: 国立国会図書館典拠ID 118,259 (0)
Remarks: Authority data listed in the catalog of the national library of Japan. Search also available via VIAF.
アメリカ国家地理空間情報局灯台識別子地理P3563: アメリカ国家地理空間情報局灯台識別子 3 (0)
ヴィクトリア国立美術館芸術家P2041: ビクトリア国立美術館芸術家ID 1,093 (0)
チェコ国立図書館典拠データベース国立図書館P691: チェコ国立図書館識別子 64,160 (0)
Remarks: National Library of the Czech Republic (Národní knihovna České republiky) is the central library of the Czech Republic.
オーストラリア国立図書館典拠国立図書館P409: オーストラリア図書館識別子 20,957 (0)
Remarks: 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.
ギリシア国立図書館 国立図書館P3348: ギリシャ国立図書館識別子 8,689 (0)
韓国国立中央図書館典拠ファイル国立図書館P5034: 韓国国立中央図書館識別子 32,120 (0)
国立図書館P1003: ルーマニア国立図書館識別子 121 (0)
地理P4055
    • ノルウェー
      • 000100
0 (0)
国立図書館P1375: NSK識別子 8,820 (0)
国立図書館P1006: NTA PPN識別子 51,738 (0)
地理P3223 4 (0)
ORCID学術データベースP496: ORCID 1,801 (0)
Remarks: 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.
写真家識別目録芸術家P2750: 写真家識別目録識別子 1,529 (0)
Remarks: PIC is a photographer's database. It is maintained by the New York Public Library.
プレアデス 地理P1584: プレアデスID 1,458 (0)
Remarks: Pleiades is a joint project of the Institute for the Study of the Ancient World at New York University and the Ancient World Mapping Center at the University of North Carolina at Chapel Hill.
MAK国立図書館P7293: ポーランド国立図書館識別子 39,297 (0)
国立図書館P1005: PTBNP識別子 9,682 (0)
地理P4423
    • ポルトガル
      • 186
0 (0)
ポーランド国立図書館国立図書館P1695: ポーランド国立図書館識別子(旧) 140 (0)
PhilPapers学術データベースP3233 158 (0)
芸術家P5321 560 (0)
パブロンズ 学術データベースP3829: Publons著者識別子 150 (0)
ResearcherID学術データベースP1053: ResearcherID 269 (0)
Remarks: 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.
その他P5504 4,384 (0)
オランダ美術史研究所データベース芸術家P650: RKDartists識別子 7,218 (0)
Remarks: 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).
RKD絵画データベース その他P350: RKDimages 177 (0)
ロシア国立図書館国立図書館P947: ロシア国立図書館 (モスクワ)人物識別子 591 (0)
Remarks: Russian State Library (Российская государственная библиотека) is the national library of Russia.
Scopus学術データベースP1153: Scopus著者識別子 2,006 (0)
Remarks: 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).
LIBRIS 国立図書館P906: SELIBR識別子 23 (0)
Remarks: Authority data from the National Library of Sweden
芸術家P781 196 (0)
Remarks: 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).
SNACその他P3430: SNAC ARK識別子 30,113 (0)
シュテーデル美術館芸術家P4581: シュテーデル美術館 芸術家ID 765 (0)
地理P5288 208 (0)
Structurae地理P454: Structurae 1,570 (0)
Structurae人物P2418 393 (0)
IdRefその他P269: IdRef識別子 80,375 (0)
Remarks: 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)
国民議会議員 人物P1045 365 (0)
Terminologia Anatomicaその他P1323: Terminologia Anatomica 98 1,025 (0)
トルコ宗教財団イスラーム百科事典 その他P7314: トルコ宗教財団イスラーム百科事典ID 1,373 (0)
ニュージーランド国立博物館テ・パパ・トンガレワ収蔵物オンライン芸術家P3544: テ・パパ代理識別子 2,001 (0)
その他P1362 154 (0)
Remarks: 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.
トローヴ 人物P1315: NLAトローヴ人物識別子 20,467 (0)
イギリスの議会人物P6213: イギリス議会識別子 604 (0)
Remarks: UK parliament member data
美術人名ユニオン・リスト 芸術家P245: ULAN 10,898 (0)
Remarks: 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).
アメリカ沿岸警備隊灯台識別子地理P3723: アメリカ沿岸警備隊灯台識別子 1 (0)
アメリカ国会人物識別子 人物P1157: アメリカ国会識別子 1,050 (0)
Remarks: 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.
opac.vatlib.it国立図書館P8034: バチカン図書館VcBA識別子 11,638 (0)
Remarks: Vatican Library document data
VIAF識別子全般P214: VIAF識別子 249,617 (0)
Remarks: International authority data from the Online Computer Library Center (OCLC)
地理P3993
    • アイスランド
      • 184
0 (0)
WorldCat Entities 全般P10832: WorldCat Entities識別子 127,443 (0)
Remarks: WorldCat Entities for persons and works, by OCLC
地理P3326 11 (0)
学術データベースP1556: zbMATH著者識別子 3,333 (0)
合計1402,191,069 (1)

require('strict')
local p = {}
local arg = mw.getCurrentFrame().args.config
local configfile = 'Module:Authority control/config' .. (arg and arg~='' and ('/' .. arg) or '')
local config = mw.loadData(configfile)
local title = mw.title.getCurrentTitle()
local namespace = title.namespace
local testcases = title.subpageText == config.i18n.testcases

local function needsAttention(sortkey)
	return '[[' .. config.i18n.category .. ':' .. config.i18n.attentioncat .. '|' .. sortkey .. title.text .. ']]'
end

local function addCat(cat,sortkey)
	if cat and cat ~= '' and (namespace == 0 or namespace == 14 or testcases) then
		local redlinkcat = ''
		if testcases == false then
			local success, exists = pcall(function() return mw.title.new(cat, 14).exists end)
			if success and not exists then 
				redlinkcat = needsAttention('N')
			end
		end
		if sortkey then
			cat = '[[' .. config.i18n.category .. ':'..cat..'|' .. sortkey .. title.text .. ']]'
		else
			cat = '[[' .. config.i18n.category .. ':'..cat..']]'
		end
		cat = cat .. redlinkcat
		return cat
	else
		return ''
	end
end

local function getCatForId(id,faulty)
	local cat = string.format(
		config.i18n.cat,
		faulty and config.i18n.faulty..id or id
	)
	return addCat(cat)
end

local function getIdsFromWikidata(qid,property)
	local function getquals(statement,qualid)
		if statement.qualifiers and statement.qualifiers['P'..qualid] then
			return mw.wikibase.renderSnak(statement.qualifiers['P'..qualid][1])
		else
			return false
		end
	end
	local ids = {}
	if qid then
		for _, statement in ipairs(mw.wikibase.getBestStatements(qid,property)) do
			if statement.mainsnak.datavalue then
				local val = statement.mainsnak.datavalue.value
				if val then
					local namedas = getquals(statement,1810) or getquals(statement,742) or ''
					table.insert(ids,{id=val,name=namedas})
				end
			end
		end
	end
	return ids
end

local _makelink = function(conf,val,nextid,qid) --validate values and create a link
	local function tooltip(text,label)
		if label and label~='' then
			return mw.getCurrentFrame():expandTemplate{title = "Tooltip", args = {text,label}}
		else
			return text
		end
	end
	local link
	if nextid==1 then
		if conf.prefix then
			link = '*' .. conf.prefix .. '\n**'
		else
			link = '*'
		end
	else
		link = '\n**'
	end
	local valid_value = false
	if conf.customlink then -- use function to validate and generate link
		local label = nextid>1 and nextid
		local newlink= require(config.auxiliary)[conf.customlink](val.id,label)
		if newlink then
			link = link .. newlink
			valid_value = true
		end
	else
		if conf.pattern then -- use pattern to determine validity if defined
			valid_value = string.match(val.id,'^'..conf.pattern..'$')
		elseif conf.patterns then
			for _,pattern in ipairs(conf.patterns) do
				valid_value = val.id:match('^'..pattern..'$')
				if valid_value then break end
			end
		elseif conf.valid then -- otherwise use function to determine validity
			valid_value = require(config.auxiliary)[conf.valid](val.id)
		else -- no validation possible
			valid_value = val.id
		end
		if valid_value then
			local newlink
			local label = conf.label
			if not label or nextid>1 then
				label = tostring(nextid)
			end
			if conf.link then
				valid_value = valid_value:gsub('%%', '%%%%')
				newlink = '[' .. mw.ustring.gsub(conf.link,'%$1',valid_value) .. ' ' .. label .. ']'
			else
				newlink = valid_value
			end
			link = link .. '<span class="uid">'..tooltip(newlink,val.name)..'</span>'
		end
	end
	if valid_value then
		link = link .. getCatForId(conf.category or conf[1])
	else
		--local preview = require("Module:If preview")
		local wdlink = qid and '[[:wikidata:' .. qid .. '#P' .. conf.property .. ']]' or ''
		local tooltip = string.format(
			config.i18n.idnotvalid,
			conf[1],
			val.id
		)
		link = link .. '[[File:' .. config.i18n.warningicon .. '|20px|frameless|link=' .. wdlink .. '|' .. tooltip .. ']]'
		if conf.errorcat then
			link = link .. addCat(conf.errorcat)
		else
			link = link .. getCatForId(conf.category or conf[1],true)
		end
		link = link .. addCat(config.i18n.allfaultycat,conf[1])-- .. preview._warning({'The '..conf[1]..' id '..val..' is not valid.'})
	end
	return link
end

--[[==========================================================================]]
--[[                                   Main                                   ]]
--[[==========================================================================]]
function p.authorityControl(frame)
	local function resolveQID(qid)
		if qid then
			qid = 'Q'..mw.ustring.gsub(qid, '^[Qq]', '')
			if mw.wikibase.isValidEntityId(qid) and mw.wikibase.entityExists(qid) then
				local sitelink = mw.wikibase.getSitelink(qid)
				if sitelink then
					return mw.wikibase.getEntityIdForTitle(sitelink) or mw.wikibase.getEntity(qid).id
				end
				return mw.wikibase.getEntity(qid).id
			end
		end
	end
	local conf = config.config
	local parentArgs = frame:getParent().args
	local auxCats = ''
	local rct = false -- boolean to track if there are any links to be returned
	local qid,topic
	local wikilink = function(qid,hideifequal)
		local label,sitelink = mw.wikibase.getLabel(qid),mw.wikibase.getSitelink(qid)
		if label then
			if sitelink then
				local target = mw.title.new(sitelink)
				if target==title or (target.isRedirect and target.redirectTarget==title) then -- do not link
					return label
				else -- make wikilink to article
					return '[[' .. sitelink .. '|' .. label .. ']]'
				end
			else
				return label
			end
		else
			auxCats = auxCats .. needsAttention('L')
			return qid
		end
	end
	if namespace == 0 then
		qid = mw.wikibase.getEntityIdForCurrentPage()
	end
	if qid then -- article is connected to Wikidata item
		if parentArgs.qid and (resolveQID(parentArgs.qid) ~= qid) then -- non-matching qid parameter
			auxCats = auxCats .. needsAttention('D')
		end
	else -- page is not connected to any Wikidata item
		qid = resolveQID(parentArgs.qid) -- check qid parameter if no wikidata item is connected
		if qid then -- qid parameter is valid, set topic to display
			topic = mw.wikibase.getLabel(qid)
			if topic then
				if mw.ustring.lower(title.subpageText) == mw.ustring.lower(topic) then -- suppress topic display if subpagename equals topic up to case change
					topic = nil
				end
				if topic and mw.wikibase.getSitelink(qid) then -- make wikilink to article
					topic = '[[' .. mw.wikibase.getSitelink(qid) .. '|' .. topic .. ']]'
				end
			else
				auxCats = auxCats .. needsAttention('L')
			end
		elseif parentArgs.qid and parentArgs.qid~='' then -- invalid qid has been supplied, add to tracking cat
			auxCats = auxCats .. needsAttention('Q')
		end
	end
	local qids = {} -- setup any additional QIDs
	if parentArgs.additional=='auto' and qid then  -- check P527 for parts to add additional qids
		local checkparts = function(property)
			local parts = mw.wikibase.getBestStatements(qid,property)
			if parts then
				for _,part in ipairs(parts) do
					if part.mainsnak.datavalue and part.mainsnak.datavalue.value.id then
						local resolvedqid = resolveQID(part.mainsnak.datavalue.value.id)
						if resolvedqid then
							table.insert(qids,resolvedqid)
		end end end end end
		for _,part in ipairs(config.auto_additional) do
			checkparts('P'..tostring(part))
		end
	elseif parentArgs.additional and parentArgs.additional ~= '' then
		for _,v in ipairs(mw.text.split(parentArgs.additional,"%s*,%s*")) do
			v = resolveQID(v)
			if v then
				if v == qid then -- duplicate of qid parameter
					auxCats = auxCats .. needsAttention('R')
				end
				table.insert(qids,v)
			else -- invalid QID specified
				auxCats = auxCats .. needsAttention('A')
			end
		end
	end

	local sections = {}
	local localparams = false
	local numsections = 0
	for _,_ in ipairs(config.sections) do numsections = numsections + 1 end
	for _ = 1,#qids+numsections do table.insert(sections,{}) end
	local qslink = '' -- setup link to add using QuickStatements

	-- check which identifiers to show/suppress in template
	local show = {} -- setup list
	local showall = true
	local function stripP(pid)
		if pid:match("^[Pp]%d+$") then
			pid = mw.ustring.gsub(pid,'[Pp]','') --strip P from property number
		end
		if pid:match("^%d+$") then
			return tonumber(pid)
		end
	end
	local function addshowlist(list)
		if list and list ~= '' then
			for _,v in ipairs(mw.text.split(string.lower(list),"%s*,%s*")) do
				local vprop = stripP(v)
				if vprop then -- e.g. show=P214 to show one particular property
					show[vprop] = true
				else -- e.g. show=arts to use whitelist
					if config.whitelists[v] then
						for _,w in ipairs(config.whitelists[v].properties) do
							show[w] = true
						end
					end
				end
			end
			showall = false
		end
	end
	addshowlist(frame.args.show) -- check show= parameter on wrapper template
	addshowlist(parentArgs.show or parentArgs.country) -- check show parameter on article template
	if parentArgs.suppress then
		local suppresslist = mw.text.split(parentArgs.suppress,"%s*,%s*") -- split parameter by comma
		for _,v in ipairs(suppresslist) do
			v = stripP(string.upper(v))
			if v then
				show[v] = false
				auxCats = auxCats .. '[[' .. config.i18n.category .. ':' .. config.i18n.suppressedcat .. ']]'
			else
				auxCats = auxCats .. needsAttention('P')
			end
		end
	end
	
	local function makeSections(qid,addit)
		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
			local showb = true
			if (show[params.property] == nil) and (show[string.upper(params[1])] == nil ) then
				showb = showall -- if not specified then depends on showall
			elseif (show[params.property] == false) or (show[string.upper(params[1])] == false) then -- if either are false then id will be suppressed
				showb = false
			end
			if not showb then
				tval[params.property] = false -- indicates the identifier is suppressed
			elseif not addit then
				local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]
				if val and val~='' then -- add local parameter to list if not already in
					localparams = true
					local bnew = true
					for _, w in pairs(tval[params.property]) do
						if val == w.id then
							bnew = false
						end
					end
					if bnew then -- add new value to table
						if qid then
							-- 末尾はQ328(英語版ウィキペディア)ではなくQ177837(日本語版ウィキペディア)とする
							qslink = qslink .. '%7C%7C' .. qid .. '%7CP' .. params.property .. '%7C%22' .. mw.uri.encode(val,"PATH") .. '%22%7CS143%7CQ177837'
						end
						table.insert(tval[params.property],{id=val,name=''})
					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 tval[params.property] ~= false and not suppress then
				local tlinks = {} -- setup table for links
				local nextIdVal = 1
				local row = ''
				for _,val in ipairs(tval[params.property]) do
					local link = _makelink(params,val,nextIdVal,qid)
					row = row .. link
					table.insert(tlinks,link)
					nextIdVal = nextIdVal + 1
				end
				if nextIdVal>=2 then
					row = row .. '\n'
					table.insert(sections[addit or params.section],row)
					rct = true
				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

	makeSections(qid,false)
	for c = 1,#qids do
		makeSections(qids[c],numsections+c)
	end

	--configure Navbox
	local outString = ''
	if rct or localparams 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 config.i18n.autocollapse,
			navbar = 'off'
		}
		for c=1,numsections+#qids do
			if #sections[c] ~= 0 then -- section is non-empty
				sect = sect + 1
				lastsect = c
				local sectname
				if c <= numsections then -- regular section
					sectname = config.sections[c].name
				else -- section from additional qid
					local qid = qids[c-numsections]
					sectname = wikilink(qid) .. pencil(qid)
				end
				navboxArgs['group' .. c] = sectname
				navboxArgs['list' .. c] = table.concat(sections[c])
			end
		end
		if localparams then
			lastsect = lastsect + 1
			sect = sect + 1
			navboxArgs['group' .. lastsect] = config.i18n.warning
			local warning = frame:expandTemplate{title = config.i18n.errortemplate, args = {config.i18n.localparams}}
			if qslink ~= '' then
				warning = warning .. ' ' .. config.i18n.movetowd .. '<span class="qs autoconfirmed-show">&#32;[[File:Commons to Wikidata QuickStatements.svg|20px|link=https://quickstatements.toolforge.org/#/v1=' .. qslink .. '|' .. config.i18n.addtowd .. ']]</span>'
			elseif not qid then
				if namespace == 0 then
					warning = warning .. ' ' .. config.i18n.connecttowd
				elseif namespace==14 or namespace==2 or namespace==118 then
					warning = warning .. ' ' .. config.i18n.qidcode
				end
			end
			navboxArgs['list' .. lastsect] = warning
		end
		if topic then -- display in expanded form with topic
			navboxArgs.title = config.i18n.aclink .. ' &ndash; ' .. topic .. pencil(qid)
		elseif sect == 1 then -- special display when only one section
			if lastsect <= numsections then
				if config.sections[lastsect].hidelabelwhenalone then -- no special label when only general or other IDs are present
					navboxArgs['group' .. lastsect] = config.i18n.aclink .. pencil(qid)
				else -- other regular section
					navboxArgs['group' .. lastsect] = config.i18n.aclink .. ': ' .. navboxArgs['group' .. lastsect] .. pencil(qid)
				end
			else -- section from additional qid
				navboxArgs['group' .. lastsect] = config.i18n.aclink .. ': ' .. navboxArgs['group' .. lastsect]
			end
		else -- add title to navbox
			navboxArgs.title = config.i18n.aclink .. pencil(qid)
		end
		outString = Navbox._navbox(navboxArgs)
	else -- 典拠管理識別子が1つもない
		if namespace == 0 or testcases then
			auxCats = auxCats .. addCat('典拠管理識別子が1つもない記事')
		end
	end
	
	if parentArgs.state
		and parentArgs.state~=''
		and parentArgs.state~=config.i18n.collapsed
		and parentArgs.state~=config.i18n.expanded
		and parentArgs.state~=config.i18n.autocollapse then --invalid state parameter
		auxCats = auxCats .. needsAttention('S')
	end
	if testcases then
		auxCats = mw.ustring.gsub(auxCats, '(%[%[)(' .. config.i18n.category .. ')', '%1:%2') --for easier checking
	end

	--out
	outString = outString..auxCats
	if namespace ~= 0 then
		-- 日本語版独自の変更あり
		outString = mw.ustring.gsub(outString,'(%[%[)(' .. config.i18n.category .. ':)([^%|%]]+' .. config.i18n.Articles .. ')%|?[^%|%]]*(%]%])','%1:%2%3%4')
	end
	local check = require('Module:Check for unknown parameters')._check
	local sortkey
	if namespace == 0 then
		sortkey = '*' .. title.text
	else
		sortkey = title.fullText
	end
	outString = outString .. check({
		['unknown'] = '[[' .. config.i18n.category .. ':' .. config.i18n.pageswithparams .. '|' .. sortkey .. ']]',
		['preview'] = config.i18n.previewwarning, 'show', 'country', 'suppress', 'additional', 'qid', 'state'
		}, parentArgs)
	return outString
end

p.makelink = function(conf,val,nextid,qid)
	return _makelink(conf,val,nextid,qid)
end

return p