Help:Datatype "Boolean"

From semantic-mediawiki.org
Help:Datatype "Boolean"Type:Boolean #LOCL formatter
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

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.

Note that not all result formats may provide support for these formatters.
{{#ask:
 [[Category:Project]]
 |?Has boolean#<FORMATTER>
}}

Examples[edit]

Annotations and queries
API example