Introduction of SMW
- Introduction to Semantic MediaWiki on MediaWiki site
- Wikis have become a great tool for collecting and sharing knowledge in communities. This knowledge is mostly contained within texts and multimedia files, and is thus easily accessible for human readers. But though wikis are very good for storing and retrieving individual facts, they are less useful for getting queried or aggregated information.
- Semantic MediaWiki enables wikis to make their knowledge computer-processable, e.g. to answer the question «What are the hundred world-largest cities with a female mayor?»
SMW Editing Features
- SMW introduces special markup elements which allow editors to provide «hints» to computer programs on how to interpret some piece of information given in the wiki. Such hints are called semantic annotations and they are created with a special markup of SMW.
- Annotations in Semantic MediaWiki can be viewed as an extension of the existing system of categories in MediaWiki
- Categories are a means to classify articles according to certain criteria. For example, by adding [[Category:Cities]] to an article, the page is tagged as describing a city. MediaWiki can use this information to generate a list of all cities in a wiki, and thus help users to browse the information.
- Semantic MediaWiki provides a further means of structuring the wiki. SMW allows you to annotate any link or text on the page to describe the meaning of the hyperlink or text. This turns links and text into explicit properties of an article.
- This addition enables users to go beyond mere categorization of articles. Usage and possible problems with using these features are similar to the existing category system. Since categories and properties merely emphasize a particular part of an article's content, they are often called (semantic) annotations. Information that was provided in an article anyway, e.g. that Berlin is the capital of Germany, is now provided in a formal way accessible to software tools.
Properties and types
- Properties and types are the basic way of entering semantic data in Semantic MediaWiki. Properties can be viewed as «categories for values in wiki pages». They are used by a simple mark-up, similar to the syntax of links in MediaWiki:
- This statement defines a
value for the property of the given
property name. The page where this is used will just show the text for
value and not the property assignment.
Data types for properties
- Semantic MediaWiki has several built-in data types that we can choose for properties. For our previous population example, the appropriate type is called Type:Number; the prefix "Type:" is again a separate namespace that distinguishes descriptive articles about types from normal pages. We want to give property "population" a special property that specifies it has "type:number". To support this Semantic MediaWiki has a built-in special property called
Property:Has type. We use the same syntax for this special property as for any other property, so in the Property:Population article, we write:
List of Data Types
- Type:Page: links to pages (the default)
- Type:String: text strings that are not longer than 250 letters
- Type:Number: integer and decimal numbers with optional exponent
- Type:Boolean: restricts the value of a property to true/false (also 1/0 and yes/no)
- Type:Date: specifies particular points in time
- Type:Text: like Type:String but can have unlimited length; the trade-off is values of this type cannot be selection or sort criteria in queries.
- Type:Code: like Type:Text but with additional precautions to preserve special formatting as used for technical texts. The value displays as regular text everywhere else (query results, factbox, "Pages using the property", etc.).
- Type:Temperature: variation of Type:Number that supports units of temperature (cannot be user-defined since converting temperature units is more complicated than multiplying by a conversion factor).
- Type:Telephone number: validates and stores international telephone numbers based on the RFC 3966 standard
- Type:Record: type for compound property values that consists of a short list of values with fixed type and order
For specifying URLs and emails, there are some special variations of the string data type:
- Type:URL: displays an external link to its URL object
- Type:Email: displays an e-mail address as a link (with
- Type:Annotation URI: similar to Type:URL but with some technical differences in SMW's RDF export
Some extension provide further types:
- Type:Geographic coordinate (provided by Semantic Maps): describes geographic locations. Different forms of geographic coordinates are supported.
- A template is one of the double-brace structures than can be in a page.
Population}} is rendered as Template:Population
- A template can have parameters
Semantic templates are a method of including the semantic markup through MediaWiki templates. This has several advantages:
- users specify annotations without learning any new syntax
- annotations are used consistently, i.e. users do not have to look for the right properties or categories when editing a page
For example, in the template page [[Template:Population]], we can annotate template fields through the following steps.
- First, we define a property hasPopulation by creating a page in Property namespace [[Property:hasPopulation]]
- Second, we annotate template fields using the property hasPopulation by the following markup
- Third, in a wiki page e.g. a page describing a city, we can use the template the same way as we use the regular MediaWiki template above.
. Then, the value 123456 of population in the wiki page will be annotated by the semantic property hasPopulation.
For these reasons, semantic templates are a very popular way of handling semantic annotations; in many wikis, semantic data is contained only in templates.
A popular extension, Semantic Forms, lets users add and edit the contents of templates using forms.
Examples and References
Interesting queries built from user submitted information
Placeography - Duluth, Minnesota
Use forms to enter data so semantic infrastructure remains hidden from the user
Placeography - 470 Hopkins Street, Saint Paul, Minnesota
Uses Exhibit to display and synamically filter results from query
All MediaWiki Extensions
Conference information is posted in tables, timelines and calendars
Using a compound query to get two different map markers
The overview page shows numerous queries -
Enter simple information about newspaper article using a form and a simple query places them on a calendar