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

Re: Facebook - RDFa in Open Graph Protocol

From: Toby Inkster <tai@g5n.co.uk>
Date: Sat, 24 Apr 2010 09:33:49 +0100
To: Dan Brickley <danbri@danbri.org>
Cc: public-rdfa <public-rdfa@w3.org>, David Recordon <recordond@gmail.com>
Message-ID: <20100424093349.56919a6b@miranda.g5n.co.uk>
On Wed, 21 Apr 2010 21:33:04 +0200
Dan Brickley <danbri@danbri.org> wrote:

> http://opengraphprotocol.org/

Last night I added some OGP-specific functionality to my RDFa parser.
No parsing tweaks needed, but some syntactic sugar to help people get
at OGP data without needing to know SPARQL or the intricacies of the
RDF data model.

It's as easy as:

  $rdfa = RDF::RDFa::Parser->new_from_url('http://example.net/');
  print $rdfa->opengraph('site_name');

In RDF terms, the opengraph method takes a property as a string. If the
property is not a full URI, it prepends the opengraph URI to make it
one. Then it finds triples such that the subject is the document's base
URL, the property is the URI provided, and the object is not a blank
node. It then returns a value or list of values as plain strings (i.e.
it doesn't differentiate between literals, resources, etc).

If the opengraph method is called without any parameters, it instead
returns a list of properties that the page has.

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>
Received on Saturday, 24 April 2010 08:35:40 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:15:06 UTC