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

Re: Experimental RDFa extractor in JS

From: Ivan Herman <ivan@w3.org>
Date: Fri, 20 Apr 2012 16:12:55 +0200
Cc: Niklas Lindström <lindstream@gmail.com>, public-rdfa-wg <public-rdfa-wg@w3.org>
Message-Id: <5F728D00-2DCE-495A-96D7-8B8A456967DF@w3.org>
To: Gregg Kellogg <gregg@greggkellogg.net>

On Apr 20, 2012, at 15:56 , Gregg Kellogg wrote:
>> (You should really try out the bookmarklet [1] in a Firefox (ideally
>> with the JSONView [2] plugin installed). :) I tried it on your own
>> FOAF page for instance, which is rich in data and really interesting
>> to examine this way. (Note that @xmlns:* aren't captured yet though,
>> so the result here isn't really correct.))
> Running in-browser, access to xmlns* might be challenging.

Actually, you should not use that foaf file, it is rdfa 1.0. I have 


which I keep hidden for now, and I intend to change my core foaf file to this one when 1.1 is a rec.

>> It should be noted that, of course, graph cycles aren't possible to
>> follow directly in a tree. So any time a reference to an already
>> created resource description (i.e. a JSON object @id:d with the
>> resource IRI) is referenced, I just put a link there (an object with
>> just the @id).
> Perfect! This is what framing is for, to turn such references into object embeds.

However, about framing... how heavyweight is that framing implementation? The huge advantage of Niklas' implementation is if it is as lightweight as possible...



> The distiller does accept JSON-LD, but probably needs a small update. You could also use jsonld.js and use the toRDF method to get n-triples out of it in the page.
>>> Niklas, this could be very important...
> Agreed!
> Gregg
>>> Thanks
>> Thanks for the positive feedback!
>> Best regards,
>> Niklas
>> [1]: http://niklasl.github.com/rdfa-lab/
>> [2]: http://jsonview.com/
>> [3]: https://github.com/antoniogarrote/rdfstore-js
>>> Ivan
>>> On Apr 20, 2012, at 01:58 , 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/
>>> ----
>>> Ivan Herman, W3C Semantic Web Activity Lead
>>> Home: http://www.w3.org/People/Ivan/
>>> mobile: +31-641044153
>>> FOAF: http://www.ivan-herman.net/foaf.rdf

Ivan Herman, W3C Semantic Web Activity Lead
Home: http://www.w3.org/People/Ivan/
mobile: +31-641044153
FOAF: http://www.ivan-herman.net/foaf.rdf

Received on Friday, 20 April 2012 14:10:49 GMT

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