W3C

RDF/A: an implementation

Jeremy Carroll


Introduction

This directory gives an XSLT2 implementation for RDF/A.

The goal is to be an initial implementation, that is fairly easy to change as the rules change.

This is not intended as a production implementation, and misses features such as validation, efficiency and error handling that would be required in a production implementation.

The current status is an initial, untested prototype.

Overview of Design

The heart of the system is a set of rules for subject, predicate and object, taken from the specification.

These rules are transformed into an XSLT program, which in turn can transform an XML document with RDF/A attributes into an RDF/XML document. Hence we distinguish between compile-time transformation, which processes the rules, and run-time transformation which processes XHTML2.

The first compile-time transformation combines the rules for S, P and O into a set of rules for SPO matches.

The second compile-time transformation takes the SPO matches and turns them into XSLT.

The run-time transformation uses the output of the compile-time transformation, and an imported module, to transform XHTML2 into RDF/XML.

Files

The files in this directory are as follows:

Source Files

rulesA.xml
The rules for subject, predicate and object matching.
combineRules.xsl
The first compile time transform. The XSLT that transforms rulesA.xml into rulesSPO.xml, in every combination of S rule, P rule and O rule.
rules2xslt.xsl
The second compile time transform. The XSLT that transforms rulesSPO.xml into rdfA.xsl, which is the run-time transform.
base.xsl
The imported module for the runtime transform. This file defines functions for URI and CURIE processing; and the top-level match etc.
testRDFA.xml
A file for testing with.
build.bat
A list of the instructions for building and running the transforms, using saxon8, works as a windows batch file, or as a unix shell script.

The generated files

rdfA.xsl
This XSLT transforms XHTML2 into RDF/XML.
output.rdf
This is the output from testRDFA.xml when transformed with rdfA.xsl.

Todo

There are numerous TODOs scattered through the code. The most significant is reification.

$ grep TODO *
base.xsl: TODO use sensible namespace for my:, and change prefix
base.xsl: TODO assumes that the bnode is legal NCNameChars
base.xsl: TODO assumes bare-infix is :
base.xsl: TODO ncname here
base.xsl: TODO this code assumes infix of length 1
rules2xslt.xsl:TODO  Reification
rules2xslt.xsl:TODO  Testing
rulesA.xml:  TODO reification rules of 5.3
testRDFA.xml:  TODO correct URI for dc. Many more tests.

Also a major tidy-up would be in order.

A further limitation is that the code assumes the value of a property rel or rev attribute is actually a qname.

The rel="next" etc functionality has not been implemented.


$Revision: 1.4 $ of $Date: 2005/12/06 15:25:33 $
Valid XHTML 1.0!