Archive:Fixed properties 1.9.0-2.4.x

From semantic-mediawiki.org
SMW admin manual
Installation
Configuration
Concept caching
Fixed properties
Using SPARQL and RDF stores
SPARQLStore
Pretty URIs
Troubleshooting
Repairing data and data structures
Extensions
Basic extensions
Semantic extensions
SMW user manual
Table of Contents
Important noteImportant Note: This feature is currently broken in recent versions of Semantic MediaWiki 1 and will proably be fixed with the Semantic MediaWiki 3.0.0 release. Thus you are advised to not use it in production.

This page provides information about fixed properties which were introduced with Semantic MediaWiki 1.8.0.

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.

Usage[edit]

To use this feature you must be using SQLStore3. The fixed property is set as an a array consisting of a key => value pair, where the key is the property name used in the wiki (a space " " must be replaced with an underscore "_" and the first letter must be capitalized) and the value as the constant used to denote properties of the respective type in class "SMWDataItem". This value is one of the following:

 SMWDataItem::TYPE_BLOB // properties of type text and code
 SMWDataItem::TYPE_URI // properties of type email, telephone number, URL and annotation URI
 SMWDataItem::TYPE_WIKIPAGE // properties of type page
 SMWDataItem::TYPE_NUMBER // properties of type number and quantity
 SMWDataItem::TYPE_TIME // properties of type date
 SMWDataItem::TYPE_BOOLEAN // properties of type boolean
 SMWDataItem::TYPE_CONTAINER // properties of type record
 SMWDataItem::TYPE_GEO // properties of type geographic coordinates

Example[edit]

As of Semantic MediaWiki 1.9.0 fixed properties must be set within the "LocalSettings.php" file of your wiki below the inclusion of Semantic MediaWiki. The following setting is an example for a fixed property called "Has age" which is of datatype "Number".

$smwgFixedProperties = array(
	'Has_age' => SMWDataItem::TYPE_NUMBER
	);

A setup run using special page "SMWAdmin" or via command line with maintenance script "setupStore.php" is needed to create these tables. If an already used property is assigned a new table all old data for this property will become inaccessible for Semantic MediaWiki. This can be repaired by either migrating it to the new table or will eventually be updated on page edits.

Important noteImportant Note: Property names must use underscores and not spaces or you will see MWException errors on some page actions

Developer section[edit]

This section is proposed to be moved to a separate page within Category:Developer documentation

The name of the database table is formed using md5

$tableName = 'smw_fpt_' . md5( $propertyKey );

See also[edit]


This documentation page applies to all SMW versions from 1.9.0 to 2.4.x.
Other versions: 1.8.0 – 1.8.x      

Fixed properties en 1.9.0 2.4.x


References

  1. ^  <semantic-mediawiki.org>: GitHub issue gh:smwo:14