Copyright © 2008 Toby Inkster, some rights reserved.
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.
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>.
JSON transformations can be referenced as so:
http://example.net/path/to/transformations.js#x
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.
Some sample transformations can be found here:
http://buzzword.org.uk/2008/jsonGRDDL/jsont-sample#Person
http://buzzword.org.uk/2008/jsonGRDDL/jsont-sample#People
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]" }
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" }