Archive:Database tables

From semantic-mediawiki.org
Table of Contents

This documentation is work in progress; some sections are not finished yet. Database schema

This page documents tables used in SMW(1.8alpha) SQLStore3

Introduction[edit]

SMW does a very complex task of retrieving query results from a SQL store so it has a big set of tables.

Table Types[edit]

The tables are for various different tasks as listed below

Property Tables[edit]

These are tables to store Property-Values in SMW.

Special Properties Tables[edit]

SMW has a specific table for each special property it uses internally to speed up frequent lookups An array of the tables for each special property is declared in SMW_SQLStore3.php as follows.

	public static $special_tables = array(
		'_TYPE' => 'smw_type',
		'_URI'  => 'smw_uri',
		'_INST' => 'smw_inst',
		'_UNIT' => 'smw_unit',
		'_IMPO' => 'smw_impo',
		'_CONV' => 'smw_conv',
		'_SERV' => 'smw_serv',
		'_PVAL' => 'smw_pval',
		'_REDI' => 'smw_redi',
		'_SUBP' => 'smw_subp',
		'_SUBC' => 'smw_subs',
		'_CONC' => 'smw_conc',
		'_SF_DF' => 'smw_sfdf', // Semantic Form's default form property
		'_SF_AF' => 'smw_sfaf',  // Semantic Form's alternate form property
		'_MDAT'  => 'smw_mdat',
		'_CDAT'  => 'smw_cdat',
		//'_ERRP', '_SKEY' // no special table
		'_LIST' => 'smw_list',
	);

Normal Property Tables[edit]

User defined properties are stored in Tables assigned for each datatype. An array of the tables for each special property is declared in SMW_SQLStore3.php as follows These are declared as follows in SMW_SQLStore3.php

	public static $di_type_tables = array(
		SMWDataItem::TYPE_NUMBER     => 'smw_di_number',
		SMWDataItem::TYPE_STRING     => 'smw_di_blob',
		SMWDataItem::TYPE_BLOB       => 'smw_di_blob',
		SMWDataItem::TYPE_BOOLEAN    => 'smw_di_bool',
		SMWDataItem::TYPE_URI        => 'smw_di_uri',
		SMWDataItem::TYPE_TIME       => 'smw_di_time',
		SMWDataItem::TYPE_GEO        => 'smw_di_coords',
		SMWDataItem::TYPE_CONTAINER  => 'smw_di_container',
		SMWDataItem::TYPE_WIKIPAGE   => 'smw_di_wikipage',
		SMWDataItem::TYPE_CONCEPT    => 'smw_conc',
		SMWDataItem::TYPE_PROPERTY   => 'smw_di_property'
	);

Fixed Property Tables[edit]

Fixed Properties are properties that are user defined but intensively used in the wiki. Hence these have their own tables created by the SMWAdmin interface. Names of these tables are made using a hash appended on the property name.

General Tables[edit]

Besides tables for Properties SMW also has a few other tables for some specific information

  • Table for ids of each page in the wiki named `smw_ids`
  • Table for concepts cache status `smw_conccache`
  • Table for usage statistics of each property `smw_stats`

See also[edit]