W3C home > Mailing lists > Public > public-xg-socialweb@w3.org > May 2010

(unknown charset) Re: Design rationale behind the current schema for Facebook Open Graph Protocol

From: (unknown charset) Toby Inkster <tai@g5n.co.uk>
Date: Wed, 5 May 2010 14:48:46 +0100
To: (unknown charset) Peter Mika <pmika@yahoo-inc.com>
Cc: (unknown charset) Fabien Gandon <Fabien.Gandon@sophia.inria.fr>, Ivan Herman <ivan@w3.org>, David Recordon <recordond@gmail.com>, Dan Brickley <danbri@danbri.org>, "public-xg-socialweb@w3.org" <public-xg-socialweb@w3.org>, Tim Berners-Lee <timbl@w3.org>, Marie-Claire Forgue <mcf@w3.org>, Murray Maloney <murray@muzmo.com>, Richard Cyganiak <richard@cyganiak.de>, Raphaƫl Troncy <raphael.troncy@eurecom.fr>, "jacobi@csail.mit.edu" <jacobi@csail.mit.edu>, Bernard Vatant <bernard.vatant@mondeca.com>
Message-ID: <20100505144846.4d60f8a9@miranda.g5n.co.uk>
On Sat, 01 May 2010 17:35:30 -0400
Peter Mika <pmika@yahoo-inc.com> wrote:

> Would you take a crack at it? In a similar fashion, an OGP to JSON 
> mapping would be also highly desirable, otherwise implementations
> will diverge on the JSON serialization.

At http://srv.buzzword.org.uk/opengraph-to-json.html I do the following:

1. Parse the input document as RDFa;

2. Create a new, empty associative array called $RV.

3. Run a query equivalent to:

   SELECT $predicate $object
   WHERE {
     <> $predicate $object .

4. For each row of results:

    If $predicate is in the OGP namespace, trim the OGP namespace away;

    If $RV[$predicate] is not defined, set it to an empty array;

    If $RV[$object] is a URI, push it onto the array $RV[$predicate];

    If $RV[$object] is a literal, push the plain value onto the array

5. Return $RV as JSON.

Toby A Inkster
Received on Wednesday, 5 May 2010 13:50:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:22:09 UTC