See something you'd like to change or add, but you've never edited an open encyclopædia before? This overview was written to help absolute beginners get started.

Help:Semantic MediaWiki

From A Storehouse of Knowledge
Jump to: navigation, search

Semantic MediaWiki (SMW) is a method for making information in Wikis understandable by computers. It also allows users to find more complex information than with ordinary string searches.

Contents

Uses

The uses of SMW include the following:

  • More intelligent searches. Instead of just searching for strings of text, you can search for, for example, cities with a population over five million people.
  • Automatically-generated lists. Instead of creating Wiki pages of "List of largest natural disasters", and having to keep the page up to date, SMW can automatically generate (and keep up to date) such a list from the articles in the Wiki.
  • Automatic measurement conversion. Instead of typing "one mile (1.6 kilometres)" into an article, you can just put in one measurement, and hovering over the text will show the measurement in other units (try it here: one mile1.609 km
    80 chains
    ).

To achieve most of these, however, special markup needs to be used.

Queries

An SMW query can find information based on categories and namespaces, and also on "properties" assigned to pages. To continue with the example above of asking for a list of all cities with a population over five million people, what you would really be asking for is a list of Wiki pages (articles) which are in the Wiki category of 'Cities' and which have a property named 'population' with a value greater than or equal to 5,000,000.

Properties first have to be created and given a type, such as 'number' or 'string'. You can also create your own types.

The Population property, for example, has a type of 'number'. The 'number' type allows for numeric sorting of populations, so that 5,000,000 is smaller than 15,000,000, whereas if they were sorted alphabetically, '15,000,000' would come before '5,000,000'.

There are some built-in types, and further types can be created.

Query formats

SMW Queries can have a format specified. Two of the main ones are list and table. See Semantic MediaWiki query format for a summary of available formats.

Types

A list of types is found here. If a type on that page has a blue link, following the link will show a list of properties using that type.

Properties

Properties are created by creating a page of the name of the property in the 'property' namespace (e.g. property:population). By default, all properties have the type 'page', unless the property page itself has the property 'has type'. So the population property page has the code [[has type::number]], which makes the 'population' property be of type 'number'.

A list of properties can be found here.

Example

The following is an example of a table produced by a SMW in-line query

Code

This code asks for all pages with the member level property, and asks for the results to include the member level and member status properties. It also limits the table to 30 entries.

{{#ask:[[member level::]]
| ?member level
| ?member status
| limit=30
}}
Result

The resulting table can be sorted by any column.

NB: This list relies on users having the {{member}} template on their user pages with the appropriate paramaters set.

  Member level Member status
Acionyx Non-member New
AddisonDM Member Active
Colonel Sanders Member Active
Dream Non-member Hopefully active
ENorman Non-member Observer
Ed Poor Non-member New
EiraG Non-member (unknown)
EvanW Senior Member Still alive
FernoKlump Member Kinda something or another
Human Member
JY23 Member Active
Jeeves Huge Member, Grand Dragon More powerful than you can possibly imagine.
Judge King User Active
KotomiT Member Not Very Active Gomen!
ListenerX Member
LoganH Non-member Active
LowKey Senior member Inactive, but not gone
Master of Puppets Member Active
Mega Non-member RESIGNED
Nx Member Still here
Philip J. Rayment Senior member Active
Philip Venson Member Active - occasionally.
Pink Member Sort of reddish white
Salt Lake City Non-member
SamHB Member Active
SuperJosh What's this? Apathetic
Taj Member Active
Taytopacket Non-member New
TheoryOfPractice Non-member Tenuous
TimS Senior member Semi-active
… further results
warning.png
  • "" cannot be used as a page name in this wiki.
  • Some use of "<nowiki>[[</nowiki>" in your query was not closed by a matching "]]".

Further reading

Personal tools
Namespaces

Variants
Actions
visitor navigation
contributor navigation
monitoring
Toolbox