Re: Twitter Annotations API

Hi Manu,

This is interesting...and it's exactly the sort of thing I had in mind
when pushing:

* tokenising the semantic web [1], and;
* a JSON version of RDFa (RDFj [2]).

As Raffi says in the video:

  "It's really hard to make RDF look right in JSON."

And that's really the problem they are trying to address.

The key thing you need here is a JSON definition of a profile. This is
how I did it with RDFj:

  {
    "context": {
      "token": {
        "name": "http://xmlns.com/foaf/0.1/name",
        "site": "http://xmlns.com/foaf/0.1/homepage"
      }
    },
    "a": "<http://xmlns.com/foaf/0.1/Person>",
    "name": "Anna Wilder",
    "site": "<http://example.org/about>"
  }

Note that the idea is that a context can exist independently of the
data, so that it can be passed to functions, etc., to guide
processing:

  var context = {
    "token": {
      "name": "http://xmlns.com/foaf/0.1/name",
      "site": "http://xmlns.com/foaf/0.1/homepage"
    }
  };

  interpretSomeDataMaybeFromTwitterAPI( context );

In the Twitter context, the API could return the properties in much
the same way as they have proposed, but it would also include  a
profile which indicates how to 'decode' the tokens as URIs. So to take
their example, but in RDFj (using your tokens), we'd have either this:

  {
    "context": {
      "token": {
        "episode": "http://purl.org/dc/terms/title",
        "series": "http://twitter.com/vocab#tv-series",
        "air-date": "http://twitter.com/vocab#air-date"
      }
    },
    "a": "tv-episode",
    "episode": "The Vampires of Venice",
    "series": "Dr. Who",
    "air-date": "20100508",
  }

or this:

  {
    "a": "tv-episode",
    "http://purl.org/dc/terms/title": "The Vampires of Venice",
    "http://twitter.com/vocab#tv-series": "Dr. Who",
    "http://twitter.com/vocab#air-date": "20100508",
  }

(Note that an RDFj context/profile can also includes things like
'base' to set a base URL against which to resolve relative paths.)

I realise that in the RDFa 1.1 discussion everyone was pretty adamant
that JSON profiles should be avoided, but I think it would be timely
to reopen this. The whole point of them was to define the bit that
I've called 'context' in the examples above, and to create exactly the
scenarios that we're talking about here.


Finally, as a complete aside, here's a demo of embedding rich media in
Tweets, which uses a combination of RDFa to create the UI, and
'Compact HTML' to embed the metadata:

  <http://ubiquity-rdfa.googlecode.com/svn/tags/0.7.2/_samples/compact-html.html>

It's related to what the Twitter guys are trying to do (allow
applications to enhance Tweets with other 'stuff'), although it puts
the information that drives the enhancement inline in the Tweet, as
described here:

  <http://webbackplane.com/mark-birbeck/2008/11/compact-html>

Regards,

Mark

[1] <http://webbackplane.com/mark-birbeck/blog/2009/04/30/tokenising-the-semantic-web>
[2] <http://code.google.com/p/backplanejs/wiki/Rdfj>


On Sun, May 9, 2010 at 2:46 PM, Manu Sporny <msporny@digitalbazaar.com> wrote:
> Twitter is going to launch an annotations API soon (#twannotations), it
> looks like this:
>
> http://mehack.com/extremely-preliminary-look-at-twitters-annota
>
> Some of you might be saying "Hey, that looks a great deal like RDF/RDFa"
> and you would be right. They even say that it is RDF inspired, but then
> say why RDF doesn't fit their use case (without realizing that RDF is
> just a data model and doesn't have anything to do with timestamps or
> OAuth). I've sent a quick ping out to the Twitter API development team
> about this, but here's how it might work.
>
> This is what they have right now:
>
> [{"tv episode"} => {"episode" => "The Vampires of Venice",
>                    "series" => "Dr. Who",
>                    "air date" => "8 May 2010"}}]
>
> but why not this:
>
> [{"twitter:tv-episode"} => {"dcterms:title" => "The Vampires of Venice",
>                           "twitter:tv-series" => "Dr. Who",
>                           "twitter:air-date" => "20100508"}}]
>
> It looks like this as triples:
>
> _:twitter-bnode0
>   <http://purl.org/dc/terms/title>
>      "The Vampires of Venice" ;
>   <http://twitter.com/vocab#tv-series>
>      "Dr. Who" ;
>   <http://twitter.com/vocab#air-date>
>      "20100508" .
>
> The assumption is that Twitter would pre-declare a number of
> vocabularies one could use in their Twitter API. dcterms and twitter are
> assumed above, but there's no reason Twitter couldn't pre-declare even
> more vocabularies that people could use for tweets.
>
> This doesn't actually require them to change their Twannotations
> system... it just requires the developer community to organize around
> pre-declared vocabularies. Serializing Twannotations to HTML+RDFa is
> just a matter of expanding the vocabularies into full URIs.
>
> It would involve very minimal effort on Twitter's side - all they would
> have to do would be to publish a document that states the vocabularies
> that Twitter supports. It could even be an RDFa Profile. Twitter (and
> anybody that publishes Twitter data) could then publish HTML+RDFa to
> express the data in their pages. They already use XHTML Strict... the
> jump to XHTML+RDFa would be very easy.
>
> It's so close, seems like there is a big opportunity for both Twitter
> and the RDFa Community here... what do all of you think?
>
> -- manu
>
> --
> Manu Sporny (skype: msporny, twitter: manusporny)
> President/CEO - Digital Bazaar, Inc.
> blog: PaySwarming Goes Open Source
> http://blog.digitalbazaar.com/2010/02/01/bitmunk-payswarming/
>
>

Received on Sunday, 9 May 2010 15:31:27 UTC