Extension:LightweightRDFa

The Lightweight RDFa extension outputs simple semantic data in the RDFa form out of Mediawiki links. This extension provides part of the Semantic Mediawiki extension annotation (but does not depend on it). It is - as titled - a very lightweight and easy approach to create an RDFa-Enabled MediaWiki installation.

We follow Wikipedia's idea and allow free text for semantic annotation. For the semantic output we use:
 * The page URI as subject.
 * The annotated link targets as objects.
 * The predicate is created from the free text by removing the whitespace, transforming it in camel case form and putting it under the "$wgServer . $wgScriptPath . '/property/" namespace

Copying the exact SMW functionality through MediaWiki hooks only has some issues: Thus, to get out of beta phase, we are looking for either help for alternative hooks or help for alternative tokens
 * extracting annotations with '::' may break some cases for link pipes
 * The parser removes the leading ':' from a link so linkBegin hook cannot handle them (we use '^^' for now)

Configuration parameters
For valid and well-formed RDFa you should also change the HTML DocType. Mediawiki offers either HTML5 i.e.


 * $wgHtml5 = true;
 * $wgHtml5Version='HTML+RDFa 1.0';

or HTML v. <= 4 i.e.


 * $wgDocType='-//W3C//DTD XHTML+RDFa 1.0//EN';
 * $wgDTD='http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd';

Examples
Using the OutputPageBodyAttributes hook we adjust the body element  In the article body we can write the following links property::Main Page => Main Page ^^property::Main Page => property::Main Page different text => different text different text => different text And we can get the following triple wiki:Links prop:property wiki:Main_Page