Special property "Allows value list"

From semantic-mediawiki.org
Allows value list
Adds a reference to a list of permissible values 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: 2.5.0
Removed: still in use
Alias: has no alias
Optional: no
Visible: yes
Annotable: yes
Declarative: yes
Key:
_PVALI
Setting: not specified
Focus: property restriction
In this wiki: Property:Allows value list
Table of Contents

The Allows value list property is a special property in Semantic MediaWiki with a built-in meaning: it assigns a reference which is used to define a page which allows to map a list of permissible values to the referencing property. It was introduced with Semantic MediaWiki 2.5.0Released on 14 March 2017 and compatible with MW 1.23.0 - 1.29.x..1

The referenced page is located like a system message in the "MediaWiki" namespace and consists of the string "Smw_allows_list_" and the stored reference as a suffix to it, e.g. "MediaWiki:Smw_allows_list_..." with "..." being replaced by the reference added to this special property.2

Starting with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. it is possible to add values lists in JSON format to improve handling of lengthy and challenging to edit via wikitext lists.3 The value list is using a simple key, value assignment with the key (e.g. "CC BY 2.5") being used as constraint value with the assigned value argument is there only to described the key and has for the validation no specific relevance.4

Usage[edit]

Two steps have to be taken to use this special property when choosing the wikiktext or json approach:

Wikitext[edit]

  1. Add [[Allows value list::...]] to a property page for defining a page reference, e.g. [[Allows value list::licenses]] will define page "MediaWiki:Smw_allows_list_licenses".
  2. Add permissible values as listed items starting either with "*" or "**" to the "MediaWiki:Smw_allows_list_..." page, e.g.
* CC BY 2.5
* CC BY-SA 2.5
* CC BY-ND 2.5
* CC BY-NC 2.5
* CC BY-NC-SA 2.5
* CC BY-ND-SA 2.5

JSON[edit]

  1. Add [[Allows value list::...]] to a property page for defining a page reference, e.g. [[Allows value list::licenses.json]] will define page "MediaWiki:Smw_allows_list_licenses.json".
  2. Add permissible values as listed items in JSON-format to the "MediaWiki:Smw_allows_list_..." page, e.g.
{
    "CC BY 2.5": "Creative Commons Attribution 2.5",
    "CC BY-SA 2.5": "Creative Commons Attribution-ShareAlike 2.5",
    "CC BY-ND 2.5": "Creative Commons Attribution-NoDerivs 2.5",
    "CC BY-NC 2.5": "Creative Commons Attribution-NonCommercial 2.5",
    "CC BY-NC-SA 2.5": "Creative Commons Attribution-NonCommercial-ShareAlike 2.5",
    "CC BY-ND-SA 2.5": "Creative Commons Attribution-NonCommercial-NoDerivs 2.5"
}

Note[edit]

  • It is possible to assign special property "Allows value"Lists one permissible value for a property as well as this special property to a property page at the same time.

See also[edit]



References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:2295
  2. ^  Semantic MediaWiki: Sandbox example sb:smw:2295
  3. ^  Semantic MediaWiki: GitHub pull request gh:smw:3289
  4. ^  Semantic MediaWiki: Sandbox example sb:smw:3289