Re: Experimental RDFa extractor in JS

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 UTC