W3C home > Mailing lists > Public > public-vocabs@w3.org > June 2012

Re: OGP/schema.org mappings

From: Jesse Weaver <weavej3@rpi.edu>
Date: Tue, 19 Jun 2012 11:39:45 -0400
Message-Id: <2BE3175C-7CDE-4315-8AE7-5A91942CE1C2@rpi.edu>
To: public-vocabs@w3.org
Hi Dan.

Someone pointed me to your email on this mailing list, and it seems  
like I can be of help.  Sorry for the late response.  For a quick  
answer to your question about finding OGP/Facebook-related schema,  
skip to the end of this email and read the conclusion.  Everything in  
between is explanation and details.

What I want to say in this email is that there are three different  
things in the overlap of Facebook and RDF: the Open Graph Protocol,  
the Custom Open Graph, and the Graph API.  These three things are not  
the same.  Often, people mistakenly refer to all RDF stuff related to  
Facebook as the Open Graph Protocol.  Below is a description of how  
these three things relate to RDF, and how their RDF can be found.


At http://ogp.me/ns (when requesting text/turtle or application/rdf 
+xml), you are served up one of the ogp.me.* files found at https://github.com/facebook/open-graph-protocol/tree/master/ns 
  .  These files contain the stand-alone, highest-level parts of the  
OGP schema (or ontology, whichever you want to call it).  Most RDFers  
are sufficiently familiar with this.


Then, there is something called Custom Open Graph (COG), which is an  
extension of OGP by Facebook.  From a strict RDF standpoint, this  
contributes more specific properties for use in meta tags, all which  
are listed here: https://developers.facebook.com/docs/opengraph/objects/builtin/ 
  .  The terminology is a bit confusing for RDFers, though.  For  
example, there is a book "object" type with associated properties  
book:release_date, book:author, book:isbn, and book:tag.  However, the  
meta tags used for describing a book result in RDF triples like:

@prefix book: <http://ogp.me/ns/book#> .
@prefix og: <http://ogp.me/ns#> .
<> og:type "book" ;
    book:release_date "2012-06-19" ;
    book:author "John Doe" .

In other words, although we are talking about a book, there is not  
rdf:type triple saying that it is a book, nor is there any URI  
representing the concept of a book.  Instead, og:type is used to  
specify a literal which indicates the instance type.  However, if you  
ask for text/turtle from a COG namespace, e.g., http://ogp.me/ns/ 
book , you will be 302 redirected to http://graph.facebook.com/schema/og/book 
  .  Here you will find basic specifications of the book properties,  
as well as a URI for the book class.  (Also included are the basic OGP  
URIs.)  Here is the book-specific portion of the document (with common  
prefix declarations implied):

@prefix api-book: <http://graph.facebook.com/schema/opengraphobject/book# 
 > .
@prefix book: <http://ogp.me/ns/book#> .
@prefix opengraphobject: <http://graph.facebook.com/schema/opengraphobject# 
 > .
opengraphobject:type a rdfs:Class ;
    rdfs:label "opengraphobject" .
api-book:book a rdfs:Class ;
    rdfs:label "book" ;
    rdfs:subClassOf opengraphobject:type .
book:author a rdf:Property ;
    rdfs:label "author" .
book:isbn a rdf:Property ;
    rdfs:label "isbn" .
book:release_date a rdf:Property ;
    rdfs:label "release_date" .
book:tag a rdf:Property ;
    rdfs:label "tag" .

The class api-book:book is not really documented anywhere except here,  
and it was created with RDFers in mind.  Although not mentioned here,  
it could be said that

api-book:book owl:equivalentClass [ a owl:Restriction; owl:onProperty  
og:type; owl:hasValue "book" . ]  .
book:author rdfs:domain api-book:book .
book:isbn rdfs:domain api-book:book .
book:release_date rdfs:domain api-book:book .
book:tag rdfs:domain api-book:book .

In hindsight, I wish I had included such triples since they make  
explicit the relationship of the class URI with what actually appears  
in the meta tags (RDFa).

(Just FYI, note that http://ogp.me/ns/article is currently broken.)

So far, I have talked about so-called "built-in objects."  These are  
the things in COG that are directly supported by Facebook.  However,  
Facebook apps can also define their own objects (see https://developers.facebook.com/docs/opengraph/define-objects/ 
  ).  I will not venture to discuss that here, primarily because I  
can't find an example app with which to make illustrations.

=== GRAPH API ===

Now you did not seem to ask about the Graph API, but since people  
commonly conflate OGP and the Graph API (or at least, the RDF served  
from it), I cannot be certain that it is not related to your question.

It is important to understand the distinction between OGP and the  
Graph API.  OGP is a standard way of describing pages on the web so  
that they can be integrated into Facebook's social graph.  Note,  
however, that Facebook's social graph contains things that are  
strictly internal.  Access to these things (respecting permissions) is  
provided via the Graph API.

Traditionally, the Graph API provided only JSON, but as of September  
2011, it also provides Turtle in which the HTTP(S) URIs are  
dereferenceable.  Some of the classes are documented at https://developers.facebook.com/docs/reference/api/ 
  , but without mention of RDF.  However, the convention for finding  
the RDF is simple.  For class <classname>, relevant data can be found  
at http://graph.facebook.com/schema/<classname> .  For example, here  
is a portion of the schema for the user class (with common prefix  
declarations implied):

@prefix : <http://graph.facebook.com/schema/~/> .
@prefix user: <http://graph.facebook.com/schema/user#> .
user:type a rdfs:Class ;
    rdfs:label "user" .
user:id a owl:DatatypeProperty ;
    a owl:InverseFunctionalProperty ;
    rdfs:label "id" ;
    rdfs:comment "The user's Facebook ID.  No `access_token`  
required.  `string`." ;
    rdfs:domain user:type ;
    rdfs:range xsd:string ;
    rdfs:subPropertyOf :id .
user:name a rdf:Property ;
    rdfs:label "name" ;
    rdfs:comment "The user's full name. No `access_token` required.  
`string`." ;
    rdfs:domain user:type ;
    rdfs:subPropertyOf :name .
user:friends a owl:ObjectProperty ;
    rdfs:label "friends" ;
    rdfs:comment "The user's wall." ;
    rdfs:domain user:type ;
    rdfs:subPropertyOf :feed .


In short, be sure not to confuse the OGP, the COG, and the Graph API.   
This is hard not to do since COG is an extension of the OGP for which  
dereferencing of URIs is supported by the Graph API.  The three are  
related, but not the same.

To find schema for OGP, ask for application/rdf+xml or text/turtle  
from http://ogp.me/ns .

To find schema for a COG object type <typename>, ask for text/turtle  
from http://ogp.me/ns/<typename> .  A list of built-in (i.e., Facebook- 
supported) COG object types can be found at https://developers.facebook.com/docs/opengraph/objects/builtin/ 

To find schema for internal Facebook type <typename>, ask for text/ 
turtle from http://graph.facebook.com/schema/<typename> .  A list of  
internal Facebook types can be found at https://developers.facebook.com/docs/reference/api/ 

I hope this was helpful.

Jesse Weaver
Ph.D. Student, Patroon Fellow
Tetherless World Constellation
Rensselaer Polytechnic Institute
Received on Tuesday, 19 June 2012 15:40:48 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:48:46 UTC