Commons:机器可读数据

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
This page is a translated version of a page Commons:Machine-readable data and the translation is 98% complete. Changes to the translation template, respectively the source language can be submitted through Commons:Machine-readable data and have to be approved by a translation administrator.

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_desc hProduct.description. 通常包含用{{Lang}}註釋的多種語言。
{{Information}} date 原創作品的創作日期 fileinfotpl_date hCalendar 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_desc hProduct.description
{{Artwork}} date 原始藝術品的創作日期 fileinfotpl_date hCalendar 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_title hProduct.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_location hProduct.locality
{{Artwork}} accession number 藝術品的登錄號 fileinfotpl_art_id hProduct.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 創作者姓名 creator vCard.fn
{{Creator}} Alternative names 創作者的別稱 fileinfotpl_creator_alt-name_value vCard.nickname
{{Creator}} Description 創作者的國籍和職業 fileinfotpl_creator_desc_value vCard.note
{{Creator}} Date of death 創作者逝世日期 fileinfotpl_creator_deathdate_value
{{Creator}} Date of birth 創作者出生日期 fileinfotpl_creator_birthdate_value vCard.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_title hProduct.fn
{{Photograph}} description 照片描述 fileinfotpl_desc hProduct.description
{{Photograph}} original description 照片的原始檔案描述 fileinfotpl_desc hProduct.description
{{Photograph}} date 原始藝術品的創作日期 fileinfotpl_date hCalendar 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_location hProduct.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現在提供有限數量的元數據。考慮以下查詢:

/w/api.php?action=query&prop=imageinfo&format=json&iiprop=extmetadata&iilimit=5&titles=File%3AFranziskanerkirche%20Salzburg%20panoramic%20view%20interior%2039252px.jpg

(在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