W3C home > Mailing lists > Public > public-rdf-in-xhtml-tf@w3.org > May 2007

RDFa support in Jena GRDDL Reader (SVN)

From: Jeremy Carroll <jjc@hpl.hp.com>
Date: Fri, 25 May 2007 13:40:15 +0100
Message-ID: <4656D92F.2060303@hpl.hp.com>
To: Paolo Castagna <paolo.castagna@hp.com>, jena-devel <jena-devel@lists.sourceforge.net>
CC: GRDDL Working Group <public-grddl-wg@w3.org>, RDFa <public-rdf-in-xhtml-tf@w3.org>


Summary:
RDFa support now in Jena GRDDL Reader, even without a GRDDL profile 
being specified. Also includes HTML tidy.
Uses v0.8 of Fabien's transform.

(Not yet released, but can be built from public sources)

Note to WGs:
This was an easy extension to a GRDDL aware agent, taking only an hour 
or two for coding and testing. This can be interpreted as showing that 
the two technologies have synergy.
Background: Paolo wants RDFa support in Jena.

========

Hi Paolo

I've made my first effort at adding RDFa support.

You need to get the SVN copy of the Jena GRDDL Reader.
The minimal documentation is found on the setProperty method of
com.hp.hpl.jena.grddl.GRDDLReader

The example test code is:

     	Model m = createMemModel();
     	RDFReader r = m.getReader("GRDDL");
     	r.setProperty("grddl.rdfa", "true");
         r.read(m, 
"http://www.w3.org/2001/sw/grddl-wg/td/hCardFabien-RDFa.html");
         Model m2 = createMemModel();
         m2.read(
"http://www.w3.org/2001/sw/grddl-wg/td/hCardFabien-output.rdf",
"http://www.w3.org/2001/sw/grddl-wg/td/hCardFabien-RDFa.html",
         		"RDF/XML");
         assertIsoModels(m2, m);


The key line is:

     	r.setProperty("grddl.rdfa", "true");

this disables all other GRDDL processing and adds Fabien's transform as 
the only transformation (for all (X)HTML input).

NB: the SVN version is not recommended for general use since I fiddle 
with the security features, and some are currently disabled. With the 
grddl.rdfa property set, the risks are much less: essentially you are 
exposed to Fabien's computer being subverted.

The test above was quite slow (about 10 seconds). I could add caching 
for transforms, so that you don't keep getting Fabien's transform when 
doing a lot of files. However, caching is not yet on my horizon.

Jeremy


-- 
Hewlett-Packard Limited
registered Office: Cain Road, Bracknell, Berks RG12 1HN
Registered No: 690597 England
Received on Friday, 25 May 2007 12:40:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:15:04 GMT