Extension:LightweightRDFa
lightweight RDFa Release status: beta |
|||
---|---|---|---|
Implementation | MyWiki | ||
Description | A standalone lightweight RDFa module. It generates RDFa out of annotated links | ||
Author(s) | Dimitris Kontokostas, maintained by AKSW. (Kontokostastalk) | ||
Latest version | 0.1 (2012-11-22) | ||
MediaWiki | 1.19+ | ||
Database changes | no | ||
License | GPLv2 | ||
Download |
README |
||
|
|||
Translate the LightweightRDFa extension if possible |
|||
Check usage and version matrix; code metrics |
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:
- 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)
Thus, to get out of beta phase, we are looking for either help for alternative hooks or help for alternative tokens
Download[edit | edit source]
You can download the extension directly from the MediaWiki source code repository (browse code). You can get:
- One of the extensions tags
Not all extensions have tags. Some extensions have tags for each release, in which case those tags have the same stability as the release. To download a tag
- Go to the tags list
- Click the name of the tag you want to download
- Click "snapshot"
- The latest version of one of the extensions branches
Each extension has a master branch containing the latest code (might be unstable). Extensions can have further branches as well.
- Go to the branches list
- Click the branch name
- Click "snapshot"
- A snapshot made during the release of a MediaWiki version.
This might be unstable and is not guaranteed to work with the associated MediaWiki version.
After you've got the code, save it into the extensions/LightweightRDFa directory of your wiki.
If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:
cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/LightweightRDFa.git
Installation[edit | edit source]
- Download and extract the files in a directory called
LightweightRDFa
in yourextensions/
folder. If you're a developer and this extension is in a Git repository, then instead you should clone the repository. - Add the following code at the bottom of your LocalSettings.php:
require_once( "$IP/extensions/LightweightRDFa/LightweightRDFa.php" );
- Done! Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.
Configuration[edit | edit source]
For valid and well-formed RDFa you should also change the HTML DocType,
either HTML5 i.e.
$wgHtml5 = true; $wgHtml5Version='HTML+RDFa 1.0';
or HTML v. <= 4 (default) i.e.
$wgDocType='-//W3C//DTD XHTML+RDFa 1.0//EN'; $wgDTD='http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd';
Examples[edit | edit source]
Using the OutputPageBodyAttributes hook we adjust the body element
<body about="http://localhost/mediawiki/index.php/Links" xmlns:prop="http://localhost/mediawiki/property/">
In the article body we can write the following links
[[property::Main Page]] => <a rel="prop:property" title="Property" href="/mediawiki/index.php/Main_Page">Main Page</a> [[^^property::Main Page]] => <a href="/mediawiki/index.php/property::Main Page">property::Main Page</a> [[property::Main Page|different text]] => <a rel="prop:property" title="Property" href="/mediawiki/index.php/Main_Page">different text</a> [[^^property::Main Page|different text]] => <a href="/mediawiki/index.php/property::Main Page">different text</a>
And we can get the following triple
wiki:Links prop:property wiki:Main_Page
See also[edit | edit source]
- Semantic Mediawiki Extension
- RDFa extension (depends on Semantic Mediawiki)