Fixed properties

From semantic-mediawiki.org
Jump to: navigation, search
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.0. To use this feature you must be using the "SQLStore3" database backend.

Important noteImportant Note: This feature was broken in Semantic MediaWiki 1, most likely for versions 2.0 to 2.4 and fixed with Semantic MediaWiki 2.5.0.

Introduction

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

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". 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

Create the page in namespace "Property" and name it e.g. "Has age" (page "Property:Has age") and assign datatype "Number" to it with [[Has type::Number]].

Step 2 - Configure the fixed property

Add the configuration parameter $smwgFixedProperties to your "LocalSettings.php" file like e.g.

$smwgFixedProperties = array(
	'Has_age'
);

Step 3 - Create the dedicated database table

Create the required database table by running the maintenance script "setupStore.php" via the command line or by triggering the special task "Database installation and upgrade" on special page "Semantic MediaWiki" 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

NoteNote:
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 the maintenance script "rebuildData.php" 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 "Semantic MediaWiki" to populate the dedicated database table for the property with the existing value assignments.

See also