Status: | effective |
Progress: | 75% |
Version: | 2.4.0+ |
Boolean | |
---|---|
Holds boolean (true/false) values | |
Further information | |
Provided by: | Semantic MediaWiki |
Since version: | 1.0 |
Until version: | still in use |
Datatype ID: | _boo
|
In this wiki: | Boolean |
Table of Contents | |
Contents |
The datatype Boolean is for attributes that can only have two possible values, called truth value. You can enter "true" or "false", also 1/0, yes/no, t/f, and y/n. Other languages may provide language-specific options.
To allow two arbitrary strings, or more than two possible values (such as no
- maybe
- probably
- yes
) use datatype "Text"Holds text of arbitrary length with special property "Allows value"Lists one permissible value for a property to restrict the possible values. In many circumstances it may also be more appropriate to use a category instead of a Boolean.
Display formatting[edit]
By default, Boolean values will display true
and false
in queries. This can be changed starting with Semantic MediaWiki 2.4.0Released on 9 July 2016 and compatible with MW 1.19.0 - 1.27.x. by specifying a format string to control what is displayed for the true and false values of a property.
{{#ask: [[Category:Project]] |?Has boolean#<FORMATTER> }}
- Type:Boolean #LOCL formatter (#LOCL to localize the output)
- Type:Boolean #num formatter (to produce 1 or 0)
- Type:Boolean #tick formatter (to display ✓ or ✕)
- Type:Boolean #x formatter (#x to output X that resembles a cross for true)
- Type:Boolean Custom label formatter (Using custom labels to define a boolean output and assign a true, false value display)
Examples[edit]
- Annotations and queries
- API example