TreeHugger is an attempt to use xpaths and xslt on rdf graphs
(a tree-hostile environment). You can download it here. Be warned that it's only
been compiling for a day, so it's very pre-alpha.
TreeHugger tries to make an RDF graph look like an ideal RDF/XML
serialisation. Hopefully XSLT stylesheets that 'break' when
confronted by odd serialisations will convert easily to
TreeHugger was written by Damian Steer. It is Free
Software, released under a BSD-style licence.
2. Using TreeHugger
Before starting you should probably flick through my introduction, particularly the
example. Next try the online
playground, where you can try stylesheets.
If you want to play in the privacy of your own home then
download treehugger. INSTALL and README should be all you
Here are a few notes on TreeHugger and XPath:
- Root corresponds to the RDF document. Its children are all
the subject nodes in the graph
- Properties have a dual identity: they are elements and they
are attributes, just as they may be in RDF/XML.
- Literals are (currently) text nodes. That is like
RDF/XML. However that means they can't have attributes (like
lang and datatype). I'll have a think about that.
- Resource elements are indicated by type (eg foaf:Person). If
a resource doesn't have a type (like the object of foaf:mbox)
use rdfs:Resource or rdf:Description.
- TreeHugger is pretty inefficient, dynamically creating a
tree from a graph as the stylesheet requires. A much better
route is creating rdf queries from XPath expressions. TreeHugger
was easier to write inefficiently, however.
4. Future Development
There are many unimplemented XPath features, but the most
notable is the descendant axis (//). This could be nasty, but
I'll have a go soon.
Provide some way to connect to RDB-backed models. I need to
look through the Jena documentation to find out how
straightforward this is.
DAML/OWL collection support. This must be easy. Back to Jena docs...
Move to Saxon 7.x, which would provide XPath 2.0, XSLT 2.0 and
XQuery 1.0. XQuery is probably the most tricky to hook in to.
Max Froumentin and Libby Miller, who started my interest in
XSLT, XPath and XQuery over RDF.
Norm Walsh, whose RDFTwig, though
pretty different, showed me how to use Saxon.
The Saxon and Jena developers, whose
code does most of the real work.
Sean B. Palmer's Pondering RDF Path
contains some useful information and links to RDF-specific path
Last modified: Wed Sep 10 13:23:08 BST 2003