Activity Vocabulary
Jump to Table of Contents
Collapse Sidebar
译者声明:
本规范的
英文版本
是其唯一标准版本。其它
翻译版本
包括本译文仅供参考。
译者力求翻译准确,但由于专业水平与时间限制,翻译难免出错。
欢迎通过以下方式提出意见建议:
a. 在
翻译 Git 存储库
创建 Issue。
b. 向
errata@wholetrans.org
发送邮件。
译者:
cdn0x12
全译
Activity Vocabulary
W3C
推荐规范
2017 年 5 月 23 日
当前版本:
最新发布版本:
最新编辑草案:
测试套件:
实现报告:
上一版本:
编者:
James M Snell
, IBM
Evan Prodromou
, Fuzzy.ai
存储库:
Github
议题 (Issues)
提交记录 (Commits)
Test:
校验器
要了解自发布以来报告的任何错误或问题,请查阅
勘误表
此规范的英文版本是唯一的标准版本。此外还可能存在不具标准效力的
翻译版本
W3C
MIT
ERCIM
Keio
Beihang
).
W3C
liability
trademark
and
permissive document license
rules apply.
摘要
本规范描述了 Activity 词汇集。它旨在用于 ActivityStreams 2.0 格式的上下文中,并为 Activity 结构和特定的 Activity 类型提供基础词汇。
编者注
本节为非规范性内容。
本草案深受 JSON Activity Streams 1.0 规范的影响,该规范最初由 Martin Atkins、Will Norris、Chris Messina、Monica Wilkinson、Rob Dolin 和 James Snell 共同撰写。作者非常感谢他们的重大贡献,并很高兴能在他们工作的基础上继续前进。本文档使用了 Activity Streams 1.0 原始文本的部分内容。
关于本文档
本节描述了本文档发布时的状态。其它文档可能会取代本文档。
W3C
现有的出版物列表和本技术报告的最新修订版可以在
W3C
技术报告索引
中找到,网址为 https://www.w3.org/TR/。
本文档由
社交网络工作组
发布为推荐规范。欢迎对本文档提出意见。请将意见以邮件形式发送至
public-socialweb@w3.org
订阅
归档
)。
请参阅工作组的
实现报告
本文档已经过
W3C
会员、软件开发人员以及其他
W3C
小组和利益相关方的审查,并已被指导组批准为
W3C
推荐规范。这是一份处于稳定组昂泰的文档,可以用作参考材料或被其他文档引用。
W3C
发布推荐规范的作用是引起对该规范的关注,并促进其广泛部署。这增强了 Web 的功能和互操作性。
本文档的编辑小组根据
2004 年 2 月 5 日的
W3C
专利政策
运作。
W3C
维护了一份
与该小组的可交付成果有关的专利披露公开列表
;该页面还包括披露专利的说明。任何实际知晓某项专利,并认为此专利中含有其
基本权利要求
的个人须根据
W3C
专利政策第 6 节
披露该信息。
本文档受
2017 年 3 月 1 日的
W3C
流程文档
的约束。
1.
引言
Activity Streams 2.0 核心语法
定义了 Activity Streams 的 JSON 语法。本文档定义了词汇集属性。
Activity Streams 2.0 词汇集定义了一组抽象类型与属性,用于描述过去、现在与未来的活动。该词汇集由两部分定义:
描述 Activity 广义结构的核心属性集;以及
扩展属性集,包括许多社交 Web 应用程序系统中常见的特定类型的活动与产物。
虽然不期望所有 Activity Streams 2.0 实现都支持扩展属性,但所有实现
必须
至少能根据
Activity Streams 2.0 核心语法
对扩展属性进行序列化与反序列化。
本文档中的关键词 "
必须
"、"
不得
"、"
要求
"、"
应当
"、"
不应
"、"
应该
"、"
不该
"、"
建议
"、"
可以
"与"
可选
"应按照 [
RFC2119
] 中的描述进行解释。
1.1
约定
除非另有说明,否则所有值类型定义为
xsd:dateTime
的属性
必须
符合 Activity Streams 2.0 核心规范
2.3 节
的规定。
本文档中包含的示例使用本规范定义的规范性 JSON 进行序列化。
2.
核心类型
Activity 词汇集核心类型构成了本词汇集其余部分的基础。
基准 URI:
Activity Streams 2.0 核心类型包括:
Object
Link
Activity
IntransitiveActivity
Collection
OrderedCollection
CollectionPage
OrderedCollectionPage
类型
描述
示例
Object
URI:
示例 1
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Object"
"id"
"http://www.test.example/object/1"
"name"
"一个简单、无特定属性的对象"
说明:
描述任意类型的对象。Object 类型作为 Activity 词汇集中定义的大多数其它类型对象的基准类型,包括其它核心类型,如
Activity
IntransitiveActivity
Collection
OrderedCollection
不相交于:
Link
属性:
attachment
attributedTo
audience
content
context
name
endTime
generator
icon
image
inReplyTo
location
preview
published
replies
startTime
summary
tag
updated
url
to
bto
cc
bcc
mediaType
duration
Link
URI:
示例 2
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Link"
"href"
"http://example.org/abc"
"hreflang"
"zh"
"mediaType"
"text/html"
"name"
"一条示例链接"
说明:
链接是对由 URL 标识的资源的间接、限定的引用。链接的基础模型由 [
RFC5988
] 建立。Activity 词汇集定义的许多属性的值可以为
Object
Link
。当使用
Link
时, Link 会在主体(即包含该链接的对象)与由
href
标识的资源之间建立
限定关系
Link
自身的属性描述该引用的属性,而非目标资源的属性。
不相交于:
Object
属性:
href
rel
mediaType
name
hreflang
height
width
preview
Activity
URI:
示例 3
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Activity"
"summary"
"Sally 对一条贴文执行了一些操作"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Note"
"name"
"一条贴文"
说明:
Activity 是
Object
的子类型,描述可能发生、正在发生或已经发生的某种形式的动作。
Activity
类型本身作为所有类型的 Activity 的抽象基准类型。需要注意的是,
Activity
类型本身不包含有关所采取动作的类型的任何特定语义。
继承自:
Object
属性:
actor
object
target
result
origin
instrument
继承
Object
的所有属性。
IntransitiveActivity
URI:
示例 4
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Travel"
"summary"
"Sally 去工作了"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"target"
: {
"type"
"Place"
"name"
"Work"
说明:
IntransitiveActivity
Activity
的子类型,表示不及物动作。因此
object
属性不适用于这些活动。
继承自:
Activity
属性:
继承
Activity
中除
object
之外的所有属性。
Collection
URI:
示例 5
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的贴文"
"type"
"Collection"
"totalItems"
"items"
: [
"type"
"Note"
"name"
"一条简单的贴文"
},
"type"
"Note"
"name"
"另一条简单的贴文"
说明:
Collection
Object
的子类型,表示
Object
Link
实例的有序或无序集合。
有关
Collection
类型的完整描述,请参阅
Activity Streams 2.0 核心规范
继承自:
Object
属性:
totalItems
current
first
last
items
继承
Object
的所有属性。
OrderedCollection
URI:
示例 6
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的贴文"
"type"
"OrderedCollection"
"totalItems"
"orderedItems"
: [
"type"
"Note"
"name"
"一条简单的贴文"
},
"type"
"Note"
"name"
"另一条简单的贴文"
说明:
Collection
的子类型,其中逻辑集合的成员被假定始终是严格有序的。
继承自:
Collection
属性:
继承
Collection
的所有属性。
CollectionPage
URI:
示例 7
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的贴文的第 1 页"
"type"
"CollectionPage"
"id"
"http://example.org/foo?page=1"
"partOf"
"http://example.org/foo"
"items"
: [
"type"
"Note"
"name"
"一条简单的贴文"
},
"type"
"Note"
"name"
"另一条简单的贴文"
说明:
用于表示
Collection
中条目的不同子集。有关
CollectionPage
对象的完整描述,请参阅
Activity Streams 2.0 核心规范
继承自:
Collection
属性:
partOf
next
prev
继承
Collection
的所有属性。
OrderedCollectionPage
URI:
示例 8
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的贴文的第 1 页"
"type"
"OrderedCollectionPage"
"id"
"http://example.org/foo?page=1"
"partOf"
"http://example.org/foo"
"orderedItems"
: [
"type"
"Note"
"name"
"一条简单的贴文"
},
"type"
"Note"
"name"
"另一条简单的贴文"
说明:
用于表示
OrderedCollection
中条目的有序子集。有关
OrderedCollectionPage
对象的完整描述,请参阅
Activity Streams 2.0 核心规范
继承自:
OrderedCollection
CollectionPage
属性:
startIndex
继承
OrderedCollection
CollectionPage
的所有属性。
3.
扩展类型
基准 URI:
Activity Streams 2.0 扩展类型包括许多社交网络应用中通用的 Activity 与对象 Object 子类型。它们分为三组:
活动类型
行为体类型
对象类型
对特定扩展词汇类型的支持预计会有所不同,实现只需选择在这些应用的特定上下文与需求中有意义的扩展类型与属性。然而,为了避免可能的互操作性问题,实现
必须
避免使用与此处定义的扩展词汇过度重叠或重复的扩展类型或属性。
3.1
活动类型
所有活动类型都继承基准
Activity
类型的属性。某些特定的活动类型是更广义的活动类型的子类型或特化类型(例如,
Invite
活动类型是
Offer
活动类型的更具体形式)。
活动类型包括:
Accept
(接受)
Add
(添加)
Announce
(宣布)
Arrive
(到达)
Block
(屏蔽)
Create
(创建)
Delete
(删除)
Dislike
(不喜欢)
Flag
(标记)
Follow
(关注)
Ignore
(忽略)
Invite
(邀请)
Join
(加入)
Leave
(离开)
Like
(喜欢)
Listen
(收听)
Move
(移动)
Offer
(提议)
Question
(提问)
Reject
(拒绝)
Read
(阅读)
Remove
(移除)
TentativeReject
(暂定拒绝)
TentativeAccept
(暂定接受)
Travel
(旅行)
Undo
(撤销)
Update
(更新)
View
(查看)
类型
描述
示例
Accept
URI:
示例 9
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 接受了一个去派对的邀请"
"type"
"Accept"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Invite"
"actor"
"http://john.example.org"
"object"
: {
"type"
"Event"
"name"
"Jim 的告别派对"
示例 10
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 接受了 Joe 加入俱乐部的请求"
"type"
"Accept"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Person"
"name"
"Joe"
},
"target"
: {
"type"
"Group"
"name"
"俱乐部"
说明:
表示
actor
接受了
object
。在某些情形下,可以使用
target
属性来表示
object
被接受进入的上下文。
继承自:
Activity
属性:
继承
Activity
的所有属性。
TentativeAccept
URI:
示例 11
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 暂时接受了一个去派对的邀请"
"type"
"TentativeAccept"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Invite"
"actor"
"http://john.example.org"
"object"
: {
"type"
"Event"
"name"
"Jim 的告别派对"
说明:
Accept
的特化类型,表示接受是暂定的。
继承自:
Accept
属性:
继承
Accept
的所有属性。
Add
URI:
示例 12
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 添加了一个对象"
"type"
"Add"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
"http://example.org/abc"
示例 13
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 把她的猫咪的图片添加到了她的猫咪图片合集中"
"type"
"Add"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Image"
"name"
"一张我的猫的图片"
"url"
"http://example.org/img/cat.png"
},
"origin"
: {
"type"
"Collection"
"name"
"相机胶卷"
},
"target"
: {
"type"
"Collection"
"name"
"我的猫图"
说明:
表示
actor
已将
object
添加到
target
。若未明确指定
target
属性,则目标需要通过上下文隐式确定。
origin
可用于识别
object
的来源上下文。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Arrive
URI:
示例 14
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 到达了公司"
"type"
"Arrive"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"location"
: {
"type"
"Place"
"name"
"公司"
},
"origin"
: {
"type"
"Place"
"name"
"家"
说明:
一种
IntransitiveActivity
,表示
actor
已到达
location
origin
可用于识别
actor
的出发地上下文。
target
通常没有固定的含义。
继承自:
IntransitiveActivity
属性:
继承
IntransitiveActivity
的所有属性。
Create
URI:
示例 15
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 创建了一条贴文"
"type"
"Create"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Note"
"name"
"一条简单的贴文"
"content"
"这是一条简单的贴文"
说明:
表示
actor
创建了
object
继承自:
Activity
属性:
继承
Activity
的所有属性。
Delete
URI:
示例 16
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 删除了一条贴文"
"type"
"Delete"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
"http://example.org/notes/1"
"origin"
: {
"type"
"Collection"
"name"
"Sally 的贴文"
说明:
表示
actor
删除了
object
。若指定了
origin
,则
origin
表示
object
被删除的来源的上下文。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Follow
URI:
示例 17
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 关注了 John"
"type"
"Follow"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Person"
"name"
"John"
说明:
表示
actor
正在“关注”
object
。这里的“关注”定义为社交系统中通常使用的含义,即行为体对对象执行的任何活动感兴趣。
target
origin
通常没有固定的含义。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Ignore
URI:
示例 18
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 忽略了一条贴文"
"type"
"Ignore"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
"http://example.org/notes/1"
说明:
表示
actor
忽略了
object
target
origin
通常没有明确含义。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Join
URI:
示例 19
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 加入了一个群组"
"type"
"Join"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Group"
"name"
"一个简单的群组"
说明:
表示
actor
已加入
object
target
origin
通常没有固定的含义。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Leave
URI:
示例 20
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 下班了"
"type"
"Leave"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Place"
"name"
"公司"
示例 21
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 离开了群组"
"type"
"Leave"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Group"
"name"
"一个简单的群组"
说明:
表示
actor
已离开
object
target
origin
通常没有含义。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Like
URI:
示例 22
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 点赞了一条贴文"
"type"
"Like"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
"http://example.org/notes/1"
说明:
表示
actor
喜欢、推荐或认可
object
target
origin
通常没有固定的含义。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Offer
URI:
示例 23
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 向 Lewis 提供了 50% 的折扣"
"type"
"Offer"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"http://www.types.example/ProductOffer"
"name"
"五折!"
},
"target"
: {
"type"
"Person"
"name"
"Lewis"
说明:
表示
actor
正在提议
object
。若给定
target
,则
target
表示被给出
object
提议的目标实体。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Invite
URI:
示例 24
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 邀请了 John 和 Lisa 参加派对"
"type"
"Invite"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Event"
"name"
"一场派对"
},
"target"
: [
"type"
"Person"
"name"
"John"
},
"type"
"Person"
"name"
"Lisa"
说明:
Offer
的特化类型,其中
actor
target
发出针对
object
的邀请。
继承自:
Offer
属性:
继承
Offer
的所有属性。
Reject
URI:
示例 25
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 拒绝了参加派对的邀请。"
"type"
"Reject"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Invite"
"actor"
"http://john.example.org"
"object"
: {
"type"
"Event"
"name"
"Jim 的告别派对"
说明:
表示
actor
拒绝了
object
target
origin
通常没有固定的含义。
继承自:
Activity
属性:
继承
Activity
的所有属性。
TentativeReject
URI:
示例 26
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 暂时拒绝了参加派对的邀请"
"type"
"TentativeReject"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Invite"
"actor"
"http://john.example.org"
"object"
: {
"type"
"Event"
"name"
"Jim 的告别派对"
说明:
Reject
的特化类型,其中拒绝被视为暂定的。
继承自:
Reject
属性:
继承
Reject
的所有属性。
Remove
URI:
示例 27
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 从她的贴文合集中移除了一条贴文"
"type"
"Remove"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
"http://example.org/notes/1"
"target"
: {
"type"
"Collection"
"name"
"贴文合集"
示例 28
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"管理员将 Sally 移出群组"
"type"
"Remove"
"actor"
: {
"type"
"http://example.org/Role"
"name"
"管理员"
},
"object"
: {
"type"
"Person"
"name"
"Sally"
},
"origin"
: {
"type"
"Group"
"name"
"一个简单的群组"
说明:
表示
actor
正在移除
object
。若指定,
origin
,则
origin
表示
object
被移除的来源的上下文。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Undo
URI:
示例 29
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 撤回了她对 John 的提议"
"type"
"Undo"
"actor"
"http://sally.example.org"
"object"
: {
"type"
"Offer"
"actor"
"http://sally.example.org"
"object"
"http://example.org/posts/1"
"target"
"http://john.example.org"
说明:
表示
actor
撤销了
object
。在大多数情形下,
object
将是描述之前执行的某个动作的
Activity
(例如,一个人可能之前“点赞”了一篇文章,但出于某种原因,可能在稍后的某个时间点选择撤销这次点赞)。
target
origin
通常没有固定含义。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Update
URI:
示例 30
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 更新了她的贴文"
"type"
"Update"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
"http://example.org/notes/1"
说明:
表示
actor
已更新
object
。但请注意,本词汇集并未定义一种具体的机制来描述对
object
所做的实际修改。
target
origin
通常没有固定含义。
继承自:
Activity
属性:
继承
Activity
的所有属性。
View
URI:
示例 31
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 阅读了一片文章"
"type"
"View"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
: {
"type"
"Article"
"name"
"关于 Activity Streams 你应该知道的事"
说明:
表示
actor
查看了该对象。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Listen
URI:
示例 32
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 听了一首歌"
"type"
"Listen"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
"http://example.org/music.mp3"
说明:
表示
actor
收听了
object
继承自:
Activity
属性:
继承
Activity
的所有属性。
Read
URI:
示例 33
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 阅读了一篇博客文章"
"type"
"Read"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
"http://example.org/posts/1"
说明:
表示
actor
阅读了
object
继承自:
Activity
属性:
继承
Activity
的所有属性。
Move
URI:
示例 34
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 把一条贴文从列表 A 移动到了列表 B"
"type"
"Move"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
"http://example.org/posts/1"
"target"
: {
"type"
"Collection"
"name"
"列表 B"
},
"origin"
: {
"type"
"Collection"
"name"
"列表 A"
说明:
表示
actor
已将
object
origin
移动到
target
。若未指定
origin
target
,则可以通过上下文确定。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Travel
URI:
示例 35
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 从公司回到了家"
"type"
"Travel"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"target"
: {
"type"
"Place"
"name"
"家"
},
"origin"
: {
"type"
"Place"
"name"
"公司"
说明:
表示
actor
正在从
origin
前往
target
Travel
是一个
IntransitiveObject
,其
actor
指定了直接对象。若未指定
target
origin
,则可以通过上下文确定。
继承自:
IntransitiveActivity
属性:
继承
IntransitiveActivity
的所有属性。
Announce
URI:
示例 36
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 宣布她已经到达了公司"
"type"
"Announce"
"actor"
: {
"type"
"Person"
"id"
"http://sally.example.org"
"name"
"Sally"
},
"object"
: {
"type"
"Arrive"
"actor"
"http://sally.example.org"
"location"
: {
"type"
"Place"
"name"
"公司"
说明:
表示
actor
正在引起
target
object
的注意。
origin
通常没有固定含义。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Block
URI:
示例 37
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 屏蔽了 Joe"
"type"
"Block"
"actor"
"http://sally.example.org"
"object"
"http://joe.example.org"
说明:
表示
actor
屏蔽了
object
。屏蔽是
Ignore
的一种更强烈的形式。其典型用途是用于允许用户屏蔽其它用户的活动或内容的社交系统。
target
origin
通常没有固定含义。
继承自:
Ignore
属性:
继承
Ignore
的所有属性。
Flag
URI:
示例 38
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 标记了一条不适当的贴文"
"type"
"Flag"
"actor"
"http://sally.example.org"
"object"
: {
"type"
"Note"
"content"
"一条不适当的贴文"
说明:
表示
actor
“标记”了
object
。标记是在许多社交平台通用的定义,即出于多种原因将举报不当内容。
继承自:
Activity
属性:
继承
Activity
的所有属性。
Dislike
URI:
示例 39
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 对一条贴文点了踩"
"type"
"Dislike"
"actor"
"http://sally.example.org"
"object"
"http://example.org/posts/1"
说明:
表示
actor
不喜欢
object
继承自:
Activity
属性:
继承
Activity
的所有属性。
Question
URI:
示例 40
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Question"
"name"
"答案是什么?"
"oneOf"
: [
"type"
"Note"
"name"
"选项 A"
},
"type"
"Note"
"name"
"选项 B"
示例 41
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Question"
"name"
"答案是什么?"
"closed"
"2016-05-10T00:00:00Z"
说明:
表示正在提出的问题。Question 对象是
IntransitiveActivity
的扩展。也就是说,Question 对象是一个 Activity,但直接对象是问题本身,因此它
禁止
包含
object
属性。
可以使用
anyOf
oneOf
属性之一来表达可能的答案,但 Question 对象
禁止
同时拥有这两个属性。
继承自:
IntransitiveActivity
属性:
oneOf
anyOf
closed
继承
IntransitiveActivity
的所有属性。
3.2
行为体类型
行为体类型是能执行活动的
Object
类型。
核心行为体类型包括:
Application
Group
Organization
Person
Service
类型
描述
属性
Application
URI:
示例 42
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Application"
"name"
"Exampletron 3000"
说明:
描述一个应用软件。
继承自:
Object
属性:
继承
Object
的所有属性。
Group
URI:
示例 43
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Group"
"name"
"Austin 的大胡子们"
说明:
表示行为体的正式或非正式集体。
继承自:
Object
属性:
继承
Object
的所有属性。
Organization
URI:
示例 44
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Organization"
"name"
"示例公司"
说明:
表示一个组织。
继承自:
Object
属性:
继承
Object
的所有属性。
Person
URI:
示例 45
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Person"
"name"
"Sally Smith"
说明:
表示一名个人。
继承自:
Object
属性:
继承
Object
的所有属性。
Service
URI:
示例 46
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Service"
"name"
"示例网络服务"
说明:
表示一个任意类型的服务。
继承自:
Object
属性:
继承
Object
的所有属性。
3.3
对象与链接类型
所有对象类型都继承基础
Object
类型的属性。链接类型继承基础
Link
类型的属性。某些特定的对象类型是更广义对象类型的子类型或特化类型(例如,
Like
类型是
Activity
类型的更具体形式)。
对象类型包括:
Article
Audio
Document
Event
Image
Note
Page
Place
Profile
Relationship
Tombstone
Video
链接类型包括:
Mention
类型
描述
属性
Relationship
URI:
示例 47
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 是 John 的熟人"
"type"
"Relationship"
"subject"
: {
"type"
"Person"
"name"
"Sally"
},
"relationship"
"http://purl.org/vocab/relationship/acquaintanceOf"
"object"
: {
"type"
"Person"
"name"
"John"
说明:
描述两个人之间的关系。
subject
object
属性用于标识连接的个人。
有关更多信息,请参阅
5.2
表示实体之间的关系
继承自:
Object
属性:
subject
object
relationship
继承
Object
的所有属性。
Article
URI:
示例 48
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Article"
"name"
"我这是过了多么疯狂的一天啊"
"content"
"
"attributedTo"
"http://sally.example.org"
说明:
表示任意类型的多段落书面作品。
继承自:
Object
属性:
继承
Object
的所有属性。
Document
URI:
示例 49
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Document"
"name"
"4Q 销售预报"
"url"
"http://example.org/4q-sales-forecast.pdf"
说明:
表示任意类型的文档。
继承自:
Object
属性:
继承
Object
的所有属性。
Audio
URI:
示例 50
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Audio"
"name"
"与一个著名技术专家的访谈t"
"url"
: {
"type"
"Link"
"href"
"http://example.org/podcast.mp3"
"mediaType"
"audio/mp3"
说明:
表示任意类型的音频文档。
继承自:
Document
属性:
继承
Document
的所有属性。
Image
URI:
示例 51
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Image"
"name"
"猫跳上马车"
"url"
: [
"type"
"Link"
"href"
"http://example.org/image.jpeg"
"mediaType"
"image/jpeg"
},
"type"
"Link"
"href"
"http://example.org/image.png"
"mediaType"
"image/png"
说明:
任意类型的图像文档
继承自:
Document
属性:
继承
Document
的所有属性。
Video
URI:
示例 52
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Video"
"name"
"狗玩球"
"url"
"http://example.org/video.mkv"
"duration"
"PT2H"
说明:
表示任意类型的视频文档。
继承自:
Document
属性:
继承
Document
的所有属性。
Note
URI:
示例 53
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Note"
"name"
"一句警告"
"content"
"看起来今天要下雨。记得带伞!"
说明:
表示通常长度少于一段的简短书面作品。
继承自:
Object
属性:
继承
Object
的所有属性。
Page
URI:
示例 54
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Page"
"name"
"Omaha 天气预报"
"url"
"http://example.org/weather-in-omaha.html"
说明:
表示一个网页。
继承自:
Document
属性:
继承
Document
的所有属性。
Event
URI:
示例 55
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Event"
"name"
"Jim 的告别派对"
"startTime"
"2014-12-31T23:00:00-08:00"
"endTime"
"2015-01-01T06:00:00-08:00"
说明:
表示任意类型的事件。
继承自:
Object
属性:
继承
Object
的所有属性。
Place
URI:
示例 56
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Place"
"name"
"Work"
示例 57
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Place"
"name"
"Fresno Area"
"latitude"
36.75
"longitude"
119.7667
"radius"
15
"units"
"miles"
说明:
表示逻辑或物理位置。有关更多信息,请参阅
5.3
表示地点
继承自:
Object
属性:
accuracy
altitude
latitude
longitude
radius
units
继承
Object
的所有属性。
Mention
URI:
示例 58
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Carrie 在她的贴文中提到 Joe"
"type"
"Mention"
"href"
"http://example.org/joe"
"name"
"Joe"
说明:
一种专门化的
Link
,表示 @提及。
继承自:
Link
属性:
继承
Link
的所有属性。
Profile
URI:
示例 59
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Profile"
"summary"
"Sally 的个人资料"
"describes"
: {
"type"
"Person"
"name"
"Sally Smith"
说明:
Profile 是一个内容对象,用于描述另一个对象,通常用于描述
行为体类型
的对象。
describes
属性用于引用被该 profile 描述的对象。
继承自:
Object
属性:
describes
继承
Object
的所有属性。
Tombstone
URI:
示例 60
"type"
"OrderedCollection"
"totalItems"
"name"
"2016 年度假照片"
"orderedItems"
: [
"type"
"Image"
"id"
"http://image.example/1"
},
"type"
"Tombstone"
"formerType"
"Image"
"id"
"http://image.example/2"
"deleted"
"2016-03-17T00:00:00Z"
},
"type"
"Image"
"id"
"http://image.example/3"
说明:
Tombstone(墓碑)表示已被删除的内容对象。它可以在
Collection
中使用,以表示该位置曾经存在一个对象,但已被删除。
继承自:
Object
属性:
formerType
deleted
继承
Object
的所有属性。
4.
属性
基准 URI:
常见属性包括:
actor
attachment
attributedTo
audience
bcc
bto
cc
context
current
first
generator
icon
id
image
inReplyTo
instrument
last
location
items
oneOf
anyOf
closed
origin
next
object
prev
preview
result
replies
tag
target
to
type
url
accuracy
altitude
content
name
duration
height
href
hreflang
partOf
latitude
longitude
mediaType
endTime
published
startTime
radius
rel
startIndex
summary
totalItems
units
updated
width
subject
relationship
describes
formerType
deleted
“定义域”(Domain)指出了属性词适用的
Object
类型。“值域”(Range)指出了属性词可以具有的值的类型。某些属性被标记为另一个词的“子属性”,意味着该词是所引用词的特化。例如,
actor
attributedTo
的子属性。标记为“函数式”(Functional)的属性只能有一个值。未标记为“函数式”的属性可以有多个值。
术语
描述
示例
id
URI:
@id
示例 61
"@context"
"https://www.w3.org/ns/activitystreams"
"name"
"Foo"
"id"
"http://example.org/foo"
说明:
提供
Object
Link
的全局唯一标识符。
定义域:
Object
Link
值域:
anyURI
函数式:
type
URI:
@type
示例 62
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"A foo"
"type"
"http://example.org/Foo"
说明:
标识
Object
Link
的类型。可以指定多个值。
定义域:
Object
Link
值域:
anyURI
actor
URI:
示例 63
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 提议 Foo"
"type"
"Offer"
"actor"
"http://sally.example.org"
"object"
"http://example.org/foo"
示例 64
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 提议 Foo"
"type"
"Offer"
"actor"
: {
"type"
"Person"
"id"
"http://sally.example.org"
"summary"
"Sally"
},
"object"
"http://example.org/foo"
示例 65
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 与 Joe 提议 Foo"
"type"
"Offer"
"actor"
: [
"http://joe.example.org"
"type"
"Person"
"id"
"http://sally.example.org"
"name"
"Sally"
],
"object"
"http://example.org/foo"
说明:
描述一个或多个执行了或预期执行该活动的实体。任何单个活动都可以有多个
actor
actor
可以
使用间接的
Link
指定。
定义域:
Activity
值域:
Object
Link
是以下属性的子属性:
attributedTo
attachment
URI:
示例 66
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Note"
"name"
"你看到我的猫了吗?"
"attachment"
: [
"type"
"Image"
"content"
"这是它的样子。"
"url"
"http://example.org/cat.jpeg"
说明:
标识附加到对象或与对象相关的资源,可能需要特殊处理。其意图是提供一个在语义上至少类似于电子邮件中的附件的模型。
定义域:
Object
值域:
Object
Link
attributedTo
URI:
示例 67
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Image"
"name"
"我的猫在打盹"
"url"
"http://example.org/cat.jpeg"
"attributedTo"
: [
"type"
"Person"
"name"
"Sally"
示例 68
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Image"
"name"
"我的猫在打盹"
"url"
"http://example.org/cat.jpeg"
"attributedTo"
: [
"http://joe.example.org"
"type"
"Person"
"name"
"Sally"
说明:
标识归属此对象的一个或多个实体。归属的实体可能不是行为体。例如,一个对象可能归属于另一项活动的完成。
定义域:
Link
Object
值域:
Link
Object
audience
URI:
示例 69
"@context"
"https://www.w3.org/ns/activitystreams"
"name"
"Holiday announcement"
"type"
"Note"
"content"
"周四公司全体放假。祝你度过愉快的一天!"
"audience"
: {
"type"
"http://example.org/Organization"
"name"
"示例公司"
说明:
标识一个或多个实体,这些实体代表了与该对象相关的所有实体的总体。
定义域:
Object
值域:
Object
Link
bcc
URI:
示例 70
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 向 John 提供了一条贴文"
"type"
"Offer"
"actor"
"http://sally.example.org"
"object"
"http://example.org/posts/1"
"target"
"http://john.example.org"
"bcc"
: [
"http://joe.example.org"
说明:
标识属于该对象私有次要受众的一个或多个对象。
定义域:
Object
值域:
Object
Link
bto
URI:
示例 71
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 向 John 提供了一条贴文"
"type"
"Offer"
"actor"
"http://sally.example.org"
"object"
"http://example.org/posts/1"
"target"
"http://john.example.org"
"bto"
: [
"http://joe.example.org"
说明:
标识属于该对象私有主要受众的一个或多个对象。
定义域:
Object
值域:
Object
Link
cc
URI:
示例 72
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 向 John 提供了一条贴文"
"type"
"Offer"
"actor"
"http://sally.example.org"
"object"
"http://example.org/posts/1"
"target"
"http://john.example.org"
"cc"
: [
"http://joe.example.org"
说明:
标识属于该对象公开次要受众的一个或多个对象。
定义域:
Object
值域:
Object
Link
context
URI:
示例 73
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"上下文 1 中的活动"
"type"
"Collection"
"items"
: [
"type"
"Offer"
"actor"
"http://sally.example.org"
"object"
"http://example.org/posts/1"
"target"
"http://john.example.org"
"context"
"http://example.org/contexts/1"
},
"type"
"Like"
"actor"
"http://joe.example.org"
"object"
"http://example.org/posts/2"
"context"
"http://example.org/contexts/1"
说明:
标识对象或活动所处的上下文。
这里使用的“上下文”概念有意模糊。预期的功能是作为一种手段,用于对拥有共同来源背景或目的的对象与活动进行分组。一个可能的例子是所有与同一项目或事件相关的活动。
定义域:
Object
值域:
Object
Link
current
URI:
示例 74
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的博客文章"
"type"
"Collection"
"totalItems"
"current"
"http://example.org/collection"
"items"
: [
"http://example.org/posts/1"
"http://example.org/posts/2"
"http://example.org/posts/3"
示例 75
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的博客文章"
"type"
"Collection"
"totalItems"
"current"
: {
"type"
"Link"
"summary"
"最近条目"
"href"
"http://example.org/collection"
},
"items"
: [
"http://example.org/posts/1"
"http://example.org/posts/2"
"http://example.org/posts/3"
说明:
在分页的
Collection
中,指示包含最近更新成员条目的页面。
定义域:
Collection
值域:
CollectionPage
Link
函数式:
first
URI:
示例 76
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的博客文章"
"type"
"Collection"
"totalItems"
"first"
"http://example.org/collection?page=0"
示例 77
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的博客文章"
"type"
"Collection"
"totalItems"
"first"
: {
"type"
"Link"
"summary"
"第一页"
"href"
"http://example.org/collection?page=0"
说明:
在有分页的
Collection
中,指示集合中最开始的前续页面。
定义域:
Collection
值域:
CollectionPage
Link
函数式:
generator
URI:
示例 78
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一条简单的贴文"
"type"
"Note"
"content"
"这就是全部内容。"
"generator"
: {
"type"
"Application"
"name"
"Exampletron 3000"
说明:
标识生成该对象的实体(例如应用)。
定义域:
Object
值域:
Object
Link
icon
URI:
示例 79
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一条简单的贴文"
"type"
"Note"
"content"
"这就是全部内容。"
"icon"
: {
"type"
"Image"
"name"
"Note icon"
"url"
"http://example.org/note.png"
"width"
16
"height"
16
示例 80
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一条简单的贴文"
"type"
"Note"
"content"
"一条简单的贴文"
"icon"
: [
"type"
"Image"
"summary"
"贴文 (16x16)"
"url"
"http://example.org/note1.png"
"width"
16
"height"
16
},
"type"
"Image"
"summary"
"贴文 (32x32)"
"url"
"http://example.org/note2.png"
"width"
32
"height"
32
说明:
指示描述此对象图标的实体。图像的纵横比应为一(水平)比一(垂直),并适合用小尺寸展示。
定义域:
Object
值域:
Image
Link
image
URI:
示例 81
"@context"
"https://www.w3.org/ns/activitystreams"
"name"
"一条简单的贴文"
"type"
"Note"
"content"
"这就是全部内容。"
"image"
: {
"type"
"Image"
"name"
"一只猫"
"url"
"http://example.org/cat.png"
示例 82
"@context"
"https://www.w3.org/ns/activitystreams"
"name"
"一条简单的贴文"
"type"
"Note"
"content"
"这就是全部内容。"
"image"
: [
"type"
"Image"
"name"
"猫 1"
"url"
"http://example.org/cat1.png"
},
"type"
"Image"
"name"
"猫 2"
"url"
"http://example.org/cat2.png"
说明:
指示描述此对象图像的实体。与 icon 属性不同,这里不假设有宽高比比或显示尺寸的限制。
定义域:
Object
值域:
Image
Link
inReplyTo
URI:
示例 83
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一条简单的贴文"
"type"
"Note"
"content"
"这就是全部内容。"
"inReplyTo"
: {
"summary"
"上一条贴文"
"type"
"Note"
"content"
"这里还有什么?"
示例 84
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一条简单的贴文"
"type"
"Note"
"content"
"这就是全部内容。"
"inReplyTo"
"http://example.org/posts/1"
说明:
标识该对象作为响应所针对的一个或多个实体。
定义域:
Object
值域:
Object
Link
instrument
URI:
示例 85
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 在示例音乐服务中收听了一首音乐"
"type"
"Listen"
"actor"
: {
"type"
"Person"
"name"
"Sally"
},
"object"
"http://example.org/foo.mp3"
"instrument"
: {
"type"
"Service"
"name"
"示例音乐服务"
说明:
标识用于(或将被用于)完成一项
Activity
的一个或多个对象。
定义域:
Activity
值域:
Object
Link
last
URI:
示例 86
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一个集合"
"type"
"Collection"
"totalItems"
"last"
"http://example.org/collection?page=1"
示例 87
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一个集合"
"type"
"Collection"
"totalItems"
"last"
: {
"type"
"Link"
"summary"
"上一页"
"href"
"http://example.org/collection?page=1"
说明:
在有分页的
Collection
, 指示该集合按既定顺序的最后一页。
定义域:
Collection
值域:
CollectionPage
Link
函数式:
location
URI:
示例 88
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Person"
"name"
"Sally"
"location"
: {
"name"
"阿拉伯海,索科特拉岛自然保护区以东"
"type"
"Place"
"longitude"
12.34
"latitude"
56.78
"altitude"
90
"units"
"m"
说明:
指示与该对象关联的一个或多个物理或逻辑位置。
定义域:
Object
值域:
Object
Link
items
URI:
示例 89
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的贴文"
"type"
"Collection"
"totalItems"
"items"
: [
"type"
"Note"
"name"
"告别派对的提醒"
},
"type"
"Note"
"name"
"会议 2016-11-17"
示例 90
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的贴文"
"type"
"OrderedCollection"
"totalItems"
"orderedItems"
: [
"type"
"Note"
"name"
"会议 2016-11-17"
},
"type"
"Note"
"name"
"告别派对的提醒"
说明:
标识集合中包含的项。被标识的项可以是有序的,也可以是无序的。
定义域:
Collection
值域:
Object
Link
| [
Object
Link
] 的有序列表
oneOf
URI:
示例 91
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Question"
"name"
"答案是什么?"
"oneOf"
: [
"type"
"Note"
"name"
"选项 A"
},
"type"
"Note"
"name"
"选项 B"
说明:
标识问题的互斥选项。使用
oneOf
意味着该问题只能有一个答案。要指定问题可以有多个答案,请使用
anyOf
定义域:
Question
值域:
Object
Link
anyOf
URI:
示例 92
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Question"
"name"
"答案是什么?"
"anyOf"
: [
"type"
"Note"
"name"
"选项 A"
},
"type"
"Note"
"name"
"选项 B"
说明:
标识问题的包含选项。使用
anyOf
意味着该问题可以有多个答案。要指定问题只能有一个答案,请使用
oneOf
定义域:
Question
值域:
Object
Link
closed
URI:
示例 93
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Question"
"name"
"答案是什么?"
"closed"
"2016-05-10T00:00:00Z"
说明:
表示问题已关闭,不再接受答案。
定义域:
Question
值域:
Object
Link
xsd:dateTime
xsd:boolean
origin
URI:
示例 94
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 将一条贴文从列表 A 移动到了列表 B"
"type"
"Move"
"actor"
"http://sally.example.org"
"object"
"http://example.org/posts/1"
"target"
: {
"type"
"Collection"
"name"
"列表 B"
},
"origin"
: {
"type"
"Collection"
"name"
"列表 A"
说明:
描述活动指向的间接对象,即活动发出的
来源
。origin 的确切含义是英语介词“from”的对象。例如,在活动“John moved an item to List B from List A”(John 将一个条目从列表 A 移动到列表 B)中,活动的 origin 是“列表 A”。
定义域:
Activity
值域:
Object
Link
next
URI:
示例 95
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的博客文章 第 2 页"
"type"
"CollectionPage"
"next"
"http://example.org/collection?page=2"
"items"
: [
"http://example.org/posts/1"
"http://example.org/posts/2"
"http://example.org/posts/3"
示例 96
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的博客文章 第 2 页"
"type"
"CollectionPage"
"next"
: {
"type"
"Link"
"name"
"下一页"
"href"
"http://example.org/collection?page=2"
},
"items"
: [
"http://example.org/posts/1"
"http://example.org/posts/2"
"http://example.org/posts/3"
说明:
在分页的
Collection
中,指示下一页的项。
定义域:
CollectionPage
值域:
CollectionPage
Link
函数式:
object
URI:
示例 97
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 点赞了一条贴文"
"type"
"Like"
"actor"
"http://sally.example.org"
"object"
"http://example.org/posts/1"
示例 98
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Like"
"actor"
"http://sally.example.org"
"object"
: {
"type"
"Note"
"content"
"一条简单的贴文"
示例 99
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 点赞了一条贴文"
"type"
"Like"
"actor"
"http://sally.example.org"
"object"
: [
"http://example.org/posts/1"
"type"
"Note"
"summary"
"一条简单的贴文"
"content"
"这是一棵树。"
说明:
当在
Activity
中使用时,描述活动的直接对象。例如,在活动“John added a movie to his wishlist”(John 将一部电影添加到他的愿望单)中,活动的对象是被添加的电影。
当在
Relationship
中使用时,描述与
subject
相关的实体。
定义域:
Activity
Relationship
值域:
Object
Link
prev
URI:
示例 100
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的博客文章 第 1 页"
"type"
"CollectionPage"
"prev"
"http://example.org/collection?page=1"
"items"
: [
"http://example.org/posts/1"
"http://example.org/posts/2"
"http://example.org/posts/3"
示例 101
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的博客文章 第 1 页"
"type"
"CollectionPage"
"prev"
: {
"type"
"Link"
"name"
"上一页"
"href"
"http://example.org/collection?page=1"
},
"items"
: [
"http://example.org/posts/1"
"http://example.org/posts/2"
"http://example.org/posts/3"
说明:
在分页的
Collection
中,标识上一页的条目。
定义域:
CollectionPage
值域:
CollectionPage
Link
函数式:
preview
URI:
示例 102
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Video"
"name"
"很酷的新电影"
"duration"
"PT2H30M"
"preview"
: {
"type"
"Video"
"name"
"预告"
"duration"
"PT1M"
"url"
: {
"href"
"http://example.org/trailer.mkv"
"mediaType"
"video/mkv"
说明:
标识提供此对象的预览的实体。
定义域:
Link
Object
值域:
Link
Object
result
URI:
示例 103
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 确认了她的航班准点"
"type"
: [
"Activity"
"http://www.verbs.example/Check"
],
"actor"
"http://sally.example.org"
"object"
"http://example.org/flights/1"
"result"
: {
"type"
"http://www.types.example/flightstatus"
"name"
"准点"
说明:
描述活动的结果。例如,若某个特定操作导致创建了新资源,则可以使用 result 属性来描述该新资源。
定义域:
Activity
值域:
Object
Link
replies
URI:
示例 104
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一条简单的贴文"
"type"
"Note"
"id"
"http://www.test.example/notes/1"
"content"
"我很好。"
"replies"
: {
"type"
"Collection"
"totalItems"
"items"
: [
"summary"
"对此贴文的回复"
"type"
"Note"
"content"
"很高兴听到这样的话。"
"inReplyTo"
"http://www.test.example/notes/1"
说明:
标识一个
Collection
,其中包含被视为对此对象的回应的对象。
定义域:
Object
值域:
Collection
函数式:
tag
URI:
示例 105
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Image"
"summary"
"Sally 的图片"
"url"
"http://example.org/sally.jpg"
"tag"
: [
"type"
"Person"
"id"
"http://sally.example.org"
"name"
"Sally"
说明:
一个或多个与对象相关联的“标签(tag)”。标签可以是任意类型的 Object。
attachment
tag
之间的主要区别在于,前者意味着通过包含进行关联,而后者意味着通过引用进行关联。
定义域:
Object
值域:
Object
Link
target
URI:
示例 106
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 向 John 提供了一条贴文"
"type"
"Offer"
"actor"
"http://sally.example.org"
"object"
"http://example.org/posts/1"
"target"
"http://john.example.org"
示例 107
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 向 John 提供了一条贴文"
"type"
"Offer"
"actor"
"http://sally.example.org"
"object"
"http://example.org/posts/1"
"target"
: {
"type"
"Person"
"name"
"John"
说明:
描述活动的间接对象,即目标(target)。target 的确切含义主要取决于所描述动作的类型,但通常是英语介词“to”的对象。例如,在活动“John added a movie to his wishlist”(John 将一部电影添加到他的愿望单)中,活动的目标是 John 的愿望单。一个活动可以有多个目标。
定义域:
Activity
值域:
Object
Link
to
URI:
示例 108
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 向 John 提供了一条贴文"
"type"
"Offer"
"actor"
"http://sally.example.org"
"object"
"http://example.org/posts/1"
"target"
"http://john.example.org"
"to"
: [
"http://joe.example.org"
说明:
标识被视为对象公开主要受众的一部分的实体
定义域:
Object
值域:
Object
Link
url
URI:
示例 109
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Document"
"name"
"4Q 销售预报"
"url"
"http://example.org/4q-sales-forecast.pdf"
示例 110
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Document"
"name"
"4Q 销售预报"
"url"
: {
"type"
"Link"
"href"
"http://example.org/4q-sales-forecast.pdf"
示例 111
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Document"
"name"
"4Q 销售预报"
"url"
: [
"type"
"Link"
"href"
"http://example.org/4q-sales-forecast.pdf"
"mediaType"
"application/pdf"
},
"type"
"Link"
"href"
"http://example.org/4q-sales-forecast.html"
"mediaType"
"text/html"
说明:
标识指向所表示的对象的一个或多个链接。
定义域:
Object
值域:
xsd:anyURI
Link
accuracy
URI:
示例 112
"@context"
"https://www.w3.org/ns/activitystreams"
"name"
"中国山东省青岛市平度市刘古路村"
"type"
"Place"
"latitude"
36.75
"longitude"
119.7667
"accuracy"
94.5
说明:
指示
Place
对象上位置坐标的准确性。以百分比属性表示。例如,“94.0”表示“94.0% 准确”。
定义域:
Place
值域:
xsd:float
[>= 0.0f, <= 100.0f]
函数式:
altitude
URI:
示例 113
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Place"
"name"
"Fresno 地区"
"altitude"
15.0
"latitude"
36.75
"longitude"
119.7667
"units"
"miles"
说明:
指示地点的海拔。度量单位使用
units
属性指示。若未指定
units
,则默认假定为“
”,表示米。
定义域:
Object
值域:
xsd:float
函数式:
content
URI:
示例 114
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一条简单的贴文"
"type"
"Note"
"content"
"A simple note"
示例 115
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一条简单的贴文"
"type"
"Note"
"contentMap"
: {
"en"
"A simple note"
"es"
"Una nota sencilla"
"zh-Hans"
"一段简单的笔记"
示例 116
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一条简单的贴文"
"type"
"Note"
"mediaType"
"text/markdown"
"content"
"## 一条简单的贴文\n一条简单的 Markdown `note`"
说明:
编码为 JSON 字符串的对象的内容或文本表示。默认情形下,
content
的值为 HTML。对象中的
mediaType
属性可用于指示不同的内容类型。
内容
可以
使用多语言标记值来表示。
定义域:
Object
值域:
xsd:string
rdf:langString
name
URI:
示例 117
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Note"
"name"
"一条简单的贴文"
示例 118
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Note"
"nameMap"
: {
"en"
"一条简单的贴文"
"es"
"Una nota sencilla"
"zh-Hans"
"一段简单的笔记"
说明:
对象的简单、人类可读的纯文本名称。
不得
包含 HTML 标记。名称
可以
使用多语言标记值来表示。
定义域:
Object
Link
值域:
xsd:string
rdf:langString
duration
URI:
示例 119
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Video"
"name"
"飞翔的鸟"
"url"
"http://example.org/video.mkv"
"duration"
"PT2H"
说明:
当对象描述一个有时限的资源(如音频或视频、会议等)时,
duration
属性指示对象的大致持续时间。该值
必须
表示为 [
xmlschema11-2
] 第 3.3.6 节定义的
xsd:duration
(例如,5 秒的时间段表示为“
PT5S
”)。
定义域:
Object
值域:
xsd:duration
函数式:
height
URI:
示例 120
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Link"
"href"
"http://example.org/image.png"
"height"
100
"width"
100
说明:
位于
Link
上,指定链接资源在设备无关像素中的渲染高度的提示。
定义域:
Link
值域:
xsd:nonNegativeInteger
函数式:
href
URI:
示例 121
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Link"
"href"
"http://example.org/abc"
"mediaType"
"text/html"
"name"
"Previous"
说明:
Link
指向的目标资源。
定义域:
Link
值域:
xsd:anyURI
函数式:
hreflang
URI:
示例 122
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Link"
"href"
"http://example.org/abc"
"hreflang"
"en"
"mediaType"
"text/html"
"name"
"Previous"
说明:
有关目标资源使用的语言的提示。值
必须
为一个 [
BCP47
] 语言标签。
定义域:
Link
值域:
BCP47
] Language Tag
函数式:
partOf
URI:
示例 123
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的贴文的第 1 页"
"type"
"CollectionPage"
"id"
"http://example.org/collection?page=1"
"partOf"
"http://example.org/collection"
"items"
: [
"type"
"Note"
"name"
"值得一试的披萨配料"
},
"type"
"Note"
"name"
"关于加州的想法"
说明:
标识
CollectionPage
对象项所属的
Collection
定义域:
CollectionPage
值域:
Link
Collection
函数式:
latitude
URI:
示例 124
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Place"
"name"
"Fresno Area"
"latitude"
36.75
"longitude"
119.7667
"radius"
15
"units"
"miles"
说明:
地点的纬度。
定义域:
Place
值域:
xsd:float
函数式:
longitude
URI:
示例 125
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Place"
"name"
"Fresno Area"
"latitude"
36.75
"longitude"
119.7667
"radius"
15
"units"
"miles"
说明:
地点的经度。
定义域:
Place
值域:
xsd:float
函数式:
mediaType
URI:
示例 126
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Link"
"href"
"http://example.org/abc"
"hreflang"
"en"
"mediaType"
"text/html"
"name"
"Next"
说明:
当在
Link
上使用时,标识所引用的资源的 MIME 媒体类型。
当在
Object
上使用时,标识
content
属性值的 MIME 媒体类型。若未指定,则假定
content
属性包含
text/html
内容。
定义域:
Link
Object
值域:
MIME 媒体类型
函数式:
endTime
URI:
示例 127
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Event"
"name"
"Jim 的告别派对"
"startTime"
"2014-12-31T23:00:00-08:00"
"endTime"
"2015-01-01T06:00:00-08:00"
说明:
描述对象实际或预期结束时间的日期与时间。例如,当与
Activity
对象一起使用时,
endTime
属性指定活动结束或预期结束的时刻。
定义域:
Object
值域:
xsd:dateTime
函数式:
published
URI:
示例 128
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"一条简单的贴文"
"type"
"Note"
"content"
"鱼游泳。"
"published"
"2014-12-12T12:12:12Z"
说明:
对象发布的日期与时间。
定义域:
Object
值域:
xsd:dateTime
函数式:
startTime
URI:
示例 129
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Event"
"name"
"Jim 的告别派对"
"startTime"
"2014-12-31T23:00:00-08:00"
"endTime"
"2015-01-01T06:00:00-08:00"
说明:
描述对象实际或预期开始时间的日期与时间。例如,当与
Activity
对象一起使用时,
startTime
属性指定活动开始或计划开始的时刻。
定义域:
Object
值域:
xsd:dateTime
函数式:
radius
URI:
示例 130
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Place"
"name"
"Fresno Area"
"latitude"
36.75
"longitude"
119.7667
"radius"
15
"units"
"miles"
说明:
地点的给定纬度与经度的半径。单位由
units
属性表示。若未指定
units
,则默认假定为“
”,表示“米”。
定义域:
Place
值域:
xsd:float
[>= 0.0f]
函数式:
rel
URI:
示例 131
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Link"
"href"
"http://example.org/abc"
"hreflang"
"en"
"mediaType"
"text/html"
"name"
"Preview"
"rel"
: [
"canonical"
"preview"
说明:
Link
关联的链接关系。该值
必须
符合 [
HTML5
] 与 [
RFC5988
] 的“链接关系”定义。
在 [
HTML5
] 中,任何不包含“空格” U+0020、“制表符”(U+0009)、“换行符”(U+000A)、“换页符”(U+000C)、“回车符”(U+000D)或“逗号”(U+002C)字符的字符串都可以用作有效的链接关系。
定义域:
Link
值域:
RFC5988
] or
[HTML5]
Link Relation
startIndex
URI:
示例 132
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的贴文的第 1 页"
"type"
"OrderedCollectionPage"
"startIndex"
"orderedItems"
: [
"type"
"Note"
"name"
"Density of Water"
},
"type"
"Note"
"name"
"Air Mattress Idea"
说明:
一个非负整数值,标识严格有序集合的逻辑视图内的相对位置。
定义域:
OrderedCollectionPage
值域:
xsd:nonNegativeInteger
函数式:
summary
URI:
示例 133
"@context"
"https://www.w3.org/ns/activitystreams"
"name"
"Cane Sugar Processing"
"type"
"Note"
"summary"
"A simple note"
示例 134
"@context"
"https://www.w3.org/ns/activitystreams"
"name"
"Cane Sugar Processing"
"type"
"Note"
"summaryMap"
: {
"en"
"A simple note"
"es"
"Una nota sencilla"
"zh-Hans"
"一段简单的笔记"
说明:
编码为 HTML 的对象自然语言摘要。
可以
提供多个带语言标记的摘要。
定义域:
Object
值域:
xsd:string
rdf:langString
totalItems
URI:
示例 135
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的贴文"
"type"
"Collection"
"totalItems"
"items"
: [
"type"
"Note"
"name"
"Which Staircase Should I Use"
},
"type"
"Note"
"name"
"Something to Remember"
说明:
一个非负整数,指定集合逻辑视图包含的对象总数。此数字可能不反映
Collection
对象实例中序列化的实际项数。
定义域:
Collection
值域:
xsd:nonNegativeInteger
函数式:
units
URI:
示例 136
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Place"
"name"
"Fresno Area"
"latitude"
36.75
"longitude"
119.7667
"radius"
15
"units"
"miles"
说明:
指定
Place
对象上
radius
altitude
属性的测量单位。若未指定,则默认假定为“
”,表示“米”。
定义域:
Place
值域:
cm
" | "
feet
" | "
inches
" | "
km
" | "
" | "
miles
" |
xsd:anyURI
函数式:
updated
URI:
示例 137
"@context"
"https://www.w3.org/ns/activitystreams"
"name"
"Cranberry Sauce Idea"
"type"
"Note"
"content"
"Mush it up so it does not have the same shape as the can."
"updated"
"2014-12-12T12:12:12Z"
说明:
对象更新的日期与时间。
定义域:
Object
值域:
xsd:dateTime
函数式:
width
URI:
示例 138
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Link"
"href"
"http://example.org/image.png"
"height"
100
"width"
100
说明:
Link
对象上,指定链接资源在设备无关像素中的渲染宽度的提示。
定义域:
Link
值域:
xsd:nonNegativeInteger
函数式:
subject
URI:
示例 139
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 是 John 的熟人"
"type"
"Relationship"
"subject"
: {
"type"
"Person"
"name"
"Sally"
},
"relationship"
"http://purl.org/vocab/relationship/acquaintanceOf"
"object"
: {
"type"
"Person"
"name"
"John"
说明:
Relationship
对象上,
subject
属性标识连接的个体之一。例如,对于描述“John is related to Sally”(John 与 Sally 有关系)的 Relationship 对象,
subject
将指代 John。
定义域:
Relationship
值域:
Link
Object
函数式:
relationship
URI:
示例 140
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 是 John 的熟人"
"type"
"Relationship"
"subject"
: {
"type"
"Person"
"name"
"Sally"
},
"relationship"
"http://purl.org/vocab/relationship/acquaintanceOf"
"object"
: {
"type"
"Person"
"name"
"John"
说明:
Relationship
对象上,
relationship
属性标识
subject
object
之间存在的关系的种类。
定义域:
Relationship
值域:
Object
describes
URI:
示例 141
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的个人资料"
"type"
"Profile"
"describes"
: {
"type"
"Person"
"name"
"Sally"
},
"url"
"http://sally.example.org"
说明:
Profile
对象上,
describes
属性标识该 Profile 所描述的对象。
定义域:
Profile
值域:
Object
函数式:
formerType
URI:
示例 142
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"此图片已被删除"
"type"
"Tombstone"
"formerType"
"Image"
"url"
"http://example.org/image/2"
说明:
Tombstone
对象上,
formerType
属性标识被删除对象的类型。
定义域:
Tombstone
值域:
Object
函数式:
deleted
URI:
示例 143
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"此图片已被删除"
"type"
"Tombstone"
"deleted"
"2016-05-03T00:00:00Z"
说明:
Tombstone
对象上,
deleted
属性是对象被删除时的时间戳。
定义域:
Tombstone
值域:
xsd:dateTime
函数式:
5.
实现说明
5.1
受众定位
从概念上讲,每个对象都有主要受众与次要受众。主要受众由直接参与或拥有该对象的实体组成。次要受众由对该对象有共同兴趣但可能不直接参与的实体集合组成(例如“粉丝”)。
例如,假设有一个由三个人组成的社交网络:Bob、Joe 与 Jane。Bob 与 Joe 都是 Jane 的朋友,但他们彼此不是朋友。Bob 选择“关注”Jane 直接参与的活动。Jane 与 Joe 分享了一个文件。
在这个例子中,Jane 与 Joe 都直接参与了文件分享活动,他们共同构成了该事件的主要受众。Bob 对涉及 Jane 的活动感兴趣,因此是次要受众。了解到这一点后,生产或消费该活动的系统就可以智能地将该事件通知给每个人。
虽然有一些手段(基于活动的类型、行为体、对象与目标)可以推断许多类型活动的主要受众,但启发式方法并非在任何情形下都有效,也不能提供识别次要受众的方法。对象中
可以
使用
to
cc
bto
bcc
属性来明确标识主要与次要受众。
包含这些属性的对象的典型用例是通过中介发布与重新分发对象。也就是说,事件源生成对象并将其发布给中介,中介决定向特定的个人用户或群组显示哪些项目子集。这种决定可以通过识别每个对象的主要与次要受众来做出。
当事件源生成对象并指定
to
cc
字段的值时,中介
应该
在保留这些字段值的情形下重新分发该对象,从而允许任何处理器看到该对象的目标受众是谁。这与电子邮件系统中使用的
to
cc
字段的模型完全相同。
然而,在某些情形下,公开受众中特定成员的身份可能是不恰当的。例如,用户可能不希望让其它用户知道他们对各种话题、个人或事件类型感兴趣。为了支持这种选择,生成对象的实现
可以
使用
bto
bcc
属性来列出对象应私下定向到的实体。当中介接收到包含这些属性的对象时,它
必须
在重新分发对象之前移除这些值。其意图是,系统
必须
bto
bcc
属性中列出的实体视为主要与次要受众的一部分,但
不得
向任何其它方透露这一事实。
包含在对象中的受众定位信息仅描述了对象创建者的意图。除了对
bto
bcc
的适当处理有明确例外之外,本规范由实现者自行决定如何使用受众定位信息。
5.1.1
受众与上下文
本节为非规范性内容。
活动很少是孤立的事件。通常,多个单独的活动会围绕相似的上下文或受众进行。例如,在同一个项目上工作的协作者可能会在实现某个目标的过程中执行多个相关的活动。这些活动可以使用
context
属性在逻辑上进行分组,并使用
audience
属性将其范围限定为特定受众。
例如,以下示例显示了共享同一个
context
audience
的两个相关活动:
示例 144
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"项目 XYZ 的 活动"
"type"
"Collection"
"items"
: [
"summary"
"Sally 创建了一条贴文"
"type"
"Create"
"id"
"http://activities.example.com/1"
"actor"
"http://sally.example.org"
"object"
: {
"summary"
"A note"
"type"
"Note"
"id"
"http://notes.example.com/1"
"content"
"A note"
},
"context"
: {
"type"
"http://example.org/Project"
"name"
"项目 XYZ"
},
"audience"
: {
"type"
"Group"
"name"
"项目 XYZ 工作组"
},
"to"
"http://john.example.org"
},
"summary"
"John 点赞了 Sally 的贴文"
"type"
"Like"
"id"
"http://activities.example.com/1"
"actor"
"http://john.example.org"
"object"
"http://notes.example.com/1"
"context"
: {
"type"
"http://example.org/Project"
"name"
"项目 XYZ"
},
"audience"
: {
"type"
"Group"
"name"
"项目 XYZ 工作组"
},
"to"
"http://sally.example.org"
5.2
表示实体间的关系
Relationship
对象用于表示个人之间的关系。例如,它可用于描述一个人是另一个人的朋友,或者一个人是特定组织的成员。以这种方式对关系建模的意图是允许描述对关系本身进行操作的活动,并允许表示关系的集合。
例如,许多社交系统都有“好友列表”的概念。这是指在某人的社交图谱中直接连接的个体集合。假设我们有一个用户 Sally,她与用户 Joe 与 Jane 有直接关系。Sally 关注 Joe 的更新,而 Sally 与 Jane 之间是互相关注的关系。
使用
Relationship
对象,我们可以将这些关系建模为:
示例 145
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 的好友列表"
"type"
"Collection"
"items"
: [
"summary"
"Sally 受 Joe 的影响"
"type"
"Relationship"
"subject"
: {
"type"
"Person"
"name"
"Sally"
},
"relationship"
"http://purl.org/vocab/relationship/influencedBy"
"object"
: {
"type"
"Person"
"name"
"Joe"
},
"summary"
"Sally 是 Jane 的朋友"
"type"
"Relationship"
"subject"
: {
"type"
"Person"
"name"
"Sally"
},
"relationship"
"http://purl.org/vocab/relationship/friendOf"
"object"
: {
"type"
"Person"
"name"
"Jane"
relationship
属性指定了由
subject
object
属性标识的两个个体之间存在的关系种类。这三个属性一起使用构成了通常所说的“
具体化语句
”,其中
subject
标识主体,
relationship
标识谓词,而
object
标识客体。
虽然在某些情形下使用具体化语句可能会有问题和令人困惑,但在 Activity Streams 词汇集中,使用它们来描述关系提供了一种描述个人社交图谱变化的简单机制。例如,为了表明 Sally 与用户 Matt 建立了新关系,实现者可以将
Relationship
对象与
Create
活动结合使用:
示例 146
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 与 Matt 成为了朋友"
"type"
"Create"
"actor"
"http://sally.example.org"
"object"
: {
"type"
"Relationship"
"subject"
"http://sally.example.org"
"relationship"
"http://purl.org/vocab/relationship/friendOf"
"object"
"http://matt.example.org"
"startTime"
"2015-04-21T12:34:56"
此外,以这种方式对关系进行建模允许实现者阐明关系本身的附加属性。例如,关系开始或结束的日期与时间。
实现可以使用为描述关系而开发的现有词汇集,或者根据其特定实现的要求创建自己的词汇集。现有的词汇集包括 “
Friend of a Friend
” 与 “
Relationship
” 词汇集。
5.2.1
“好友请求”建模
本节为非规范性内容。
许多社交平台的一个常见用例是建立对等的“好友”关系,即一个用户最初向另一个用户发出建立新连接的请求。一旦连接建立,两个用户就会自动开始接收对方执行活动的通知,并且建立的关系在任一用户的“好友列表”中变得可见。
初始的“好友请求”可以通过组合
Offer
Relationship
对象类型来建模,如下例所示:
示例 147
"@context"
"https://www.w3.org/ns/activitystreams"
"id"
"http://example.org/connection-requests/123"
"summary"
"Sally 请求与 John 成为好友"
"type"
"Offer"
"actor"
"acct:sally@example.org"
"object"
: {
"summary"
"Sally 与 John 的好友关系"
"id"
"http://example.org/connections/123"
"type"
"Relationship"
"subject"
"acct:sally@example.org"
"relationship"
"http://purl.org/vocab/relationship/friendOf"
"object"
"acct:john@example.org"
},
"target"
"acct:john@example.org"
假设“好友请求”被接受,这个常见应用场景中的其余步骤可以表示为一组不同的活动:
示例 148
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 与 John 的关系历史"
"type"
"Collection"
"items"
: [
"summary"
"John 接受了 Sally 的好友请求"
"id"
"http://example.org/activities/122"
"type"
"Accept"
"actor"
"acct:john@example.org"
"object"
"http://example.org/connection-requests/123"
"inReplyTo"
"http://example.org/connection-requests/123"
"context"
"http://example.org/connections/123"
"result"
: [
"http://example.org/activities/123"
"http://example.org/activities/124"
"http://example.org/activities/125"
"http://example.org/activities/126"
},
"summary"
"John 关注了 Sally"
"id"
"http://example.org/activities/123"
"type"
"Follow"
"actor"
"acct:john@example.org"
"object"
"acct:sally@example.org"
"context"
"http://example.org/connections/123"
},
"summary"
"Sally 关注了 John"
"id"
"http://example.org/activities/124"
"type"
"Follow"
"actor"
"acct:sally@example.org"
"object"
"acct:john@example.org"
"context"
"http://example.org/connections/123"
},
"summary"
"John 将 Sally 添加到了他的好友列表中"
"id"
"http://example.org/activities/125"
"type"
"Add"
"actor"
"acct:john@example.org"
"object"
"http://example.org/connections/123"
"target"
: {
"type"
"Collection"
"summary"
"John 的好友圈"
},
"context"
"http://example.org/connections/123"
},
"summary"
"Sally 将 John 添加到了她的好友列表中"
"id"
"http://example.org/activities/126"
"type"
"Add"
"actor"
"acct:sally@example.org"
"object"
"http://example.org/connections/123"
"target"
: {
"type"
"Collection"
"summary"
"Sally 的好友圈"
},
"context"
"http://example.org/connections/123"
如本例所示,接受“好友请求”会导致四个额外的活动,包括:John 关注 Sally,Sally 关注 John,John 将与 Sally 的关系添加到他的好友集合中,以及 Sally 将与 John 的关系添加到她的好友集合中。
在此例中,
Accept
活动中使用了可选的
result
属性,以标识因接受操作而发生的额外活动。
可选的
context
属性用于将各种活动关联回一个共同的参考点,在本例中即正在建立的关系。
context
允许实现高效地将相关活动分组,以便进行展示或分析。
5.3
表示地点
本节为非规范性内容。
Place
对象用于表示物理与逻辑位置。虽然存在许多用于以各种方式描述位置的现有词汇集,但这些词汇集之间的不一致与不兼容使得实现之间难以实现适当的互操作性。Activity 词汇集中包含
Place
对象,旨在提供一个最小化、可互操作的起点,以便在 Activity Streams 2.0 实现中一致地描述位置。
Place
对象具有灵活的设计意图。例如,它可以仅通过名称来标识一个位置:
示例 149
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Place"
"name"
"San Francisco, CA"
Or, by
longitude
and
latitude
示例 150
"@context"
"https://www.w3.org/ns/activitystreams"
"type"
"Place"
"name"
"San Francisco, CA"
"longitude"
"122.4167"
"latitude"
"37.7833"
Place
对象还可以使用
radius
(半径)属性描述给定点周围的区域,以及位置的
altitude
(海拔)与
accuracy
(精度)。
虽然不要求发布者必须使用这些特定属性,且发布者
可以
利用其它机制来描述位置,但支持
Place
对象的消费端实现
必须
支持这些属性的使用。
5.4
表示问题
本节为非规范性内容。
Question
对象可用于表达各种类型的询问。
例如,类似于发布在众包问答网站上的简单开放式问题:
示例 151
"@context"
"https://www.w3.org/ns/activitystreams"
"name"
"关于机器人的一个问题"
"id"
"http://help.example.org/question/1"
"type"
"Question"
"content"
"我想做一个喂猫机器人。我该用 Arduino 还是树莓派?"
也支持使用
oneOf
anyOf
属性来表示多项选择题或“投票”:
示例 152
"@context"
"https://www.w3.org/ns/activitystreams"
"id"
"http://polls.example.org/question/1"
"name"
"关于机器人的一个问题"
"type"
"Question"
"content"
"我想做一个喂猫机器人。用哪个平台最好?"
"oneOf"
: [
"name"
"arduino"
},
"name"
"树莓派"
使用包含引用该问题的
inReplyto
属性的
对象
,表示对问题的回复。
示例 153
"@context"
"https://www.w3.org/ns/activitystreams"
"attributedTo"
"http://sally.example.org"
"inReplyTo"
"http://polls.example.org/question/1"
"name"
"arduino"
由于
Question
对象也是
Activity
的实例,可以使用
result
属性来表示问题的结果或结局(视情形而定):
示例 154
"@context"
"https://www.w3.org/ns/activitystreams"
"name"
"关于机器人的一个问题"
"id"
"http://polls.example.org/question/1"
"type"
"Question"
"content"
"我想做一个喂猫机器人。用哪个平台最好?"
"oneOf"
: [
"name"
"arduino"
},
"name"
"raspberry pi"
],
"replies"
: {
"type"
"Collection"
"totalItems"
"items"
: [
"attributedTo"
"http://sally.example.org"
"inReplyTo"
"http://polls.example.org/question/1"
"name"
"arduino"
},
"attributedTo"
"http://joe.example.org"
"inReplyTo"
"http://polls.example.org/question/1"
"name"
"arduino"
},
"attributedTo"
"http://john.example.org"
"inReplyTo"
"http://polls.example.org/question/1"
"name"
"raspberry pi"
},
"result"
: {
"type"
"Note"
"content"
"用户倾向于 "arduino" 比例为 33%。"
5.5
逆活动与撤销(Undo)
本节为非规范性内容。
一些核心的
活动类型
被定义为彼此的自然逆向操作。这些包括:
Accept
(接受)与
Reject
(拒绝),
Arrive
(到达)与
Leave
(离开),
Join
(加入)与
Leave
(离开),
Create
(创建)与
Delete
(删除),
Like
(点赞)与
Dislike
(点踩)
值得注意的是,这些类型的活动在语义上是截然不同的,并且没有直接的依赖关系。也就是说,例如,若一个行为体在一个时间点“like”(点赞)了一条贴文,然后又对其“dislike”(点踩),“dislike”活动并不会“撤销”或抵消之前的“like”。
对于下例,恰当的解释是 Sally 先点赞,后来又点踩 John 的贴文:
示例 155
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"John 的贴文的历史"
"type"
"Collection"
"items"
: [
"summary"
"Sally 点赞了 John 的贴文"
"type"
"Like"
"actor"
"http://sally.example.org"
"id"
"http://activities.example.com/1"
"published"
"2015-11-12T12:34:56Z"
"object"
: {
"summary"
"John 的贴文"
"type"
"Note"
"id"
"http://notes.example.com/1"
"attributedTo"
"http://john.example.org"
"content"
"我的贴文"
},
"summary"
"Sally 点踩了 John 的贴文"
"type"
"Dislike"
"actor"
"http://sally.example.org"
"id"
"http://activities.example.com/2"
"published"
"2015-12-11T21:43:56Z"
"object"
: {
"summary"
"John 的贴文"
"type"
"Note"
"id"
"http://notes.example.com/1"
"attributedTo"
"http://john.example.org"
"content"
"我的贴文"
为了提供撤销或取消先前活动的特定能力,我们定义了
Undo
(撤销)活动类型。因此,对于下例的恰当解释是,Sally 曾经点赞 John 的贴文,但后来明确撤回了该“点赞”操作。
示例 156
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"John 的贴文的历史"
"type"
"Collection"
"items"
: [
"summary"
"Sally 点赞了 John 的贴文"
"type"
"Like"
"id"
"http://activities.example.com/1"
"actor"
"http://sally.example.org"
"published"
"2015-11-12T12:34:56Z"
"object"
: {
"summary"
"John 的贴文"
"type"
"Note"
"id"
"http://notes.example.com/1"
"attributedTo"
"http://john.example.org"
"content"
"我的贴文"
},
"summary"
"Sally 不再点赞 John 的贴文"
"type"
"Undo"
"id"
"http://activities.example.com/2"
"actor"
"http://sally.example.org"
"published"
"2015-12-11T21:43:56Z"
"object"
"http://activities.example.com/1"
前一个示例的最终结果是 Sally 表示她改变了对 John 的贴文的看法,现在不喜欢它;而后一个示例中,她目前既不喜欢也不反感它。
5.6
提及、标签与其它常见的社交微语法
本节为非规范性内容。
许多社交软件系统使用特殊的基于文本的微语法,允许用户在对象内定义用于通知、链接或分类的特殊寻址。例如,在对象内容中包含诸如“
@username
”之类的文本,通常会将对象路由到特定用户的特殊“提及”或“收件箱”流。同样,在对象内容中包含诸如“
#话题
”之类的文本,通常会将对象标记为与主题“
话题
”相关。这些机制通常分别被称为“提及”与“话题标签”。
虽然这些微语法
可以
在 Activity Streams
Object
content
name
summary
属性值中使用,但
不应
要求实现解析这些属性的值来确定对象的适当通知路由、分类或链接。相反,发布者
应该
适当使用专门为此目的提供的词汇集术语。
例如,假设某作者希望向名为“@sally”的另一位用户发送感谢信,并带有标签“#givingthanks”。此消息在笔记内容中的典型呈现方式如下所示:
Figure
带有提及与话题标签的一条简单的贴文:
Thank
you
sally
for all your hard work! #givingthanks
典型的社交软件实现通常会渲染此类内容,将“
@sally
”替换为指向“@sally”账户页的超链接,并将“
#givingthanks
”替换为指向带有相同话题标签的其它贴文列表的超链接。大多数实现还会向 sally 发送特别通知,告知她有一条提及她的贴文已创建。
下面的示例展示了一个等效的 Activity Streams
Note
对象:
示例 157
"@context": "https://www.w3.org/ns/activitystreams",
"name": "A thank-you note",
"type": "Note",
"content": "Thank you @sally
for all your hard work!
#givingthanks",
"to": {
"name": "Sally",
"type": "Person",
"id": "http://sally.example.org"
},
"tag": {
"id": "http://example.org/tags/givingthanks",
"name": "#givingthanks"
to
属性表明用户“@sally”被视为贴文
主要受众
的一部分,因此应该收到通知。
tag
属性将该贴文与对“
”的引用关联起来。请注意,
content
仍然包含“
@sally
”与“
#givingthanks
”微语法,但消费端实现不需要解析这些内容即可建立适当的关联。
若发布者希望表示提及但不关联通知,可以使用
Mention
对象类型作为
tag
属性的值。
示例 158
"@context"
"https://www.w3.org/ns/activitystreams"
"name"
"A thank-you note"
"type"
"Note"
"content"
"Thank you @sally for all your hard work! #givingthanks"
"tag"
: [
"type"
"Mention"
"href"
"http://example.org/people/sally"
"name"
"@sally"
},
"id"
"http://example.org/tags/givingthanks"
"name"
"#givingthanks"
5.7
来源与目标
Activity 的
origin
(来源)与
target
(目标)属性分别标识动作
源自
的实体与
指向
的实体。例如,在英文语句“Sally moved the file from Folder A to Folder B”(Sally 将文件从文件夹 A 移动到文件夹 B)中,
origin
是“文件夹 A”,
target
是“文件夹 B”。此活动在下面的示例中说明:
示例 159
"@context"
"https://www.w3.org/ns/activitystreams"
"summary"
"Sally 将销售数据从文件夹 A 移动到了文件夹 B"
"type"
"Move"
"actor"
"http://sally.example.org"
"object"
: {
"type"
"Document"
"name"
"销售数据"
},
"origin"
: {
"type"
"Collection"
"name"
"文件夹 A"
},
"target"
: {
"type"
"Collection"
"name"
"文件夹 B"
origin
属性适用于任意类型的活动,只要英语介词“from”可用于标识活动
object
(对象)的起源、来源或出处。
target
属性适用于任意类型的活动,只要英语介词“to”可用于标识活动
object
(对象)的间接宾语或目的地。
5.8
活动类型的驱动用例
本节为非规范性内容。
本词汇集中定义的
活动类型
主要是为了解决下述常见的已实现社交用例而选择的。
5.8.1
内容管理
内容管理用例主要处理涉及内容创建、修改或删除的活动。这包括譬如“John 创建了一条新贴文”、“Sally 更新了一篇文章”与“Joe 删除了照片”等活动。
相关活动:
Create
Delete
Update
5.8.2
集合管理
集合管理用例主要处理涉及集合内内容管理的活动。集合的示例包括文件夹、相册、好友列表等。这包括譬如“Sally 向文件夹 A 添加了一个文件”、“John 将文件从文件夹 A 移动到文件夹 B”等活动。
相关活动:
Add
Move
Remove
5.8.3
回应
回应用例主要处理对内容的回应。这可以包括诸如点赞或点踩内容、忽略更新、将内容标记为不当内容、接受或拒绝对象等活动。
相关活动:
Accept
Block
Dislike
Flag
Ignore
Like
Reject
TentativeAccept
TentativeReject
5.8.4
事件 RSVP
事件 RSVP 用例主要处理事件邀请与 RSVP 类型的响应。
相关活动:
Accept
Ignore
Invite
Reject
TentativeAccept
TentativeReject
5.8.5
群组管理
群组管理用例主要处理群组的管理。它可以包括譬如“John 将 Sally 添加到群组 A”、“Sally 加入群组 A”、“Joe 离开群组 A”等活动。
相关活动:
Add
Join
Leave
Remove
5.8.6
内容体验
内容体验用例主要处理描述涉及收听、阅读或观看内容的活动。例如,“Sally 阅读了文章”,“Joe 听了这首歌”。
相关活动:
Listen
Read
View
5.8.7
地理社交事件
地理社交事件用例主要处理涉及地理标记类型活动的活动。例如,它可以包括“Joe 到达工作地点”、“Sally 离开工作地点”与“John 正在从家去往工作地点的途中”等活动。
相关活动:
Arrive
Leave
Travel
5.8.8
通知
通知用例主要处理唤起对特定对象或通知的注意。
相关活动:
Announce
5.8.9
问题
问题用例主要处理任意类型的询问表示。有关更多信息,请参见
5.4
表示问题
相关活动:
Question
5.8.10
关系管理
关系管理用例主要处理涉及人际与社交关系管理的活动(例如好友请求、社交网络管理等)。有关更多信息,请参见
5.2
表示实体间的关系
相关活动:
Accept
Add
Block
Create
Delete
Follow
Ignore
Invite
Reject
5.8.11
否定活动
否定活动用例主要处理撤回先前完成活动的能力。有关更多信息,请参见
5.5
逆活动与“撤销”
相关活动:
Undo
5.8.12
提议
提议用例处理涉及向另一方提供对象的活动。例如,它可以包括“A 公司向 Sally 提供购买 Z 产品的折扣”、“Sally 提议向文件夹 A 添加文件”等活动。
相关活动:
Offer
A.
非规范性本体定义
本节为非规范性内容。
Activity Streams 2.0 词汇集的
非规范性
Turtle 定义可在
此处
与/或
命名空间
获取,以方便希望使用 RDF 机制处理 Activity Streams 2.0 的实现者。但请注意,本文档提供了 Activity Streams 2.0 词汇集的规范定义。
B.
变更日志
本节为非规范性内容。
2016-12-15
的上一个候选推荐标准以来,本文档进行了以下显著更改。
由于缺乏实现,删除了四个规范性的
relationship
值。将示例更改为使用
Relationship
词汇集中的术语。
删除了流程部分,特别是那些注明退出标准与风险特性的部分。
修正了
deleted
值域中的拼写错误。
datetime
boolean
添加到
closed
属性的值域中。
first
last
current
属性的定义域设置为
Collection
C.
资料引用
C.1
规范性引用
[BCP47]
Tags for Identifying Languages
. A. Phillips; M. Davis. IETF. September 2009. IETF 当前最佳实践. URL:
[RFC2119]
Key words for use in RFCs to Indicate Requirement Levels
. S. Bradner. IETF. March 1997. 当前最佳实践. URL:
[RFC5988]
Web Linking
. M. Nottingham. IETF. October 2010. 建议规范. URL:
[xmlschema11-2]
W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes
. David Peterson; Sandy Gao; Ashok Malhotra; Michael Sperberg-McQueen; Henry Thompson; Paul V. Biron et al. W3C. 5 April 2012. W3C 推荐规范. URL:
C.2
资料性引用
[HTML5]
HTML5
. Ian Hickson; Robin Berjon; Steve Faulkner; Travis Leithead; Erika Doyle Navara; Theresa O'Connor; Silvia Pfeiffer. W3C. 28 October 2014. W3C 推荐规范. URL: