W3C home > Mailing lists > Public > public-rdfa@w3.org > April 2010

An implementation of a RDFa-like templating language

From: Kjetil Kjernsmo <kjetil@kjernsmo.net>
Date: Mon, 26 Apr 2010 22:58:55 +0200
To: public-rdfa@w3.org
Cc: dev@lists.perlrdf.org
Message-id: <201004262259.08985.kjetil@kjernsmo.net>
Hi all!

I have previously brought up some ideas for a RDFa-like templating 
language, and it stirred up some controversy. I decided to just write a 
prototype so that we have concrete running code to discuss, rather than 
just speculate around conceptual ideas.

So, I'm happy to announce the new Perl module RDF::RDFa::Template:

It implements the ideas that are described in
but it has a long TODO-list (also documented in the distribution).

The idea here is not to create a templating language that *is* RDFa, I feel 
it is more important that developers coming from an XHTML background to 
feel familiar, so I exploit XML more than I exploit RDF. Furthermore, I'm 
relying on Toby Inkster's RDF::RDFa::Parser, and the language doesn't 
require any features beyond what is in there. It also exploits the fact 
that we can have rdf:XMLLiterals to encode variables in the document. 
For the future, Toby has told me that I may be able to encode variables 
more easily with some new CURIE stuff he has in the works, which will 
simplify the language further.

For most users who have Perl installed, installing and running this module 
is really easy. If you have wget installed too, all you need to install it 
is to do this on the command line:

wget -O - http://cpanmin.us | perl - RDF::RDFa::Template

or if you have the cpan shell or CPANPLUS installed, you may prefer to use 
that. I have had some problems with the above method if any of the 
dependencies are already installed and you try to install as a unprivileged 
user. It is worth trying though, as that one-liner usually works. Also, you 
need the headers of libxml2 installed, usually, this means libxml2-dev or 
libxml2-devel or something like that. 

Once installed, the distribution contains a very simple web server that is 
configured to serve up an example template. This is in the examples/ 
directory of the distribution. If you used the above method, you may find 
this in 

cd to this directory.

In there, there is a script called demoserver.pl. Again, if you used
cpanmin.us as non-root, you will probably do something like
perl -I$HOME/perl5/lib/perl5/ ./demoserver.pl

There are more details in the distribution README.

If you installed it system-wide you would probably not need the -I option. 
After running this script, you can connect to 
and the template system will run, a SPARQL Query is sent to DBpedia, and 
the results are rendered. 

I hope that this will give people a feeling for how it works. As you can 
tell from the code, it is far from production ready, I just wanted to throw 
something out there as a discussion item. Yet, the code is there, and it 
runs, so I hope you will try it out.

Please direct comments on the Perl implementation to dev@lists.perlrdf.org 
and comments on the templating language itself to public-rdfa@w3.org. CCing 
both lists or me shouldn't be necessary.


Kjetil Kjernsmo

Received on Monday, 26 April 2010 21:02:49 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:15:06 UTC