Re: Facebook - RDFa in Open Graph Protocol

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