OpenGraphNET – A Simple Open Graph Library for .NET

A OpenGraphNET is a simple parser / library for the Open Graph protocol created by Facebook. More information on this protocol can be found at opengraphprotocol.org.  If this is something new to you, I'd suggest reading up on the semantic web, RDFa, and related OpenGraph materials - there is a good writeup here covering all of the previously mentioned topics from a developer's perspective.

On to the library... The initial implementation of OpenGraphNET was really just to get the ball rolling since no libraries currently exist for OpenGraph in .NET.  It currently can parse OpenGraph data found in HTML pages, write OpenGraph data as meta tags, and download the OpenGraph protocol schema.   However, I need to research RDFa libraries in .NET to create a more correct implementation. 

The current source code and project can be viewed at http://opengraphnet.codeplex.com/ (although I haven't yet pushed out a recommended release).

Reading OpenGraph objects
It currently uses MSDN's SGML parser to read HTML from a given URL, converts it to XML, and then finds all the META properties of the webpage.

//sample reading
OpenGraphObject ogObject = OpenGraphLib.PopulateOpenGraphObject("http://www.rottentomatoes.com/m/10011268-oceans/");

Writing from OpenGraph objects

Once you have an OpenGraph object populated with information, you can output it as HTML in the form of a string.

//sample output of html meta tags  
OpenGraphLib.CreateOpenGraphHtml(ogObject);

There is much to be done for this library, but I think it is a starting point.

As for the protocol itself, there is still much debate about it, its future, the (in)valid "property" attribute of the meta tag, and of course many opinions on Facebook's real reasoning for the protocol. Though, since it is backed by Facebook, I don't see it going away.