alct / noapi

Get structured information out of online services.
GNU General Public License v3.0
6 stars 1 forks source link

Use ActivityStreams 2.0 to describe data #1

Open paulcmal opened 8 years ago

paulcmal commented 8 years ago

Why not use Activity Streams 2.0 to represent the data extracted from silos?

Activity Streams 2.0 is a Working Draft by the W3 Social Working Group, so it may in the long run become a W3C standard. It's based on the efforts of the RDFa and microformats communities to build a decentralized semantic social network on the web.

ActivityStreams is built around Activities, Actors and Objects.

Given the context, you can return any Activity, Object or Actor, or mix them up.

As shown in the docs, an actor can be represented like this:

{
  "@context": "http://www.w3.org/ns/activitystreams",
  "type": "Person",
  "name": "Shirley Upperson"
  "url": "https://twitter.com/example"
  "summary": "Privacy matters. Piracy, too."
  …
}

See also an example activity.

I think when adding more silo backends (like for Facebook, Diaspora, Movim), you're going to need some standard data structure to make noapi easily implementable and maintainable. There's many different proposals out there to do just this (Indieweb-flavored microformats2 is worth taking a look), but I think Activity Streams is quite easy to dive in and portable (JSON-LD).

Also worth noting: the W3 Social WG is working on ActivityPub as a standard PUBSUB protocol for sharing ActivityStreams interactions between websites, for notifications/reshares, that is what we currently do with webmentions.

paulcmal commented 8 years ago

Actually, a working draft was just released for JF2, a JSON representation of microformats2.

An example taken from the draft:

{
  "type": "entry",
  "published": "2015-10-20T15:49:00-0700",
  "url": "http://example.com/like/r23eugi02c",
  "author": {
    "type": "card",
    "name": "Alice",
    "url": "http://alice.example.com",
    "photo": "http://alice.example.com/photo.jpg"
  },
  "like-of": "http://bob.example.com/post/100",
  "category": ["Likes", "Posts"],
  "references": {
    "http://bob.example.com/post/100": {
      "type": "entry",
      "published": "2015-10-18T12:33:00-0700",
      "url": "http://bob.example.com/post/100",
      "author": "http://bob.example.com",
      "name": "My First Post",
      "content": "This is my first post on my new blog, I hope you like it"
    },
    "http://bob.example.com": {
      "type": "card",
      "name": "Bob",
      "url": "http://bob.example.com",
      "photo": "http://bob.example.com/mypicture.jpg"
    }
  }
}

Although simpler than ActivityStreams, it's incredibly powerful due to the mapping to microformats.

What do you think?