Semantic MediaWiki and related extensions
database

This document provides a short introduction into the database schema and table structure used by Semantic MediaWiki.

Database schema

The database schema is defined using the TableSchemaManager class and together with the TableBuilder is forming the interface to define, create, and remove database and schema related information used by Semantic MediaWiki.

The SPO (subject, predicate, and object) pattern paradigm is reflected in how semantic relations are organized in Semantic MediaWiki. Three table types are used to store information with table fields normally being identified by its related intent such as s_ (subject), p_ (predicate, property), and o_ (object).

The three table types are:

A special type are temporary tables only used during a search request (which remains in-memory) and is dropped as soon as a query is resolved.

Data tables

Data tables follow individual schema definitions to serve a specific purpose for either collecting or aggregating data.

Property tables (Common)

User defined properties with an assigned datatype are stored in tables with a predefined structure and relevant fields required by the https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/architecture/datamodel.dataitem.md "`DataItem`" to represent its literal value.

[
    DataItem::TYPE_NUMBER     => 'smw_di_number',
    DataItem::TYPE_BLOB       => 'smw_di_blob',
    DataItem::TYPE_BOOLEAN    => 'smw_di_bool',
    DataItem::TYPE_URI        => 'smw_di_uri',
    DataItem::TYPE_TIME       => 'smw_di_time',
    DataItem::TYPE_GEO        => 'smw_di_coords',
    DataItem::TYPE_CONTAINER  => 'smw_di_container',
    DataItem::TYPE_WIKIPAGE   => 'smw_di_wikipage',
    DataItem::TYPE_CONCEPT    => 'smw_conc'
]

Available fields include:

Property tables (Fixed)

Fixed property table assignments are either defined by TypesRegistry.php (for predefined properties) or by the $smwgFixedProperties setting (for user-defined fixed properties).

Available fields include:

See also


About | General disclaimer | Privacy policy