Parsing RDF using XSLT in Ruby

These files support XSLT-based RDF parsing, with the output in (something approximating) the RDFCore WG's NTriples syntax.

This package includes a full RDF parser in XSLT by Max Froumentin. See below for parser todo and buglist.

Todo:

An XSLT RDF Parser: Parser#_5

This page documents Max Froumentin's XSLT RDF parser. This is an implementation of an RDF/XML 1.0 parser as an XSLT 1.0 transform, and is based on the current RDF Core specs including proposed fixes to the RDF syntax. The output of the parser is a text document in the N-Triples RDF testing format.

Parser#_5 is the 5th (known to us) RDF XSLT parser. It is intended to be useful and/or complete and (eventually) track the RDF Core specifications and test suite. It is composed of two XSLT transforms: rdfc14n.xsl, which transforms the RDF/XML instance into a canonicalised form of RDF/XML, and rdfc2nt.xsl, which outputs n-triples from the canonicalised form.

These stylesheets were developed using Saxon 6, xsltproc (as of libxslt 10021) has a bug in the canonicalisation stylesheets. Non-RDF attributes of a predicate element are copied to the output while they shouldn't (see source for details).

At the current time there are several known bugs:

Known Bugs

There are least the following bugs, possibly more. Use at your own risk. Send bug reports to Max (perhaps copying Dan and/or www-archive+parser5@w3.org, for public archived list). Bug reports should include a brief test case and cite the relevant section of the RDF spec.

XSLT Tools: installation

For XSLT support in Ruby, we use the Sablotron module. There are a couple of other native Ruby XSLT implementations, but I couldn't get them to work with the XSLT docs used here.

To install, get Sablotron installed, make sure you have both ruby and ruby-dev installed (as packaged for debian, anyway), and run the configure /make rituals as per the README in the sablot distribution. The Ruby Sablot tools need the Sablotron header files too; these are also packaged separately from sablotron.

If you are using a Ruby environment for which a Sablotron binary (or other command line tool) is available but for some reason you can't compile the Sablot Ruby package against Sablotron, consider writing some Ruby wrapper code for the commandline version. See the basicrdf.rb library for details of what needs doing.

Here's one path this running under Debian:

   apt-get install ruby
   apt-get install sablotron
   apt-get install ruby-dev
   apt-get install libsablot0-dev

Other parsers

There are a number (4 at least) of other RDF parsers for XSLT. The XSLT/RDF tool also ships with a parser that was originally a slight modification of Jason Diamond's. I'm now using a revision created by Jason (see initial snapshot). This is available as rdf2nt.xsl.


Last updated: $Id: README.html,v 1.6 2003/02/10 20:06:37 mf Exp $
Dan Brickley, Max Froumentin.