Special property "Allows value"

From semantic-mediawiki.org
Allows value
Lists one permissible value for a property
Further Information
Provided by: extension "Semantic MediaWiki "Semantic MediaWiki (SMW) is a free, open-source extension to MediaWiki that lets you store and query data within the wiki's pages. Semantic MediaWiki is also a full-fledged framework, in conjunction with many spinoff extensions, that can turn a wiki into a powerful and flexible knowledge management system. All data created within SMW can easily be published via the Semantic Web, allowing other systems to use this data seamlessly.
Added: 1.0
Removed: still in use
Alias: has no alias
Optional: no
Visible: yes
Annotable: yes
Declarative: yes
Setting: not specified
Focus: property restriction
In this wiki: Property:Allows value

The Allows value property is a special property in Semantic MediaWiki with a built-in meaning: it lists one permissible value for a property.

You can use this special property with a property of any datatype to limit its possible values. It is similar in its functionality to special property "Allows pattern".


For example, the page for a Problem severity property might contain:

[[Allows value::Enhancement]]
[[Allows value::Trivial]]
[[Allows value::Minor]]
[[Allows value::Normal]]
[[Allows value::Major]]
[[Allows value::Critical]]

Ordered properties[edit]

Enumerating several allowed values does not put the possible values of a property in that order. Properties will always sort in the natural order provided by the datatype assigned to them. You can ensure that alphabetical sort order is appropriate for properties of e.g. datatype "Text" by using a prefix, for example:

[[Allows value::a - Enhancement]]
[[Allows value::b - Trivial]]
[[Allows value::c - Minor]]

Thus you can query for greater-than-or-equal or less-than-or-equal values, for example [[property name::<c-Minor]]

Bounded intervals, ranges for number and quantity datatypes[edit]

The following notations are only valid for a property of number and nuantity datatypes.

A simple range can be defined using > and < as in [[Allows value::>100]] or in combination [[Allows value::>100]] [[Allows value::<200]].

Defining various intervals should be done using the bounded range ... indicator such as [[Allows value::1...20]] [[Allows value::100...200]]. Note that [[Allows value::1...20]] is equivalent to [[Allows value::>0]] [[Allows value::<21]] but using > and < more than once per property specification is not supported therefore the ... notation should be used to create numeric intervals.

Error Handling[edit]

When [[Foo::bar]] is used to set a property to a value that is not allowed, the property will not be set, and a warning sign will be shown. When using {{#set: Foo=bar }} to set the property, the error will be silently ignored. To find all pages that use a value that is not allowed, the special property "Has improper value for" can be used.

See the property page "Allows value" to see which pages use this special property on this wiki.

See also[edit]