Semantic MediaWiki 1.2.0

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   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 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:

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.

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</tt>, note</tt> (any other text), email</tt>, workphone</tt>, cellphone</tt>, homephone</tt>, organization</tt>. 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

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

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


 * #show queries. A new parser function #show</tt> is introduced to simplify queries that only ask for a property value of one particular page. For example, one can now write

to display the population of Berlin; result. 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:

(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:

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 annotate and create links like Property::meta:Test pointing to other wikis using datatype Page
 * Extended maintenance scripts
 * delete an existing (now unused) SMW store with SMW_setup --delete</tt>
 * select SMW sotrage engine to use for scripts with option -b &lt;Store></tt>
 * 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

From the RELEASE-NOTES

 * 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.
 * 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
 * Support for semantic interwiki links (e.g. property::meta:Test )
 * Stored queries on Concept: pages (concepts as "dynamic categories"), see http://semantic-mediawiki.org/wiki/Help:Concepts
 * 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)