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

GRDDL implementation in Raptor

From: Dave Beckett <dave.beckett@bristol.ac.uk>
Date: Mon, 04 Apr 2005 11:38:53 +0100
To: public-rdf-in-xhtml-tf@w3.org
Message-Id: <1112611133.22606.55.camel@hoth.ilrt.bris.ac.uk>

In a fit of coding enthusiasm just before going on vacation, I added
GRDDL support to my Raptor RDF parser & serialiser library based on
reading http://www.w3.org/2004/01/rdxh/spec quickly and using libxml2
and libxslt.

It's only in raptor's CVS right now but you can try it out in the demo
on the two examples I found:

http://librdf.org/parse?uri=http%3A%2F%2Fwww.w3.org%2F2003%2F12%2Frdf-
in-xhtml-xslts%2Fcomplete-example.html&language=grddl

http://librdf.org/parse?uri=http%3A%2F%2Fwww.w3.org%2F2004%2Flambda%
2FSites%2Findex.html&language=grddl

or enter your own URIs at http://librdf.org/parse  and select parser
GRDDL.

I think it's doing the right thing but I didn't spend a lot of time
checking.  When multiple transforms are present, do they make one graph?
I went with Yes.  Should users be able to select them by parameter?  I
went with No.  Are any XSLT parameters passed in?  I went with No.

It works by reading the source document (assumes it is XHTML) into a
libxml2 document, then applying an XPath query:
//html:html/html:head[@profile="http://www.w3.org/2003/g/data-
view"]/html:link[@rel="transformation"]/@href

where the prefix html: is defined to URI http://www.w3.org/1999/xhtml

It then uses the resulting entries in the nodeset as relative URIs to
the document of XSLT sheets, which are then fetched and applied with
libxslt to the source libxml2 document, giving a new RDF/XML document
which is parsed with raptor's RDF/XML parser to give RDF triples.

Dave
Received on Monday, 4 April 2005 10:38:57 GMT

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