The hTurtle Microformat

hTurtle is a microformat for embedding Turtle, an RDF format that's easy to write, into XHTML documents. It is compatible with GRDDL via a service which provides an XSLT transform to RDF/XML from any given hTurtle URI.

To use hTurtle, you simply embed the Turtle content inside comments and braces. This means that you can still use regular comments by omitting the braces. An example of what you could embed:

<!--{
<> dc:creator [ foaf:name "Sean B. Palmer"; 
   foaf:homepage <http://inamidst.com/sbp/> ] .
}-->

You can use as many Turtle comments in an XHTML document as you like, in any place that a comment is valid. They will be concatenated together before being sent to the parser, so you can declare your prefixes at the top of the file. Several commonly used prefixes are declared as default, so you don't have to declare them yourself, including rdf, rdfs, owl, dc, foaf, doap, and skos. All of the Turtle syntax is supported.

There are two ways to say that your document is an hTurtle document. The first and preferred way is to be compatible with GRDDL by using a GRDDL profile and then specifying a <link> to the hTurtle GRDDL XSLT service. There is an hTurtle GRDDL Example that you can follow to use this idiom.

The other way is to use the hTurtle profile URI as the value of the profile attribute on the head element of your HTML or XHTML document, as follows:

<head profile="http://inamidst.com/sw/hturtle/">

Which licenses user-agents to parse the document as an hTurtle document and garner the RDF triples from it. This approach SHOULD NOT be used if the GRDDL approach is available, but may be useful for example when using HTML rather than XHTML. The XSLT service may support the parsing of such documents in the future.

The GRDDL XSLT Service

hTurtle URI:

If you've made an hTurtle document, you can put its address in the form above and submit it to be sent to a page which you can use as the value of the transformation link to bring your document into the GRDDL world. See the hTurtle GRDDL Example for a clearer cut-'n'-paste example of how to do this.

This service, and hence the format given that this is the de facto reference implementation at the moment, has the following limitations:

The input URIs will all turn up in my server logs, so don't use this service on any documents that you don't potentially want me to view.

This document that you're reading now is also a valid example of an hTurtle document that uses this GRDDL XSLT service. You can see its output as RDF/XML or Turtle thanks to the Triplr GRDDL conversion service.

The GRDDL XSLT service uses components of Trio and a Python CGI to make it work.

Sean B. Palmer, inamidst.com