Wednesday, August 03, 2011

Embedding remote JSON data in MediaWiki pages

Machine readable content is good for something. The actual format is not so important, and we can route RDF over JSON, so I'm fine with JSON. MediaWiki has a External Data (ED) extension that allows getting remote data in various formats, among which JSON. It works OK, but I have not figured out how to take advantage from hierarchy. If the some field shows up at various places in the hierarchy, ED still does not distinguish between them :(

Anyway, the obvious application it to show your last tweets on your MediaWiki homepage. Right?

The source for this content looks like:
= Twitter =

{| class="table" border=0
! {{#if:{{{Twitter|}}}|Three Latest Tweets}} {{#for_external_table:
{{!}} {{{text}}} }}
The {{{Twitter|}}} bit hooks in to the template field that created that People box on the right hand side of that page, which you can see in the above screenshot with my twitter account set.

Of course, I have a hidden agenda here. The true reason is not twitter messages. It is being able to move data around. For example, wouldn't it be great to embed SPARQL results in wiki pages this way? Well, maybe there are better solutions, but the point is that this is technologically possible, and that we should think creatively in making mashups that help our scientific research.

No comments:

Post a Comment