Today I’ve wrote a small change to Semantic MediaWiki that adds aliasing supports to it’s result formats. I’ve been working (mainly theorizing) on this for quite a while, and came up with some rather complex solutions, that where not feasible since they required PHP 5.3. The implementation I ended up with is ridiculously easy, and works with an $smwgResultAliases array. This array holds result formats as the keys, and the aliases as (array) value. A simple example of adding aliases using this array is:
$smwgResultAliases['googlemaps'] = array(‘googlemap’, ‘gmap’, ‘google’);
Here googlemap, gmap and google will do the same as googlemaps, which is the actual result format. To hold into account these aliases, I only needed to add some simple code to the getResultFormat function in SMWQueryProcessor. This is the code:

This implementation is fully working with Semantic Maps, and has fixed an issue this extension had with the display of it’s result formats on the special:ask page (see screenshot).
Anyway, my first direct contribution to SMW – yay

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 