Help:Datatype "Reference"

(Redirected from Help:Datatype "Reference")
Holds a value that associates it to individual defined provenance metadata record
Further information
Provided by: Semantic MediaWiki
Since version: 2.5.0
Until version: still in use
Datatype ID:
In this wiki: Reference
Table of Contents

The datatype Reference is meant to associate a value with an individual defined provenance metadata record. It was introduced in Semantic MediaWiki 2.5.0Released on 14 March 2017 and compatible with MW 1.23.0 - 1.29.x..1

This page is mainly concerned with the [[Has type::Reference]] datatype declaration but you may want to read information referenced statement to find some background on the reasoning for this datatype.

For an exhaustive description on how to use the reference and provenance data feature which is made available by this datatype, please see the Semantic MediaWiki GitHub issue #18082 as well as the Semantic MediaWiki Sandbox example page for the corresponding pull request #1812.3


  • To create a property of datatype "Reference", the [[Has type::Reference]] annotation has to be added to the property page
  • To define the actual fields that will hold the provenance data, apply an annotation like
    [[Has fields::Property for the reference value;Property for the reference date;Property for the reference source]] on the property page of the reference property - you cannot refer to the same field property twice, nor can you have multiple [[Has fields::...]] annotations on the reference property page.4
  • The datatypes and position of the provenance data fields are fixed by the position used in the [[Has fields::...;...;...]] declaration
  • By convention the first field of the "Has fields" declaration must describe the property holding the value to be referenced. This is equivalent to just declaring [[Has type::...]] without adding provenance data
  • An annotation to a property of datatype "Reference" requires the reference to be added as a concatenated string separated by ";", e.g.
    [[Property of datatype Reference::Population number;Retrieved on date;Retrieved from URL]]
  • In case a value itself contains "; "as part of its declaration then "\;" is to be used to distinguish it from the separator
  • Annotations of datatype "Reference" work in the same way other datatypes do and can be combined with the #set parser function or the #subobject parser function
  • Queries which operate the same way as with those of the "Record" datatype and can specify the level of granularity with which an entity is expected to match ([[Has population::?;>2000]] vs. [[Has population::>30000000]])


  • Values with a reference will show a marker to indicate additional information being available which when hovered over to display a tooltip with those additional value statements
  • A reference to a value will in most cases (when displayed as in-text or as result of a #ask query) be displayed as a tooltip


Has Wikidata reference

See Property:Has Wikidata reference and Franz Schubert

Has population (Sandbox)

The property is called "Has population" and the following declarations are added to it's page: [[Has type::Reference]] [[Has fields::Population;Retrieved on;Retrieved from]] with property "Population" being of datatype "Number"Holds integer and decimal numbers, with an optional exponent, "Retrieved on" being of datatype "Date"Holds particular points in time and "Retrieved from" being of datatype "URL"Holds URIs, URNs and URLs.

API example


  • You cannot use special property "Display units"Specifies a comma-separated list of units or formats that a property should use in display to control how a specific field appears.
  • You cannot #ask for a ?reference-property.field printout if that field property has a special property "Corresponds to"Gives the conversion factor for some unit of a physical quantity and the possible names for that unit annotation.5
  • You cannot set the layout of the values; they will always appear as a comma-separated list.
  • Fields of records cannot be the basis for special purpose query formats such as result format "Timeline"Displays query results in interactive timelines or geography related result formats, etc.

See also[edit]


  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:1812
  2. ^  Semantic MediaWiki: GitHub issue gh:smw:1808
  3. ^  Semantic MediaWiki: Sandbox example sb:smw:1812
  4. ^  Semantic MediaWiki: GitHub pull request gh:smw:3522
  5. ^  Semantic MediaWiki: GitHub issue gh:smw:3517