Fixed properties

From semantic-mediawiki.org
N/A
Provides information about the use of fixed properties
Table of Contents

This page provides information about fixed properties which were introduced with Semantic MediaWiki 1.8.0Released on 2 December 2012 and compatible with MW 1.17.0 - 1.22.x
(except 1.22.1).
. To use this feature you must be using the "SQLStore3" database backend.

This feature was broken in Semantic MediaWiki 1, most likely for versions 2.0 to 2.4 and fixed with Semantic MediaWiki 2.5.0Released on 14 March 2017 and compatible with MW 1.23.0 - 1.29.x..

Introduction[edit]

The SQL store (SQLStore3) provides a feature called fixed properties. Fixed properties are properties which are used heavily within a wiki with a minimum of 1,000 or better even more data value assignements using a dedicated database table. A property with a usage level of 25,000+ value assignments should be considered for being changed to fixed properties. The general idea is that fixed properties allow to save disk space and memory usage.

For example a wiki about people will have a property called "Has age" used extensively within the wiki. To optimize operations on this property there is support to have property-value tuples of these properties stored in a separate dedicated database table rather than in the generic table used for their datatypes. This potentially speeds up some comparisons at query time through smaller indexes which means that there are less things to compare when searching a data value.

See also the help page on property usage count.

Configuration[edit]

The configuration of fixed properties is done in the "LocalSettings.php" file of your wiki below the inclusion of Semantic MediaWiki.2 The following steps show an example on how to define a fixed property called "Has age" which is of datatype "Number"Holds integer and decimal numbers, with an optional exponent. If the datatype for a property already set up as a fixed property is changed only the steps 3 and 4 have to be taken otherwise the data will become inaccessible to Semantic MediaWiki and thus errors will occur.

Step 1 - Create a property page[edit]

Create the page in namespace "Property" and name it e.g. "Has age" (page "Property:Has age") and assign datatype datatype "Number"Holds integer and decimal numbers, with an optional exponent to it with [[Has type::Number]].

Step 2 - Configure the fixed property[edit]

Add configuration parameter $smwgFixedPropertiesSets user defined properties to have a dedicated database table for them to your "LocalSettings.php" file like e.g.

$smwgFixedProperties = [
	'Has_age'
];

Step 3 - Create the dedicated database table[edit]

Create the required database table by running the maintenance script "setupStore.php"Allows to set up the data backend/store via the command line or by triggering the special task "Database installation and upgrade" on special page "SemanticMediaWiki"Provides functions for wiki administrators that assist in doing their administration work to initialize and create the dedicated database table for the property.

Now you can use this fixed property on you wiki as you use every other user defined property.

Step 4 - Rebuild the semantic data[edit]

This step only needs to be taken if an already used property is converted into a fixed property or if the datatype for a property already set up as a fixed property is changed. In the latter case it is advisable to use the edit protection feature introduced with Semantic MediaWiki 2.5.0 to prevent the datatype of a fixed property from being changed without and system administrator at hand to trigger or preferably do the required rebuilding of the semantic data as described in this step.

The three steps described above can also be taken to convert an already used property into a fixed property. However as a fourth step the semantic data has to rebuild to populate the new dedicated database table. Rebuild the required database table by running maintenance script "rebuildData.php"Allows to rebuild all the semantic data for a selected data backend/store via the command line or by triggering the special task "Data repair and update" by clicking the button labeled "Start updating data" in the "Data repair and update" section on special page "SemanticMediaWiki"Provides functions for wiki administrators that assist in doing their administration work to populate the dedicated database table for the property with the existing value assignments.

See also[edit]


References

  1. ^  <semantic-mediawiki.org>: GitHub issue gh:smwo:14
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:2135