Help:SemanticMW

From Biowikifarm Metawiki
Jump to: navigation, search

This section gives some guidance on, and provides some examples for the use the Semantic MediaWiki extension. For more detailed descriptions see the SemanticMW website.

Introduction

The Semantic MediaWiki (SemanticMW) extension is useful if you want to summarize and compare information which is located in different wiki pages. The Category:Countries gives an example of how information on different countries can be combined in a table. This has 2 advantages:

  • In the table you can sort the countries, e.g. by their population size or by the height of their highest mountain.
  • If the information in the source page changes (e.g. the figure for the total population in a given country is adjusted) then the table updates itself automatically.

The Semantic MediaWiki extension is well advanced and provides many different ways of formatting and retrieving the data. We can only give a few examples here.

Defining properties and data types

SemanticMW works with "properties". These define the type of information you want to collect and compare. For example, by creating the page Property:Population SemanticMW knows that "population" is a clearly defined information unit for a country (which could have been also named "number of inhabitants" or something else). In this case it is also important to assign the Type:Number to the "population" property. Otherwise data entered for this property would be regarded as plain text and we might get a sorting order like 179, 2499, 280, 4808, and 560.

Entering data

Data are assigned to each property by using the format:
 [[Capital::Vienna| ]]
 [[Area::83.9| ]]
 [[Population::8.3| ]]

Note the 2 colons. In the above format the data assignment in the page "Austria" does not produce any text in the page. However, you can also combine the data assignment with the text displayed.

Calling up the data

For retrieving or querying the data like in the Category:Countries use the format:
 {{#ask: [[Category:Countries| country]] 
 | ?Capital# = capital
 | ?Area# = land area (1000 km²)
 | ?Population# = population (millions)
 | ?Highest mountain# = highest mountain
 | ?Highest mountain height# = height (m above SL)
 }}

Note that:

  • In the 1st line the statement "| country" makes a header for the first column.
  • On the 4th line the statement "| ?Population# = population (millions)" does 3 things:
    1. it retrieves all data assigned to the property "population" in a separate column,
    2. the "# " states that the values in the column are not page links (otherwise the system would display the values in red, as non-existing pages), and
    3. the "= population (millions)" labels the header for this column.
  • There are many different ways of formatting such a table, for example you can display numbers in many different formats, but additional extensions might be needed for some.

Installation

For enabling the SemanticMW on another wiki of the biowikifarm follow the guidelines at