.
1543 [responses]
1544 Snell, J., "Responses for Activity Streams", March 2012,
1545 .
1547 Appendix A. Acknowledgements
1549 The author wishes to thank the Activity Streams community and
1550 implementers for their support, encouragement, and enthusiasm
1551 including but not limited to: Abdul Qabiz, Adina Levin, Adrian Chan,
1552 Adriana Javier, Alan Hoffman, Alex Kessinger, Alexander Ovchinnikov,
1553 Alexander Zhuravlev, Alexandre Loureiro Solleiro, Amy Walgenbach,
1554 Andres Vidal, Angel Robert Marquez, Ari Steinberg, Arjan
1555 Scherpenisse, Arne Roomann-Kurrik, Beau Lebens, Ben Hedrington, Ben
1556 Metcalfe, Ben Werdmuller, Benjamin Goering, Bill de hOra, Bo Xing,
1557 Bob Aman, Bob Wyman, Brett Slatkin, Brian Walsh, Brynn Evans, Charlie
1558 Cauthen, Chris Chabot, Chris Messina, Chris Toomey, Christian
1559 Crumlish, Dan Brickley, Dan Scott, Daniel Chapman, Danny Ayers, Dare
1560 Obasanjo, Darren Bounds, David Cramer, David Nelson, David Recordon,
1561 DeWitt Clinton, Douglas Pearce, Ed Summers, Elias Bizannes, Elisabeth
1562 Norris, Eric Marcoullier, Eric Woods, Evan Prodromou, Gee-Hsien
1563 Chuang, Greg Biggers, Gregory Foster, Henry Saputra, Hillary Madsen,
1564 Howard Liptzin, Hung Tran, Ian Kennedy, Ian Mulvany, Ivan Pulleyn,
1565 Jacob Kim, James Falkner, James Pike, James Walker, Jason Kahn, Jason
1566 Kantz, Jeff Kunins, Jeff Martin, Jian Lin, Johannes Ernst, John
1567 Panzer, Jon Lebkowsky, Jon Paul Davies, Jonathan Coffman, Jonathan
1568 Dugan, Joseph Boyle, Joseph Holsten, Joseph Smarr, Josh Brewer, Jud
1569 Valeski, Julien Chaumond, Julien Genestoux, Jyri Engestroem, Kaliya
1570 Hamlin, Kevin Marks, Laurent Eschenauer, Laurie Voss, Leah Culver,
1571 Libby Miller, Manu Mukerji, Mark Weitzel, Marko Degenkolb, Marshall
1572 Kirkpatrick, Martin Atkins, Martin Svensson, Marty Alchin, Mary
1573 Hoder, Matt Leventi, Matt Wilkinson, Matthias Mueller-Prove, Max
1574 Engel, Max Wegmueller, Melvin Carvalho, Michael Buckbee, Michael
1575 Chan, Michael Richardson, Michael Sullivan, Mike Macgirvin, Mislav
1576 Marohnić, Mo Jangda, Monica Wilkinson, Nate Benes, NeilFred
1577 Picciotto, Nick Howard, Nick Lothian, Nissan Dookeran, Nitya
1578 Narasimhan, Pablo Martin, Padraic Brady, Pat G. Cappalaere, Patrick
1579 Aljord, Peter Ferne, Peter Reiser, Peter Saint-Andre, Phil Wolff,
1580 Philip (flip) Kromer, Richard Cunningham, Richard Zhao, Rick
1581 Severson, Robert Hall, Robert Langbert, Robert Dolin, Robin Cover,
1582 Ryan Boyd, Sam Sethi, Scott Raymond, Scott Seely, Simon Grant, Simon
1583 Wistow, Stephen Garcia, Stephen Sisk, Stephen Paul Weber, Steve Ivy,
1584 Steve Midgley, Steven Livingstone-Perez, Sylvain Carle, Sylvain
1585 Hellegouarch, Tantek Celik, Tatu Saloranta, Tim Moore, Timothy Young,
1586 Todd Barnard, Tosh Meston, Tyler Gillies, Will Norris, Zach Copley,
1587 and Zach Shepherd.
1589 Appendix B. Processing as JSON-LD
1591 The following non-normative JSON-LD @context document MAY be used
1592 when processing an Activity Streams 2.0 document using the JSON-LD
1593 model.
1595 { "@context": [{
1596 "dc": "http://purl.org/dc/elements/1.1/",
1597 "dct": "http://purl.org/dc/terms/",
1598 "dctypes": "http://purl.org/dc/dcmitype/",
1599 "foaf": "http://xmlns.com/foaf/0.1/",
1600 "vcard": "http://www.w3.org/2006/vcard/ns#",
1601 "org": "http://www.w3.org/ns/org#",
1602 "prov": "http://www.w3.org/ns/prov#",
1603 "link": "http://www.iana.org/assignments/link-relations/"
1604 },{
1605 "as" : "http://activitystrea.ms/2.0/",
1606 "id": "@id",
1607 "language": "@language",
1608 "objectType": {
1609 "@id": "as:objectType"
1610 },
1611 "displayName": {
1612 "@id": "as:displayName",
1613 "@container": "@language"
1614 },
1615 "url": {
1616 "@id": "as:url",
1617 "@type": "@id",
1618 "@container": "@set"
1619 },
1620 "rel": "as:rel",
1621 "mediaType": "as:mediaType",
1622 "verb": {
1623 "@id": "as:verb"
1624 },
1625 "actor": {
1626 "@id": "as:actor",
1627 "@type": "@id",
1628 "@container": "@set"
1629 },
1630 "object": {
1631 "@id": "as:object",
1632 "@type": "@id",
1633 "@container": "@set"
1634 },
1635 "target": {
1636 "@id": "as:target",
1637 "@type": "@id",
1638 "@container": "@set"
1639 },
1640 "result": {
1641 "@id": "as:result",
1642 "@type": "@id",
1643 "@container": "@set"
1644 },
1645 "instrument": {
1646 "@id": "as:instrument",
1647 "@type": "@id",
1648 "@container": "@set"
1649 },
1650 "participant": {
1651 "@id": "as:participant",
1652 "@type": "@id",
1653 "@container": "@set"
1654 },
1655 "priority": {
1656 "@id": "as:priority",
1657 "@type": "xsd:float"
1658 },
1659 "status": {
1660 "@id": "as:status",
1661 "@type": "@vocab"
1662 },
1663 "completed": {
1664 "@id": "as:CompletedStatus"
1665 },
1666 "active": {
1667 "@id": "as:ActiveStatus"
1668 },
1669 "canceled": {
1670 "@id": "as:CanceledStatus"
1671 },
1672 "pending": {
1673 "@id": "as:PendingStatus"
1674 },
1675 "tentative": {
1676 "@id": "as:TentativeStatus"
1677 },
1678 "to": {
1679 "@id": "as:to",
1680 "@type": "@id",
1681 "@container": "@set"
1682 },
1683 "bto": {
1684 "@id": "as:bto",
1685 "@type": "@id",
1686 "@container": "@set"
1687 },
1688 "cc": {
1689 "@id": "as:cc",
1690 "@type": "@id",
1691 "@container": "@set"
1692 },
1693 "bcc": {
1694 "@id": "as:bcc",
1695 "@type": "@id",
1696 "@container": "@set"
1697 },
1698 "alias": {
1699 "@id": "as:alias",
1700 "@type": "@id",
1701 "@container": "@set"
1702 },
1703 "author": {
1704 "@id": "as:author",
1705 "@type": "@id",
1706 "@container": "@set"
1707 },
1708 "content": {
1709 "@id": "as:content",
1710 "@container": "@language"
1711 },
1712 "duplicates": {
1713 "@id": "as:duplicates",
1714 "@type": "@id",
1715 "@container": "@set"
1716 },
1717 "icon": {
1718 "@id": "as:icon",
1719 "@type": "@id",
1720 "@container": "@set"
1721 },
1722 "image": {
1723 "@id": "as:image",
1724 "@type": "@id",
1725 "@container": "@set"
1726 },
1727 "location": {
1728 "@id": "as:location",
1729 "@type": "@id",
1730 "@container": "@set"
1731 },
1732 "published": {
1733 "@id": "as:published",
1734 "@type": "xsd:dateTime"
1735 },
1736 "generator": {
1737 "@id": "as:generator",
1738 "@type": "@id",
1739 "@container": "@set"
1740 },
1741 "provider": {
1742 "@id": "as:provider",
1743 "@type": "@id",
1744 "@container": "@set"
1745 },
1746 "summary": {
1747 "@id": "as:summary",
1748 "@container": "@language"
1750 },
1751 "updated": {
1752 "@id": "as:updated",
1753 "@type": "xsd:dateTime"
1754 },
1755 "startTime": {
1756 "@id": "as:startTime",
1757 "@type": "xsd:dateTime"
1758 },
1759 "endTime": {
1760 "@id": "as:endTime",
1761 "@type": "xsd:dateTime"
1762 },
1763 "validFrom": {
1764 "@id": "as:validFrom",
1765 "@type": "xsd:dateTime"
1766 },
1767 "validUntil": {
1768 "@id": "as:validUntil",
1769 "@type": "xsd:dateTime"
1770 },
1771 "validAfter": {
1772 "@id": "as:validAfter",
1773 "@type": "xsd:dateTime"
1774 },
1775 "validBefore": {
1776 "@id": "as:validBefore",
1777 "@type": "xsd:dateTime"
1778 },
1779 "rating": {
1780 "@id": "as:rating",
1781 "@type": "xsd:float"
1782 },
1783 "tags": {
1784 "@id": "as:tags",
1785 "@type": "@id",
1786 "@container": "@set"
1787 },
1788 "title": {
1789 "@id": "as:title",
1790 "@container": "@language"
1791 },
1792 "duration": {
1793 "@id": "as:duration"
1794 },
1795 "height": {
1796 "@id": "as:height",
1797 "@type": "xsd:nonNegativeInteger"
1799 },
1800 "width": {
1801 "@id": "as:width",
1802 "@type": "xsd:nonNegativeInteger"
1803 },
1804 "inReplyTo": {
1805 "@id": "as:inReplyTo",
1806 "@type": "@id",
1807 "@container": "@set"
1808 },
1809 "actions": {
1810 "@id": "as:actions",
1811 "@container": "@index"
1812 },
1813 "scope": {
1814 "@id": "as:scope",
1815 "@type": "@id",
1816 "@container": "@set"
1817 },
1818 "totalItems": {
1819 "@id": "as:totalItems",
1820 "@type": "xsd:nonNegativeInteger"
1821 },
1822 "itemsPerPage": {
1823 "@id": "as:itemsPerPage",
1824 "@type": "xsd:nonNegativeInteger"
1825 },
1826 "startIndex": {
1827 "@id": "as:startIndex",
1828 "@type": "xsd:nonNegativeInteger"
1829 },
1830 "items": {
1831 "@id": "as:items",
1832 "@container": "@list"
1833 },
1834 "itemsAfter": {
1835 "@id": "as:itemsAfter",
1836 "@type": "xsd:dateTime"
1837 },
1838 "itemsBefore": {
1839 "@id": "as:itemsBefore",
1840 "@type": "xsd:dateTime"
1841 },
1842 "first": {
1843 "@id": "as:first",
1844 "@type": "@id",
1845 "@container": "@set"
1846 },
1847 "last": {
1848 "@id": "as:last",
1849 "@type": "@id",
1850 "@container": "@set"
1851 },
1852 "prev": {
1853 "@id": "as:prev",
1854 "@type": "@id",
1855 "@container": "@set"
1856 },
1857 "previous": {
1858 "@id": "as:prev",
1859 "@type": "@id",
1860 "@container": "@set"
1861 },
1862 "next": {
1863 "@id": "as:next",
1864 "@type": "@id",
1865 "@container": "@set"
1866 },
1867 "current": {
1868 "@id": "as:current",
1869 "@type": "@id",
1870 "@container": "@set"
1871 },
1872 "self": {
1873 "@id": "as:self",
1874 "@type": "@id",
1875 "@container": "@set"
1876 },
1877 "replies": {
1878 "@id": "as:replies",
1879 "@container": "@index"
1880 }
1881 }]
1882 }
1884 Appendix C. Activity Statement Linguistic Forms
1886 The Activity Streams format has been intentionally designed to be
1887 flexible in how statements about past, present or future actions can
1888 be expressed.
1890 C.1. Intransitive Activity
1892 In many situations, the "actor" of an Activity also serves as the
1893 "direct object". For example, if I say, "The process terminated",
1894 then the "process" is both the "actor" and the "object". Such
1895 statements are formally known as being "intransitive".
1897 To describe intransitive actions using the Activity Streams syntax,
1898 simply omit the "object" property:
1900 {
1901 "actor": {
1902 "objectType": "process",
1903 "displayName": "Build Process"
1904 },
1905 "verb": "terminate"
1906 }
1908 C.2. Transitive Activity
1910 In a "transitive" activity, the actor and direct object are distinct
1911 entities. This is the form most commonly expressed using the
1912 Activity Streams format. For instance, if I say, "Joe posted a blog
1913 entry", the actor is "Joe" and the "blog entry" is the direct object.
1915 {
1916 "actor": "acct:joe@example.org",
1917 "verb": "post",
1918 "object": {
1919 "objectType": "article",
1920 "title": "A Blog Entry",
1921 "content": "..."
1922 }
1923 }
1925 C.3. Ditransitive Activity
1927 In "ditransitive" activities, there exist distinct actor, direct and
1928 indirect objects. The indirect object specifies the target to which
1929 the action on the direct object has been directed. For instance, in
1930 "Joe posted a blog entry to his Weblog", the indirect object (or
1931 "target") is "Joe's Weblog".
1933 {
1934 "actor": "acct:joe@example.org",
1935 "verb": "post",
1936 "object": {
1937 "objectType": "article",
1938 "title": "A Blog Entry",
1939 "content": "..."
1940 },
1941 "target": {
1942 "objectType": "blog",
1943 "title": "Joe's Weblog"
1944 }
1945 }
1947 C.4. Expressing tense and aspect
1949 By using the "startTime", "endTime", "duration" and "status"
1950 properties, Activity statements can be used to express past, present
1951 or future actions. Implementations should never rely on an activity
1952 statement's verb identifier to determine the tense or aspect of the
1953 action.
1955 For instance, to indicate an activity that has already concluded, the
1956 startTime and endTime properties would be used to indicate past
1957 points in time:
1959 {
1960 "actor": "acct:joe@example.org",
1961 "verb": "post",
1962 "object": "http://example.org/blog/entry/1",
1963 "startTime": "2012-12-12T12:12:12Z",
1964 "endTime": "2012-12-12T12:12:12Z"
1965 }
1967 If specific start and end times for a concluded activity are not
1968 available, the "status" property can be used to expressly indicate
1969 that the action has completed:
1971 {
1972 "actor": "acct:joe@example.org",
1973 "verb": "post",
1974 "object": "http://example.org/blog/entry/1",
1975 "status": "completed"
1976 }
1978 To indicate an activity that began in the past but is still ongoing,
1979 only the startTime property would be used:
1981 {
1982 "actor": "acct:joe@example.org",
1983 "verb": "watch",
1984 "object": "http://movies.example.org/movie/1",
1985 "startTime": "2014-03-18T04:32:43Z"
1986 }
1988 The status property value "active" can also be used to identify
1989 ongoing activities:
1991 {
1992 "actor": "acct:joe@example.org",
1993 "verb": "watch",
1994 "object": "http://movies.example.org/movie/1",
1995 "status": "active"
1996 }
1998 To indicate an activity that is expected to begin in the future, the
1999 startTime property would indicate a future point in time:
2001 {
2002 "actor": "acct:joe@example.org",
2003 "verb": "cook",
2004 "object": "http://recipes.example.org/recipe/1",
2005 "startTime": "2015-12-23T12:34:21Z"
2006 }
2008 Or, alternatively:
2010 {
2011 "actor": "acct:joe@example.org",
2012 "verb": "cook",
2013 "object": "http://recipes.example.org/recipe/1",
2014 "status": "pending"
2015 }
2017 The status values "pending" and "tentative" differ in that the former
2018 is used to mark actions that are expected to happen while the latter
2019 is used to mark proposed actions that may (or may not) happen.
2021 As an alternative to explicitly stating the "startTime" or "endTime"
2022 properties, the "duration" property can be used to indicate a
2023 specific duration of time relative to either the "startTime" or
2024 "endTime". For instance, specifying an "endTime" of
2025 "2015-12-23T12:23:23Z" with a duration of "PT1H", implies a startTime
2026 of exactly "2015-12-23T11:23:23Z" (1 hour before the specified
2027 endTime).
2029 Note that the value of the "duration" property can be expressed
2030 either as a non-negative integer specifying a number of seconds, or
2031 as an [RFC3339] "duration" string such as "PT1H", "P1DT1H", etc. For
2032 Activity Streams 2.0 implementations for which backwards
2033 compatibility with the Activity Streams 1.0 syntax is not critical,
2034 the RFC 3339 string format is strongly recommended.
2036 C.5. Activity Duration
2038 Actions expressed via the Activity Streams format can either be
2039 instantaneous (semelfactive) or durative (having distinct start and
2040 end times). The specific duration of an activity can be optionally
2041 expressed using the "startTime", "endTime" and "duration" properties.
2043 By default, all activities are assumed to occur instantaneously, that
2044 is, occuring at one point in time without any specific duration.
2045 Such events are indicated by omitting the "startTime", "endTime" or
2046 "duration" properties:
2048 {
2049 "actor": "acct:sally@example.org",
2050 "verb": "post",
2051 "object": "http://example.org/notes/1"
2052 }
2054 An activity that occurs within a specific period of time can be
2055 expressed using combinations of either: "startTime" and "endTime",
2056 "startTime" and "duration", or "endTime" and "duration". For
2057 example:
2059 {
2060 "actor": "acct:sally@example.org",
2061 "verb": "watch",
2062 "object": "http://movies.example.org/movies/1",
2063 "startTime": "2014-05-23T12:23:12Z",
2064 "endTime": "2014-05-23T13:25:15Z"
2065 }
2067 {
2068 "actor": "acct:sally@example.org",
2069 "verb": "watch",
2070 "object": "http://movies.example.org/movies/1",
2071 "startTime": "2014-05-23T12:23:12Z",
2072 "duration": "PT1H2M3S"
2073 }
2075 {
2076 "actor": "acct:sally@example.org",
2077 "verb": "watch",
2078 "object": "http://movies.example.org/movies/1",
2079 "duration": "PT1H2M3S",
2080 "endTime": "2014-05-23T13:25:15Z"
2081 }
2083 Appendix D. Motivational Use Cases
2085 This specification defines a number of syntax changes relative to the
2086 JSON Activity Streams 1.0 specification. The sections that follow
2087 describe some of the general motivations for these changes with
2088 illustrative examples.
2090 D.1. Internationalization (i18n)
2092 The JSON Activity Streams 1.0 syntax has no inherent notion of a
2093 "language context". That is, the core syntax has no internal
2094 mechanism a publisher can use to identify the language used when
2095 constructing the Activity Streams document. Nor are there any
2096 existing mechanisms at the JSON syntax level that an Activity Streams
2097 implementation can inherit. This specification introduces the
2098 "language" property and Natural Language Value concepts to fill this
2099 gap.
2101 Imagine a scenario with a service that receives Activity objects from
2102 users and republishes those to a distributed audience of interested
2103 parties. This service spans international boundaries and the users
2104 speak a multitude of different languages. Within this system, a
2105 native English speaker might subscribe to notifications about
2106 activities posted by a native French speaker.
2108 For instance, let's suppose that our native French speaker posts the
2109 following activity to this system:
2111 POST /activity/feed HTTP/1.1
2112 Content-Type: application/activity+json
2114 {
2115 "verb": "post",
2116 "language": "fr",
2117 "object": {
2118 "objectType": "article",
2119 "displayName": "Un exemple basique",
2120 ...
2121 }
2122 }
2124 The system receives this activity post and prepares to notify our
2125 native English speaking user. Knowing that this user prefers English
2126 and does not speak a word of French, the system can inspect the
2127 Activity and detect automatically that a translation ought to be
2128 provided. Rather than replacing the original French text, however,
2129 the service can simply add in the English translation along side it.
2131 {
2132 "verb": "post",
2133 "language": "fr",
2134 "actor": {
2135 "id": "urn:example:person:abc",
2136 "displayName": "Jean Valjean"
2137 },
2138 "object": {
2139 "type": "article",
2140 "displayName": {
2141 "fr": "Un exemple basique",
2142 "en": "A basic example"
2143 }
2144 ...
2145 }
2146 }
2148 It is also possible for a Natural Language Value to express
2149 alternative same-language representations of a string that utilize
2150 different writing systems or regions. For instance, it is common for
2151 Japanese translations to provide equivalent ideographic (kanji) and
2152 phonetic (katakana or hiragana) alternatives:
2154 {
2155 "title": {
2156 "ja-Hani": "...",
2157 "ja-Kana": "..."
2158 }
2159 }
2161 D.2. Extensibility (e11y)
2163 Arguably, the two most important extensibility points in the Activity
2164 Streams format are the object type and verb properties.
2165 Implementations are free to come up with their own types and verbs at
2166 any point. While such extensibility is extremely powerful, it comes
2167 with a cost. Namely, implementations that encounter previously
2168 unknown verbs and object types may not have enough to knowledge about
2169 those to do anything significant with them.
2171 For instance, the most common use case for Activity Streams today is
2172 the generation of a human-readable "activity feed" that translates
2173 Activity objects into sentences just as "John uploaded a new photo"
2174 or "Jane checked in at a hotel", etc. Given an extension verb such
2175 as "http://example.org/whatever", an implementation might not have
2176 sufficient information about that verb to generate a readable
2177 sentence describing the activity that occurred.
2179 With Activity Streams 1.0, a number of different approaches have been
2180 tried to address this problem, but all of the solutions essentially
2181 deal with the need to provide additional metadata about extension
2182 verbs and object types so that an implementation can dynamically
2183 learn and adapt. The notion of "type values" is added by this
2184 specification to specifically deal with this issue.
2186 For example, suppose I have an implementation that generates Activity
2187 objects that use a new extension verb "urn:example:verbs:upload".
2188 Knowing that consumers of these objects might not have encountered
2189 this verb before, I want to make it possible for those
2190 implementations to automatically discover metadata about the new
2191 verb. To do so, I can use a type value to provide some basic
2192 information.
2194 {
2195 "verb": {
2196 "id": "urn:example:verbs:upload",
2197 "url": "http://example.org/verbs.json",
2198 "mediaType": "application/ld+json",
2199 "displayName": {
2200 "en": "upload",
2201 "fr": "televersement"
2202 },
2203 "alias": "post"
2204 },
2205 "actor": {
2206 "type": "person",
2207 "displayName": "John"
2208 },
2209 "object": {
2210 "type": "photo",
2211 "displayName": "cats.jpg"
2212 }
2213 }
2215 An implementation receiving this has several choices. It could
2216 choose to ignore everything other than the verb's identifier,
2217 treating it generically as one would have to today using the 1.0
2218 syntax; or, it could inspect the metadata provided and notice that
2219 the extension verb can be treated generally as an alias of "post" or
2220 displayed in English as "upload" and in French as "televersement";
2221 or, it can choose to attempt discovering more information about the
2222 verb by dereferencing the provided URL.
2224 The point is, these options are built into the core syntax, making
2225 extension verbs and object types significantly more usable,
2226 particularly when combined with the new language context features.
2228 D.2.1. Publishing Extension objectType and verb Libraries
2230 By treating extension objectTypes and verbs as objects in their own
2231 right, it becomes trivially possible to use the Activity Streams
2232 format as a means of publishing metadata about extension verbs.
2234 For example:
2236 {
2237 "displayName": "My object types and verbs",
2238 "items": [
2239 {
2240 "objectType": "verb",
2241 "id": "urn:example:verbs:create",
2242 "alias": "post",
2243 "displayName": "Create"
2244 },
2245 {
2246 "objectType": "objectType",
2247 "id": "urn:example:types:article",
2248 "displayName": "Article"
2249 }
2250 ]
2251 }
2253 Implementations could use such documents to dynamically learn about
2254 new verbs and objectTypes.
2256 D.3. First Class Links
2258 Linking in the 1.0 syntax is largely undefined and inconsistent.
2259 There is a general notion of Media Link objects that are used for
2260 some things like images and videos, along with a "url" property that
2261 in some cases is used to always point to HTML represenations while in
2262 other cases might point to JSON documents or image files, and there
2263 is no reusable concept of a generic link provided for extensions to
2264 leverage which has led to inconsistent implementation. The 2.0
2265 syntax introduced here deals with these issues by introducing a
2266 clear, consistent, reusable first class linking model.
2268 For instance, using the 2.0 syntax, an "image" object type can be
2269 represented simply as:
2271 {
2272 "objectType": "image",
2273 "url": "http://example.org/cats.jpg",
2274 "mediaType": "image/jpeg",
2275 "displayName": "A picture of my cats",
2276 "alternate": {
2277 "url": "http://example.org/gallery?i=cats.jpg",
2278 "mediaType": "text/html"
2279 }
2280 "preview": "http://example.org/thumbnails/cats.jpg"
2281 }
2283 Essentially, any 2.0 object that contains a "url" property can be
2284 interpreted as a link. That "url" property points to a
2285 representation of the object, while the "mediaType" property
2286 identifies the content type of that linked resource. RFC 5988 Link
2287 Relations can be used directly within the 2.0 syntax to provide
2288 additional data -- in this case, an alternative HTML representation
2289 of the image as well as a thumbnail preview.
2291 Another case that the more flexible linking approach allows us to
2292 address is providing multiple links for a single property. For
2293 instance, it is not uncommon for there to be several alternative
2294 versions of an image resource offered at various resolutions to
2295 support multiple types of devices. With the 2.0 syntax, multiple
2296 choices for a single link can be easily provided.
2298 {
2299 "objectType": "application",
2300 "displayName": "My application",
2301 "icon": [
2302 {
2303 "url": "http://example.org/sd/icon.png",
2304 "width": 57,
2305 "height": 57
2306 },
2307 {
2308 "url": "http://example.org/hd/icon.png",
2309 "width": 114,
2310 "height": 114
2311 }
2312 ],
2313 "preview": [
2314 "http://www.example.org/screenshots/1.jpg",
2315 "http://www.example.org/screenshots/2.jpg",
2316 "http://www.example.org/screenshots/3.jpg"
2317 ]
2318 }
2320 D.4. Use of External Vocabularies
2322 Use of an "external vocabulary" within Activity Streams means using
2323 object types, verbs and properties that are not defined by the core
2324 Activity Streams specification. An example would be using concepts
2325 defined within a microdata vocabulary such as that defined by
2326 Schema.org (http://schema.org).
2328 Implementations that wish to use a Activity Streams with such
2329 external vocabularies face the challenge that, often times, identical
2330 or overlapping concepts can be expressed in a multitude of ways
2331 depending on which vocabulary is selected. This can make it
2332 difficult to map abstract data models into a specific JSON
2333 serialization.
2335 For instance, suppose an application uses the Schema.org model to
2336 represent an article, described here: http://schema.org/Article.
2337 Within this model, there are several properties defined that directly
2338 overlap properties defined by the core Activity Streams syntax. Such
2339 properties include "name", "contentLocation", and "articleBody". In
2340 order to encode the abstact model of a Schema.org/Article into the
2341 JSON Activity Streams model, the application needs to determine
2342 precisely how to map the abstract properties to the serialized
2343 format. In Activity Streams 1.0, no guidance was given on how to
2344 achieve such a mapping, within the 2.0 syntax, the JSON Serialization
2345 for Linked Data (JSON-LD) provides a foundation.
2347 Using JSON-LD I can maintain basic Activity Streams 2.0 syntax while
2348 mapping the physical serialization to the abstract model inline.
2350 {
2351 "objectType": "article",
2352 "displayName": "My article about things",
2353 "content": "This is my article",
2354 "@context": {
2355 "objectType": "@type",
2356 "article": "http://schema.org/Article",
2357 "displayName": "http://schema.org/name",
2358 "content": "http://schema.org/Article/articleBody"
2359 }
2360 }
2362 For any non-JSON-LD aware implementation, this can be processed just
2363 as if it were an ordinary Activity Streams object, without any
2364 additional consideration given. For a JSON-Ld aware implementation,
2365 however, the addition of the "@context" property allows the
2366 serialized JSON to be unambiguously mapped to the Schema.org concept
2367 of an "Article". The fact that we can support such a mapping allows
2368 the Activity Streams format to extend to a broader range of scenarios
2369 without requiring alternative, incompatible vocabulary specific
2370 models of "actions" or "activities" to be developed.
2372 D.5. Embedded Actions
2374 Every Activity Streams object represents a discreet modular component
2375 that can be distributed, shared, or acted upon in a variety of ways.
2376 The 2.0 syntax allows these components to not only express
2377 information about the content but also about the specific types of
2378 actions that can be performed with the object.
2380 For example, an email that is automatically generated by an expense
2381 reporting system could embed a structured Activity Stream object that
2382 contains a listing of the possible actions the recipient of the email
2383 can take. An intelligent email agent can interpret this embedded
2384 metadata and provide a tailored, in-context UI experience:
2386
2387
2388
2399
2400 Your employee, John Doe, has submitted a new expense
2401 report for "John's trip to San Francisco"....
2402
2403
2405 Author's Address
2407 James M Snell (editor)
2408 IBM
2410 Email: jasnell@gmail.com