CARVIEW |
Activity Streams 2.0
W3C Working Draft
- This version:
- https://www.w3.org/TR/2015/WD-activitystreams-core-20150129/
- Latest published version:
- https://www.w3.org/TR/activitystreams-core/
- Latest editor's draft:
- https://jasnell.github.io/w3c-socialwg-activitystreams/activitystreams2.html
- Previous version:
- https://www.w3.org/TR/2014/WD-activitystreams-core-20141023/
- Editor:
- James M Snell, IBM
- Repository:
- Github
- Issues
- Commits
Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.
Abstract
This specification details a model for representing potential and completed activities using the JSON format.
Author's Note
This section is non-normative.
This draft is heavily influenced by the JSON Activity Streams 1.0 specification originally co-authored by Martin Atkins, Will Norris, Chris Messina, Monica Wilkinson, Rob Dolin and James Snell. The author is very thankful for their significant contributions and gladly stands on their shoulders. Some portions of the original text of Activity Streams 1.0 are used in this document.
Status of This Document
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.
This document was published by the Social Web Working Group as a Working Draft. This document is intended to become a W3C Recommendation. If you wish to make comments regarding this document, please send them to public-socialweb@w3.org (subscribe, archives). All comments are welcome.
Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This document is governed by the 1 August 2014 W3C Process Document.
Table of Contents
1. Introduction
In the most basic sense, an "Activity" is a semantic description of a completed or ongoing action. It is the goal of this specification to provide a JSON-based syntax that is sufficient to express metadata about activities in a rich, human-friendly but machine-processable and extensible manner. This can include constructing natural-language descriptions or visual representations about the activity, associating actionable information with various types of objects, communicating or recording activity logs, or delegation of potential actions to other applications.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
1.1 Relationship to JSON Activity Streams 1.0
This section is non-normative.
The JSON Activity Streams 1.0 [AS1] specification was published in May of 2011 and provided a baseline extensible syntax for the expression of completed activities. This specification builds upon that initial foundation by incorporating lessons learned through extensive implementation, community feedback and related ongoing work from a variety of other communities.
While the syntax defined by this specification diverges from that defined by JSON Activity Streams 1.0, the fundamental model defined by that original specification remains intact. Specific processing rules are defined by this specification that allow existing Activity Streams 1.0 documents to be mapped to and processed as an Activity Streams 2.0 document.
This specification incorporates several existing extensions to the 1.0 syntax directly into the 2.0 model. These include portions of the Activity Streams 1.0 Base Schema, Audience Targeting, Responses, and Priority extensions.
1.2 Serialization Notes
This specification describes a JSON-based [RFC7159] serialization syntax for the Activity Vocabulary that follows the conventions defined by the [JSON-LD] specification. While serialization forms other than JSON-LD are possible, alternatives are not discussed by this document.
When serialized, absent properties are represented by either (a) setting the property value to null, or (b) by omitting the property declaration altogether at the option of the publisher; these representations are semantically equivalent. If a property has an array value, the absence of any items in that array MUST be represented by omitting the property entirely or by setting the value to null. The appropriate interpretation of an omitted or explicitly null value is that no value has been assigned as opposed to the view that the given value is empty or nil.
This specification uses IRIs [RFC3987]. Every URI [RFC3986] is also an IRI, so a URI may be used wherever an IRI is named. There are two special considerations: (1) when an IRI that is not also a URI is given for dereferencing, it MUST be mapped to a URI using the steps in Section 3.1 of [RFC3987] and (2) when an IRI is serving as an "id" value, it MUST NOT be so mapped.
Unless otherwise specified, all properties with date and time values MUST conform to the "date-time" production in [RFC3339], with an uppercase "T" character used to separate date and time, and an uppercase "Z" character in the absence of a numeric time zone offset. All such timestamps SHOULD be represented relative to Coordinated Universal Time (UTC).
Activity Streams 2.0 documents MUST be serialized using the UTF-8 character encoding.
The serialized JSON form of an Activity Streams 2.0 document MUST be consistent with what would be produced by the standard JSON-LD 1.0 Processing Algorithms and API [JSON-LD-API] Compaction Algorithm using, at least, the normative JSON-LD @context definition provided here. Implementations MAY augment the provided @context with additional @context definitions but MUST NOT override or change the normative context. Implementations MAY also include in the serialized JSON document additional properties and values not defined in the JSON-LD @context with the understanding that any such properties will likely be unsupported and ignored by consuming implementations that use the standard JSON-LD algorithms. See the Extensibility section for more information on handling extensions within Activity Streams 2.0 documents.
2. Examples
This section is non-normative.
Following are three examples of activities with varying degrees of detail. Each of the examples uses an implied JSON-LD @context equal to that provided here.
Note that the Activity Streams JSON-LD @context maps the prefix "as:
" to the
base URI "https://www.w3.org/ns/activitystreams#
". This means that terms such
as "as:Activity
" are equivalent to the expanded form
"https://www.w3.org/ns/activitystreams#Activity
". In order to best illustrate
that implementors MUST support both forms, both the compact and expanded forms are used
interchangeably by the examples in this document.
2.1 Minimal Activity
'urn:example:person:martin' posted
'https://example.org/foo.jpg'
. No additional detail is given.
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Post", "actor": "urn:example:person:martin", "object": "https://example.org/foo.jpg" }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Post"> <link itemprop="actor" href="urn:example:person:martin">Martin</link> posted <a itemprop="object" href="https://example.org/foo.jpg"> "https://example.org/foo.jpg" </a> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Post"> <link property="actor" href="urn:example:person:martin">Martin</link> posted <a property="object" href="https://example.org/foo.jpg"> "https://example.org/foo.jpg" </a> </div>
<div class="h-as-post"> <link class="u-author" href="urn:example:person:martin">Martin</link> posted <a class="u-item" href="https://example.org/foo.jpg"> "https://example.org/foo.jpg" </a> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . _:c14n0 a as:Post ; as:actor <urn:example:person:martin> ; as:object <http://example.org/foo> .
2.2 Basic activity with some additional detail
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Post", "published": "2015-02-10T15:04:55Z", "actor": { "@type": "Person", "@id": "urn:example:person:martin", "displayName": "Martin Smith", "url": "https://example.org/martin", "image": { "@type": "Link", "href": "https://example.org/martin/image.jpg", "mediaType": "image/jpeg" } }, "object" : { "@id": "urn:example:blog:abc123/xyz", "@type": "Article", "url": "https://example.org/blog/2011/02/entry", "displayName": "Why I love Activity Streams" }, "target" : { "@id": "https://example.org/blog/", "@type": "urn:example:types:blog", "displayName": "Martin's Blog" } }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Post"> <div itemprop="actor" itemscope itemtype="https://www.w3.org/ns/activitystreams#Person" itemid="urn:example:person:martin"> <a itemprop="url" href="https://example.org/martin"> <span itemprop="displayName">Martin Smith</span> </a> <img itemprop="image" itemscope itemtype="https://www.w3.org/ns/activitystreams#Image" src="https://example.org/martin/image.jpg" type="image/jpeg" /> </div> Posted <div itemprop="object" itemscope itemtype="https://www.w3.org/ns/activitystreams#Article" itemid="urn:example:blog:abc123/xyz"> <a itemprop="url" href="https://example.org/blog/2011/02/entry"> "<span itemprop="displayName">Why I love Activity Streams</span>" </a> </div> To <div itemprop="target" itemscope itemtype="urn:example:types:blog" itemid="https://example.org/blog"> "<span itemprop="displayName">Martin's Blog</span>" </div> On <meta itemprop="published" content="2015-02-10T15:04:55Z"> February 10, 2015 at 03:04:55 UTC </meta> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Post"> <div property="actor" typeof="Person" resource="urn:example:person:martin"> <a property="url" href="https://example.org/martin"> <span property="displayName">Martin Smith</span> </a> <img property="image" typeof="Image" src="https://example.org/martin/image.jpg" type="image/jpeg" /> </div> Posted <div property="object" typeof="Article" resource="urn:example:blog:abc123/xyz"> <a property="url" href="https://example.org/blog/2011/02/entry"> "<span property="displayName">Why I love Activity Streams</span>" </a> </div> To <div property="target" typeof="urn:example:types:blog" resource="https://example.org/blog"> "<span property="displayName">Martin's Blog</span>" </div> On <meta property="published" content="2015-02-10T15:04:55Z"> February 10, 2015 at 03:04:55 UTC </meta> </div>
<div class="h-entry"> <div class="p-author h-card"> <meta class="p-as-id" name="id" content="urn:example:person:martin" /> <a class="u-url p-name" href="https://example.org/martin"> Martin Smith </a> <img class="u-photo" src="https://example.org/martin/image.jpg" type="image/jpeg" /> </div> Posted <div class="p-item h-entry"> <meta class="p-as-id" name="id" content="urn:example:blog:abc123/xyz" /> <a class="u-url p-name" href="https://example.org/blog/2011/02/entry"> "Why I love Activity Streams" </a> </div> To <div class="p-as-target h-entry"> <meta class="p-as-id" name="id" content="https://example.org/blog" /> "<span class="p-name">Martin's Blog</span>" </div> On <meta class="dt-published" name="published" content="2015-02-10T15:04:55Z"> February 10, 2015 at 03:04:55 UTC </meta> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <urn:example:person:martin> a as:Person ; as:displayName "Martin Smith" ; as:url <http://example.org/martin> ; as:image [ a as:Link ; as:href <http://example.org/martin/image.jpg> ; as:mediaType "image/jpeg" . ] . <http://example.org/blog/> a <"urn:example:types:blog"> ; as:displayName "Martin's Blog" . <urn:example:blog:abc123/xyz> a as:Article ; as:displayName "Why I love Activity Streams" ; as:url <http://example.org/blog/2011/02/entry> . _:c14n0 as as:Post ; as:published "2015-02-10T15:04:55Z"^^xsd:dateTime ; as:actor <urn:example:person:martin> ; as:object <urn:example:blog:abc123/xyz> ; as:target <http://example.org/blog/> .
2.3 An extended activity
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Collection", "totalItems": 1, "items" : [ { "@type": "Post", "published": "2011-02-10T15:04:55Z", "generator": "https://example.org/activities-app", "provider": "https://example.org/activity-stream", "displayNameMap": { "en": "Martin posted a new video to his album.", "ga": "Martin phost le fisean nua a albam." }, "actor": { "@type": "Person", "@id": "urn:example:person:martin", "displayName": "Martin Smith", "url": "https://example.org/martin", "image": { "@type": "Link", "href": "https://example.org/martin/image", "mediaType": "image/jpeg", "width": 250, "height": 250 } }, "object" : { "@type": "Image", "@id": "https://example.org/album/my_fluffy_cat", "preview": { "@type": "Link", "href": "https://example.org/album/my_fluffy_cat_thumb.jpg", "mediaType": "image/jpeg" }, "url": [ { "@type": "Link", "href": "https://example.org/album/my_fluffy_cat.jpg", "mediaType": "image/jpeg" }, { "@type": "Link", "href": "https://example.org/album/my_fluffy_cat.png", "mediaType": "image/png" } ] }, "target": { "@type": "Album", "@id": "https://example.org/album/", "displayNameMap": { "en": "Martin's Photo Album", "ga": "Grianghraif Mairtin" }, "image": { "@type": "Link", "href": "https://example.org/album/thumbnail.jpg", "mediaType": "image/jpeg" } } } ] }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Collection"> <meta itemprop="totalItems" content="1" /> <div itemprop="items" itemscope itemtype="https://www.w3.org/ns/activitystreams#Post"> <meta itemprop="published" content="2011-02-10T15:04:55Z" /> <link itemprop="generator" href="https://example.org/activities-app" /> <link itemprop="provider" href="https://example.org/activity-stream" /> <div itemprop="displayName" lang="en"> Martin posted a new video to his album. </div> <div itemprop="displayName" lang="ga"> Martin posted a new video to his album. </div> <div itemprop="actor" itemscope itemtype="https://www.w3.org/ns/activitystreams#Person" itemid="urn:example:person:martin"> <div itemprop="displayName"> <a itemprop="url" href="https://example.org/martin">Martin Smith</a> </div> <img itemprop="image" itemscope itemtype="https://www.w3.org/ns/activitystreams#Link" src="https://example.org/martin/image" type="image/jpeg" height="250" width="250" /> </div> <div itemprop="object" itemscope itemtype="https://www.w3.org/ns/activitystreams#Image" itemid="https://example.org/album/my_fluffy_cat"> <img itemprop="preview" itemscope itemtype="https://www.w3.org/ns/activitystreams#Link" src="https://example.org/album/my_fluffy_cat_thumb.jpg" type="image/jpeg" /> <a itemprop="url" itemscope itemtype="https://www.w3.org/ns/activitystreams#Link" href="https://example.org/album/my_fluffy_cat.jpg" type="image/jpeg">JPG</a> | <a itemprop="url" itemscope itemtype="https://www.w3.org/ns/activitystreams#Link" href="https://example.org/album/my_fluffy_cat.png" type="image/png">PNG</a> </div> <div itemprop="target" itemscope itemtype="https://www.w3.org/ns/activitystreams#Album" itemid="https://example.org/album/"> <div itemprop="displayName" lang="en"> Martin's Photo Album </div> <div itemprop="displayName" lang="ga"> Grianghraif Mairtin </div> <img itemprop="image" itemscope itemtype="https://www.w3.org/ns/activitystreams#Link" href="https://example.org/album/thumbnail.jpg" type="image/jpeg" /> </div> </div> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Collection"> <meta property="totalItems" content="1" /> <div property="items" typeof="Post"> <meta property="published" content="2011-02-10T15:04:55Z" /> <link property="generator" href="https://example.org/activities-app" /> <link property="provider" href="https://example.org/activity-stream" /> <div property="displayName" lang="en"> Martin posted a new video to his album. </div> <div property="displayName" lang="ga"> Martin posted a new video to his album. </div> <div property="actor" typeof="Person" resource="urn:example:person:martin"> <div property="displayName"> <a property="url" href="https://example.org/martin">Martin Smith</a> </div> <img property="image" typeof="Link" src="https://example.org/martin/image" type="image/jpeg" height="250" width="250" /> </div> <div property="object" typeof="Image" resource="https://example.org/album/my_fluffy_cat"> <img property="preview" typeof="Link" src="https://example.org/album/my_fluffy_cat_thumb.jpg" type="image/jpeg" /> <a property="url" typeof="Link" href="https://example.org/album/my_fluffy_cat.jpg" type="image/jpeg">JPG</a> | <a property="url" typeof="Link" href="https://example.org/album/my_fluffy_cat.png" type="image/png">PNG</a> </div> <div property="target" typeof="Album" resource="https://example.org/album/"> <div property="displayName" lang="en"> Martin's Photo Album </div> <div property="displayName" lang="ga"> Grianghraif Mairtin </div> <img property="image" typeof="Link" href="https://example.org/album/thumbnail.jpg" type="image/jpeg" /> </div> </div> </div>
<div class="h-as-collection"> <meta class="p-as-total-items" name="totalItems" content="1" /> <div class="p-as-items h-as-post"> <meta class="dt-published" name="published" content="2011-02-10T15:04:55Z" /> <link class="u-as-generator" href="https://example.org/activities-app" /> <link class="u-as-provider" href="https://example.org/activity-stream" /> <div class="p-name" lang="en"> Martin posted a new video to his album. </div> <div class="p-name" lang="ga"> Martin posted a new video to his album. </div> <div class="p-author h-card"> <meta class="p-as-id" name="id" content="urn:example:person:martin" /> <div class="p-name"> <a class="u-url" href="https://example.org/martin">Martin Smith</a> </div> <img class="u-photo" src="https://example.org/martin/image" type="image/jpeg" height="250" width="250" /> </div> <div class="p-item h-entry"> <meta class="p-as-id" name="id" content="https://example.org/album/my_fluffy_cat" /> <img class="u-preview" src="https://example.org/album/my_fluffy_cat_thumb.jpg" type="image/jpeg" /> <a class="u-url" href="https://example.org/album/my_fluffy_cat.jpg" type="image/jpeg">JPG</a> | <a class="u-url" typeof="Link" href="https://example.org/album/my_fluffy_cat.png" type="image/png">PNG</a> </div> <div class="p-as-target h-entry" <meta class="p-as-id" name="id" content="https://example.org/album/" /> <div class="p-name" lang="en"> Martin's Photo Album </div> <div class="p-name" lang="ga"> Grianghraif Mairtin </div> <img class="u-photo" href="https://example.org/album/thumbnail.jpg" type="image/jpeg" /> </div> </div> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <urn:example:person:martin> a as:Person ; as:displayName "Martin Smith" ; as:url <http://example.org/martin> ; as:image [ a as:Link ; as:href <http://example.org/martin/image> ; as:mediaType "image/jpeg" ; as:width "250"^^xsd:nonNegativeInteger ; as:height "250"^^xsd:nonNegativeInteger . ] . <http://example.org/album/my_fluffy_cat> a as:Image ; as:preview [ a as:Link ; as:href <http://example.org/album/my_fluffy_cat_thumb.jpg> ; as:mediaType "image/jpeg" . ] ; as:url ( [ a as:Link ; as:href <http://example.org/album/my_fluffy_cat.jpg> ; as:mediaType "image/jpeg" . ] [ a as:Link ; as:href <http://example.org/album/my_fluffy_cat.png> ; as:mediaType "image/png" . ] ) . <http://example.org/album/> a as:Album ; as:displayName "Martin's Photo Album"@en ; as:displayName "Grianghraif Mairtin"@ga ; as:image [ a as:Link ; as:href <http://example.org/album/thumbnail.jpg> ; as:mediaType "image/jpeg" . ] . _:c14n0 a as:Collection ; as:totalItems "1"^^xsd:nonNegativeInteger ; as:items [ a as:Post ; as:published "2011-02-10T15:04:55Z"^^xsd:dateTime ; as:generator <http://example.org/activities-app> ; as:provider <http://example.org/activity-stream> ; as:displayName "Martin posted a new video to his album"@en ; as:displayName "Martin phost le fisean nua a albam."@ga ; as:actor <urn:example:person:martin> ; as:object <http://example.org/album/my_fluffy_cat> ; as:target <http://example.org/album/> ] .
3. Model
The Activity Vocabulary defines the abstract model for Activity Streams 2.0. The vocabulary is segmented into a one set of six core class and an extended set of Activity and Object types common to most "Social" Web applications. The core classes include: Object, Link, Actor, Activity, Collection and OrderedCollection. Each of these classes is described and illustrated below. The extended Activity and Object types are defined normatively in the Activity Vocabulary specification.
3.1 Object
The Object
class is the primary base class for the Activity Streams vocabulary.
In addition to having a global identifier in the form of an absolute IRI
using the JSON-LD @id
keyword, and an "object type" (expressed
using the JSON-LD @type
keyword), all instances of the Object
class share a common set of properties as defined by the
Activity Vocabulary. These include:
alias
|
attachedTo
|
attachment
|
attributedTo
|
attributedWith
|
content
|
context
|
contextOf
|
contentMap
|
displayName
|
displayNameMap
|
endTime
|
generator
|
generatorOf
|
icon
|
image
|
inReplyTo
|
memberOf
|
location
|
locationOf
|
originOf
|
objectOf
|
preview
|
previewOf
|
provider
|
providerOf
|
published
|
rating
|
resultOf
|
replies
|
scope
|
scopeOf
|
startTime
|
summary
|
summaryMap
|
tag
|
tagOf
|
targetOf
|
title
|
titleMap
|
updated
|
url
Previous versions of the Activity Streams format used the objectType
property to identify the action type. The objectType
property MUST NOT
be used within an Activity Streams 2.0 document to represent object type.
While all properties are optional, all Object
instances SHOULD
at least contain either displayName
or displayNameMap
.
@id
and @type
JSON-LD keywords to express the global identifier and object type:{ "@context": "https://www.w3.org/ns/activitystreams", "@id": "https://example.org/foo", "@type": "Note", "displayName": "This is a note", "attributedTo": { "@id": "urn:example:person:joe", "@type": "Person", "displayName": "Joe Smith" }, "published": "2014-08-21T12:34:56Z" }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Note" itemid="https://example.org/foo"> <div itemprop="displayName">This is a note</div> <div itemprop="attributedTo" itemscope itemtype="https://www.w3.org/ns/activitystreams#Person" itemid="urn:example:person:joe"> <span itemprop="displayName">Joe Smith</span> </div> <div itemprop="published">2014-08-21T12:34:56Z</div> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Note" resource="https://example.org/foo"> <div property="displayName">This is a note</div> <div property="attributedTo" typeof="Person" resource="urn:example:person:joe"> <span property="displayName">Joe Smith</span> </div> <div property="published">2014-08-21T12:34:56Z</div> </div>
<div class="h-entry"> <meta class="p-as-id" name="id" content="https://example.org/foo" /> <div class="p-name">This is a note</div> <div class="p-author h-card"> <meta class="p-as-id" name="id" content="urn:example:person:joe" /> <span class="p-name">Joe Smith</span> </div> <div class="dt-published">2014-08-21T12:34:56Z</div> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <urn:example:person:joe> a as:Person ; as:displayName "Joe Smith" . <http://example.org/foo> a as:Note ; as:displayName "This is a note" ; as:attributedTo <urn:example:person:joe> ; as:published "2014-08-21T12:34:56Z"^^xsd:dateTime .
Implementations MUST treat all object types in an Activity Streams document as subclasses of Object unless the object is a Link.
actor
is
considered to be an instance of Object while the value of object
is not:{ "@context": "https://www.w3.org/ns/activitystreams", "@id": "https://example.org/foo", "@type": "Share", "displayName": "A Test", "actor": { "@type": "Person", "@id": "https://example.org/~sally", "displayName": "Sally" }, "object": { "@type": "Link", "href": "https://example.org/posts/1" } }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Share" itemid="https://example.org/foo"> <div itemprop="displayName">A Test</div> <div itemprop="actor" itemscope itemtype="https://www.w3.org/ns/activitystreams#Person" itemid="https://example.org/~sally"> <span itemprop="displayName">Sally</span> </div> <a itemprop="object" itemscope itemtype="https://www.w3.org/ns/activitystreams#Link" href="https://example.org/posts/1"> https://example.org/posts/1 </a> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Share" resource="https://example.org/foo"> <div property="displayName">A Test</div> <div property="actor" itemscope typeof="Person" resource="https://example.org/~sally"> <span property="displayName">Sally</span> </div> <a property="object" itemscope typeof="Link" href="https://example.org/posts/1"> https://example.org/posts/1 </a> </div>
<div class="h-as-share"> <meta class="p-as-id" name="id" content="https://example.org/foo" /> <div class="p-name">A Test</div> <div class="p-author h-card" <meta class="p-as-id" name="id" content="https://example.org/~sally" /> <span class="p-name">Sally</span> </div> <a class="u-share-of" href="https://example.org/posts/1"> https://example.org/posts/1 </a> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://example.org/~sally> a as:Person ; as:displayName "Sally" . <http://example.org/foo> a as:Share ; as:displayName "A Test" ; as:actor <http://example.org/~sally> ; as:object [ a as:Link ; as:href <http://example.org/posts/1> . ] .
The Activity Vocabulary defines a broad
range of Object
types that are common to many "Social" Web applications.
This specification stops short of defining semantically specific properties for most
of these objects. External vocabularies can be used to express additional detail not
covered by the Activity Vocabulary.
Furthermore, while implementations are free to introduce new types of Objects beyond those
defined by the Activity Vocabulary, interoperability issues can arise when applications
rely too much on extension types that are not recognized by other implementations. Care
should be taken to not unduly overlap with or duplicate the existing Object types. For
instance, some vocabularies (e.g. The Good Relations Vocabulary) define their own classes
for describing locations. An implementation that wishes, for example, to use a
https://purl.org/goodrelations/v1#Location
as an Object SHOULD identify that
Object as being both a Place
and an
https://purl.org/goodrelations/v1#Location
, as
illustrated in the following:
Place
and a gr:Location
:{ "@context": [ "https://www.w3.org/ns/activitystreams", { "gr": "https://purl.org/goodrelations/v1#" } ], "@type": ["Place", "gr:Location"], "displayName": "Sally's Restaurant", "longitude": 12.34, "latitude": 56.78, "gr:category": "restaurants/french_restaurants" }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Place https://purl.org/goodrelations/v1#Location"> <div itemprop="displayName">Sally's Restaurant</div> At Longitude: <span itemprop="longitude">12.34</span>, Latitude: <span itemprop="latitude">56.78</span>. <meta itemprop="https://purl.org/goodrelations/v1#category" content="restaurants/french_restaurants" /> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Place https://purl.org/goodrelations/v1#Location"> <div property="displayName">Sally's Restaurant</div> At Longitude: <span property="longitude">12.34</span>, Latitude: <span property="latitude">56.78</span>. <meta property="https://purl.org/goodrelations/v1#category" content="restaurants/french_restaurants" /> </div>
<div class="h-geo"> <div class="p-name">Sally's Restaurant</div> At Longitude: <span class="p-longitude">12.34</span>, Latitude: <span class="p-latitude">56.78</span>. <meta name="category" content="restaurants/french_restaurants" /> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix gr: <http://purl.org/goodrelations/v1#> . _:c14n0 a as:Place, gr:Location ; as:displayName "Sally's Restaurant" ; as:longitude "12.34"^^xsd:float ; as:latitude "56.78"^^xsd:float ; gr:category "restaurants/french_restaurants" .
Certain properties defined by some External Vocabularies can overlap or duplicate those defined by the Activity Vocabulary. Where such overlap exists, for the sake of consistent interoperability, implementers MUST use the properties defined by the Activity Vocabulary.
3.2 Natural Language Values
Several properties defined by the Vocabulary are defined as having natural language values. These are representations of human-readable character sequences using one or more languages. Within the JSON-LD serialization, they are expressed as either (1) a single JSON string or (2) a JSON object mapping [RFC5646] Language-Tags to localized, equivalent translations of the same string value. In [JSON-LD], such constructs are referred to as "Language Maps". In the serialized JSON-LD, these two forms are differentiated using a simple property naming convention, for instance: "displayName
" identifies the JSON string form for the displayName
property while "displayNameMap
" represents the Language Map form.
{ "displayName": "This is the title" }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Object"> <div itemprop="displayName">This is the title</div> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Object"> <div property="displayName">This is the title</div> </div>
<div class="h-entry"> <div class="p-name">This is the title</div> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . _:c14n0 a as:Object ; as:displayName "This is the title" .
{ "displayNameMap": { "en": "This is the title", "fr": "C'est le titre", "sp": "Este es el titulo" } }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Object"> <div itemprop="displayName" lang="en">This is the title</div> <div itemprop="displayName" lang="fr">C'est le titre</div> <div itemprop="displayName" lang="sp">Este es el titulo</div> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Object"> <div property="displayName" lang="en">This is the title</div> <div property="displayName" lang="fr">C'est le titre</div> <div property="displayName" lang="sp">Este es el titulo</div> </div>
<div class="h-entry"> <div class="p-name" lang="en">This is the title</div> <div class="p-name" lang="fr">C'est le titre</div> <div class="p-name" lang="sp">Este es el titulo</div> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . _:c14n0 a as:Object ; as:displayName "This is the title"@en ; as:displayName "C'est le titre"@fr ; as:displayName "Este el el titulo"@sp .
Every key in the Language Map form MUST be a valid [RFC5646] Language-Tag. The associated values MUST be Strings.
The Activity Vocabulary defines
four specific natural language values:
displayName
,
title
,
summary
, and
content
.
Accordingly, the Activity Streams JSON-LD
@context definition respectively maps the terms "displayName
",
"title
", "summary
", and "content
" for representing
the JSON string forms and the terms "displayNameMap
", "titleMap
",
"summaryMap
", and "contentMap
" for representing the Language Map
forms.
The default language for document or an individual object can be established
using the JSON-LD @language
keyword within a @context
definition. For instance:
{ "@context": [ "https://www.w3.org/ns/activitystreams", {"@language": "en"} ], "displayName": "This is the title" }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Object" lang="en"> <div itemprop="displayName">This is the title</div> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Object" lang="en"> <div property="displayName">This is the title</div> </div>
<div class="h-entry" lang="en"> <div class="p-name">This is the title</div> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . _:c14n0 a as:Object ; as:displayName "This is the title"@en .
The JSON-LD format generally supports one additional way of associating language tag information with a literal string value using what JSON-LD calls a "value object", as illustrated below:
{ "@context": "https://www.w3.org/ns/activitystreams", "displayName": { "@value": "This is the title", "@language": "en" } }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Object"> <div itemprop="displayName" lang="en">This is the title</div> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Object"> <div property="displayName" lang="en">This is the title</div> </div>
<div class="h-entry"> <div class="p-name" lang="en">This is the title</div> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . _:c14n0 a as:Object ; as:displayName "This is the title"@en .
While Activity Streams 2.0 implementations MAY use JSON-LD value objects in this manner, doing so is strongly discouraged. Implementations SHOULD, instead, use the Language Map form. The one situation where use of the value object cannot be avoided is when a default language context has been established and a particular language-sensitive field needs to be explicitly excluded from that context, as in the following example:
{ "@context": [ "https://www.w3.org/ns/activitystreams", { "@language": "en" } ], "displayName": { "@value": "This is the title", "@language": null } }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Object" lang="en"> <div itemprop="displayName" lang="">This is the title</div> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Object" lang="en"> <div property="displayName" lang="">This is the title</div> </div>
<div class="h-entry" lang="en"> <div class="p-name" lang="">This is the title</div> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . _:c14n0 a as:Object ; as:displayName "This is the title" .
3.3 Link
A Link
describes a qualified, indirect reference to another resource that
is closely related to the conceptual model of Links as established in [RFC5988].
The target URI of the Link is expressed using the required
href
keyword.
In addition, all Link
instances share the following common set of
optional properties as defined by the
Activity Vocabulary:
displayName
|
displayNameMap
|
hreflang
|
mediaType
|
rel
|
title
|
titleMap
|
height
|
width
|
duration
|
actorOf
|
attachedTo
|
attributedWith
|
contextOf
|
generatorOf
|
iconFor
|
imageOf
|
locationOf
|
memberOf
|
objectOf
|
originOf
|
previewOf
|
providerOf
|
resultOf
|
scopeOf
|
tagOf
|
targetOf
For example, all Objects can contain an
image
property whose value describes a graphical representation of the containing
object. This property will typically be used to provide the URL to an image
(e.g. JPEG, GIF or PNG) resource that can be displayed to the user. Any given
object might have multiple such visual representations -- multiple screenshots,
for instance, or the same image at different resolutions. In Activity Streams 2.0,
there are essentially three ways of describing such references.
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Application", "@id": "https://example.org/application/123", "displayName": "My Application", "image": "https://example.org/application/123.png" }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Application" itemid="https://example.org/application/123"> <div itemprop="displayName">My Application</div> <img itemprop="image" src="https://example.org/application/123.png" /> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Application" resource="https://example.org/application/123"> <div property="displayName">My Application</div> <img property="image" src="https://example.org/application/123.png" /> </div>
<div class="h-entry" <meta class="p-as-id" name="id" content="https://example.org/application/123"> <div class="p-name">My Application</div> <img class="u-photo" src="https://example.org/application/123.png" /> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . <http://example.org/application/123> a as:Application ; as:displayName "My Application" ; as:image <http://example.org/application/123.png> .
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Application", "@id": "https://example.org/application/123", "displayName": "My Application", "image": { "@type": "Link", "href": "https://example.org/application/123.png", "mediaType": "image/png" } }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Application" itemid="https://example.org/application/123"> <div itemprop="displayName">My Application</div> <img itemprop="image" itemscope itemtype="https://www.w3.org/ns/activitystreams#Link" type="image/png" src="https://example.org/application/123.png" /> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Application" resource="https://example.org/application/123"> <div property="displayName">My Application</div> <img property="image" typeof="Link" type="image/png" src="https://example.org/application/123.png" /> </div>
<div class="h-entry" <meta class="p-as-id" name="id" content="https://example.org/application/123"> <div class="p-name">My Application</div> <img class="u-photo" src="https://example.org/application/123.png" /> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . <http://example.org/application/123> a as:Application ; as:displayName "My Application" ; as:image [ a as:Link ; as:href <http://example.org/application/123.png> ; as:mediaType "image/png" . ] .
Formally, the former example establishes an unqualified
direct relationship with the image resource while the
latter creates a qualified,
indirect relationship that allows additional properties about the
relationship to be specified. Such properties (e.g. mediaType
,
hreflang
, rel
, etc) describe the Link
itself as opposed to describing the referenced resource. For many practical
applications, this distinction will likely be fairly insignificant but it
is still worth keeping in mind.
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Application", "@id": "https://example.org/application/123", "displayName": "My Application", "image": [ "https://example.org/application/abc.gif", { "@type": "Link", "href": "https://example.org/application/123.png", "mediaType": "image/png" } ] }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Application" itemid="https://example.org/application/123"> <div itemprop="displayName">My Application</div> <img itemprop="image" src="https://example.org/application/123.gif" /> <img itemprop="image" itemscope itemtype="https://www.w3.org/ns/activitystreams#Link" type="image/png" src="https://example.org/application/123.png" /> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Application" resource="https://example.org/application/123"> <div property="displayName">My Application</div> <img property="image" src="https://example.org/application/123.gif" /> <img property="image" typeof="Link" type="image/png" src="https://example.org/application/123.png" /> </div>
<div class="h-as-application" <meta class="p-as-id" name="id" content="https://example.org/application/123"> <div class="p-name">My Application</div> <img class="u-photo" src="https://example.org/application/123.gif" /> <img class="u-photo" src="https://example.org/application/123.png" /> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . <http://example.org/application/123> a as:Application ; as:displayName "My Application" ; as:image ( <http://example.org/application/abc.gif> [ a as:Link ; as:href <http://example.org/application/123.png> ; as:mediaType "image/png" . ] ) .
Individual items contained in such an array are independent of the others and no significance is given to the ordering.
RFC 5988 defines that all Links have a "link relation" that describes
the contextual purpose of the link. Within a Link,
the rel
property
provides the link relation value. If no rel
property is
specified, the link relation is considered to be unspecified.
In the following example, two separate references are provided. The link
relation of the first is unspecified, while the link relation of the
second is "canonical
".
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Application", "@id": "https://example.org/application/123", "displayName": "My Application", "image": [ "https://example.org/application/abc.gif", { "@type": "Link", "href": "https://example.org/application/123.png", "mediaType": "image/png", "rel": "canonical" } ] }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Application" itemid="https://example.org/application/123"> <div itemprop="displayName">My Application</div> <img itemprop="image" src="https://example.org/application/123.gif" /> <img itemprop="image" itemscope itemtype="https://www.w3.org/ns/activitystreams#Link" type="image/png" src="https://example.org/application/123.png" rel="canonical" /> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Application" resource="https://example.org/application/123"> <div property="displayName">My Application</div> <img property="image" src="https://example.org/application/123.gif" /> <img property="image" typeof="Link" type="image/png" src="https://example.org/application/123.png" rel="canonical" /> </div>
<div class="h-as-application" <meta class="p-as-id" name="id" content="https://example.org/application/123"> <div class="p-name">My Application</div> <img class="u-photo" src="https://example.org/application/123.gif" /> <img class="u-photo" src="https://example.org/application/123.png" rel="canonical" /> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . <http://example.org/application/123> a as:Application ; as:displayName "My Application" ; as:image ( <http://example.org/application/abc.gif> [ a as:Link ; as:href <http://example.org/application/123.png> ; as:mediaType "image/png" ; as:rel "canonical" . ] ) .
It ought to be noted that the [HTML5] specification provides it's own alternative definition of a "link relation" that differs slightly from the [RFC5988] definition. In the HTML5 definition, any string that does not contain the "space" U+0020, "tab" (U+0009), "LF" (U+000A), "FF" (U+000C), "CR" (U+000D) or "," (U+002C) characters can be used as a valid link relation. To promote interoperability, Activity Streams 2.0 implementations MUST only use link relations that are valid in terms of both the [RFC5988] and [HTML5] definitions.
Note that the Link and Object classes are disjoint from one another. That is, any given Object cannot also be a Link.
3.4 Actor
Actor objects are specializations of the base Object
type that represent entities capable of carrying out an
Activity. The Actor class is the base class for all
Actor objects. The Activity
Vocabulary provides the normative definition of ten specific
types of Actors:
Application
|
Device
|
Group
|
Organization
|
Community
|
Identity
|
Person
|
Process
|
Role
|
Service
.
This specification intentionally defines Actors in only the most generalized
way, stopping short of defining semantically specific properties for each.
All Actor objects are specializations of Object
and inherit
all of the core properties common to all Object's. External vocabularies
(VCard for instance) can be used to express additional detail not covered
by the Activity Vocabulary.
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Share", "actor": { "@type": "Person", "@id": "acct:sally@example.org", "displayName": "Sally Smith" }, "object": { "@type": "Note", "content": "This is a simple note" } }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Share"> <div itemprop="actor" itemscope itemtype="https://www.w3.org/ns/activitystreams#Person" itemid="acct:sally@example.org"> <span itemprop="displayName">Sally Smith</span> </div> Shared <div itemprop="object" itemscope itemtype="https://www.w3.org/ns/activitystreams#Note"> "<span itemprop="content">This is a simple note</span>" </div> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Share"> <div property="actor" typeof="Person" resource="acct:sally@example.org"> <span property="displayName">Sally Smith</span> </div> Shared <div property="object" typeof="Note"> "<span property="content">This is a simple note</span>" </div> </div>
<div class="h-as-share"> <div class="p-author h-card"> <link class="u-url p-name" href="acct:sally@example.org"> Sally Smith </link> </div> Shared <div class="p-share-of h-entry"> "<span class="e-content">This is a simple note</span>" </div> </div>
<acct:sally@example.org> a as:Person ; as:displayName "Sally Smith" . _:c14n0 a as:Share ; as:actor <acct:sally@example.org> ; as:object [ a as:Note ; as:content "This is a simple note" . ] .
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Share", "actor": { "@type": "Person", "@id": "acct:sally@example.org", "displayName": "Sally Smith", "vcard:given-name": "Sally", "vcard:family-name": "Smith" }, "object": { "@type": "Note", "content": "This is a simple note" } }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Share"> <div itemprop="actor" itemscope itemtype="https://www.w3.org/ns/activitystreams#Person" itemid="acct:sally@example.org"> <span itemprop="displayName"> <span itemprop="https://www.w3.org/2006/vcard/ns#given-name">Sally</span> <span itemprop="https://www.w3.org/2006/vcard/ns#family-name">Smith</span> </span> </div> Shared <div itemprop="object" itemscope itemtype="https://www.w3.org/ns/activitystreams#Note"> "<span itemprop="content">This is a simple note</span>" </div> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Share"> <div property="actor" typeof="Person" resource="acct:sally@example.org"> <span property="https://www.w3.org/2006/vcard/ns#given-name">Sally</span> <span property="https://www.w3.org/2006/vcard/ns#family-name">Smith</span> </div> Shared <div property="object" typeof="Note"> "<span property="content">This is a simple note</span>" </div> </div>
<div class="h-as-share"> <div class="p-author h-card"> <link class="u-url p-name" href="acct:sally@example.org"> <span class="p-given-name">Sally</span> <span class="p-family-name">Smith</span> </link> </div> Shared <div class="p-share-of h-entry"> "<span class="e-content">This is a simple note</span>" </div> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix vcard: <http://www.w3.org/2006/vcard/ns#> . <acct:sally@example.org> a as:Person ; as:displayName "Sally Smith" ; vcard:given-name "Sally" ; vcard:family-name "Smith" . _:c14n0 a as:Share ; as:actor <acct:sally@example.org> ; as:object [ a as:Note ; as:content "This is a simple note" . ] .
While implementations are free to introduce new types of Actors beyond
those defined by the Activity Vocabulary, interoperability issues can arise
when applications rely too much on extension types that are not recognized
by other implementations. Care should be taken to not unduly overlap with or
duplicate the existing Actor types. For instance, some vocabularies (e.g. VCard)
define their own classes for describing people. An implementation that wishes,
for example, to use a vcard:Individual
as an Actor SHOULD identify
that Actor as being both a
Person
and
an vcard:Individual
, as illustrated in the following:
Person
and a vcard:Individual
:{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Share", "actor": { "@type": ["Person", "vcard:Individual"], "@id": "acct:sally@example.org", "displayName": "Sally Smith", "vcard:given-name": "Sally", "vcard:family-name": "Smith" }, "object": { "@type": "Note", "content": "This is a simple note" } }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Share"> <div itemprop="actor" itemscope itemtype=" https://www.w3.org/ns/activitystreams#Person https://www.w3.org/2006/vcard/ns#Individual" itemid="acct:sally@example.org"> <span itemprop="displayName"> <span itemprop="https://www.w3.org/2006/vcard/ns#given-name">Sally</span> <span itemprop="https://www.w3.org/2006/vcard/ns#family-name">Smith</span> </span> </div> Shared <div itemprop="object" itemscope itemtype="https://www.w3.org/ns/activitystreams#Note"> "<span itemprop="content">This is a simple note</span>" </div> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Share"> <div property="actor" typeof="Person https://www.w3.org/2006/vcard/ns#Individual" resource="acct:sally@example.org"> <span property="https://www.w3.org/2006/vcard/ns#given-name">Sally</span> <span property="https://www.w3.org/2006/vcard/ns#family-name">Smith</span> </div> Shared <div property="object" typeof="Note"> "<span property="content">This is a simple note</span>" </div> </div>
<div class="h-as-share"> <div class="p-author h-card"> <link class="u-url p-name" href="acct:sally@example.org"> <span class="p-given-name">Sally</span> <span class="p-family-name">Smith</span> </link> </div> Shared <div class="p-share-of h-entry"> "<span class="e-content">This is a simple note</span>" </div> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix vcard: <http://www.w3.org/2006/vcard/ns#> . <acct:sally@example.org> a as:Person, vcard:Individual ; as:displayName "Sally Smith" ; vcard:given-name "Sally" ; vcard:family-name "Smith" . _:c14n0 a as:Share ; as:actor <acct:sally@example.org> ; as:object [ a as:Note ; as:content "This is a simple note" . ] .
3.5 Activity
Activity objects are specializations of the base Object type that provide information about pending, ongoing or completed actions.
In additional to common properties supported by all Object
instances, Activity
objects support the following additional
properties defined by the Vocabulary:
actor
|
object
|
target
|
origin
|
result
|
priority
|
to
|
bto
|
cc
|
bcc
The JSON-ID @type
keyword is used to identify the type
of action the Activity Statement represents. Previous versions of the
Activity Streams format used the verb
property to identify
the action type. The verb
MUST NOT be used within an
Activity Streams 2.0 Activity to represent the action type.
{
"@context": "https://www.w3.org/ns/activitystreams",
"@type": "Like",
"@id": "urn:example:activity:1",
"actor": "https://example.org/profiles/joe",
"object": "https://example.com/notes/1",
"published": "2014-09-30T12:34:56Z"
}
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Like"> <a itemprop="actor" href="https://example.org/profiles/joe">Joe</a> liked <a itemprop="object" href="https://example.org/notes/1"> "https://example.org/notes/1" </a> <meta itemprop="published" content="2014-09-30T12:34:56Z" /> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Like"> <a property="actor" href="https://example.org/profiles/joe">Joe</a> liked <a property="object" href="https://example.org/notes/1"> "https://example.org/notes/1" </a> <meta property="published" content="2014-09-30T12:34:56Z" /> </div>
<div class="h-as-like"> <a class="u-author" href="https://example.org/profiles/joe">Joe</a> liked <a class="u-like-of" href="https://example.org/notes/1"> "https://example.org/notes/1" </a> <meta class="dt-published" name="published" content="2014-09-30T12:34:56Z" /> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . _:c14n0 a as:Like ; as:published "2014-09-30T12:34:56Z"^^xsd:dateTime ; as:actor <http://example.org/profiles/joe> ; as:object <http://example.com/notes/1> .
The Activity Vocabulary defines a broad
range of Activity
types that are common to many "Social" Web applications.
This specification stops short of defining semantically specific properties for most
of these activities. External vocabularies can be used to express additional detail not
covered by the Activity Vocabulary.
Furthermore, while implementations are free to introduce new types of Activites beyond those
defined by the Activity Vocabulary, interoperability issues can arise when applications
rely too much on extension types that are not recognized by other implementations. Care
should be taken to not unduly overlap with or duplicate the existing Activity types. For
instance, some vocabularies (e.g. Schema.org) define their own classes for describing actions.
An implementation that wishes, for example, to use
https://schema.org/LikeAction
as an Activity SHOULD identify that Object as being both a
Like
and an
https://schema.org/LikeAction
, as illustrated in the following:
Like
and
a https://schema.org/LikeAction
:{
"@context": "https://www.w3.org/ns/activitystreams",
"@type": ["Like", "https://schema.org/LikeAction"],
"@id": "urn:example:activity:1",
"actor": "https://example.org/profiles/joe",
"object": "https://example.com/notes/1",
"published": "2014-09-30T12:34:56Z"
}
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Like https://schema.org/LikeAction"> <a itemprop="actor" href="https://example.org/profiles/joe">Joe</a> liked <a itemprop="object" href="https://example.org/notes/1"> "https://example.org/notes/1" </a> <meta itemprop="published" content="2014-09-30T12:34:56Z" /> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Like https://schema.org/LikeAction"> <a property="actor" href="https://example.org/profiles/joe">Joe</a> liked <a property="object" href="https://example.org/notes/1"> "https://example.org/notes/1" </a> <meta property="published" content="2014-09-30T12:34:56Z" /> </div>
<div class="h-as-like"> <a class="u-author" href="https://example.org/profiles/joe">Joe</a> liked <a class="u-like-of" href="https://example.org/notes/1"> "https://example.org/notes/1" </a> <meta class="dt-published" name="published" content="2014-09-30T12:34:56Z" /> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . _:c14n0 a as:Like, <http://schema.org/LikeAction>; as:published "2014-09-30T12:34:56Z"^^xsd:dateTime ; as:actor <http://example.org/profiles/joe> ; as:object <http://example.com/notes/1> .
3.5.1 Audience Targeting
Every Activity has both a Primary and Secondary audience. The Primary audience consists of those entities either directly involved in the performance of the activity or who "own" the objects involved. The Secondary audience consists of the collection of entities sharing an interest in the activity but who are not directly involved (e.g. "followers").
For instance, suppose a social network of three individuals: Bob, Joe and Jane. Bob and Joe are each friends with Jane but not friends with one another. Bob has chosen to "follow" activities for which Jane is directly involved. Jane shares a file with Joe.
In this example, Jane and Joe are each directly involved in the file sharing activity and together make up the Primary Audience for that event. Bob, having an interest in activities involving Jane, is the Secondary Audience. Knowing this, a system that produces or consumes the activity can intelligently notify each person of the event.
While there are means, based on the action type, actor, object and target of
the activity, to infer the primary audience for many types of
activities, those do not work in every case and do not provide a
means of identifying the secondary audience. The
to
,
cc
,
bto
and
bcc
properties MAY be used within an Activity to explicitly identify the
Primary and Secondary audiences.
The prototypical use case for an Activity containing these properties is the publication and redistribution of Activities through an intermediary. That is, an event source generates the activity and publishes it to the intermediary which determines a subset of events to display to specific individual users or groups. Such a determination can be made, in part, by identifying the Primary and Secondary Audiences for each activity.
When the event source generates the activity and specifies values for
the to
and cc
fields, the
intermediary SHOULD redistribute that event
with the values of those fields intact, allowing any processor to see
who the activity has been targeted to. This is precisely the same
model used by the to
and cc
fields in email systems.
There are situations, however, in which disclosing the identity of
specific members of the audience may be inappropriate. For instance,
a user may not wish to let other users know that they are interested
in various topics, individuals or types of events. To support this
option, an event source generating an activity MAY use the
bto
and bcc
properties to list
entities to whom the activity should be privately targeted. When an
intermediary receives an activity containing these properties, it
MUST remove those values prior to redistributing the activity. The
intent is that systems MUST consider entities listed within the
bto
and bcc
properties as
part of the Primary and Secondary audience but MUST NOT disclose that
fact to any other party.
Audience targeting information included within an Activity only
describes the intent of the activity creator. With clear exception
given to the appropriate handling of bto
and
bcc
, this specification leaves it up to implementations
to determine how the audience targeting information is used.
3.6 Collection
Collection objects are a specialization of the base Object
that contain a listing of other Objects or Links.
The Collection object is used primarily as the root of an
Activity Streams Document, but can also be used as the
value of object properties.
The model for collections within the Activity Vocabulary is designed largely around the abstract model of "logical feeds" and "pages" discussed in [RFC5005], Section 1.2. Specifically, collections have both a logical model and a physical serialization. While the logical model of a collection might contain a large number of member objects, any single serialized representation might include only a subset of those objects, with "paging" Links used to reference additional serialized representations that include other subsets. Such representations are known as "multi-page collections", with each serialized subset representing a single "page".
In addition to the common properties shared by all Object instances,
Collection
objects set of properties defined by the
Vocabulary. These include:
items |
totalItems |
itemsPerPage |
startIndex |
current |
next |
prev |
first |
last |
self
Collections can be ordered or unordered. In the JSON-LD serialization,
the unordered members of a Collection are represented using the
items
property while the ordered members are represented using
the orderedItems
property. The normative JSON-LD @context
definition maps both the items
and orderedItems
properties to the Activity Vocabulary items
term. However, the orderedItems
property is defined in
the JSON-LD @context as @container = @list
, indicating that the
items are strictly ordered.
Note that when using orderedItems
within a Collection
object, the order imposed on the items applies only to the subset of items
directly contained within the one Collection
object. Implementations
MAY use the OrderedCollection
class to identify collections whose entire logical set of members are
strictly ordered.
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Collection", "totalItems": 10, "itemsPerPage": 1, "next": "https://example.org/foo?page=2", "self": "https://example.org/foo?page=1", "items": [ { "@type": "Post", "actor": "urn:example:person:sally", "object": "https://example.org/foo" } ] }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Collection"> <meta itemprop="totalItems" content="10" /> <meta itemprop="itemsPerPage" content="1" /> <a itemprop="next" href="https://example.org/foo?page=2">Next Page</a> <link itemprop="self" href="https://example.org/foo?page=1" /> <ul> <li itemscope itemtype="https://www.w3.org/ns/activitystreams#Post"< <link itemprop="actor" href="urn:example:person:sally">Sally</link> Posted <a itemprop="object" href="https://example.org/foo">"https://example.org/foo"</a> </li< <ul> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Collection"> <meta property="totalItems" content="10" /> <meta property="itemsPerPage" content="1" /> <a property="next" href="https://example.org/foo?page=2">Next Page</a> <link property="self" href="https://example.org/foo?page=1" /> <ul> <li property typeof="Post"< <link property="actor" href="urn:example:person:sally">Sally</link> Posted <a property="object" href="https://example.org/foo">"https://example.org/foo"</a> </li< <ul> </div>
<div class="h-as-collection"> <meta class="p-as-total-items" name="totalItems" content="10" /> <meta class="p-as-items-per-page" name="itemsPerPage" content="1" /> <a rel="next" href="https://example.org/foo?page=2">Next Page</a> <link rel="self" href="https://example.org/foo?page=1" /> <ul class="p-as-items"> <li class="h-as-post"< <link class="u-author" href="urn:example:person:sally">Sally</link> Posted <a class="u-item" href="https://example.org/foo">"https://example.org/foo"</a> </li< <ul> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . _:c14n0 a as:Collection ; as:totalItems "10"^^xsd:nonNegativeInteger ; as:itemsPerPage "1"^^xsd:nonNegativeInteger ; as:next <http://example.org/foo?page=2> ; as:self <http://example.org/foo?page=1> ; as:items [ a a:Post; as:actor <urn:example:person:sally> ; as:object <http://example.org/foo> . ] .
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "OrderedCollection", "totalItems": 10, "itemsPerPage": 1, "next": "https://example.org/foo?page=2", "self": "https://example.org/foo?page=1", "startIndex": 0, "orderedItems": [ { "@type": "Post", "actor": "urn:example:person:sally", "object": "https://example.org/foo" } ] }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#OrderedCollection"> <meta itemprop="totalItems" content="10" /> <meta itemprop="itemsPerPage" content="1" /> <meta itemprop="startIndex" content="0" /> <a itemprop="next" href="https://example.org/foo?page=2">Next Page</a> <link itemprop="self" href="https://example.org/foo?page=1" /> <ol> <li itemscope itemtype="https://www.w3.org/ns/activitystreams#Post"< <link itemprop="actor" href="urn:example:person:sally">Sally</link> Posted <a itemprop="object" href="https://example.org/foo">"https://example.org/foo"</a> </li< <ol> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="OrderedCollection"> <meta property="totalItems" content="10" /> <meta property="itemsPerPage" content="1" /> <meta property="startIndex" content="0" /> <a property="next" href="https://example.org/foo?page=2">Next Page</a> <link property="self" href="https://example.org/foo?page=1" /> <ol> <li property typeof="Post"< <link property="actor" href="urn:example:person:sally">Sally</link> Posted <a property="object" href="https://example.org/foo">"https://example.org/foo"</a> </li< <ol> </div>
<div class="h-as-collection"> <meta class="p-as-total-items" name="totalItems" content="10" /> <meta class="p-as-items-per-page" name="itemsPerPage" content="1" /> <meta class="p-as-start-index" name="startIndex" content="0" /> <a rel="next" href="https://example.org/foo?page=2">Next Page</a> <link rel="self" href="https://example.org/foo?page=1" /> <ol class="p-as-items"> <li class="h-as-post"< <link class="u-author" href="urn:example:person:sally">Sally</link> Posted <a class="u-item" href="https://example.org/foo">"https://example.org/foo"</a> </li< <ol> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . _:c14n0 a as:OrderedCollection ; as:totalItems "10"^^xsd:nonNegativeInteger ; as:itemsPerPage "1"^^xsd:nonNegativeInteger ; as:startIndex "0"^^xsd:nonNegativeInteger ; as:next <http://example.org/foo?page=2> ; as:self <http://example.org/foo?page=1> ; as:items [ rdf:first [ a a:Post; as:actor <urn:example:person:sally> ; as:object <http://example.org/foo> . ] ; rdf:rest rdf:nil . ] .
In ordered collections that use paging, the
startIndex
property is used to indicate the relative index position of the first item contained in
the orderedItems
list in the logical set of items.
A startIndex
of 0
indicates the first item in the collection.
Using paging with an OrderedCollection
can be tricky because
there is no guarantee that implementations will process the distinct pages
in any predictable order. Therefore, it is strongly recommended that
OrderedCollection
instances that require paging always include the
first
,
next
,
prev
and
last
paging properties. Implementations that wish to reconstruct the appropriate
complete ordering of member instances in the logical collection would navigate
to the OrderedCollection
instance identified by the first
(or last
) link, then recursively follow the next
(or prev
) link until all pages have been processed.
4. Activity Streams Document
An Activity Streams Document
is a JSON-LD document whose root value is a Collection and
whose MIME media type is "application/activity+json
".
5. Deprecated Activity Streams 1.0 Syntax
The JSON syntax defined by this specification differs somewhat from that defined in the original JSON Activity Streams 1.0 [AS1] specification in ways that are not backwards compatible. Implementations can choose to continue supporting the JSON Activity Streams 1.0 syntax but SHOULD consider it to be deprecated. This means that while implementations MAY continue to consume the 1.0 syntax, they SHOULD NOT output the 1.0 syntax unless specifically interacting with older non-2.0 compliant implementations.
Specifically:
-
Implementations MUST use the "
application/stream+json
" MIME media type when producing a JSON serialization using the Activity Streams 1.0 syntax, and "application/activity+json
" when producing a serialization conforming to the 2.0 syntax. -
Implementations that process serializations identified using either
the "
application/stream+json
" or the more generic "application/json
" MIME media type MUST follow the syntax and processing rules set by [AS1]. The 2.0 syntax and processing rules apply only when handling serializations using the "application/activity+json
" media type. - When processing Activity Streams 1.0 documents using a JSON-LD processing model, implementations MUST use the special AS 1.0 to AS 2.0 expansion @context definition provided here to produce the JSON-LD expanded representation. Refer to the JSON-LD Processing Algorithms and API for details.
-
When processing Activity Streams 1.0 documents and converting those to 2.0,
implementations MUST treat
id
as an alias for the JSON-LD@id
key word; and theobjectType
andverb
properties as aliases for the JSON-LD@type
keyword. -
This document redefines the
displayName
,title
,content
andsummary
properties as natural language values which means their values can be expressed as either a String or a JSON-LD Language Map. In the 1.0 syntax, these are expressed solely as String values. Because the 1.0 values are a valid subset allowed by this specification, implementations are not required to take any specific action to continue supporting those values. - This document redefines a large number of common properties defined originally as Objects in 1.0 as either Objects or Links. The JSON-LD serialization allows such property values to be expressed as either an IRI String, an JSON object, or an Array of IRI Strings and JSON objects. Because the 1.0 values are a valid subset allowed by this specification, existing implementations are not required to take any specific action to continue supporting those values.
-
This specification deprecates the
upstreamDuplicates
anddownstreamDuplicates
properties defined by Activity Streams 1.0 and does not provide a replacement. This is due largely to lack of any reasonable implementation evidence. While theupstreamDuplicates
anddownstreamDuplicates
properties MAY continue to be used, implementations SHOULD avoid them.
By following these requirements, all JSON Activity Streams 1.0 serializations can be processed successfully by 2.0 implementations.
6. Extensibility
In Activity Streams 2.0, an "extension" is any property not defined by the Activity Vocabulary. Consuming implementations that encounter unfamiliar extensions MUST NOT stop processing or signal an error and MUST continue processing the items as if those properties were not present. Support for specific extensions can vary across implementations and no normative processing model for extensions is provided.
While consuming implementations are not required to use the standard JSON-LD Processing Algorithms [JSON-LD-API], it is important to note that the algorithms, as currently defined, will silently ignore any property that is not defined in a JSON-LD @context. Implementations that publish Activity Streams 2.0 documents that contain extension properties SHOULD provide a @context definition of those extensions.
It is also important to note that there are valid JSON constructs which
cannot be used within a JSON-LD document. For instance, JSON-LD forbids
"arrays of arrays" as used, for example, by the popular
GeoJSON specification. While implementations
are free to use such constructs as extensions within an Activity Streams 2.0
document, consumers that use the standard JSON-LD Processing Algorithms
will be required to either ignore such extensions or map those to alternative
compatible constructs prior to applying the JSON-LD algorithms.
Simple GeoJSON Points, for instance, can be mapped to
Place
objects,
while more complex geometries can be converted to
GeoSparql
"Well-Known Text" representations as illustrated in the non-normative examples
below:
{ "type": "Point", "coordinates": [36.74, -119.77] }
Place
alternative:{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Place", "latitude": 36.74, "longitude": -119.77 }
<div itemscope itemtype="https://www.w3.org/ns/activitystreams#Place"> <meta itemprop="latitude" content="36.74" /> <meta itemprop="longitude" content="-119.77" /> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="Place"> <meta property="latitude" content="36.74" /> <meta property="longitude" content="-119.77" /> </div>
<div class="h-geo"> <meta class="p-latitude" name="latitude" content="36.74" /> <meta class="p-longitude" name="longitude" content="-119.77" /> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . _:c14n0 a as:Place; as:latitude "36.74"^^xsd:float ; as:longitude "-119.77"^^xsd:float .
{ "type": "Polygon", "coordinates": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ] }
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "geos:Geometry", "geos:asWKT": "Polygon((100.0, 0.0, 101.0, 0.0, 101.0, 1.0, 100.0, 1.0, 100.0, 0.0))" }
<div itemscope itemtype="https://www.opengis.net/ont/geosparql#Geometry"> <meta itemprop="https://www.opengis.net/ont/geosparql#asWKT" content="Polygon((100.0, 0.0, 101.0, 0.0, 101.0, 1.0, 100.0, 1.0, 100.0, 0.0))" /> </div>
<div vocab="https://www.w3.org/ns/activitystreams#" typeof="itemtype="http://www.opengis.net/ont/geosparql#Geometry""> <meta property="https://www.opengis.net/ont/geosparql#asWKT" content="Polygon((100.0, 0.0, 101.0, 0.0, 101.0, 1.0, 100.0, 1.0, 100.0, 0.0))" /> </div>
<div class="h-geo"> <meta name="wkt" content="Polygon((100.0, 0.0, 101.0, 0.0, 101.0, 1.0, 100.0, 1.0, 100.0, 0.0))" /> </div>
@prefix as: <http://www.w3.org/ns/activitystreams#> . @prefix geos: <http://www.opengis.net/ont/geosparql#> . _:c14n0 a geos:Geometry ; geos:asWKT "Polygon((100.0, 0.0, 101.0, 0.0, 101.0, 1.0, 100.0, 1.0, 100.0, 0.0))"^^geos:wktLiteral .
6.1 Handling of JSON-ID Compact IRIs
In JSON-LD, a "Compact IRI" is a type of shorthand notation that allows absolute IRI values to be split into an absolute base IRI and a relative token. For instance, in the following example:
{ "@context": { "foaf": "https://xmlns.com/foaf/0.1/" }, "foaf:givenName": "Sam" }
The property name foaf:givenName
is a Compact IRI that expands to
"https://xmlns.com/foaf/0.1/givenName
" when processed by a JSON-LD
implementation.
While there are differences of opinion on how extensively Compact IRIs ought to be used within JSON-LD document instances, JSON-LD implementations are required to support them.
In order to simplify implementation and encourage interoperable reuse, the following predefined prefixes are defined in the normative Activity Streams 2.0 JSON-LD @context. Implementations MUST NOT redefine any of the provided prefix mappings.
Prefix | Expanded | Name |
---|---|---|
as: |
https://www.w3.org/ns/activitystreams# |
Activity Streams Vocabulary |
dc: |
https://purl.org/dc/elements/1.1/ |
Dublin Core |
dct: |
https://purl.org/dc/terms/ |
Dublin Core Terms |
dctypes: |
https://purl.org/dc/dcmitype/ |
Dublin Core Types |
foaf: |
https://xmlns.com/foaf/0.1/ |
Friend of a Friend |
vcard: |
https://www.w3.org/2006/vcard/ns# |
VCard |
org: |
https://www.w3.org/ns/org# |
W3C Org Ontology |
prov: |
https://www.w3.org/ns/prov# |
W3C Provenance Ontology |
geo: |
https://www.w3.org/2003/01/geo/wgs84_pos# |
W3C Basic Geo Ontology |
geos: |
https://www.opengis.net/ont/geosparql# |
Geo-Sparql |
ical: |
https://www.w3.org/2002/12/cal/ical# |
iCalendar Ontology |
oa: |
https://www.w3.org/ns/oa# |
Web Annotation Data Model |
For instance, the property name foaf:givenName
would expand to
"https://xmlns.com/foaf/0.1/givenName
", while the property
prov:actingOnBehalfOf
would expand to
"https://w3.org/ns/prov#actingOnBehalfOf
".
7. Mentions, Tags and Other Common Social Microsyntaxes
Many social software systems use special text-based microsyntaxes
that allow users to define special addressing for notifications,
linking, or categorization within objects. For example, including
text such as "@username
" within an object's content
will often route the object to a special "mentions" or "inbox"
stream for a particular user. Likewise, including text such as
"#topic
" within the object's content will often mark
the object as being related to the topic "topic
".
Such mechanisms are commonly referred to as "mentions" and "hashtags",
respectively.
While such microsyntaxes MAY be used within the values of the
content
,
displayName
,
summary
, and
title
properties
on an Activity Streams Object
, implementations
SHOULD NOT be required to parse the values of those properties in order to
determine the appropriate routing of notifications, categorization or linking
between objects. Instead, publishers SHOULD make appropriate use of the
Activity Streams Vocabulary terms
provided specifically for these purposes.
For example, suppose that an author wishes to send a note of thanks to another user named "sally" with a hashtag of "#givingthanks". A typical way this message would appear within the content of a note is shown below:
"Thank you @sally for all your hard work! #givingthanks"
A typical social software implementation would typically render such a
content such that "@sally
" is replaced with a hyperlink to "sally"'s
social profile page and "#givingthanks
" is replaced with a
hyperlink to a listing of other notes that have been "tagged" with the
same topic. Most implementations would also send a special notification
to sally letting her know that a note mentioning her has been posted.
The following illustrates an equivalent Activity Streams
Note
object:
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Note", "content": "Thank you @sally for all your hard work! #givingthanks", "to": { "@type": "Person", "@id": "https://example.org/people/sally", "alias": "@sally" }, "tag": { "@id": "https://example.org/tags/givingthanks", "alias": "#givingthanks" } }
The to
property indicates that the user "@sally" is
to be considered part of the primary audience
of the note and should therefore receive notification. The tag
property associates the Note with a reference to
"https://example.org/tags/givingthanks
". Note that the note's
content still includes the "@sally
" and "#givingthanks
"
microsyntaxes but that consuming implementations are not required to parse
those in order to make the appropriate associations.
In the case a publisher wishes to indicate a mention without an associated
notification, the publisher can use the
Mention
object
type as a value of the tag
property. The Mention
object is a subclass of
Link
.
{ "@context": "https://www.w3.org/ns/activitystreams", "@type": "Note", "content": "Thank you @sally for all your hard work! #givingthanks", "tag": [ { "@id": "https://example.org/tags/givingthanks", "alias": "#givingthanks" }, { "@type": "Mention", "href": "https://example.org/people/sally", "displayName": "@sally" } ] }
8. Security Considerations
Publishers or Consumers implementing Activity Streams as a stream of public data may also want to consider the potential for unsolicited commercial or malicious content and should take preventative measures to recognize such content and either identify it or not include it in their implementations.
Publishers should take reasonable measures to ensure potentially malicious user input such as cross-site scripting attacks are not included in the Activity Streams data they publish.
Consumers that re-emit ingested content to end-users MUST take reasonable measures if emitting ingested content to make sure potentially malicious ingested input is not re-emitted.
Consumers that re-emit ingested content for crawling by search engines should take reasonable measures to limit any use of their site as a Search Engine Optimization loophole. This may include converting untrusted hyperlinks to text or including a rel="nofollow" attribute.
Consumers should be aware of the potential for spoofing attacks where the attacker publishes activities or objects with falsified property values with the intent of injecting malicious content, hiding or corrupting legitimate content, or misleading users.
Activity Streams are JSON Documents and are subject to the same security considerations described in [RFC7159].
Activity Streams implementations handle URIs. See Section 7 of [RFC3986].
Activity Streams implementations handle IRIs. See Section 8 of [RFC3987].
9. IANA Considerations
9.1 The application/activity+json
Media Type
This specification registers the application/activity+json
MIME Media Type specifically for identifying documents
conforming to the Activity Streams 2.0 format.
Type name: | application |
Subtype name: | activity+json |
Required parameters: | None |
Optional parameters: | None |
Encoding considerations: |
Resources that use the "application/activity+json "
Media Type are required to conform to all of the requirements
for the "application/json " Media Type and are
therefore subject to the same encoding considerations specified
in Section 11 of [RFC7159].
|
Security considerations: | As defined in this specification. |
Contact: | James M Snell <jasnell@gmail.com> |
9.2 The application/stream+json
Media Type
This specification registers the application/stream+json
MIME Media Type specifically for identifying documents
conforming to the JSON Activity Streams 1.0 [AS1] format.
Type name: | application |
Subtype name: | stream+json |
Required parameters: | None |
Optional parameters: | None |
Encoding considerations: |
Resources that use the "application/stream+json "
Media Type are required to conform to all of the requirements
for the "application/json " Media Type and are
therefore subject to the same encoding considerations specified
in Section 11 of [RFC7159].
|
Security considerations: | As defined in [AS1] |
Contact: | James M Snell <jasnell@gmail.com> |
A. Acknowledgements
The author wishes to thank the Activity Streams community and implementers for their support, encouragement, and enthusiasm including but not limited to: Abdul Qabiz, Adina Levin, Adrian Chan, Adriana Javier, Alan Hoffman, Alex Kessinger, Alexander Ovchinnikov, Alexander Zhuravlev, Alexandre Loureiro Solleiro, Amy Walgenbach, Andres Vidal, Angel Robert Marquez, Ari Steinberg, Arjan Scherpenisse, Arne Roomann-Kurrik, Beau Lebens, Ben Hedrington, Ben Metcalfe, Ben Werdmuller, Benjamin Goering, Bill de hOra, Bo Xing, Bob Aman, Bob Wyman, Brett Slatkin, Brian Walsh, Brynn Evans, Charlie Cauthen, Chris Chabot, Chris Messina, Chris Toomey, Christian Crumlish, Dan Brickley, Dan Scott, Daniel Chapman, Danny Ayers, Dare Obasanjo, Darren Bounds, David Cramer, David Nelson, David Recordon, DeWitt Clinton, Douglas Pearce, Ed Summers, Elias Bizannes, Elisabeth Norris, Eric Marcoullier, Eric Woods, Evan Prodromou, Gee-Hsien Chuang, Greg Biggers, Gregory Foster, Henry Saputra, Hillary Madsen, Howard Liptzin, Hung Tran, Ian Kennedy, Ian Mulvany, Ivan Pulleyn, Jacob Kim, James Falkner, James Pike, James Walker, Jason Kahn, Jason Kantz, Jeff Kunins, Jeff Martin, Jian Lin, Johannes Ernst, John Panzer, Jon Lebkowsky, Jon Paul Davies, Jonathan Coffman, Jonathan Dugan, Joseph Boyle, Joseph Holsten, Joseph Smarr, Josh Brewer, Jud Valeski, Julien Chaumond, Julien Genestoux, Jyri Engestroem, Kaliya Hamlin, Kevin Marks, Laurent Eschenauer, Laurie Voss, Leah Culver, Libby Miller, Manu Mukerji, Mark Weitzel, Marko Degenkolb, Marshall Kirkpatrick, Martin Atkins, Martin Svensson, Marty Alchin, Mary Hoder, Matt Leventi, Matt Wilkinson, Matthias Mueller-Prove, Max Engel, Max Wegmueller, Melvin Carvalho, Michael Buckbee, Michael Chan, Michael Richardson, Michael Sullivan, Mike Macgirvin, Mislav Marohnić, Mo Jangda, Monica Wilkinson, Nate Benes, NeilFred Picciotto, Nick Howard, Nick Lothian, Nissan Dookeran, Nitya Narasimhan, Pablo Martin, Padraic Brady, Pat Cappelaere, Patrick Aljord, Peter Ferne, Peter Reiser, Peter Saint-Andre, Phil Wolff, Philip (flip) Kromer, Richard Cunningham, Richard Zhao, Rick Severson, Robert Hall, Robert Langbert, Robert Dolin, Robin Cover, Ryan Boyd, Sam Sethi, Scott Raymond, Scott Seely, Simon Grant, Simon Wistow, Stephen Garcia, Stephen Sisk, Stephen Paul Weber, Steve Ivy, Steve Midgley, Steven Livingstone-Perez, Sylvain Carle, Sylvain Hellegouarch, Tantek Çelik, Tatu Saloranta, Tim Moore, Timothy Young, Todd Barnard, Tosh Meston, Tyler Gillies, Will Norris, Zach Copley, Laurent-Walter Goix, Matthew Marum, Andy Smith, and Zach Shepherd.
B. Summary of Changes
2015-01-16
- Include Extended Vocabulary
- Add
Actor
,OrderedCollection
- Add
- Include discussion about Mentions and Tags
- Expanded Examples
2014-11-06
- Refactor's Natural Language Context to address JSON-LD compatibility and serialization concerns. For instance, rather than "displayName" having a value that is *either* a string or a Language Map, this creates a separate "displayNameMap" for the Language Map case and keeps "displayName" as a String only. The JSON-LD processing algorithms handle this just fine and non-JSON-LD implementations end up with a more predictable, consistent target.
- Remove the "language" property
- Refactor as:Link, add as:href to indicate the target of the Link, move away from overloading @id. This ought to resolve the modeling issues that have been discussed.
- Deprecate the "verb" property in AS 2.0, use @type instead to represent the Activity Type. Provide clear guidelines for handling the "verb" property when moving from AS 1.0 to AS 2.0.
- Require JSON-LD compacted form using a normative JSON-LD @context definition. Forbid implementations from altering the normative JSON-LD @context. This will ensure that the serialized JSON will remain consistent for the key properties, making it easier for implementations that choose not to use the JSON-LD standard algorithms.
- Strengthen the MUST IGNORE requirement for extensions. Make it clear that implementations SHOULD define extension properties using an @context and spell out the consequences if they do not. Make it clear that there are some valid JSON constructs (arrays of arrays) that are not supported in JSON-LD and show an example using the one significant case we are currently aware of (GeoJSON).
- Provide a AS1-to-AS2 specific @context definition that is specifically for processing AS1 documents using AS2 semantics.
- Remove the Verb and ObjectType abstract classes. Verb is no longer needed with the move to @type. Verbs just become subclasses of as:Activity. The ObjectType definition can be handled better using other constructs. Overall, this simplifies our vocabulary, which is good.
- Add iCal to the JSON-LD initial context
2014-09-30
- Rework serialization model to be based on JSON-LD.
- Updated vocabulary model.
- Remove notion of "Type Values".
- Redefine "Link Values" as "Link".
- Removed the "duplicates" property introduced in earlier AS2 drafts due to lack of any implementation evidence.
- Vocabulary: rename "attachments" to "attachment" and "tags" to "tag", deprecate the old names.
- Vocabulary: define "url", "image" and "icon" as having Link values. The clean up here ought to resolve the confusion over the relationship between
@id
,url
,self
, etc. - Vocabulary: The
mediaType
andrel
properties are defined on Link and not Object.
C. Table of Figures
- Fig. 1
Expresses the statement
'urn:example:person:martin' posted 'https://example.org/foo.jpg'
. No additional detail is given. - Fig. 2 Expresses the statement "Martin Smith posted an article to the blog 'Martin's Blog' at 3:04 PM UTC on February 2, 2015." Some additional details about the article, actor and target blog are given using properties defined by the Activity Streams 2.0 Vocabulary.
- Fig. 3 A more extensive, single-entry "Activity Stream" follows.
- Fig. 4 Following is an example Object that uses the JSON-ID
@id
and@type
JSON-LD keywords to express the global identifier and object type: - Fig. 5 For instance, in the following example, the value of
actor
is considered to be an instance of Object while the value ofobject
is not: - Fig. 6 An Object that is both a
Place
and agr:Location
: - Fig. 7 A single displayName String value without language information:
- Fig. 8 Multiple, language-specific values:
- Fig. 9 Establishing a default language context:
- Fig. 10 Specifying language in a JSON-LD value object:
- Fig. 11 Excluding a natural language property from the language context:
- Fig. 12 To reference a single image without any additional metadata, a direct association can be expressed as a JSON string containing an absolute or relative IRI.
- Fig. 13 Alternatively, if additional metadata is required (such as the MIME content type of the referenced resource) a Link can be used:
- Fig. 14 If more than one value is to be expressed, A JSON Array with a mix of strings and Links can be used:
- Fig. 15
- Fig. 16 An Activity with a Person actor:
- Fig. 17 An Activity with a Person actor extended with VCard properties:
- Fig. 18 An Actor that is both a
Person
and avcard:Individual
: - Fig. 19 The following example illustrates a simple Activity:
- Fig. 20 An Activity that is both a
Like
and ahttps://schema.org/LikeAction
: - Fig. 21 The following is a simple unordered collection with paging:
- Fig. 22 The following is a simple ordered collection with paging:
- Fig. 23 GeoJSON Point Coordinates:
- Fig. 24 The Equivalent
Place
alternative: - Fig. 25 GeoJSON Polygon Coordinates:
- Fig. 26 The Equivalent GeoSparl Well-Known-Text alternative:
- Fig. 27
- Fig. 28 A simple note with a mention an a hashtag:
- Fig. 29 Mentions and Tags within an Activity Streams Note
- Fig. 30 Mentions and Tags within an Activity Streams Note
D. References
D.1 Normative references
- [AS1]
- J. Snell; M. Atkins; W. Norris; C. Messina; M. Wilkinson; R. Dolin. JSON Activity Streams 1.0. unofficial. URL: https://activitystrea.ms/specs/json/1.0/
- [HTML5]
- Ian Hickson; Robin Berjon; Steve Faulkner; Travis Leithead; Erika Doyle Navara; Edward O'Connor; Silvia Pfeiffer. HTML5. 28 October 2014. W3C Recommendation. URL: https://www.w3.org/TR/html5/
- [JSON-LD]
- Manu Sporny; Gregg Kellogg; Markus Lanthaler. JSON-LD 1.0. 16 January 2014. W3C Recommendation. URL: https://www.w3.org/TR/json-ld/
- [JSON-LD-API]
- Markus Lanthaler; Gregg Kellogg; Manu Sporny. JSON-LD 1.0 Processing Algorithms and API. 16 January 2014. W3C Recommendation. URL: https://www.w3.org/TR/json-ld-api/
- [RFC2119]
- S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
- [RFC3339]
- G. Klyne; C. Newman. Date and Time on the Internet: Timestamps. July 2002. Proposed Standard. URL: https://tools.ietf.org/html/rfc3339
- [RFC3986]
- T. Berners-Lee; R. Fielding; L. Masinter. Uniform Resource Identifier (URI): Generic Syntax. January 2005. Internet Standard. URL: https://tools.ietf.org/html/rfc3986
- [RFC3987]
- M. Duerst; M. Suignard. Internationalized Resource Identifiers (IRIs). January 2005. Proposed Standard. URL: https://tools.ietf.org/html/rfc3987
- [RFC5988]
- M. Nottingham. Web Linking. October 2010. Proposed Standard. URL: https://tools.ietf.org/html/rfc5988
- [RFC7159]
- T. Bray, Ed.. The JavaScript Object Notation (JSON) Data Interchange Format. March 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7159
D.2 Informative references
- [RFC5005]
- M. Nottingham. Feed Paging and Archiving. September 2007. Proposed Standard. URL: https://tools.ietf.org/html/rfc5005
- [RFC5646]
- A. Phillips, Ed.; M. Davis, Ed.. Tags for Identifying Languages. September 2009. Best Current Practice. URL: https://tools.ietf.org/html/rfc5646