W3C home > Mailing lists > Public > public-rdfa-wg@w3.org > April 2012

Re: Experimental RDFa extractor in JS

From: Gregg Kellogg <gregg@greggkellogg.net>
Date: Thu, 19 Apr 2012 21:30:58 -0400
To: Niklas Lindström <lindstream@gmail.com>
CC: public-rdfa-wg <public-rdfa-wg@w3.org>
Message-ID: <24F0F65F-6FC4-4E3D-AD3B-39060077A0E6@greggkellogg.net>
Niklas, this is great! I think creating JSON-LD from RDFa is a natural thing to do, and of course, we can always get triples out of JSON-LD.

I had been thinking of a CoffeeScript implementation too, but ClojureScript is tempting.

Gregg

On Apr 19, 2012, at 4:58 PM, Niklas Lindström wrote:

> Hi all!
> 
> The last couple of days I've been experimenting with a different kind
> of approach to implementing an RDFa extractor. The result so far is a
> draft with admittedly rather partial coverage. However, I hope some
> aspects of it will be of interest even at this stage:
> 
> 1. It is implemented in pure Javascript. (Well, actually, in some 170
> lines of CoffeeScript, but the generated result is the same.)
> 2. It runs both in the browser and on Node (used with jsdom).
> 3. It does not produce triples. It directly creates a JSON-LD extract
> (corresponding in shape to the RDFa). This is the difference, and the
> fun part.
> 
> Now, it really doesn't handle anything but the most simple RDFa 1.1.
> Possibly all of Lite, plus @datatype, @rel (including hanging),
> @inlist, @rev and perhaps one or two more. It only copes with @about
> if it's alone, it doesn't handle combinations of @rel and @property,
> and so on. I'll strive to make it a lot more compliant given time of
> course.
> 
> - You can check out the code at: https://github.com/niklasl/rdfa-lab
> - Or enjoy the bookmarklet (only tested in Firefox), available at:
> http://niklasl.github.com/rdfa-lab/
> 
> (Just add the latter to your bookmarks and apply on any page
> containing RDFa. I recommend the JSONView [1] browser add-on for a
> good experience.)
> 
> I hope you'll enjoy the little things it can do. (For one, using the
> resulting JSON-LD directly in a JS application should prove
> interesting.)
> 
> Best regards,
> Niklas
> 
> [1]: http://jsonview.com/
> 
Received on Friday, 20 April 2012 01:31:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 27 April 2012 04:55:20 GMT