More about Facebook Linked Data

APOLOGIES FOR CROSS-POSTING

In this email, I would like to reveal a bit more about the Linked Data  
provided through Facebook's Graph API.


AUTHENTICATION

Before I get started, I have been asked about how to get an access  
token.  Information regarding authentication can be found at https://developers.facebook.com/docs/authentication/ 
  .  If you just want a quick way to obtain a security token, just go  
to https://developers.facebook.com/docs/reference/api/ and click on  
one of the example "connections" URLs and it will automatically  
generate a temporary access token (in the URL) for you (if you're  
logged in to your Facebook account).


MORE THAN JUST USERS

The main thing I want to point out is that the Graph API is much more  
than just basic information about users.  See https://developers.facebook.com/docs/reference/api/ 
  for details.  The Facebook graph includes things like pages,  
checkins, and links; it also includes "connections" (edges between  
things in the graph).  Anything you can get from the Graph API can be  
obtained in Turtle via HTTP content negotiation.  Simply include text/ 
turtle in the Accept header (with a higher q preference than more  
typical mime types if necessary).  One of the most interesting  
features of the Graph API is the search mechanism:

https://graph.facebook.com/search?until=yesterday&q=semantic+web&access_token= 
<ACCESS_TOKEN>

This will include information about a variety of things such as  
statuses, links, photos, and videos.  (At this point, I feel like I  
should point out the obvious, that is, that the information you see is  
only whatever is accessible given the access token provided.)

Another cool feature is the ability to ask for information about any  
number of IDs, where an ID could even be the URL of something included  
in the Open Graph.  For example:

http://graph.facebook.com/?ids=http://www.cs.rpi.edu/~weavej3/index.xhtml,jesserweaver

This includes information about my RPI website (which is in the Open  
Graph) and myself (jesserweaver).


LINKED DATA URIs

All of the HTTP(S) URIs in the RDF are dereferenceable.  Most of the  
URIs are hash-URIs (that is, strip off the fragment and fetch the  
document, returning 200 OK), but there are some slash-URIs (for  
example, http://graph.facebook.com/schema/~/data ) which 303  
redirect.  There are also information resources.  It's quite varied.


SCHEMA

This leads me to discuss the schema (or ontology, or whatever you want  
to call it).  Even the URIs representing properties and classes are  
dereferenceable.  For example, http://graph.facebook.com/schema/link#type 
  is the URI identifying the link class, and http://graph.facebook.com/schema/link 
  will return information (with 200 OK) about the link class.   
Information includes relevant properties, possibly specifying whether  
a relevant property is a owl:DatatypeProperty, owl:ObjectProperty, and/ 
or owl:InverseFunctionalProperty.  There may also be rdfs:domain and/ 
or rdfs:range specified where appropriate.

There are also properties that are not associated with a specific  
class, and these (generally) use the http://graph.facebook.com/schema/ 
~/ namespace URI.  Properties using this namespace have very vague  
semantics.  For example, the property identified by URI http://graph.facebook.com/schema/ 
~/data (which 303 redirects to http://graph.facebook.com/schema? 
tag=data ) has the following description:

"A tag having no semantics beyond the conventional semantics of the  
JSON key \"data\" as used in the Facebook Graph API."

So if never_used_as_a_key is never used as a key in the Graph API  
JSON, then the property http://graph.facebook.com/schema/~/ 
never_used_as_a_key is essentially meaningless.  There are two special  
cases, however.  One is http://graph.facebook.com/schema/~/id which is  
a owl:InverseFunctionalProperty with rdfs:range xsd:string.  The other  
exception is any URI beginning with http://graph.facebook.com/schema/ 
~/ followed by an optional underscore and then a non-negative  
integer.  These properties are an attempt at more practical container  
membership properties.  As an example, check out

http://graph.facebook.com/schema/~/_14

http://graph.facebook.com/schema/~/_14 is a rdfs:subPropertyOf  
tag:graph.facebook.com,2011:/has (the invented, generic, container  
membership property) and has an explicitly defined integer index as  
the value of the tag:graph.facebook.com,2011:/index property  
(something missing from the RDF container membership properties).

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix api: <tag:graph.facebook.com,2011:/> .
@prefix og: <http://ogp.me/ns#> .
@prefix fb: <http://ogp.me/ns/fb#> .
@prefix : <http://graph.facebook.com/schema/~/> .
:_14 a rdf:Property ;
	rdfs:label "_14" ;
	rdfs:comment "A tag having no semantics beyond the conventional  
semantics of the JSON key \"14\" as used in the Facebook Graph API." ;
	rdfs:subPropertyOf api:has ;
	api:index 14 .


OPEN GRAPH

URIs used as properties in the Open Graph (except for those in the http://ogp.me/ns# 
  and http://ogp.me/ns/fb# namespaces; those URIs go elsewhere) also  
redirect to the Graph API schema feature.  For example, http://ogp.me/ns/book#author 
  is a property, and http://ogp.me/ns/book 302-redirects to http://graph.facebook.com/schema/og/book 
  (302 instead of 303 because they are hash URIs).  For information  
about Open Graph, see http://ogp.me and https://developers.facebook.com/docs/beta/opengraph/ 
  .  Please understand that the Graph API and the Open Graph are NOT  
the same thing.


STATUS OF FB LINKED DATA

These are just some of the features of the Facebook Graph API Linked  
Data.  I have been told that Facebook Linked Data is considered  
experimental and that continued support depends on the degree of use  
by developers.


I hope this was helpful, and I am happy to attempt to answer any  
questions.  Please understand, though, that I am not a Facebook  
employee; I only recently finished an internship there.


Regards,

Jesse Weaver
Ph.D. Student, Patroon Fellow
Tetherless World Constellation
Rensselaer Polytechnic Institute
http://www.cs.rpi.edu/~weavej3/index.xhtml

Received on Tuesday, 11 October 2011 21:36:01 UTC