Semantic MediaWiki 1.2

Jump to: navigation, search
Semantic MediaWiki 1.2
Release date: 10 Jul 2008
Previous version: SMW 1.1.2
Next version: SMW 1.2.1
Compatible with: MW 1.11.x - 1.14.x
Current version
SMW 2.4.1

Version 1.2 of Semantic MediaWiki introduced a number of new features to SMW. This page explains the major enhancements and modifications compared to SMW 1.1.

Upgrading existing installations

SMW has changed its way of storing data, and every existing site must refresh its internal store when migrating a wiki. If you merely follow the basic installation instructions, the wiki will not yet have its existing semantic data available yet. SMW 1.2 also no longer is compatible to beta versions of SMW by default, and so the Relation namespace vanishs and <ask> queries are not fully functional any more. Support for those obsolete features can be switched on with a configuration option. Some further minor configuration options have changed in the new version.

Details are explained in Help:Installation 1.2.

New features

New SMW storage backend

SMW 1.2 introduces a new internal organisation for its data. This requires the above upgrades, but it also has many advantages:

  • SMW is faster. Inline queries are much more efficient and create less load on the database server. Other basic operations that SMW needs to access are also faster and pages with many properties display somewhat faster. In compensation, writing to the new store gets somewhat slower, but saving an article of course is much less performance critical than reading it.
  • Full equality support. SMW treats pages as semantically equal if they are linked by MediaWiki redirects. So far, this could not be fully realised in all queries without considerable performance impact. the new store will use redirects in all places by default without any slowdown in reading speed. Equality support can still be fully switched off to improve writing performance.
  • Disjunctions in queries. SMW 1.2 allow you to use the keyword OR in inline queries to take the union of two queries in one result set. For example, the next query shows up to 100 countries and cities of Europe, ordered by their population:
 {{#ask: [[Category:Country]] [[located in ::Europe]] OR 
         [[Category:City]] [[located in ::Europe]] 
   | sort=population | order= descending

vCard export for query results

SMW 1.2 lets you download the result of inline queries in the vcard format that enables many address book tools to import contacts from the wiki. This is achieved by the query format "vcard". Printout statements are used to add data to the vCard, e.g.

 {{#ask: [[Category:Person]]
   | ?firstname
   | ?lastname
   | ?url = homepage   
   | format=vcard

creates a link to a list of vCards that contain first and last name, as well as the homepage for each page in the Category:Person. Like in the case of RSS and iCalendar format, it is important which label a property printout has (e.g. "homepage" above is recognised by vCard, while "url" would not). The available fields are: name (displayed full name), prefix (something like "Dr."), suffix (something like "Jun."), firstname, extraname (middle name), lastname, birthday (a date), homepage, note (any other text), email, workphone, cellphone, homephone, organization. Most fields including the phone numbers have no special format and will take whatever you give them.

Lists of vCards work very well on most address book tools with the notable exception of MS Outlook. Outlook users can only import the first contact in each vCard file, and must therefore import contacts individually from many links, or consider moving to another tool for personal information management, such as Thunderbird. Outlook also is reported to fail at character decoding in some cases, e.g. if names use non-latin letters.

Improved semantic query syntax and processing

The inline query input now accepts a couple of simplifications that make queries more easy to read and write:

  • Property chains. You can now express chains of properties by using a list of property names separated by ".". For example, the following query
{{#ask: [[located in.population::>100,000]]}}

for things located in a place with more than 100,000 inhabitants would formerly be written with a nested query as follows:

{{#ask: [[located in:: <q>[[population::>100,000]]</q>]] }}

The old syntax is still supported, but the new one is clearly simpler.

  • #show queries. A new parser function #show is introduced to simplify queries that only ask for a property value of one particular page. For example, one can now write
{{#show: Berlin | ?population}}

to display the population of Berlin; result 3,520,061. The function otherwise works like an inline query, and all parameters available for inline queries can also be used on #show if desired. The above function can also be written as an #ask query as follows:

{{#ask: [[Berlin]] | ?population = }}
(the '=' sign disables displaying a header for "population"); result:
  • Controlling queries. Wiki administrators can now enable or disable all major query features separately using the option $smwgQFeatures. See SMW_Settings.php for documentation.

Support for custom sortkeys

There are many occassions when pages are ordered alphabetically. In SMW 1.2 it is possible to define a label that should be used instead of a page's name for this purpose. This is already well-known for MediaWiki, where especially categories have their own sortkeys (for example, the category of all popes should not have all its elements in "P" even though all articles start with "Pope"). To set a page's sortkey in SMW 1.2, the following syntax is used anywhere on a page:

{{DEFAULTSORTKEY: custom key}}

This syntax also is used in MediaWiki to define the default sortkey for categories of that page.

Stored queries on Concept: pages

SMW 1.2 can store queries on pages of the wiki. A new namespace "Concept:" is provided for that purpose. Every concept can be regarded as a "dynamic category", i.e. a collection of pages that is not defined manually but derived from the contents of the wiki using some query. See Help:Concepts for details.

Automated updates

When a (semantic) template or a property definition in SMW are changed, this change might affect other pages as well. SMW 1.2 now automatically triggers these required updates and thus ensures that the wiki will again be up-to-date after some time, even if the affected pages are not edited again. The updates are not done immediately but queued internally and executed in small pieces, this ensures that the initial change does not take too long or create too much server load in one step.

Other features

  • Support for semantic interwiki links: you can now create links like [[property::meta:Test]] pointing to other wikis
  • Extended maintenance scripts
    • delete an existing (now unused) SMW store with SMW_setup --delete
    • select SMW sotrage engine to use for scripts with option -b <Store>
    • SMW_dumpRDF now supports restriction to concepts or concepts+categories
  • SMW <1.0 features disabled by default (remove obsolete features), can be reenabled with $smwgSMWBetaCompatible.
  • Compatible with Semantic Forms 1.2.3 and MediaWiki 1.13 (current devel version)
  • Extended translations


  • New SMW storage backend (SMWSQLStore2)
    • faster for queries and page display/rendering
    • full equality support built-in, no performance impact
    • support for disjunctions in queries (keyword "OR")
  • vCard export for query results
  • Improved semantic query syntax and processing
    • shortcut query syntax #show for displaying properties of single pages, e.g. {{#show: Berlin | ?population}}
    • property chains like [[property1.property2::value]]
    • more detailed control of which query features to support (see setting $smwgQFeatures in SMW_Settings.php)
  • Support for custom sortkey to control alphabetic sorting of all pages, using MediaWiki's {{DEFAULTSORTKEY: custom key}}
  • Support for semantic interwiki links (e.g. [[property::meta:Test]])
  • Stored queries on Concept: pages (concepts as "dynamic categories"), see
  • Automated updates: changes in templates and property definitions are automatically applied to affected pages (after some time)
  • Extended maintenance scripts
    • delete an existing (now unused) SMW store with SMW_setup --delete
    • select SMW storage engine to use for scripts with option -b <Store>
    • SMW_dumpRDF now supports restriction to concepts or concepts+categories
  • SMW < 1.0 features disabled by default (remove obsolete features), can be re-enabled with $smwgSMWBetaCompatible.
  • Compatible with Semantic Forms 1.2.3 and MediaWiki 1.13 (current devel version)

This page in other languages: de

Semantic MediaWiki 1.2 en