RDF

jsonGRDDL

Buzzword.org.uk Draft 15 December 2008

This version:
http://buzzword.org.uk/2008/jsonGRDDL/spec.20081215
Latest version:
http://buzzword.org.uk/2008/jsonGRDDL/spec
Editor:
Toby Inkster

Abstract

GRDDL uses XSLT linked to from namespace documents (or from XML files directly) to transform XML into RDF/XML.

jsonGRDDL uses JSONT linked to from JSON Schemas (or from JSON files directly) to transform JSON into RDF/JSON.

1. jsonGRDDL Transformation

A JSON transform file, suitable for use with jsonGRDDL takes the form:

var transform1 = { ... } ;
var transform2 = { ... } ;
var transform3 = { ... } ;

Such that each transformation conforms to jsonT, and produces as output a string, conforming to RDF/JSON.

The transformations should not include any script which assumes that they will be evaluated in a browser context, and should use only standard ECMAScript functionality. For example, they should not try to access the "document" or "window" objects, or attempt any interaction with the user. The transformations should assume the existence of a built-in global "JSON" object, with the following methods:

For testing, an ECMAScript file which provides such functions can be found at <http://buzzword.org.uk/2008/jsonGRDDL/jsonobject>.

1.1. Multiple Transformations in One File

JSON transformations can be referenced as so:

where x is the variable name corresponding to the desired transformation. If the fragment identifier is left out of the URL, a transformation called _main is used.

1.2. Example Transformations

Some sample transformations can be found here:

2. Linking from JSON Objects to Transformations

2.1. Linking Directly

JSON objects may link directly to a jsonGRDDL transformation:

{
	"$transformation" : "http://buzzword.org.uk/2008/jsonGRDDL/jsont-sample#Person" ,
	"name" : "Joe Bloggs" ,
	"mbox" : "[email protected]" 
}

2.2. Linking via a Schema

A JSON object may link to a JSON schema, which itself links to the jsonGRDDL transformation like this:

{
	"$schemaTransformation" : "http://buzzword.org.uk/2008/jsonGRDDL/jsont-sample#People"
}

3. Examples