Commons:Machine-readable data

Shortcut: COM:MRD

On Wikimedia Commons, much of the file metadata – including the license and author – is not machine-readable. One can use the MediaWiki Action API to send a GET request and retrieve metadata for one or more image files. This is typically done with the Imageinfo module using the parameter iiprop=extmetadata.

Currently, the data displayed on file description pages is stored as free text. The ongoing Structured data on Commons initiative aims to migrate this information into fully structured form. Once complete, it will supersede the machine-readable metadata format described on this page.

In the meantime, and to ease a transition towards more structured data at a future time, Wikimedia Commons use a set of standard templates which have been made machine-readable in some ways, through HTML elements. Some scripts already make use of that. It is worth noting that this data is available for any wiki using Wikimedia Commons, where it can be read from the html of the File: page just as other local data.

Example Action API request:
Result
{
  "continue": {
    "iistart": "2009-09-30T06:04:51Z",
    "continue": "||"
  },
  "query": {
    "normalized": [
      {
        "from": "File:T-45A_Goshawk_03.jpg",
        "to": "File:T-45A Goshawk 03.jpg"
      }
    ],
    "pages": {
      "4193254": {
        "pageid": 4193254,
        "ns": 6,
        "title": "File:T-45A Goshawk 03.jpg",
        "imagerepository": "local",
        "imageinfo": [
          {
            "extmetadata": {
              "DateTime": {
                "value": "2009-09-30 07:19:49",
                "source": "mediawiki-metadata",
                "hidden": ""
              },
              "ObjectName": {
                "value": "T-45A Goshawk 03",
                "source": "mediawiki-metadata"
              },
              "CommonsMetadataExtension": {
                "value": 1.2,
                "source": "extension",
                "hidden": ""
              },
              "Categories": {
                "value": "Taken with Canon PowerShot S5 IS|Images with annotations|Featured pictures of Texas|Featured pictures from the United States Navy|Commons featured desktop backgrounds|PD US Navy|Files created by the United States Navy with known IDs|Images with infobox aircraft|Featured pictures on Wikipedia, Malay|Taken on missing SDC inception|CC-PD-Mark|June 2008 in Texas|2008 in aviation in the United States|Number 205 on aircraft|United States photographs taken on 2008-06-04|Featured photographs in the public domain|Featured pictures of military of the United States|Featured pictures of military airplanes|Assessment tagged pages marked as POTY candidates|Military aircraft facing left|McDonnell Douglas T-45 Goshawk in flight",
                "source": "commons-categories",
                "hidden": ""
              },
              "Assessments": {
                "value": "featured|potd|poty",
                "source": "commons-categories",
                "hidden": ""
              },
              "Artist": {
                "value": "\u003Cdiv class=\"fn value\"\u003E\nLt. j.g. John A. Ivancic\u003C/div\u003E",
                "source": "commons-desc-page"
              },
              "ImageDescription": {
                "value": "A T-45A Goshawk executes a turning rejoin during a recent formation flight over South Texas. The T-45 is a twin-seat, single-engine jet trainer and is the only aircraft in the Navy's inventory used specifically for training pilots to land aboard aircraft carriers.",
                "source": "commons-desc-page"
              },
              "DateTimeOriginal": {
                "value": "Taken on 4 June 2008",
                "source": "commons-desc-page"
              },
              "Credit": {
                "value": "\u003Ctable class=\"layouttemplate sourcetemplate\" style=\"width:100%; clear:both; text-align:center; margin:0.5em auto; box-sizing: border-box; padding: 0; border-spacing: 8px; background-color: var(--background-color-neutral-subtle, #f6f7f5); color: var(--color-base, #202122); border: var(--border-subtle, 1px solid #555555);\" dir=\"ltr\" lang=\"en\"\u003E\n\n\u003Ctbody\u003E\u003Ctr\u003E\n\u003Ctd\u003E\u003Cspan typeof=\"mw:File\"\u003E\u003Cspan\u003E\u003Cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/0/09/Seal_of_the_United_States_Department_of_the_Navy.svg/120px-Seal_of_the_United_States_Department_of_the_Navy.svg.png\" decoding=\"async\" width=\"80\" height=\"80\" class=\"mw-file-element\" srcset=\"https://upload.wikimedia.org/wikipedia/commons/thumb/0/09/Seal_of_the_United_States_Department_of_the_Navy.svg/250px-Seal_of_the_United_States_Department_of_the_Navy.svg.png 2x\" data-file-width=\"889\" data-file-height=\"889\"\u003E\u003C/span\u003E\u003C/span\u003E\n\u003C/td\u003E\n\u003Ctd align=\"center\"\u003E\n\u003Cp\u003E\u003Cspan class=\"layouttemplateargs\" style=\"display:none;speak:none;\" title=\"template=ID-USMil 1%3D080604-N-2798I-002 2%3DNavy url%3Dhttp%3A%2F%2Fwww.navy.mil%2Fview_image.asp%3Fid%3D59981\"\u003E \u003C/span\u003E\nThis image was released by the United States Navy with the \u003Ca href=\"//commons.wikimedia.org/wiki/Commons:VIRIN\" title=\"Commons:VIRIN\"\u003EID\u003C/a\u003E \u003Ca rel=\"nofollow\" class=\"external text\" href=\"http://www.navy.mil/view_image.asp?id=59981\"\u003E080604-N-2798I-002\u003C/a\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/w/index.php?title=Category:Files_created_by_the_United_States_Navy_with_known_IDs&filefrom=080604-N-2798I-002#mw-category-media\"\u003E\u003Csmall\u003E(next)\u003C/small\u003E\u003C/a\u003E.\u003Cbr\u003E\n\u003Csmall\u003EThis tag does not indicate the copyright status of the attached work. \u003Cspan style=\"white-space:nowrap\"\u003EA normal \u003Ca href=\"//commons.wikimedia.org/wiki/Special:MyLanguage/Commons:Copyright_tags\" title=\"Special:MyLanguage/Commons:Copyright tags\"\u003Ecopyright tag\u003C/a\u003E is still required.\u003C/span\u003E \u003Cspan style=\"white-space:nowrap\"\u003ESee \u003Ca href=\"//commons.wikimedia.org/wiki/Special:MyLanguage/Commons:Licensing\" title=\"Special:MyLanguage/Commons:Licensing\"\u003ECommons:Licensing\u003C/a\u003E.\u003C/span\u003E\u003C/small\u003E\n\u003C/p\u003E\n\u003Chr\u003E\n\u003Cp\u003E\u003Cspan style=\"font-size:small;line-height:1.4\" class=\"plainlinks noprint\"\u003E\u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/ar\"\u003E\u003Cbdi class=\"language lang-ar\" lang=\"ar\"\u003Eالعربية\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/bn\"\u003E\u003Cbdi class=\"language lang-bn\" lang=\"bn\"\u003Eবাংলা\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \n\u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/jax\"\u003E\u003Cbdi class=\"language lang-jax\" lang=\"jax\"\u003EBahaso Jambi\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \n\u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/de\"\u003E\u003Cbdi class=\"language lang-de\" lang=\"de\"\u003EDeutsch\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/de-formal\"\u003E\u003Cbdi class=\"language lang-de-formal\" lang=\"de-formal\"\u003EDeutsch (Sie-Form)\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/en\"\u003E\u003Cbdi class=\"language lang-en\" lang=\"en\"\u003EEnglish\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/es\"\u003E\u003Cbdi class=\"language lang-es\" lang=\"es\"\u003Eespañol\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/eu\"\u003E\u003Cbdi class=\"language lang-eu\" lang=\"eu\"\u003Eeuskara\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/fa\"\u003E\u003Cbdi class=\"language lang-fa\" lang=\"fa\"\u003Eفارسی\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/fr\"\u003E\u003Cbdi class=\"language lang-fr\" lang=\"fr\"\u003Efrançais\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/it\"\u003E\u003Cbdi class=\"language lang-it\" lang=\"it\"\u003Eitaliano\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/ja\"\u003E\u003Cbdi class=\"language lang-ja\" lang=\"ja\"\u003E日本語\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/ko\"\u003E\u003Cbdi class=\"language lang-ko\" lang=\"ko\"\u003E한국어\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/mk\"\u003E\u003Cbdi class=\"language lang-mk\" lang=\"mk\"\u003Eмакедонски\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/ml\"\u003E\u003Cbdi class=\"language lang-ml\" lang=\"ml\"\u003Eമലയാളം\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/nds\"\u003E\u003Cbdi class=\"language lang-nds\" lang=\"nds\"\u003EPlattdüütsch\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/nl\"\u003E\u003Cbdi class=\"language lang-nl\" lang=\"nl\"\u003ENederlands\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/pl\"\u003E\u003Cbdi class=\"language lang-pl\" lang=\"pl\"\u003Epolski\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/ps\"\u003E\u003Cbdi class=\"language lang-ps\" lang=\"ps\"\u003Eپښتو\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/pt\"\u003E\u003Cbdi class=\"language lang-pt\" lang=\"pt\"\u003Eportuguês\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/ru\"\u003E\u003Cbdi class=\"language lang-ru\" lang=\"ru\"\u003Eрусский\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/sl\"\u003E\u003Cbdi class=\"language lang-sl\" lang=\"sl\"\u003Eslovenščina\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/sv\"\u003E\u003Cbdi class=\"language lang-sv\" lang=\"sv\"\u003Esvenska\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/tr\"\u003E\u003Cbdi class=\"language lang-tr\" lang=\"tr\"\u003ETürkçe\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/uk\"\u003E\u003Cbdi class=\"language lang-uk\" lang=\"uk\"\u003Eукраїнська\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/zh-hans\"\u003E\u003Cbdi class=\"language lang-zh-hans\" lang=\"zh-hans\"\u003E简体中文\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/wiki/Template:ID-USMil/zh-hant\"\u003E\u003Cbdi class=\"language lang-zh-hant\" lang=\"zh-hant\"\u003E繁體中文\u003C/bdi\u003E\u003C/a\u003E \u003Cb\u003E∙\u003C/b\u003E \u003Csmall class=\"plainlinks\"\u003E\u003Ca class=\"external text\" href=\"https://commons.wikimedia.org/w/index.php?title=Template:ID-USMil/lang&action=edit\"\u003E+/−\u003C/a\u003E\u003C/small\u003E\u003C/span\u003E\n\u003C/p\u003E\n\u003C/td\u003E\n\u003Ctd\u003E\u003Cspan class=\"mw-image-border\" typeof=\"mw:File\"\u003E\u003Cspan\u003E\u003Cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Flag_of_the_United_States.svg/120px-Flag_of_the_United_States.svg.png\" decoding=\"async\" width=\"90\" height=\"47\" class=\"mw-file-element\" srcset=\"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Flag_of_the_United_States.svg/250px-Flag_of_the_United_States.svg.png 1.5x\" data-file-width=\"1235\" data-file-height=\"650\"\u003E\u003C/span\u003E\u003C/span\u003E\n\u003C/td\u003E\u003C/tr\u003E\u003C/tbody\u003E\u003C/table\u003E",
                "source": "commons-desc-page"
              },
              "Permission": {
                "value": "\u003Ci\u003EThis file is a work of a sailor or employee of the \u003Ca href=\"https://en.wikipedia.org/wiki/United_States_Navy\" class=\"extiw\" title=\"w:United States Navy\"\u003EU.S. Navy\u003C/a\u003E, taken or made as part of that person's official duties. As a \u003Ca href=\"https://en.wikipedia.org/wiki/Work_of_the_United_States_Government\" class=\"extiw\" title=\"w:Work of the United States Government\"\u003Ework\u003C/a\u003E of the \u003Ca href=\"https://en.wikipedia.org/wiki/Federal_government_of_the_United_States\" class=\"extiw\" title=\"w:Federal government of the United States\"\u003EU.S. federal government\u003C/a\u003E, it is in the \u003Cb\u003E\u003Ca href=\"https://en.wikipedia.org/wiki/public_domain\" class=\"extiw\" title=\"w:public domain\"\u003Epublic domain\u003C/a\u003E\u003C/b\u003E in the United States.\u003C/i\u003E",
                "source": "commons-desc-page",
                "hidden": ""
              },
              "LicenseShortName": {
                "value": "Public domain",
                "source": "commons-desc-page",
                "hidden": ""
              },
              "UsageTerms": {
                "value": "Public domain",
                "source": "commons-desc-page"
              },
              "AttributionRequired": {
                "value": "false",
                "source": "commons-desc-page",
                "hidden": ""
              },
              "Copyrighted": {
                "value": "False",
                "source": "commons-desc-page",
                "hidden": ""
              },
              "Restrictions": {
                "value": "",
                "source": "commons-desc-page",
                "hidden": ""
              },
              "License": {
                "value": "pd",
                "source": "commons-templates",
                "hidden": ""
              }
            }
          }
        ]
      }
    }
  } 
}

Machine readable data

Machine readable data set by infobox templates

These are several standard infobox templates tagging different elements of the template with different tags to allow parsing of the information. Several different styles of tags are used:

  • Microformat tags follow industry standards and can be parsed by already existing tools.
  • <td> id attributes (identifiers) are custom markings which allow more complete tags, which have to be read by custom tools. Most universal infoboxes have two column structure: column #1 holds name of the field and column #2 holds the value
    • Traditionally <td> id attributes were used to tag the name call in the first column in a row. To get the data, you would need to get the contents of the following <td> cell in the second column.
    • {{Creator}} and {{Institution}} templates have more complicated structure, so the cells with the actual data are tagged with attributes using magenta background.
Template Template parameter name Description <td> id attribute Microformat Comment
{{Information}}description file descriptionfileinfotpl_deschProduct.description. Often contains multiple languages annotated with {{Lang}}.
{{Information}}date date the original work was createdfileinfotpl_datehCalendar vevent.dtstart Sometimes additionally, or only, contains publication date. These two dates have different meanings for copyright. When used, {{Date context}} can indicate the difference. Microformat added by {{Date}} template
{{Information}}source file's sourcefileinfotpl_src Often contains entire tables. We have no good way to deal with this source templates yet. Source templates often have references to catalogue IDs, but these are also not machine readable.
{{Information}}author file's authorfileinfotpl_aut This can be author, creator and/or copyright holder and is used mixed. Often contains the {{Creator}} template which is described below.
{{Information}}permission permission/license for the filefileinfotpl_perm
{{Information}}other versions other versions of the filefileinfotpl_ver
{{Artwork}}description description of the artworkfileinfotpl_deschProduct.description
{{Artwork}}date date of creation of the original artworkfileinfotpl_datehCalendar vevent.dtstart microformat added by {{Date}} template
{{Artwork}}source file's sourcefileinfotpl_src
{{Artwork}}artist creator of the artworkfileinfotpl_aut"hProduct.fn value"
{{Artwork}}author author of the artworkfileinfotpl_aut"hProduct.fn value"
{{Artwork}}permission permission/license for the file and artworkfileinfotpl_perm
{{Artwork}}other versions other versions of the filefileinfotpl_ver
{{Artwork}}title title of the artworkfileinfotpl_art_titlehProduct.fn
{{Artwork}}object type artwork object typefileinfotpl_art_object_type
{{Artwork}}medium technique or medium of the artworkfileinfotpl_art_medium
{{Artwork}}dimensions dimensions of the artworkfileinfotpl_art_dimensions
{{Artwork}}gallery institution holding the artworkfileinfotpl_art_gallery
{{Artwork}}location location of the artwork within the institutionfileinfotpl_art_locationhProduct.locality
{{Artwork}}accession number accession number of the artworkfileinfotpl_art_idhProduct.identifier
{{Artwork}}object history object history of the artworkfileinfotpl_art_object_history
{{Artwork}}exhibition history exhibition history of the artworkfileinfotpl_art_exhibition_history
{{Artwork}}credit line credit line of the artworkfileinfotpl_art_credit_line
{{Artwork}}inscriptions inscriptions on the artworkfileinfotpl_art_inscriptions
{{Artwork}}notes notes about the artworkfileinfotpl_art_notes
{{Artwork}}references references related to the artworkfileinfotpl_art_references
{{Book}}Author author of the bookfileinfotpl_author
{{Book}}Editor editor of the bookfileinfotpl_book_editor
{{Book}}Translator translator of the bookfileinfotpl_book_translator
{{Book}}Illustrator illustrator of the bookfileinfotpl_book_illustrator
{{Book}}Title title of the bookfileinfotpl_book_title
{{Book}}Subtitle subtitle of the bookfileinfotpl_book_subtitle
{{Book}}Series title series-title of the bookfileinfotpl_book_series-title
{{Book}}Authority file authority control datafileinfotpl_book_authority
{{Book}}Publisher publisher of the bookfileinfotpl_book_publisher
{{Book}}Printer printer of the bookfileinfotpl_book_printer
{{Book}}Year of publication date or year of the publication of the bookfileinfotpl_date
{{Book}}Place of publication place or city of the publication of the bookfileinfotpl_book_place-of-publication
{{Book}}Language language of the bookfileinfotpl_book_language
{{Book}}Description description of the bookfileinfotpl_desc
{{Creator}}Name Name of creatorcreatorvCard.fn
{{Creator}}Alternative names Alternative names of creatorfileinfotpl_creator_alt-name_valuevCard.nickname
{{Creator}}Description Nationality and occupation(s) of creatorfileinfotpl_creator_desc_valuevCard.note
{{Creator}}Date of death Date of death of creatorfileinfotpl_creator_deathdate_value
{{Creator}}Date of birth Date of birth of creatorfileinfotpl_creator_birthdate_valuevCard.bday
{{Creator}}Location of birth/death Location of death of creatorfileinfotpl_creator_deathloc_value
{{Creator}}Location of birth Location of birth of creatorfileinfotpl_creator_birthloc_value
{{Creator}}Work period Work period of creatorfileinfotpl_creator_work-period_value
{{Creator}}Work location Work location of creatorfileinfotpl_creator_work-location_valuev
{{Creator}}Image portrait or photo showing the creatorfileinfotpl_creator_image
{{Creator}}Authority file Authority control related to the creatorfileinfotpl_creator_authority_value


{{FileContentsByBot}} (various) depends, please confer {{FileContentsByBot}}(various)hproduct-by-bot big data set and still growing, please confer {{FileContentsByBot}}
{{Photograph}}title title of the photographfileinfotpl_art_titlehProduct.fn
{{Photograph}}description description of the photographfileinfotpl_deschProduct.description
{{Photograph}}original description original archival description of the photographfileinfotpl_deschProduct.description
{{Photograph}}date date of creation of the original artworkfileinfotpl_datehCalendar vevent.dtstart microformat added by {{Date}} template
{{Photograph}}medium technique or medium of the photographfileinfotpl_art_medium
{{Photograph}}dimensions dimensions of the photographfileinfotpl_art_dimensions
{{Photograph}}artist creator of the photographfileinfotpl_aut"hProduct.fn value"
{{Photograph}}institution institution holding the artworkfileinfotpl_art_gallery
{{Photograph}}location location of the photograph within the institutionfileinfotpl_art_locationhProduct.locality
{{Photograph}}source file's sourcefileinfotpl_src
{{Photograph}}permission permission/license for the file and artworkfileinfotpl_perm
{{Photograph}}other versions other versions of the filefileinfotpl_ver
{{Photograph}}accession number accession number of the photographhProduct.identifier

Alternative format for CommonsMetadata

Because the table + id based format proved very hard to add to templates which were not formatted similarly to the Commons information template, CommonsMetadata allows an alternative format, similar to license templates: the whole information template has to be enclosed in a fileinfotpl class and the tag containing the specific information needs to have a fileinfotpl_* class (same names as above, but class, not id).

Machine readable data set by license templates

Introduced in October 2010, using classes <span class="licensetpl_XXX">

licensetpl
An element identifying a license. Wraps the entire license code and should be a SINGLE license, not a multi license.
licensetpl_short
Short name of the license: “Public domain”, “CC BY-SA 3.0”, “CC by 2.0 fr”, etc.
licensetpl_long
Long name of the license: “Public domain”, “Creative Commons Attribution-Share Alike 3.0”,
licensetpl_attr_req
Whether attribution is required. “true” or “false”.
licensetpl_attr
The requested attribution: Free text.
licensetpl_link_req
Whether a link to the license is required for this license. “true” or “false”.
licensetpl_link
The link to the license deed. “www.creativecommons.org/licenses/by-sa/XXX/YYY”
licensetpl_nonfree
“true“ if this is a non-free license (not used on Commons, only on wikis with an EDP)

Multiple licensetpl blocks for the same work might be wrapped in a block using the class licensetpl_wrapper.

Templates setting this information

Machine readable data set by style formatting templates

Style formatting templates, meant to provide uniform styles to different families of non-license templates, carry machine readable data identifying these families.

Template Purpose class name
{{Restriction-Layout}} used by Restriction tags restrictiontemplate
{{FoP-Layout}} used by freedom of panorama tags foptemplate
{{Partnership-Layout}} used by Partnership templates partnershiptemplate
{{Source-Layout}} used by generic Source templates sourcetemplate
{{Created with}} used by Created with ... templates createdwithtemplate

Templates regarding non-copyright legal restrictions carry these classes to identify specific types of restrictions.

Template(s) Purpose class name
{{Trademarked}} Trademarked images restriction-trademarked
{{Copydesign}} Copyrighted designs restriction-design
{{Communist symbol}} Communist symbols restriction-communist
{{Italy-MiBAC-disclaimer}} {{Soprintendenza}} Italian cultural goods restriction-ita-mibac
{{Australian Commonwealth reserve}} Australian reserves restriction-aus-reserve
{{Personality rights}} {{Romania personality rights}} Personality rights restriction-personality
{{2257}} Child Protection and Obscenity Enforcement Act warning (United States) restriction-2257
{{Costume}} Costuming restriction-costume
{{Fan art}} Fan art restriction-fan-art
{{Currency}} Currency restriction-currency
{{IHL Symbol}} Symbols restricted by International Humanitarian Law restriction-ihl
{{Nazi symbol}} Nazi and fascist symbols restriction-nazi
{{Insignia}} Official insignia restriction-insignia

Machine readable data set by specific templates

More machine-readable data are set. Here is a non-exhaustive list:

{{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>

Machine-readable data set by location templates

{{Location}} and similar templates add machine-readable geocodes in the following format: <span class="geo">12.34;24.68</span> (latitude and longitude as floating-point numbers, separated by a semicolon). The coordinates use the en:WGS84 system (same as the GPS and most online maps). See Commons:Geocoding for more details.

Usage

MediaWiki API

The MediaWiki API now serves a limited number of metadata. Consider the following query:

(Open in API Sandbox) that returns some useful parameters such as Credit, Artist, LicenseUrl and Copyrighted and is used by Media Viewer, for example.

Scripts using machine-readable data

External tools

See also

Defining new machine readable data

  • Do NOT use HTML id's, use classes. An ID can only be used once per page and most of these fields can occur multiple times per page. Consider for instance descriptions of derivative works, which can include information about the original and the derivative.
  • When possible, wrap the actual data, not some field header. This last method is historically used for all our Information templates, but much harder to support in the long run.
  • Wrap data, not the way the data is formatted.
  • Expect that formatting is lost when converting to data. Visual dress up is not part of the information.
  • 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.

Problems

There are a few things that are currently NOT or badly recognizable. These include:

  • 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
Category:Commons help