Extension:RDFa

=What does this extension do?= This extension provides the functionality of outputing semantic data of Mediawiki pages in the RDFa format. The RDFa formatted data generated from a page will have the page itself as the subject. The properties and objects are retrived from the semantic data of this page.

Besides the user defined properties, this extension is also able to regconize the following special properties:
 * Category
 * Has Type
 * Modification date
 * "Sub-Category" relation
 * Subproperty of

The corresponding properties in the RDFa format are as follows:


 * typeof
 * Property:Has_type
 * Property:Modification date
 * http://www.w3.org/2000/01/rdf-schema#subClassOf
 * http://www.w3.org/2000/01/rdf-schema#subPropertyOf

This extension does not generate any visible content for usual reading. You should use an RDFa-aware browser or tool to use the RDFa metadata.

The extension also provides the functionality that allows user to map the property of MediaWiki to other property. For example, instead of output property "has end date" from MediaWiki, user can ask the extension output property "vcal:dtend", where "vcal" is a prefix for "http://www.w3.org/2002/12/cal/icaltzd#".

=Download and installation=

You can download the code at:


 * RDFa Extension (Version 1)
 * RDFa Extension (Version 2)

After you downloaded the code, place the code to the 'RDFa' directory within your MediaWiki 'extensions' directory. Then, add the following code to your LocalSetting.php after the line that installs Semantic MediaWiki.

require_once ("$IP/extensions/RDFa/rdfa.php");

You can browse the code at:


 * Browse RDFa Extension(Version 1)
 * Browse RDFa Extension(Version 2)

=Dependencies=

This extension requires Semantic MediaWiki.

= Functionalities and Usage=

Basic Usage
capital of::Germany locate in::Europe has LatLong::52.5166667,13.4

Suppose there is a wiki page contains above structured data in wiki format. Further, lets assume the host address of the wiki is http://localhost/mediawiki. Then this extension will generate triples in the RDFa format as follows：

    

Notice that the extension use different html markup,  and &lt;div&gt;, to present the data. This is because the extension is able to regconize the type of the values of properties: the extension uses  to markup data if the value of property is another wiki page. Otherwise, the extension uses &lt;div&gt; markup. Also, the "typeof" property in the RDFa data is generated by the "Category" markup of wiki page.

These RDFa formatted data can be displayed as RDF triples:   .

  .

 <http://localhost/mediawiki/index.php/Property:Has_LatLong> "52.5166667,13.4".

<http://localhost/mediawiki/index.php/Berlin> <http://localhost/mediawiki/index.php/Property:Locate_in> <http://localhost/mediawiki/index.php/Europe>.

<http://localhost/mediawiki/index.php/Berlin> <http://localhost/mediawiki/index.php/Property:Modification_date> "3 September 2009 02:19:03".

Mapping Properties
In some cases, the user may want to translate the property of MediaWiki to another property for certain purpose(so SearchMonkey of Yahoo! can display the enhanced search result). Parser function "rdfa_map" provides the functionality that maps one property of MediaWiki to other property.

We provides two ways for user to map between properties: 1. user can provide the title of a page which contains the mapping of properties(check Mapping Page Format for detail) at LocalSettings.php, 2. use parser function "rdfa_map"; Note: if bother ways are presented, extension will use the second one(parser function) to translate.

Provide page title
All you need to do is set variable $rdfa_map_page = "...page title..." in LocalSettings.php, and create the mapping at that page(check Mapping Page Format for detail). Exmaple: $rdfa_map_page="property_map";

Parser usage
The parser provided by the extension is associated with magic word "rdfa_map", and takes only one argument: title of the article which contains the mapping of two properties. For instance, in above example, the page contains the mapping of properties has title "property_map".

Mapping Page Format
Example: property_map @prefix xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" @prefix xmlns:vcal="http://www.w3.org/2002/12/cal/icaltzd#" @prefix xmlns:dc="http://purl.org/dc/terms/" @prefix xmlns:vcard="http://www.w3.org/2006/vcard/ns#" @prefix xmlns:review="http://purl.org/stuff/rev#" @prefix xmlns:xsd="http://www.w3.org/2001/XMLSchema#" @prefix xmlns:commerce="http://search.yahoo.com/searchmonkey/commerce/" End_date      = vcal:dtend Location      = vcal:location Start_date    = vcal:dtstart Name          = dc:title Has_start_date = vcal:dtstart Has_end_date  = vcal:dtend Has_location  = vcal:location Has_label     = vcard:fn rdfs:label Comment       = rdfs:comment Latitude      = vcard:latitude Longitude     = vcard:longitude Longitude     = vcard:longitude

The parser function recognizes the namespace declaration if "@prefix" provided. The format for namespace declaration is illustrated as above. Please note that there is a space between "@prefix" and the namespace, and a " " after each declaration.

To map a property to a different property defined externally, we use "=" declare the mapping. In above example, property "End_date" in MediaWiki will be map to "vcal:dtend". Note: "vcal" is a namespace declared in the namespace declaration. Again, a " " is needed after each mapping.

=Bugs, new feature request and contact information=

Please reports bug, feature requests, or any feedback to zhengj3-at-rpi.edu

=RDFa viewers=

Please look at http://rdfa.info/wiki/Tools

=Todo=


 * an "action=rdfa" option to a page to render only rdfa data

=Release Log=


 * Date: 2009-10-20, version number:0.0.2.
 * This version provides the functionality that allows user to map the property of MediaWiki to other property. For example, instead of output property "has name" from MediaWiki, user can ask the extension output property "vcal:dtend", where "vcal" is a prefix for "http://www.w3.org/2002/12/cal/icaltzd#". More details can be found at Mapping Properties
 * Instead of producing URIs(eg, instead of property="http://localhost/wiki/Property:has_name"), we use prefix to declare the namespace, and producing the "CURIEs" (CURIEs)
 * Download link: RDFa Extension (Version 2)


 * Date: 2009-09-11, version number:0.0.1, Version Description: initial version.
 * This version provides basic functionality of allowing people to output semantic data in RDFa format.
 * Download link: RDFa Extension (Version 1)