Help:Data type
Shortcut: WD:GLOBEShortcut: WD:GLOBEThis is an information page. It is not one ofWikidata's policies or guidelines, but rather intends to describe some aspect(s) of Wikidata's norms, customs, technicalities, or practices. It may reflect varying levels of consensus and vetting. |
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 atWikidata:Property proposal.
| Data type | Number of properties |
|---|---|
| External identifier | 9,845 |
| Item | 1,716 |
| Quantity | 679 |
| String | 348 |
| URL | 115 |
| Commons media file | 89 |
| Point in time | 69 |
| Monolingual text | 64 |
| Property | 22 |
| Geographic coordinates | 10 |
| Tabular data | 6 |
| Geographic shape | 3 |
| Data type | Number of properties |
|---|---|
| Mathematical expression | 36 |
| Sense | 19 |
| Lexeme | 15 |
| Form | 10 |
| Musical Notation | 6 |
For a list of the properties that currently require each type of data type, see either:
Wikidata has 6 types of entities (Item,Property,Lexeme,Sense,Form and⧼datatypes-type-wikibase-EntitySchema⧽). For each entity type there exists a same-named data type that can be used to link entities of that type.
The following data types are primarily meant for statements on Lexemes, which make up thelexicographical data of Wikidata.
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.
Maximum length is 1,500 characters on Wikidata, as defined withwmgWikibaseStringLimits inInitialiseSettings.php.
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. SeeHelp:Monolingual text languages 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 withwmgWikibaseStringLimits inInitialiseSettings.php.
String that represents an identifier used in an external system. Will display as external link if aformatter URL(P1630) is defined. See:External identifiers.
Maximum length is 1,500 characters on Wikidata, as defined withwmgWikibaseStringLimits inInitialiseSettings.php.
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 withwmgWikibaseStringLimits inInitialiseSettings.php.
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.
Reference tomap data file on Wikimedia Commons. During entry in the textfield the"Data" namespace on Wikimedia Commons will be searched for matching entries.
Reference totabular data file on Wikimedia Commons. During entry in the textfield the "Data" namespace on Commons will be searched for matching entries.
Formatted string that displays as formula.
Example:
\sqrt{1-e^2} produces:Seew:Help:Displaying a formula for applicable format.
Current limitation: input text can't be queried on Query Service.
Generated image in.png format that displays a musical score. Values for that data type are strings describing music followingLilyPond syntax.
Example:
\relative c' { c d e f | g2 g | a4 a a a | g1 |}, produces
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:
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 onconversion to SI unit(P2370). 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 filein the WMF Mediawiki repository.
This data type stores a date in Gregorian or Julian calendar.See detailed structure.
SeeHelp:Dates for more.
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" (World Geodetic System 1984(Q11902211)), which may not be suitable for less Earth-like bodies, and this is not configurable.
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 isEarth(Q2). 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 (example).
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. TheCLI tool is one way to access the API. In this exampleOlympus Mons(Q520) is given a coordinate onMars(Q111) using the globe parameter (used incoordinate location(P625)):
wd ac Q520 P625 '{ "latitude": 18.4, "longitude": 226, "precision": 0.016666666666667, "globe": "http://www.wikidata.org/entity/Q111" }'
Theglobe.js script adds a UI to set the globe parameter ofcoordinate location(P625).
Bots such asLocatorBot orPi bot may detect when the globe parameter ofcoordinate location(P625) is not set according tolocated on astronomical body(P376). Addinglocated on astronomical body(P376) and waiting for a bot to update the coordinate globe is an accepted workaround.
In theWikibase JSON format each value is represented by"datatype": <datatype>, "datavalue": {"type": <type>, "value": ...}, where the representation of thevalue depends on thetype.
In theRDF format data types are represented by theRDF name in the following table prefixed withhttp://wikiba.se/ontology# (or thewikibase: prefix in case of the RDF dumps). Note that this prefix is also available in theWikidata query service, so for example?prop wikibase:propertyType wikibase:String will return all properties of data type String.
| Name | JSONdatatype | RDF name | JSONtype | Implemented by | Links |
|---|---|---|---|---|---|
| Item | wikibase-item | WikibaseItem | wikibase-entityid | built-in | list,query |
| Property | wikibase-property | WikibaseProperty | wikibase-entityid | built-in | list,query |
| Lexeme | wikibase-lexeme | WikibaseLexeme | wikibase-entityid | WikibaseLexeme(Q28925815) | list,query |
| Sense | wikibase-sense | WikibaseSense | wikibase-entityid | WikibaseLexeme(Q28925815) | list,query |
| Form | wikibase-form | WikibaseForm | wikibase-entityid | WikibaseLexeme(Q28925815) | list,query |
| EntitySchema | entity-schema | EntitySchema | wikibase-entityid | Wikidata Entity Schema(Q73505550) | list,query |
| Monolingual text | monolingualtext | Monolingualtext | monolingualtext | built-in | list,query |
| String | string | String | string | built-in | list,query |
| External identifier | external-id | ExternalId | string | built-in | list,query |
| URL | url | Url | string | built-in | list,query |
| Commons media file | commonsMedia | CommonsMedia | string | built-in | list,query |
| Geographic shape | geo-shape | GeoShape | string | built-in | list,query |
| Tabular data | tabular-data | TabularData | string | built-in | list,query |
| Mathematical expression | math | Math | string | Math(Q21677559) | list,query |
| Musical Notation | musical-notation | MusicalNotation | string | Score(Q21678392) | list,query |
| Quantity | quantity | Quantity | quantity | built-in | list,query |
| Point in time | time | Time | time | built-in | list,query |
| Geographic coordinates | globe-coordinate | Globecoordinate | globecoordinate | built-in | list,query |
For none of the following dates of implementation are likely to be available. Existing datatypes may solve it in the meantime.
time in HH:MM:SS format.
A property calculated by Wikibase and added directly to items. Not in development plan.
Possible uses: number of statements on the item.
A coordinate format for specifying positions of celestial objects. Not in development plan.
Current work-around: seeWikidata:Property proposal/Astronomical coordinates
A quantity datatype for positive integer numbers. This was partially implemented by removing precision and creatinginteger constraint(Q52848401).
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
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.
A string that may contain newlines.
Properties in remote repositories are likely to be identified through a special field on existing entities, not a separate datatype.
A simplified way to store series of values for different points in time. Not in development plan.
Display strings in FEN notation as inposition in Forsyth-Edwards Notation(P6648) directly as chessboards.
Strings for display withWikiHiero. Strings inWikiHiero syntax are embedded in<hiero></hiero> to display. Samples onTalk:Q68101340 andProperty_talk:P7383.
Phab request to do.
Datatype to add numeric id and page title, e.g. of a MediaWiki page. QualifierMediaWiki page ID(P9675) is sometimes added to property value with page titles. Some properties use the numeric value directly.
Datatype to reference a specific Wikidata statement.
Datatype to store regular expressions (regex). These are currently stored as strings or monolingual text, e.g.format as a regular expression(P1793),format as language specific regular expression(P8770).
Datatype to store address ranges and simplify querying them.
Declined. Suggested alternative: item-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 orProject chat. After a consensus, a request may be made inContact the development team. You should readprevious 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 useProperties for deletion for such requests.