Help:Data type

From testwiki
Jump to navigation Jump to search

<languages /> Template:Information page <translate> Data types define how the statement will behave, and what kind of data they take. Different types of statements use different types of properties, and they are also using different data types. During creation of properties one of the choices is to set the data type, and once set the property gets locked to this data type. That has implications for how they can be used and there must be some amount of planning before a useful property can be defined.

Coordination of work on properties happens at Template:Ll. </translate>

Template:Properties by datatype Template:Clear

<translate>

Properties by type

For a list of the properties that currently require each type of data type, see either:

  • Special:ListProperties
  • [[<tvar name="1">Special:MyLanguage/Wikidata:Database reports/List of properties/all</tvar>|List of all properties]]
  • [[<tvar name="2">Wikidata:Database reports/Constraint violations/All properties</tvar>|Constraint violations: all properties]]
  • Category:Properties by datatype

Wikidata has <tvar name="num">6</tvar> types of entities (<tvar name="1">Template:Entitytype</tvar>, <tvar name="2">Template:Entitytype</tvar>, <tvar name="3">Template:Entitytype</tvar>, <tvar name="4">Template:Entitytype</tvar>, <tvar name="5">Template:Entitytype</tvar> and <tvar name="6">Template:Entitytype</tvar>). For each entity type there exists a same-named data type that can be used to link entities of that type. </translate>

⧼datatypes-type-wikibase-item⧽ Template:Anchor
<translate> Link to an {{<tvar name="1">ll|Help:items</tvar>|item}}.</translate> ([[Special:ListProperties/wikibase-item|Template:Int list of properties]])
⧼datatypes-type-wikibase-property⧽ Template:Anchor
<translate> Link to a {{<tvar name="1">ll|Help:properties</tvar>|property}}.</translate> ([[Special:ListProperties/wikibase-property|Template:Int list of properties]])
⧼datatypes-type-entity-schema⧽ Template:Anchor
<translate> Link to an {{<tvar name="1">ll|Help:EntitySchema</tvar>|entity schema}}.</translate> ([[Special:ListProperties/entity-schema|Template:Int list of properties]])

<translate> The following data types are primarily meant for statements on Lexemes, which make up the {{<tvar name="1">ll|Wikidata:Lexicographical data</tvar>|lexicographical data}} of Wikidata. </translate>

⧼datatypes-type-wikibase-lexeme⧽ Template:Anchor
<translate> Link to a {{<tvar name="1">ll|Help:lexeme</tvar>|lexeme}}.</translate> ([[Special:ListProperties/wikibase-lexeme|Template:Int list of properties]])
⧼datatypes-type-wikibase-form⧽ Template:Anchor
<translate> For statements on lexemes that reference {{<tvar name="1">ll|Help:form</tvar>|forms}} on other lexemes in order to indicate their relation.</translate> ([[Special:ListProperties/wikibase-form|Template:Int list of properties]])
⧼datatypes-type-wikibase-sense⧽ Template:Anchor
<translate> For statements on lexemes that reference {{<tvar name="1">ll|Help:sense</tvar>|senses}} on other lexemes.</translate> ([[Special:ListProperties/wikibase-sense|Template:Int list of properties]])

<translate> String-based data types</translate> Template:Anchor

Template:Anchor

⧼wikibase-listdatatypes-string-head⧽

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with string-datatype</translate> -- Special:ListProperties/string

<translate> Chain of characters, numbers and symbols that don't need to be translated into different languages or number formats. A string is not used for calculations.</translate>

Template:Int Examples⧼colon⧽
  • B123
  • 90928390-XLE
  • u29238

<translate> Maximum length is 1,500 characters on Wikidata, as defined with <tvar name="1">wmgWikibaseStringLimits</tvar> in <tvar name="2">InitialiseSettings.php</tvar>.</translate>

Template:Anchor

⧼wikibase-listdatatypes-monolingualtext-head⧽

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with monolingualtext-datatype</translate> -- Special:ListProperties/monolingualtext

<translate> A string that is not translated into other languages. This type of string is defined once and reused in all languages. Typical use is a geographically localized entity name written in the local language, an identifier of some kind, a chemical formula or a Latin scientific name. See Template:Ll for information about the language codes available for monolingual text values and how to request support for additional language codes. (Note that monolingual text also implies a single script system, which can make the string somewhat problematic.)

Maximum length is 1,500 characters on Wikidata, as defined with <tvar name="1">wmgWikibaseStringLimits</tvar> in <tvar name="2">InitialiseSettings.php</tvar>.</translate>

Template:Anchor

⧼wikibase-listdatatypes-external-id-head⧽

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with external-id-datatype</translate> -- Special:ListProperties/external-id

<translate> String that represents an identifier used in an external system. Will display as external link if a Template:Property is defined. See: [[<tvar|extID>Wikidata:External identifiers</>|External identifiers]].

Maximum length is 1,500 characters on Wikidata, as defined with <tvar name="1">wmgWikibaseStringLimits</tvar> in <tvar name="2">InitialiseSettings.php</tvar>.</translate>

Template:Anchor

⧼wikibase-listdatatypes-url-head⧽

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with url-datatype</translate> -- Special:ListProperties/url

<translate> A generalized "URL" that identifies some kind of external resource, perhaps a link to an external site of some kind, or an identifier used for lookup in some kind of specialized resource.

Maximum length is 1,500 characters on Wikidata, as defined with <tvar name="1">wmgWikibaseStringLimits</tvar> in <tvar name="2">InitialiseSettings.php</tvar>.</translate>

<translate> Data types to reference files on Commons</translate>

Template:Anchor

⧼wikibase-listdatatypes-commonsmedia-head⧽

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with commonsMedia-datatype</translate> -- Special:ListProperties/commonsMedia

<translate> References to files on Wikimedia Commons. During entry in the textfield the "File" namespace on Commons will be searched for matching entries. These files can be used both to illustrate the concepts in Wikidata and as an actual property value for inclusion on Wikipedia.</translate>

Template:Int Examples⧼colon⧽
  • Wikidata-logo.svg

Template:Anchor

⧼wikibase-listdatatypes-geo-shape-head⧽

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with geo-shape-datatype</translate> -- Special:ListProperties/geo-shape

<translate> Reference to [[<tvar|mw>mw:Help:Map Data</>|map data]] file on Wikimedia Commons. During entry in the textfield the [[<tvar|Commons>c:Help:Namespaces</>|"Data" namespace on Wikimedia Commons]] will be searched for matching entries.</translate>

Template:Anchor

⧼wikibase-listdatatypes-tabular-data-head⧽

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with tabular-data-datatype</translate> -- Special:ListProperties/tabular-data

<translate> Reference to [[<tvar|mw>mw:Help:Tabular Data</>|tabular data]] file on Wikimedia Commons. During entry in the textfield the "Data" namespace on Commons will be searched for matching entries.</translate>

<translate> Data types for specific notations</translate>

Template:Anchor

Mathematical expression

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with math-datatype</translate> -- Special:ListProperties/math

<translate> Formatted string that displays as formula.

Example:

\sqrt{1-e^2} produces: 1e2

See w:Help:Displaying a formula for applicable format.

Current limitation: input text can't be queried on Query Service.</translate>

Template:Anchor

⧼wikibase-listdatatypes-musical-notation-head⧽

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with musical-notation-datatype</translate> -- Special:ListProperties/musical-notation

<translate> Generated image in .png format that displays a musical score. Values for that data type are strings describing music following LilyPond syntax.

Example:

Value string \relative c' { c d e f | g2 g | a4 a a a | g1 |}, produces

</translate>

<score>\relative c' { c d e f | g2 g | a4 a a a | g1 |}</score>

<translate>

Other data types

</translate>

Template:Anchor

⧼wikibase-listdatatypes-quantity-head⧽

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with quantity-datatype</translate> -- Special:ListProperties/quantity

<translate> A Quantity value represents a decimal number, together with information about the uncertainty interval of this number, and a unit of measurement. The attributes are:

  • amount: the quantity's main value
  • lowerBound: the quantity's lower bound (optional)
  • upperBound: the quantity's upper bound (optional)
  • unit: unit of measure item (empty for dimensionless values)

Internally, amount, lower bound and upper bound are strings; positive numbers are stored with a plus sign, though this will not be displayed. The representation of a quantity may not be longer than 127 characters; therefore, the maximal value of a quantity is 10^126-1.

Unit conversion is implemented based on Template:P. Most units with that property are normalized in the RDF export for the query service (October 2019).

The normalisation table is readable as a JSON file [<tvar|gerrit>https://gerrit.wikimedia.org/r/plugins/gitiles/operations/mediawiki-config/+/master/wmf-config/unitConversionConfig.json</> in the WMF Mediawiki repository].</translate>

Template:Int Examples⧼colon⧽

<translate>

  • 762 (dimensionless)
  • 2500 km (upper and lower bounds are not set, with unit)
  • 1.03 ± 0.02 g (enter as nominal value +/- tolerance, representing a lower and upper bound, with unit). The tolerance is in some cases not shown at Wikipedia, only the nominal value, for example in Wikidata lists produced by the listeria bot.

</translate>

Template:Anchor

⧼wikibase-listdatatypes-time-head⧽

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with time-datatype</translate> -- Special:ListProperties/time

<translate> This data type stores a date in Gregorian or Julian calendar. [[<tvar|SLDT>Special:ListDatatypes#time</>|See detailed structure.]]</translate>

Template:Int Examples⧼colon⧽

<translate>

  • 2012
  • 1780-05 (=May 1780)
  • 1833-11-01 (=1st November 1833)</translate>

<translate> See <tvar name="1">Template:Ll</tvar> for more. </translate>

Template:Anchor

⧼wikibase-listdatatypes-globe-coordinate-head⧽

Template:Int type⧼colon⧽ Template:Datatype (Template:Datatype)
Template:Int list of properties⧼colon⧽ <translate> Category:Properties with globe-coordinate-datatype</translate> -- Special:ListProperties/globe-coordinate

<translate> A geographical position given as a latitude-longitude pair (in gms or decimal degrees) for a given "globe" (any stellar body). Globe defaults to "Earth" (globe: http://www.wikidata.org/entity/Q2). A "precision" parameter describes the resolution of the source of the coordinate. Note that the coordinate system is assumed to be "WGS84" (Template:Q), which may not be suitable for less Earth-like bodies, and this is not configurable.</translate> Template:Phabricator <translate> Currently, the Web UI of Wikidata doesn't expose all parameters of this data type. The value is visualized only as the coordinate, plus an embedded map if the globe is Template:Q. The precision can be modified in the edit mode. The globe is not visible, nor editable, in the item view. The full configuration is however visible in the history diff view ([<tvar|1>https://www.wikidata.org/w/index.php?diff=284584739&oldid=262434301&title=Q520</> example]). </translate>

Template:Phabricator <translate> When using the Web UI, the value saved will be an exact multiple of the precision chosen.

It is possible to edit the data in full via API. The [<tvar|github>https://github.com/maxlath/wikibase-cli/blob/master/docs/write_operations.md#rich-values</> CLI tool] is one way to access the API. In this example Template:Q is given a coordinate on Template:Q using the globe parameter (used in Template:P):</translate>

wd ac Q520 P625 '{ "latitude": 18.4, "longitude": 226, "precision": 0.016666666666667, "globe": "http://www.wikidata.org/entity/Q111" }'

<translate> The [[<tvar|u>User talk:Molarus/globe.js</>|globe.js script]] adds a UI to set the globe parameter of Template:P.

Bots such as <tvar|b>LocatorBot</> may detect when the globe parameter of Template:P is not set according to Template:P. Adding Template:P and waiting for a bot to update the coordinate globe is an accepted workaround. </translate>

<translate> Technical details</translate>

<translate> In the {{<tvar name="1">ll|Help:Wikibase JSON</tvar>|Wikibase JSON}} format each value is represented by <tvar name=code>"datatype": <datatype>, "datavalue": {"type": <type>, "value": ...}</tvar>, where the representation of the <tvar name="2">value</tvar> depends on the <tvar name="3">type</tvar>.

In the {{<tvar name="1">ll|Wikidata:RDF</tvar>|RDF}} format data types are represented by the <tvar name=col-name>RDF name</tvar> in the following table prefixed with <tvar name=prefix-url>http://wikiba.se/ontology#</tvar> (or the <tvar name=prefix>wikibase:</tvar> prefix in case of the RDF dumps). Note that this prefix is also available in the {{<tvar name="2">ll|Help:WDQS</tvar>|Wikidata query service}}, so for example <tvar name=query>Template:Quickquery</tvar> will return all properties of data type String. </translate>

{{#invoke:datatypes|overviewTable}}

<translate> Limitations</translate>

<translate>

Pending data types

For none of the following dates of implementation are likely to be available. Existing datatypes may solve it in the meantime.

See: Wikidata:Development plan

To be done

Duration

</translate> Template:Tracked <translate> time in HH:MM:SS format.

To plan

Calculated property

</translate> Template:Tracked <translate> A property calculated by Wikibase and added directly to items. Not in development plan.

Possible uses: number of statements on the item.

Celestial coordinates

</translate> Template:Tracked <translate> A coordinate format for specifying positions of celestial objects. Not in development plan.

Current work-around: see <tvar name="1">Wikidata:Property proposal/Astronomical coordinates</tvar></translate>

Template:Anchor <translate>

Integer datatype

</translate> Template:Tracked <translate> A quantity datatype for positive integer numbers. This was partially implemented by removing precision and creating Template:Q.

Monostring item

A datatype allowing descriptions in any language, but a single label. Not in development plan.

Current alternatives: lexemes

Alternative that is being evaluated: multilingual label replacing repeated labels </translate> Template:Anchor <translate>

Multilingual text

</translate> Template:Tracked <translate> A string that must be translated into other languages. Use might be an entity name on non-local form, that is translated into various languages and script systems. (Note that multilingual text also imply a lot of manual work during translation.). Actual purpose to be determined.

Multiline text

</translate> Template:Tracked

<translate> A string that may contain newlines.

Remote property

</translate> Template:Tracked <translate> Properties in remote repositories are likely to be identified through a special field on existing entities, not a separate datatype.</translate>

Template:Anchor <translate>

Value series

</translate> Template:Tracked <translate> A simplified way to store series of values for different points in time. Not in development plan.

Chess

</translate> Template:Tracked <translate> Display strings in FEN notation as in Template:P directly as chessboards.

Hiero

Strings for display with [[<tvar|mw>mw:Special:MyLanguage/Extension:WikiHiero</>|WikiHiero]]. Strings in WikiHiero syntax are embedded in <tvar|tag><hiero></hiero></> to display. Samples on <tvar|q>Talk:Q68101340</> and Property_talk:P7383.

Phab request to do.

Combined human-readable and numeric id

</translate> Template:Tracked <translate> Datatype to add numeric id and page title, e.g. of a MediaWiki page. Qualifier Template:P is sometimes added to property value with page titles. Some properties use the numeric value directly.

Wikibase statement

</translate> Template:Tracked <translate> Datatype to reference a specific Wikidata statement.

Regular expressions

</translate> Template:Tracked <translate> Datatype to store regular expressions (regex). These are currently stored as strings or monolingual text, e.g. Template:P, Template:P.

IP address ranges

</translate> Template:Tracked <translate> Datatype to store address ranges and simplify querying them.

Data types that will never be implemented

Boolean

</translate> Template:Tracked <translate> Declined. Suggested alternative: item-datatype.

Changing datatype

A property in "string" datatype may be converted to "external identifier" datatype by a system administrator. To propose such a change, you may start a discussion at the talk page of the property or [[<tvar|PC>WD:PC</>|Project chat]]. After a consensus, a request may be made in [[<tvar|dev>WD:DEV</>|Contact the development team]]. You should read [[<tvar|mig>Wikidata:Identifier migration</>|previous discussion]] if you want to convert a property created before 2016.

Other changes of data type requires creating a new property and deleting the old one. You should use [[<tvar|PFD>WD:PFD</>|Properties for deletion]] for such requests.

See also