Semantic MediaWiki/Overview

From SEQwiki
Jump to: navigation, search

This is an attempt to create an intelligible overview of one way that SMW can be used to model data.

SMW Overview

Here I assume that you understand some very basic relational database terminology, such as 'Table', 'Column', 'Row' and 'Data Value' (or just 'Value'). These are very simple concepts, but their precise definitions can get a bit hairy... If your stuck, think of a table as one Excel worksheet with a few labelled columns. Each row in the worksheet has appropriate values for the various columns. For example:

Licence Age Color
L19 JJR 1 red
K21 PQS 2 green
C82 ADB 10 blue


Semantic MediaWiki (SMW) is a system for creating structured data within a wiki. In general terms you can think of the following correspondence between data in SMW and data in a relational database:

  • A Page in the wiki can thought of as a Row in a database Table.
  • A Property used in a Page can be thought of as a Column of the Table.
  • The Value of the Property can be thought of as the value for the data in that Row and Column.

For example, to model the above data, we would create three pages, one called [[L19 JJR]], one called [[K21 PQS]], and one called [[C82 ADB]]. The Properties and Values would then be assigned within the pages using something like:

Page:[[L19 JJR]]
This page is about a car that is [[age::1]] years old and is [[color::red]].

Page:[[K21 PQS]]
This page is about a car that is [[age::2]] years old and is [[color::green]].

Page:[[C82 ADB]]
This page is about a car that is [[age::10]] years old and is [[color::blue]].


From this we can see that SMW uses a very abstract data modelling language where 'relationships' between typed data values are represented as triples. There are three parts to a triple (surprise?), and in SMW the first part is always a particular page in the wiki. So we can read the above set of triples as "L19 JJR has age 1", "L19 JJR has color red", "K21 PQS has age 2", ... and so on.


The above database analogy is enforced when SMW is used in combination with Semantic Forms (SF). SF imposes the use of MediaWiki (MW) Templates. Templates Templates Templates. Templates.

When a Template is used in a Page, it defines a particular set of Properties and additionally puts the Page in a MW Category. By giving each page a specific set of Properties, the template enforces the 'Row' analogy and the Category conveniently takes the role of 'Table' to the Pages Rows. Different templates define the different tables in the 'database'. Easy eh?

Personal tools
Namespaces

Variants
Actions
wiki navigation
Software
Toolbox