Yesterday I quickly wrote up a simple (but awesome) MediaWiki extension that allows you to make use of the Spark library in your wiki.
Spark as described on the Spark website:
The web is not only growing in sheer size, but it also grows in how much it is interconnected. Where once the Web was a set of more or less separated sites, today sites are more and more being connected. More and more data is being offered on the Web in a way that can be further processed, and more and more sites and applications are using external data. More and more mashups are created, where data from different sources is integrated and displayed with novel visualisations.
Spark is a library that enables HTML authors to create mashups more easily than ever before. Using standard Web technologies like SPARQL, RDF, HTML5, and JavaScript, Spark can query external knowledge sources (so called triple stores or SPARQL endpoints), and then visualise the results.
With Spark, website developers can create visually appealing mashups without having to write a single line of JavaScript, but merely using some markup elements describing the source of the data that is to be shown, a query to select the appropriate data, and selecting one from an expandable set of visualisations and their parameters.
Spark is developed by Denny VrandeÄić and Andreas Harth.
This MediaWiki extension, unsurprisingly titled Spark, adds a <spark> tag to MediaWiki which is equivalent to <div class=”spark”> as described in the spark library documentation. All parameters (except the class=”spark” one) can just be copied over between spark divs in web pages, and the <spark> tag in MediaWiki. It is currently at version 0.1, which is a beta release. It includes a still experimental version of the Spark library, so you should probably not use this extension on production websites just yet. The Spark people are looking for developers to help out, so if you want to play around with SPARQL a bit, like I basically did with this extension, be sure to poke them
The extension required MediaWiki 1.17 or above (as it makes use of the new Resource Loader) and PHP 5.2 or later.
Download
Further possibilities
Right now you can embed mashups with SPARQL queries that get their data from some SPARQL endpoint. This opens up a whole bunch of possibilities, but is a bit silly when you are running your own Semantic MediaWiki instance and want to visualize structured data stored by it using Spark. A possible addition to the Spark MediaWiki extension therefore is having support for Spark as a so called SMW result format. For this translation from the SMW ask query language to SPARQL is needed, which is some work. I might implement this at some future point, but have several other things I want to poke at, so it won’t be soonish
A few weeks back I started work on a new MediaWiki extension to provide decent rating functionality. The reason: I got sick of all the crappy rating extensions out there and decided to write one that both works and has sane code. The new extension is called “Ratings“.
The Ratings extension provides a tag extension that when embedded in a page allows users to rate different “properties” of the page. Quite simple. It also adds a votesummary hook which allows embedding a summary as seen below into pages for any property of any page.
The extension is written in such a way it’s easy to add additional types of rating (interface) elements. It exposes 2 API modules, one to obtain all rating data needed on a page, and one to submit votes.
It’s not quite finished yet, as I can’t get the rating interface quite right. I tried 2 jQuery rating star plugins, both messing up their position in the page after onload. Therefore I have not made any release yet, and definitely recommend against using this extension on any production wiki. I’m not planning to put any more time into this issue (I already wasted some hours on it >_>), so feel absolutely free to fix the layout issues (you can contact me for details, or try out the extension yourself and spot the obvious), or to put in your own favourite rating element. (source code)
Yesterday I for some reason decided to have some fun with Python by writing a simple script to Find Dead Translation keys in MediaWiki extensions. The resulting script, titled FDT, can be found on GitHub, and is licenced under the GNU GPL v3+ (yes, the later probably comes as a shock to you!).
What is does, and how
The script works by first obtaining a list of defined language keys from the specified i18n file (which is done via an evil PHP subprocess, to avoid messy parsing of array keys), and then looping over all php files in the directory (recursively ofc) to check if they contain any of the keys, after which a list of not-found keys is returned. If there are not-found keys, the script offers to delete those from the i18n file, which also saves quite some work if they are assigned to for many languages. One important limitation is that the script finds key usage by doing a simple “in string” search on the whole contents of each file, which obviously will miss dynamically constructed strings. An example of the work this script did (for Semantic Maps) can be found in this commit.
Some more points of interest
This was a nice little exercise in Python for me, making me more familiar with the language basics, which after several similar small projects, I now think I pretty much have mastered. Also fun was that this is the first project I did using Apatana Studio 3, which was released very recently. It’s an Eclipse based IDE aimed at Python and Ruby web development, including excellent support for JavaScript and various JS libraries such as jQuery and Ext. It also has some support for PHP, but that’s a bit meagre compared to Zend Studio or PhpStorm, an IntelliJ based IDE I’ve been trying out lately.
More posts to come
Over the past 2 years I’ve changed my blog posting style from posting casual updates about small stuff like this post, to only posting about new MediaWiki extensions or important updates to existing ones. I’ve decided to reverse this trend and post more lightweight for fun things, as opposed to only big release announcements
A few days back I created my second ever Android application, basically a re-do of the first one that was titled “Pamela for Android“, now with the name “PAMELA Widget“. It has the same function: display a list of people at 0×20, the hackerspace in Ghent, or HSB, the space in Brussels,obtained via the PAMELA webservice. More info on PAMELA can be found here.
I couldn’t really get the interface in the previous app quite working as I wanted, and then got inspired by the iRail Liveboard app, created by Christophe Versieux, to write a new version, based on the code of the Liveboard app.
You can get the app from the Android market by searching “pamela widget”. You can also get the code, which is GPL3+ licenced, from GitHub.

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