Skip to content

Research: W3C Activity Streams Data Model

enderortak edited this page Feb 16, 2020 · 5 revisions

W3C Activity Streams Data Model

This specification details a model for representing potential and completed activities using the JSON format. It is intended to be used with vocabularies that detail the structure of activities, and define specific types of activities.

What is an Activity Stream?

Little "a" activity streams : are a UI paradigm for displaying recent activity within a context. Activities are typically displayed in reverse chronological order and consist of relatively simple statements such as "John uploaded a new photo" or "12 people liked Sally's post".

Big "A" Activity Streams : is a data format for encoding and transferring activity/event metadata. The first version of the specification was published in 2011 by the independent Activity Streams Working Group and is based on extending Atom. The current (2.0+) version of the spec is JSON-based.

Data Model

The Activity Streams 2.0 Core Syntax defines the JSON syntax for Activity Streams. This document defines the vocabulary properties.

The Activity Streams 2.0 Vocabulary defines a set of abstract types and properties that describe past, present and future Activities. The vocabulary is defined in two parts:

  1. A Core set of properties describing the generalized structure of an Activity; and
  2. An Extended set of properties that cover specific types of Activities and Artifacts common to many social Web application systems.

Core Types

Class Description Example
Object Describes an object of any kind. The Object type serves as the base type for most of the other kinds of objects defined in the Activity Vocabulary, including other Core types such as Activity, IntransitiveActivity, Collection and OrderedCollection. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object
Link A Link is an indirect, qualified reference to a resource identified by a URL. The fundamental model for links is established by [ RFC5988]. Many of the properties defined by the Activity Vocabulary allow values that are either instances of Object or Link. When a Link is used, it establishes a qualified relation connecting the subject (the containing object) to the resource identified by the href. Properties of the Link are properties of the reference as opposed to properties of the resource. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-link
Activity An Activity is a subtype of Object that describes some form of action that may happen, is currently happening, or has already happened. The Activity type itself serves as an abstract base type for all types of activities. It is important to note that the Activity type itself does not carry any specific semantics about the kind of action being taken. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-activity
IntransitiveActivity Instances of IntransitiveActivity are a subtype of Activity representing intransitive actions. The object property is therefore inappropriate for these activities. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-intransitiveactivity
Collection A Collection is a subtype of Object that represents ordered or unordered sets of Object or Link instances. Refer to the Activity Streams 2.0 Core specification for a complete description of the Collection type. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collection
OrderedCollection A subtype of Collection in which members of the logical collection are assumed to always be strictly ordered. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection
CollectionPage Used to represent distinct subsets of items from a Collection. Refer to the Activity Streams 2.0 Core for a complete description of the CollectionPage object. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collectionpage
OrderedCollectionPage Used to represent ordered subsets of items from an OrderedCollection. Refer to the Activity Streams 2.0 Core for a complete description of the OrderedCollectionPage object. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollectionpage

Extended Types

Activity Types

  • Accept
  • Add
  • Announce
  • Arrive
  • Block
  • Create
  • Delete
  • Dislike
  • Flag
  • Follow
  • Ignore
  • Invite
  • Join
  • Leave
  • Like
  • Listen
  • Move
  • Offer
  • Question
  • Reject
  • Read
  • Remove
  • TentativeReject
  • TentativeAccept
  • Travel
  • Undo
  • Update
  • View

Actor Types

  • Application
  • Group
  • Organization
  • Person
  • Service

Object and Link Types

  • Article
  • Audio
  • Document
  • Event
  • Image
  • Note
  • Page
  • Place
  • Profile
  • Relationship
  • Tombstone
  • Video
  • Mention

Properties

  • actor
  • attachment
  • attributedTo
  • audience
  • bcc
  • bto
  • cc
  • context
  • current
  • first
  • generator
  • icon
  • id
  • image
  • inReplyTo
  • instrument
  • last
  • location
  • items
  • oneOf
  • anyOf
  • closed
  • origin
  • next
  • object
  • prev
  • preview
  • result
  • replies
  • tag
  • target
  • to
  • type
  • url
  • accuracy
  • altitude
  • content
  • name
  • duration
  • height
  • href
  • hreflang
  • partOf
  • latitude
  • longitude
  • mediaType
  • endTime
  • published
  • startTime
  • radius
  • rel
  • startIndex
  • summary
  • totalItems
  • units
  • updated
  • width
  • subject
  • relationship
  • describes
  • formerType
  • deleted

Simple Example

EXAMPLE 1: Context with a string
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "summary": "A note",
  "type": "Note",
  "content": "My dog has fleas."
}
EXAMPLE 2: Context with an object
{
  "@context": {
     "@vocab": "https://www.w3.org/ns/activitystreams",
     "ext": "https://canine-extension.example/terms/",
     "@language": "en"
  },
  "summary": "A note",
  "type": "Note",
  "content": "My dog has fleas.",
  "ext:nose": 0,
  "ext:smell": "terrible"
}
EXAMPLE 3: Context with an array
{
  "@context": [
     "https://www.w3.org/ns/activitystreams",
     {
      "css": "http://www.w3.org/ns/oa#styledBy"
     }
  ],
  "summary": "A note",
  "type": "Note",
  "content": "My dog has fleas.",
  "css": "http://www.csszengarden.com/217/217.css?v=8may2013"
}
EXAMPLE 4: Basic activity with some additional detail
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "summary": "Martin added an article to his blog",
  "type": "Add",
  "published": "2015-02-10T15:04:55Z",
  "actor": {
   "type": "Person",
   "id": "http://www.test.example/martin",
   "name": "Martin Smith",
   "url": "http://example.org/martin",
   "image": {
     "type": "Link",
     "href": "http://example.org/martin/image.jpg",
     "mediaType": "image/jpeg"
   }
  },
  "object" : {
   "id": "http://www.test.example/blog/abc123/xyz",
   "type": "Article",
   "url": "http://example.org/blog/2011/02/entry",
   "name": "Why I love Activity Streams"
  },
  "target" : {
   "id": "http://example.org/blog/",
   "type": "OrderedCollection",
   "name": "Martin's Blog"
  }
}

Complete Example

EXAMPLE 4: IBM Connections
{
    "startIndex": 0,
    "totalResults": 1,
    "entry": [
        {
        "published": "2011-11-21T15:14:06.508Z",
        "url": "http://www.example.org/connections/opensocial/rest/activitystreams/@me/@all/@all/86c62a05-61de-4658-97a7-16e7ccf72e78",
        "target": {
            "summary": "Top App Entry",
            "replies": {
                "items": [{
                    "content": "This was my first comment",
                    "author": {
                        "objectType": "person",
                        "id": "12345678-8f0a-1028-xxxz-db07163b51b2",
                        "displayName": "Joe Blogs"
                    },
                    "updated": "2011-11-21T15:13:59.999Z",
                    "id": "f8f0e93f-e462-4ede-92cc-f6e8a1b7eb36"
                 },
                 {
                    "content": "This was another comment",
                    "author": {
                        "objectType": "person",
                        "id": "12345678-8f0a-1028-xxxy-db07163b51b2",
                        "displayName": "Jane Doe"
                    },
                    "updated": "2011-11-21T15:14:06.508Z",
                    "id": "5369ea82-d791-46cb-a87a-3696ff90d8f3"
                 }],
                "totalItems": 0
            },
            "embed": {
                "gadget": "http://www.example.org/greatgadgets/TopApp.xml",
                "context": {
                    "summary": "Test ",
                    "topAppUrl": "http://www.example.org/topapp/atom/1028-xxxx-db07163b51b2",
                }
            },
            "objectType": "note",
            "author": {
                "id": "12345678-8f0a-1028-xxxx-db07163b51b2",
                "displayName": "Joseph Bloggs"
            },
            "updated": "2011-11-21T15:08:44.321Z",
            "id": "87d7a7fb-af22-403b-ab0d-d101d9caac4f",
            "displayName": "Joseph Bloggs",
            "published": "2011-11-21T15:08:44.321Z",
            "url": "http://www.example.org/topapp/1028-xxxx-db07163b51b2"
        },
        "provider": {
            "id": "http://www.ibm.com/xmlns/prod/sn",
            "displayName": "IBM Connections - News Service",
            "url": "http://www.example.org/news"
        },
        "generator": {
            "image": {
                "url": "http://www.example.org/topapp/images/icon.png"
            },
            "id": "topapp",
            "displayName": "Top Application",
            "url": "http://www.example.org/topapp"
        },
        "actor": {
            "id": "12345678-8f0a-1028-xxxx-db07163b51b2",
            "displayName": "Joseph Bloggs"
        },
        "connections": {
            "actionable": "false",
            "broadcast": "true",
            "rollupid": "87d7a7fb-af22-403b-ab0d-d101d9caac4f",
            "saved": "false",
            "canUnFollow": "true"
        },
        "title": "Joseph Bloggs commented on their own Top App entry.",
        "content": "<span class=\"vcard\"><a class=\"fn url\" title=\"This is a link to the profile of Joseph Bloggs.\" href=\"http://www.example.org/profiles/html/profileView.do?userid=12345678-8f0a-1028-xxxx-db07163b51b2\"><span class=\"photo\" src=\"http://www.example.org/profiles/photo.do?userid=12345678-8f0a-1028-xxxx-db07163b51b2\" alt=\"This is a photo of Joseph Bloggs.\" style=\"display : none\"></span>Joseph Bloggs</a><span class=\"x-lconn-userid\" style=\"display : none\">12345678-8f0a-1028-xxxx-db07163b51b2</span></span> commented on their own Top App entry.",
        "id": "urn:lsid:ibm.com:activitystreams:86c62a05-61de-4658-97a7-16e7ccf72e78",
        "updated": "2011-11-21T15:14:07.024Z",
        "object": {
            "summary": "This was my first comment",
            "objectType": "comment",
            "author": {
                "id": "12345678-8f0a-1028-xxxx-db07163b51b2",
                "displayName": "Joseph Bloggs"
            },
            "id": "5369ea82-d791-46cb-a87a-3696ff90d8f3",
            "url": "http://www.example.org/topapp/1028-xxxx-db07163b51b2/comments/1"
        },
        "verb": "post"
    }],
    "itemsPerPage": 1
}

References

Clone this wiki locally