RDF-3T

RDF in Machine Tags

Introduction

RDF-3T is a Metaformat(a language used to describe another language [3]) that uses a Triple Tag syntax to describe RDF triples in XHTML.

The Wikipedia definition of a triple tag says...

A triple tag is a tag that uses a special syntax to define extra information about the tag, making it easier or more meaningful for interpretation by a computer program. Triple tags comprise three parts: a namespace, a predicate and a value.

Triple Tags were first devised in 2004 by Mikel Maron as an experiment in using del.icio.us as a collaborative geo-annotation database. This Method was adopted by Flicr who used the Technical term Machine Tags when referring to Triple Tags. RDF-3T uses Machine Tags and a minimal set of standard html attributes to provide easily discoverable RDF triples or NTriples on any xhtml page.

Attributes

RDF-3T uses a minimal set of three standard html attributes.

id
A unique Identifier used in combination with item as a relative url of the subject. The contents of an id are either a plain text string or a CURIE
href
Also a unique Identifier used in combination with item as an absolute url of the subject.
class
This attribute assigns a class name or set of class names to an element and is used for general syntax processing.
RDF-3T syntax

RDF-3T uses the following syntax

[ prefix ] ' : ' [ term ] ' = ' [ value ]

colon (:)
A Prefix, Term seperator.
equals (=)
The string after equals(=) is the value of the object that you are describing.

Define a prefix

Define a prefix by using a <meta> tag in the <head>...</head> of a page using the meta name="prefix", you should also define a scheme using using the meta attribute scheme with the value of your chosen prefix. The content attribute should contain the url of your prefix example:

<meta name="prefix" scheme="foaf" content="http://xmlns.com/foaf/0.1/"/>

Reference a Term using a "follow your nose" principle and easy RDF-3T statements. see also: RDF-3T syntax

RDF-3T Values

RDF-3T has eight possible Values.

item
An instance of a RDF class that may contain a set of RDF classes, What type of thing this is.
content
Content is Text or Plain literal.
resource
A RDF resource type, the values will be either src or href.
literal
RDF datatype XMLLiteral, the contents are html tags and should not contain further RDF-3T markup.
hash (#)
A relative hash uri reference of an id example: foaf:maker=#thatid.
hash underscore (#_)
Looks down the document for the first child item with a href attribute if none exists the parser will generate a "blank node" example: foaf:maker=#_.
[prefix:reference] (curie)
A compact uri reference of a resource examples: mo:release_type=[mo:album], rdf:type=[pim:ContactLocation] and foaf:maker=[doc:me].
string
Any string after equals(=) example: dc:date=2008-12-25, a string should not contain any spaces.

RDF-3T Tests

The following pages are some basic tests that were used during the development of RDF-3T, they all including source snippets and conversions.

  1. Test 1 Publishing contact information
  2. Test 2 Publishing Music
  3. Test 3 Publishing an Article
  4. Test 4 FOAF in HTML 4.01 Transitional

GRDDL Profile

The RDF-3T GRDDL profile is available at http://purl.org/weborganics/RDF-3T

Usage: Add the GRDDL Data view profile to the <head> of your page...

<head profile="http://www.w3.org/2003/g/data-view">

Then also add a link in the <head>...</head> of your page...

<link rel="transformation" href="http://purl.org/weborganics/RDF-3T" />

Thats it you are done, you can view the output of this page either by using the Transformr RDF-3T Service (bookmarklet). or Convert to RDF/NTriples, using : Mindswap RDF Converter

Notes and Inspiration

Notes

  1. [1] Wikipedia entry on Compact URI's ( curie )
  2. [2] W3C Standard CURIE Syntax 1.0
  3. [3] Wikipedia entry on Metaformat's
  4. [4] What are Machine Tags by Gabriel Horner

Inspiration

[...@todo...]

WebOrganics 2009, Public Domain Licence.

Semantic Web