Semantic MediaWiki

From SubSurfWiki
< User:Matt
MattSemantic MediaWiki
Jump to navigation Jump to search

Semantic MediaWiki or SMW is a set of extensions for MediaWiki, the open source software that runs this wiki.

Why use SMW?

Semantic MediaWiki has some useful features:

  • We can store semi-structured data in the wiki itself, turning the wiki into a database.
  • We can easily include geocoded and geospatial data in the wiki.
  • We can easily display timeseries as timelines or calendars.
  • We can perform unit conversions on the fly.

Examples

Markup

Here's an example of a page that uses a semantic template: Gas sand tight streak, Class IV (Castagna and Swan 1997).

Queries

A simple query for VP and ρ of sandstones only:

{{#ask: [[Category:Rock property catalog]] [[lithology::sandstone]]
|?V
|?rho
}}


The same query, via the API: Query over API

Unit conversion

Hover over the quantities to see the converted quantities.

Alternatives to SMW

Approaches to structured data.

SMW uses semantic tags to mark data in ordinary wiki pages. There are two other ways to use data with a wiki:

  • Store the data in a separate, data-only wiki, then call on it when you want to use data. This is how WikiData works (note, WikiData is not used directly by Wikipedia — most of what is in Wikipedia is original, unlinked data.
  • Store untagged data in the wiki (e.g. in infoboxes) and scrape it using heuristics. This is how DBpedia works.

There are advantages and disadvantages to each of these approaches:

Approach Advantages Disadvantages
Semantic
  • Data is in context and right where it's needed
  • 'Database' is never out of sync
  • Markup adds some cruft to the wikitext
External
  • Database is well structured
  • Markup adds even more cruft to the wikitext
  • Markup is more obscure than SMW
  • Not yet implemented[1]
Scraped
  • No mark-up for data items
  • Data items limited to infobox or other structures
  • Database is very well structured
  • Easy connection by other services
  • Synchronization becomes an issue
  • Hard to balance precision and recall

Note that the semantic approach does not preclude also using scraping.

Installing SMW

The easiest way to install SMW is with the Semantic Bundle. The set includes the following extensions:

  • Semantic Result Formats - defines many additional formats for SMW queries
  • Semantic Forms - allows wiki administrators to create easy-to-use editing and querying interfaces for their wiki
  • Semantic Compound Queries - allows for displaying multiple queries at the same time
  • Semantic Internal Objects - allows for storing compound, "n-ary" data on pages
  • Semantic Drilldown - defines an easy browsing tool for the data set
  • Semantic Maps - allows for using various map services to display semantic coordinate data and enter coordinates within forms
  • Semantic Watchlist - lets users be notified of specific changes to semantic data
  • Semantic Tasks - allows for sending reminder and notification emails to users for tasks
  • Semantic Forms Inputs - provides additional input types for Semantic Forms
  • Semantic Image Input - allows for automatic adding of images from Wikipedia pages via a Semantic Forms input

It also includes a set of other extensions that are often used with SMW. These include Admin Links, Approved Revs, Arrays, Data Transfer, External Data, Header Tabs, Maps, Page Schemas, Replace Text, Validator, and Widgets.

The installation process is a little more complicated than most other extensions. Be sure to follow the instructions carefully.

References