Commons:Machine-readable data/zh

Shortcut: COM:MRD

在維基共享資源上,許多的元數據(包括授權和作者)並非是機器可讀。有一個API模塊iiprop=extmetadata可用於取出某些值(範例),但是由於信息是以自由文本的方式被輸入到文件描述頁面本身,因此這並不完美。正在進行的Structured data on Commons專案旨在推動元數據成為完全結構化的數據,並最終取代本頁面中顯示的機器可讀數據。

與此同時,為了在未來輕鬆過渡到更結構化的數據,維基共享資源使用了一組標準模板,這些模板通過HTML元素以某種方式已經成為機器可讀的。一些腳本已經使用了它。值得注意的是,該數據可用於任何使用維基共享資源的wiki,可以像其他本地數據一樣從File:頁面的html中讀取。

机器可读数据

由信息框模板設置的機器可讀數據

這些是幾個標準的信息框模板用不同的標籤標記模板的不同元素以允許信息的解析。有使用了幾種不同風格的標籤:

  • Microformat標籤遵循行業標準,可以被現有工具解析。
  • <td>id 屬性(標識符)是自定義標記,允許更完整的標籤,必須由自定義工具讀取。大多數通用信息框都有兩列結構:第1列保存字段名稱,第2列保存值
    • 傳統上,<td>id屬性用於標記一行中第一列中的名稱調用。要獲取數據,您需要獲取第二列中以下<td>單元格的內容。
    • {{Creator}}{{Institution}}模板結構比較複雜,所以實際數據的單元格用attributes using magenta background
模板 模板参数名 描述 <td> id屬性 微格式 评论
{{Information}}description文件描述fileinfotpl_deschProduct.description.通常包含用{{Lang}}註釋的多種語言。
{{Information}}date原創作品的創作日期fileinfotpl_datehCalendar vevent.dtstart有時另外或僅包含發布日期。這兩個日期對於版權具有不同的含義。使用時,{{Date context}}可以指示差異。{{Date}}模板添加的微格式
{{Information}}source文件来源fileinfotpl_src通常包含整個表格。我們還沒有很好的方法來處理這個源模板。源模板通常引用目錄ID,但這些也不是機器可讀的。
{{Information}}author文件作者fileinfotpl_aut這可以是作者、創作者和/或版權所有者,並且可以混合使用。通常包含{{Creator}}模板,如下所述。
{{Information}}permission文件的許可/許可fileinfotpl_perm
{{Information}}other versions文件的其他版本fileinfotpl_ver
{{Artwork}}description藝術品描述fileinfotpl_deschProduct.description
{{Artwork}}date原始藝術品的創作日期fileinfotpl_datehCalendar vevent.dtstart{{Date}}模板添加的微格式
{{Artwork}}source文件来源fileinfotpl_src
{{Artwork}}artist藝術品的創造者fileinfotpl_aut"hProduct.fn value"
{{Artwork}}author藝術品的作者fileinfotpl_aut"hProduct.fn value"
{{Artwork}}permission文件和藝術品的許可/許可fileinfotpl_perm
{{Artwork}}other versions文件的其他版本fileinfotpl_ver
{{Artwork}}title作品名稱fileinfotpl_art_titlehProduct.fn
{{Artwork}}object type藝術品對像類型fileinfotpl_art_object_type
{{Artwork}}medium藝術作品的技術或媒介fileinfotpl_art_medium
{{Artwork}}dimensions藝術品的尺寸fileinfotpl_art_dimensions
{{Artwork}}gallery持有藝術品的機構fileinfotpl_art_gallery
{{Artwork}}location藝術作品在機構內的位置fileinfotpl_art_locationhProduct.locality
{{Artwork}}accession number藝術品的登錄號fileinfotpl_art_idhProduct.identifier
{{Artwork}}object history藝術品的對象歷史fileinfotpl_art_object_history
{{Artwork}}exhibition history作品展歷史fileinfotpl_art_exhibition_history
{{Artwork}}credit line藝術品的信用額度fileinfotpl_art_credit_line
{{Artwork}}inscriptions藝術品上的銘文fileinfotpl_art_inscriptions
{{Artwork}}notes關於藝術品的筆記fileinfotpl_art_notes
{{Artwork}}references與藝術品相關的參考資料fileinfotpl_art_references
{{Book}}Author這本書的作者fileinfotpl_author
{{Book}}Editor該書的編輯fileinfotpl_book_editor
{{Book}}Translator這本書的翻譯fileinfotpl_book_translator
{{Book}}Illustrator這本書的插畫師fileinfotpl_book_illustrator
{{Book}}Title書名fileinfotpl_book_title
{{Book}}Subtitle書的副標題fileinfotpl_book_subtitle
{{Book}}Series title系列-書名fileinfotpl_book_series-title
{{Book}}Authority file權限控制數據fileinfotpl_book_authority
{{Book}}Publisher該書的出版商fileinfotpl_book_publisher
{{Book}}Printer書的打印機fileinfotpl_book_printer
{{Book}}Year of publication書籍出版的日期或年份fileinfotpl_date
{{Book}}Place of publication書籍出版地或城市fileinfotpl_book_place-of-publication
{{Book}}Language書的語言fileinfotpl_book_language
{{Book}}Description書的描述fileinfotpl_desc
{{Creator}}Name創作者姓名creatorvCard.fn
{{Creator}}Alternative names創作者的別稱fileinfotpl_creator_alt-name_valuevCard.nickname
{{Creator}}Description創作者的國籍和職業fileinfotpl_creator_desc_valuevCard.note
{{Creator}}Date of death創作者逝世日期fileinfotpl_creator_deathdate_value
{{Creator}}Date of birth創作者出生日期fileinfotpl_creator_birthdate_valuevCard.bday
{{Creator}}Location of birth/death創作者死亡地點fileinfotpl_creator_deathloc_value
{{Creator}}Location of birth創作者出生地fileinfotpl_creator_birthloc_value
{{Creator}}Work period創作者工作時間fileinfotpl_creator_work-period_value
{{Creator}}Work location創作者工作地點fileinfotpl_creator_work-location_valuev
{{Creator}}Image顯示創作者的肖像或照片fileinfotpl_creator_image
{{Creator}}Authority file與創建者相關的權限控制fileinfotpl_creator_authority_value


{{FileContentsByBot}}(多个)視情況而定,請商討{{FileContentsByBot}}(various)hproduct-by-bot大數據集且仍在增長,請商討 {{FileContentsByBot}}
{{Photograph}}title照片的標題fileinfotpl_art_titlehProduct.fn
{{Photograph}}description照片描述fileinfotpl_deschProduct.description
{{Photograph}}original description照片的原始檔案描述fileinfotpl_deschProduct.description
{{Photograph}}date原始藝術品的創作日期fileinfotpl_datehCalendar vevent.dtstart{{Date}}模板添加的微格式
{{Photograph}}medium照片的技術或媒介fileinfotpl_art_medium
{{Photograph}}dimensions照片的尺寸fileinfotpl_art_dimensions
{{Photograph}}artist照片的創作者fileinfotpl_aut"hProduct.fn value"
{{Photograph}}institution持有藝術品的機構fileinfotpl_art_gallery
{{Photograph}}location照片在機構內的位置fileinfotpl_art_locationhProduct.locality
{{Photograph}}source文件来源fileinfotpl_src
{{Photograph}}permission文件和藝術品的許可/許可fileinfotpl_perm
{{Photograph}}other versions文件的其他版本fileinfotpl_ver
{{Photograph}}accession number照片的登錄號hProduct.identifier

CommonsMetadata的替代格式

由於基於表+id的格式被證明很難添加到格式與Commons信息模板不同的模板中,CommonsMetadata允許替代格式,類似於許可證模板:整個信息模板必須包含在一個fileinfotpl類中,包含特定信息的標籤需要有一個 fileinfotpl_*類(同上,但類,而不是id)。

許可證模板設置的機器可讀數據

2010年10月引入,使用<span class="licensetpl_XXX">

licensetpl:標識許可證的元素。包裝整個許可證代碼,應該是單一許可證,而不是多重許可證。
licensetpl_short:許可證的簡稱:“公共領域”、“CC BY-SA 3.0”、“CC by 2.0 fr”等。
licensetpl_long:許可證的長名稱:“公共領域”、“知識共享署名-相同方式共享3.0”、
licensetpl_attr_req:是否需要署名。“是或否”。
licensetpl_attr:請求的屬性:自由文本。
licensetpl_link_req:此許可證是否需要許可證鏈接。“對或錯”。
licensetpl_link:許可證的鏈接。“www.creativecommons.org/licenses/by-sa/XXX/YYY”
licensetpl_nonfree
“true”如果這是一個非自由許可證(不在共享資源上使用,僅在具有EDP的維基上使用)

可以使用licensetpl_wrapper類將同一作品的多個licensetpl塊包裝在一個塊中。

設置此信息的模板

由樣式格式模板設置的機器可讀數據

樣式格式化模板,旨在為不同系列的非許可模板提供統一的樣式、承載識別這些系列的機器可讀數據。

模板 目的 类名
{{Restriction-Layout}} 被限制標籤使用 restrictiontemplate
{{FoP-Layout}} 全景自由標籤使用 foptemplate
{{Partnership-Layout}} 合作夥伴模板使用 partnershiptemplate
{{Source-Layout}} 由通用源模板使用 sourcetemplate
{{Created with}} 使用...模板創建使用 createdwithtemplate

非版權限制模板設置的機器可讀數據

有關非版權法律限制的模板帶有這些類別以識別特定類型的限制。

模板 目的 类名
{{Trademarked}} 商標圖片 restriction-trademarked
{{Copydesign}} 受版權保護的設計 restriction-design
{{Communist symbol}} 共產主義符號 restriction-communist
{{Italy-MiBAC-disclaimer}} {{Soprintendenza}} 意大利文化用品 restriction-ita-mibac
{{Australian Commonwealth reserve}} 澳大利亞儲備 restriction-aus-reserve
{{Personality rights}} {{Romania personality rights}} 人格權 restriction-personality
{{2257}} 兒童保護和淫穢執法法案警告(美國) restriction-2257
{{Costume}} 服裝 restriction-costume
{{Fan art}} 爱好者艺术作品 restriction-fan-art
{{Currency}} 货币 restriction-currency
{{IHL Symbol}} 受國際人道主義法限制的符號 restriction-ihl
{{Nazi symbol}} 納粹和法西斯符號 restriction-nazi
{{Insignia}} 官方徽章 restriction-insignia

特定模板設置的機器可讀數據

設置了更多的機器可讀數據。 這是一個非詳盡列表:

{{Personality rights}}
<span class="commons-template-name" style="display:none" id="commons-template-personality-rights">Personality rights</span>
{{Credit line}}
<td id="fileinfotpl_credit" class="fileinfo-paramfield fileinfotpl_credit" style=""></td>

由位置模板設置的機器可讀數據

{{Location}}和類似的添加機器可讀的地理編碼模板,格式如下:<span class="geo">12.34;24.68</span>(緯度和經度作為浮點數,用分號分隔)。坐標使用en:WGS84系統(與GPS和大多數在線地圖相同)。更多細節詳見Commons:Geocoding

用法

MediaWiki API

MediaWiki API現在提供有限數量的元數據。考慮以下查詢:

(在API沙盒中打開)。舉例如下,它返回一些有用的參數,例如Credit、Artist、LicenseUrl和Copyrighted,並由Media Viewer使用。

使用機器可讀數據的腳本

外部工具

參見

定義新的機器可讀數據

  • 不要使用那些HTML ID,应使用。一个ID只能每页使用一次,而这些字段大多可以在每页出现多次。例如,在描述衍生作品时,可以包含原作和衍生作品的信息。
  • 在可能的情况下,封装“实际”数据,而不是某些字段标题。最后一种方法历来用于我们所有的信息模板,但从长远来看更难支持。
  • 打包数据,而不是数据的格式化方式。
  • 在转换为数据时,格式会被“丢失”。视觉修饰並非信息的一部分。
  • Don't wrap multiple units of information inside one field. There is a difference between a publication date and a creation date. Both are dates, but both are different 'data fields'. Also CC BY-SA-4.0-3.0-2.5 is not a license name, those would be 3 licenses with the name CC BY-SA-##.
  • Make sure that the data value has one unit, or outputs one consistent unit.

问题

有一些東西目前無法識別或難以識別。 這些包括:

  • Derivative works
  • Works included in works. See also Category:FoP_templates
  • licenses derivates or works included in works are a mess.
  • Author vs. Copyright holder
  • usernames vs 'real names'
  • Catalogue IDs etc
  • VRTS permissions
  • Publication date vs creation date
Category:Commons help/zh
Category:Commons help/zh