跳至內容

模板:Wikidata list/doc

維基百科,自由的百科全書

請勿用於主空間

本模板現時禁止在主名字空間使用。

使用

本模板用於定義基於維基數據自動生成的列表。模板後必須加上{{Wikidata list end}},兩個模板之間的內容會由機械人自動更新。目前,每個頁面僅支持一個列表。

示例:

{{Wikidata list|sparql=
 SELECT ?item WHERE {
 ?item wdt:P31 wd:Q39715 .
 ?item (wdt:P131)* wd:Q55
 }
|columns=label:Article,description,p131:Place,P580,P582,p625,P18
|section=131
|min_section=3
|sort=label
|links=text
|thumb=128
|autolist=fallback
|wdedit=yes
}}
... (This will be overwritten by ListeriaBot) ... {{Wikidata list end}}

參數:

sparql
一條SPARQL SELECT語名。需返回?item(維基數據項)。該參數為必需參數
參見適用於Listeria的SPARQL查詢示例
columns
定義表格的列。允許值包括:
  • number, a serial row number (per section), increasing from 1, according to the initial sorting
  • label, the wiki-language-based label of the item, linked to the local article (where exists), or the Wikidata item
  • label/de, the wiki-language-based label of the item, using the given language (here, "de"), as plain text
  • description, the manual, or auto-generated description
  • item, the Q item number
  • Pxxx a Wikidata property
  • Pxxx/Pzzz, qualifier properties; for Pxxx linking to an item Qyyy and having a Pzzz qualifier, the Qxxx linked label and the value of Pzzz
  • Pxxx/Qyyy/Pzzz, qualifier properties; for Pxxx linking to an item Qyyy and having a Pzzz qualifier, the value of Pzzz. This is a version of the above, specific for a single item; e.g., "p553/q866/p554" to get YouTube account names.
  • ?fieldname, a SPARQL result field name. For SPARQL-based lists only.
在其後加上":TITLE"可定義每一列的標題。沒有指定標題時,將使用維基數據屬性的名稱。該參數為必需參數
sort
用於表格元素的排序。允許值包括:
  • label, the label of the item
  • family_name, tries to find, and sort by, the family (last) name from the label, assuming items are people. This is a heuristic and may not work properly in all cases. If possible, try to sort by P734 (family name).
  • Pxxx, a Wikidata property
該參數為可選參數。
section
列表可使用一個維基數據屬性來劃分章節。該參數為可選參數。
min_section
使用section參數時每章節包含元素的最小值。其他元素將放入"misc"章節中。默認值:2。該參數為可選參數。
autolist
description(描述)為表格的一列而維基數據中還沒有對應描述時,"autolist=fallback"使用AutoDesc生成描述。該參數為可選參數。
language
當標籤/描述使用的語言與站點語言不同時可使用此參數。該參數為可選參數。
thumb
圖片縮略圖的寬度(對應列P18)。默認值:128。該參數為可選參數。
links
定義如何處理本地維基百科的紅鏈。允許值包括:
  • all to link to Wikidata. Default.
  • local to remove entries for which there exists no local article (the opposite of red_only).
  • red to generate red links based on label and item.
  • red_only to remove entries for which there exists a local article (the opposite of local).
  • text to generate blue links for existing pages, and plain text otherwise.
  • reasonator to generate blue links for existing pages, and links to Reasonator otherwise.
該參數為可選參數。
row_template
Generates a template call rather than a table row; the template must then generate the table row in turn or the table header/footer need to be surpressed using skip_table parameter. Parameters passed to the template are the lower-case keys from the columns parameter, e.g. label or p18. Optional
header_template
Generates a template call rather than a table header; the template must then generate the table header. No parameters are passed to this template. Recommended to be used with row_template. Optional
skip_table
Suppresses the table markup completely when using row_template. Any value will work.
wdedit
Generates information that allows Wikidata editing from Wikipedia using this JavaScript. Value needs to be yes. Does not work when row_template is used. Caution: This will result in larger wikitext than normal, and updates may fail because of that. Optional
references
Add references. Allowed value is all. Requires {{reflist}} or similar somewhere in the page. Optional
freq
Numerical value X; wait at least X days before an automatic update. Does not affect updates via web interface. Optional
summary
Comma-separated list of keys to add as a summary underneath all other content. Optional
  • itemnumber The total number of items (rows) in this list.