Help:Changing the datatype of properties

From semantic-mediawiki.org
Semantic extension(s): Semantic MediaWiki
Further extension(s):  -/-
Keyword(s): datatype · properties

Description:

One of the strengths of Semantic MediaWiki (SMW) is its flexible handling of Properties. You can change the type of a property after it has been defined and even after it has been used for some time.

An example of how this comes in handy is having pages with a "Has country" property of datatype "Text"Holds text of arbitrary length. If you then decide you want to have one page for each country value, you can simply change the property declaration from [[Has type::Text]] to [[Has type::Page]]. This will cause SMW to link the values on the first set of pages to the newly created country pages.

SMW allow restricting which users can change property declarations via the data curator user type.

Technical background[edit]

As of Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. and later, when changing a property type, SMW will schedule a "smw.changePropagationDispatch" job and block the property until the changes to a property have been populated (see waiting change propagation. After a successful propagation, the property is released and the dispatcher will create individual "smw.changePropagationUpdate" (or "smw.changePropagationClassUpdate") jobs to ensure that any related subject to the changed property will be re-parsed and updated.

The property page will inform about the estimated progress meaning the remaining jobs (it depends on the feedback and accuracy of the MediaWiki job queue) that need to be executed before all subjects have seen an update, until then discrepancies can appear for those subjects (wiki pages) that hold a reference to the "old" property definition and were not re-parsed.