W3C home > Mailing lists > Public > public-rdfa-wg@w3.org > November 2010

Re: RDFa API - adding Namespace

From: Nathan <nathan@webr3.org>
Date: Sun, 21 Nov 2010 17:21:41 +0000
Message-ID: <4CE95525.9080607@webr3.org>
To: Tim Berners-Lee <timbl@w3.org>
CC: Manu Sporny <msporny@digitalbazaar.com>, RDFA Working Group <public-rdfa-wg@w3.org>, Mark Birbeck <mark.birbeck@webbackplane.com>
Tim Berners-Lee wrote:
> I don't think they do.
> You have to figure out what you are going to pass.
> You have to allow someone to either use a prefixed URI or a full long URI or give a string or a number (or a Date).
> I've been writing lots of javascipt and I am happy to learn new tricks but I am sure that the 
> user needs a consistent model and a simple compose-able rules.
> document.data.add(me, foaf('knows'), you);
> d = document.data
> d.add(me, foaf('name'), "John Doe");
> d.add(me, foaf('knows'), mydoc('sally');
> d.add(me, foaf('age'), 3);
> d.add(me, foaf('kidsAges'), [10, 6]);   // Makes an RDF Collection
> d.add(me, foaf('dob'), new Date('1921-09-19'));  // Makes the right datatype
> Where any of the three parameters to add can take any of the forms (modulo the RDF model).
> The aim is to coerce from the natural javascript to the appropriate RDF in a very consistent way.

Just a quick note to say that I've just released a library which handles 
all of this:


And it's completely RDFa API compatible so allows the above examples, 
but also allows you to:

   var me = {
     name: "John Doe",
     knows: sally,
     age: 3


   me.kidsAges = [10,6];
   me.dob = new Date('1921-09-19');

where the js just /is/ rdf too, so you can then do:

   me.n3()         // dumps as n3/turtle
   me.toNT()       // dumps as nt
   me.graphify()   // dumps an RDFGraph for use w/ the RDFa API

Rather than converting, each value just is both js and rdf:

   true.toNT();       //"true"^^<http://www.w3.org/2001/XMLSchema#boolean>
   (12 * 1.4).toNT(); // "12.3"^^<http://www.w3.org/2001/XMLSchema#decimal>


Received on Sunday, 21 November 2010 17:22:25 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:05:22 UTC