Overview of Semantic MediaWiki and Semantic Forms

This is a work in progress, anyone should feel free to edit this document. Add yourself to the list of authors if you make any significant changes (however small).

Semantic concepts
Semantic concepts

Relations
In addition to the basic property types, String, Number, Date, Boolean, etc., a property can have the type of Page. The value of a property of type Page is interpreted as a page name of another page in the wiki. For example, within the page for 'Stan Bolton', we can add the following wiki code to assign the relevant value for the 'Works in' property:


 * Stan Bolton works in the institute Works in::Dundee University.

In this example, the 'Works in' property is assigned the type of Page, and there is a page in the wiki with the page name 'Dundee University'. The 'Works in' property defines a named relation between the page for Stan Bolton and the page for Dundee University. Later on we will see how relations between pages can be explicitly typed, after we introduce the concept of a class.

Overview of Semantic Forms (SF)
The class concept described above has been implemented in an ad hoc way throughout Wikipedia by the use of templates. Here we will summarise the key features of templates, however, a complete description is beyond the scope of this document. For more information, see: http://www.mediawiki.org/wiki/Help:Templates.

Templates are used to define wiki text that can be reused in any number of regular wiki pages. When called, a template may be passed a set of named values, called parameters, that are substituted into the resulting template text. For example, we may define a template called 'Person' with the following wiki text:


 * This page describes a person who works in the institute 
 * and has the email address.

The template would be called from a page describing a particular person, for example, the page for Stan Bolton would use the following wiki code to call the Person template:



When called, the 'works in' and 'email' parameters are substituted into the template text and the result, when the page is viewed, will be:


 * This page describes a person who works in the institute Dundee University
 * and has the email address sbolton@dundee.ac.uk.

Typically, such a template would also categorize the calling page, in this case into the Person category. In this way, templates standardize the collection and presentation of structured data in MediaWiki.

Semantic templates extend this basic idea by using the template to apply semantic annotation to the passed values. The above template could be converted to a semantic template, yielding:


 * This page describes a person who works in the institute Works in::   
 * and has the email address Has email address::.

The template call does not need to be altered, and the resulting text is unchanged. However, the relevant data values are semantically annotated by the template. The template acts to group properties into defined sets, and will categorise the calling page. Semantic templates, therefore, enforce the class convention described above. Specifically, pages in a particular category have a consistent set of properties assigned to them.

The Semantic Forms extension builds on this idea by providing simple, form-based template editing functionality. Together with a template, a form enables structured data entry by presenting the user with the specific set of fields to use when editing a page in a particular class (Figure 1). The form fields are dynamically created from the associated properties, allowing automatic type checking and user feedback via auto-completion based on the existing property values in the wiki.

A form is associated with a page by being linked to a particular category in the wiki. For example, the Person form is used to edit pages in the Person class (Figure 2). However, a form can also be linked to a particular relation (a property of type Page). The association of a form with a particular relation serves to explicitly type those property values (pages) as being instances of a particular class. For example, the 'Works in' property is linked to the 'Institutes' form and, therefore, the Institutes class.