Help:List of datatypes

From semantic-mediawiki.org
Table of Contents

Using different datatypes, properties can be used to describe very different kinds of values. A complete list of all 17 datatypes provided by Semantic MediaWiki and 1 provided by other semantic extensions is available from special page "Types". The available 18 datatypes are:

Overview[edit]

The following table gives an overview of all 17 datatypes provided by Semantic MediaWiki:

Name Description Help Added Key
Annotation URI Holds URIs, but has some technical differences during export compared to the "URL" type help page 1.0
_anu
Boolean Holds boolean (true/false) values help page 1.0
_boo
Email Holds e-mail addresses help page 1.0
_ema
Number Holds integer and decimal numbers, with an optional exponent help page 1.0
_num
Page Holds names of wiki pages, and displays them as a link help page 1.0
_wpg
Temperature Holds temperature values (similar to type Quantity) help page 1.0
_tem
Text Holds text of arbitrary length help page 1.0
_txt
URL Holds URIs, URNs and URLs help page 1.0
_uri
Date Holds particular points in time help page 1.4.0
_dat
Code Holds technical, pre-formatted texts (similar to datatype Text) help page 1.4.2
_cod
Telephone number Holds international telephone numbers based on the RFC 3966 standard help page 1.5.0
_tel
Quantity Holds values that describe quantities, containing both a number and a unit help page 1.6.0
_qty
Record Holds compound property values that consist of a short list of values with fixed type and order help page 1.6.0
_rec
Monolingual text Holds a text value that associates the annotation with a specific language code help page 2.4.0
_mlt_rec
External identifier Holds a value that associates it with with a external URI for formatting help page 2.5.0
_eid
Reference Holds a value that associates it to individual defined provenance metadata record help page 2.5.0
_ref_rec
Keyword Holds text of restricted length that is being normalised (similar to datatype Text) help page 3.0.0
_keyw

The following table gives an overview of all datatypes provided by extensions to Semantic MediaWiki (Currently Extension "Maps" only):

Name Description Help Added Key
Geographic coordinates Holds coordinates describing geographic locations help page 1.0
_geo

Enumerations and allowed values[edit]

In addition to assigning a datatype to a property, you can also restrict the allowed values to a given set (like a whitelist for property inputs). This is done by using the special property "Allows value"Lists one permissible value for a property to enumerate its permitted values. This works for every datatype.

Units[edit]

Datatype "Quantity"Holds values that describe quantities, containing both a number and a unit allows a unit after the numeric value to distinguish values (e.g. "30 miles" versus "42 km"). To support automatic conversion and multiple unit formats, one needs to declare each supported unit as described in the documentation on custom units. Property values are then automatically converted between different units, so that users are free to use their preferred unit in each article yet still query and compare with property values in other articles.

Example values and formatting[edit]

Datatype Property Example value Query display Query display using #- (plain)
Annotation URI Property:Has annotation uri https://www.semantic-mediawiki.org https://www.semantic-mediawiki.org https://www.semantic-mediawiki.org
Boolean Property:Has boolean true true true
Code Property:Has code
Code
is preserved but variables are expanded, e.g:
Help:List of datatypes
is displayed as the name of this page instead of FULLPAGENAME
Code
is preserved but variables are expanded, e.g:
Help:List of datatypes
is displayed as the name of this page instead of FULLPAGENAME
Code
is preserved but variables are expanded, e.g:
Help:List of datatypes
is displayed as the name of this page instead of FULLPAGENAME
Date Property:Has date 2015-05-22T17:32 22 May 2015 17:32:00 2015-05-22T17:32:00
External_identifier Property:Has SMW issue ID 1218 1218 1218
EMail Property:Has email address president@whitehouse.gov president@whitehouse.gov president@whitehouse.gov
Geographic coordinate Property:Has coordinates 32° 42' 54.00" N, 117° 9' 45.00" W 32° 42' 54.00" N, 117° 9' 45.00" W 32° 42' 54.00" N, 117° 9' 45.00" W
Keyword Property:Has keyword TestKeyword TestKeyword TestKeyword
Number Property:Has number 47000.11 47,000.11 47000.11
Monolingual text Property:Has mlt Monoglingual text in english (en)Einsprachiger Text auf Deutsch (de)Texte monoglinguel en français (fr) Monoglingual text in english (en), Texte monoglinguel en français (fr), Einsprachiger Text auf Deutsch (de) Monoglingual text in english (en), Texte monoglinguel en français (fr), Einsprachiger Text auf Deutsch (de)
Page Property:Has example Semantic MediaWiki Semantic MediaWiki Semantic MediaWiki
Quantity Property:Has area 1052km²406.18 sqmi <br /> 1,052.00 km²406.18 sqmi <br /> 1052.00 km²
Reference Property:Has Wikidata reference Q190087 Q190087 Q190087
Record Property:Has conservation status Dodo (Extinct, 2012) Dodo (Extinct, 2012) Dodo (Extinct, 2012)
Telephone number Property:Telephone number +1-800-225-5288 +1-800-225-5288
1-800-225-5288
Temperature Property:Has temperatureExample 23°C296.15 K <br />73.4 °F <br />533.07 °R <br /> 296.15 K23 °C <br />73.4 °F <br />533.07 °R <br /> 296.15 K
Text Property:SomeProperty Did you create the page for Tokyo 東京 ? Yes ✓ Did you create the page for Tokyo 東京 ? Yes ✓ Did you create the page for Tokyo 東京 ? Yes ✓
URL Property:Has_URL http://www.whitehouse.gov http://www.whitehouse.gov http://www.whitehouse.gov

Handling in earlier versions[edit]

Up to Semantic MediaWiki 1.5.6Released on 24 February 2011 and compatible with MW 1.14.x - 1.17.x., datatypes had individual wiki pages in their own namespace called "Type". This was abolished to reduce the number of extra namespaces. You may still find expressions like "Type:Number" in places in this wiki. Both writings are accepted for assigning a datatype to a property.

In very early versions of SMW up to Semantic MediaWiki 0.7Released on 28 April 2007 and compatible with MW 1.8.x - 1.10.x., properties with datatype datatype "Page"Holds names of wiki pages, and displays them as a link were known as relations and only those used double colons (::) as the separator between property name and link text. All other properties (numbers, text, etc.) were known as attributes and had to use colon equals (:=) as the separator.

See Upgrading from SMW 0.7 to SMW 1.0 for other changes in SMW 1.0; if you're still using the older version of SMW, see semweb:Help:Annotation (SMW0.7) for documentation of Annotations in version 0.7.