Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
9326 lines (8754 loc) · 303 KB
/
Copy pathindex.html
File metadata and controls
9326 lines (8754 loc) · 303 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<title>Activity Streams 2.0</title>
<meta charset="UTF-8">
<script src="https://www.w3.org/Tools/respec/respec-w3c-common" async class="remove"></script>
<script class="remove">
var respecConfig = {
specStatus: "ED",
prEnd: "2017-05-11",
crEnd: "2017-01-12",
license: "w3c-software-doc",
edDraftURI: "https://w3c.github.io/activitystreams/core/",
testSuiteURI: "https://github.com/w3c/activitystreams/tree/master/test",
implementationReportURI: "https://github.com/w3c/activitystreams/tree/master/implementation-reports",
errata: "https://github.com/w3c/activitystreams/blob/master/ERRATA.md",
shortName: "activitystreams-core",
editors: [
{
name: "James M Snell",
url: "https://jasnell.me",
company: "IBM",
companyUrl: "https://ibm.com",
w3cid:"26988"
},
{
name: "Evan Prodromou",
url: "https://fuzzy.ai/about",
company: "Fuzzy.ai",
companyUrl: "https://fuzzy.ai",
w3cid: "43626"
}
],
maxTocLevel: 2,
previousMaturity: "CR",
previousPublishDate: "2016-12-15",
wg: "Social Web Working Group",
wgURI: "https://www.w3.org/Social/WG",
wgPublicList: "public-socialweb",
wgPatentURI: "https://www.w3.org/2004/01/pp-impl/72531/status",
localBiblio: {
"AS1": {
title: "JSON Activity Streams 1.0",
href: "https://activitystrea.ms/specs/json/1.0/",
authors: [
"J. Snell",
"M. Atkins",
"W. Norris",
"C. Messina",
"M. Wilkinson",
"R. Dolin"
],
status: "unofficial",
publisher: "https://activitystrea.ms"
},
"SWP": {
title: "Social Web Protocols",
href: "https://www.w3.org/TR/social-web-protocols/",
authors: [
"A. Guy"
]
}
},
otherLinks: [{
key: 'Repository',
data: [
{
value: 'Github',
href: 'https://github.com/w3c/activitystreams'
},
{
value: 'Issues',
href: 'https://github.com/w3c/activitystreams/issues'
},
{
value: 'Commits',
href: 'https://github.com/w3c/activitystreams/commits/master'
}
]
},
{
key: 'Test',
data: [
{
value: 'Validator',
href: 'https://as2.rocks/'
}
]
}]
};
</script>
<style>
thead {
background: #005A9C;
color: white;
}
thead th {
font-weight: normal;
}
table, td, th { border: 1px solid gray }
table { width: 100% ;}
td {
vertical-align: top;
padding: 5px;
}
.nanotabs > ul li { float:left; list-style:none; }
.nanotabs > ul li a { display:block; padding:4px 6px; margin-right: 3px; border-left: 1px solid #b9ab2d; border-right: 1px solid #b9ab2d; border-top: 1px solid #b9ab2d; border-collapse: collapse; background:#fcfaee; color:#b9ab2d; font-family: sans-serif;
text-decoration:none; }
.nanotabs > ul li a:hover { background:#FFFCE5; color:#550; }
.nanotabs > ul li a.selected { background:#555; color:#FFF; }
</style>
</head>
<body>
<section id="abstract">
<p>
This specification details a model for representing potential and
completed activities using the JSON format. It is intended to be used
with vocabularies that detail the structure of activities, and define
specific types of activities.
</p>
<section id="authorsnote" class="informative">
<h2>Author's Note</h2>
<p>
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.
</p>
</section>
</section>
<section id="sotd">
</section>
<section id="introduction">
<h2>Introduction</h2>
<p>
In the most basic sense, an "Activity" is a semantic description of
an 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.
</p>
<p>
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]].
</p>
<section id="swp" class="informative">
<h2>Relationship to Other Social Standards</h2>
<p>
Activity Streams 2.0 is suitable as a social data syntax. It forms
part of the [[SWP]] suite of related standards.
</p>
</section>
<section id="activitystreams-1.0" class="informative">
<h2>Relationship to JSON Activity Streams 1.0</h2>
<p>
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.
</p>
<p>
Some of the issues that specifically motivated the evolution of
Activity Streams 2.0 from Activity Streams 1.0 include:
</p>
<ul>
<li>
Multi-lingual representation of activities
</li>
<li>
Unification of "verb" and "objectType" to "type"
</li>
<li>
Removal of activity types and object types that weren't core to social
use cases
</li>
<li>
Introduction of the Link type for richly-described links
</li>
<li>
Incorporation of audience targeting into the core spec
</li>
<li>
The generalized "Undo" activity type, so all activities can be undone
</li>
<li>
Consistent collection and paging representation
</li>
<li>
Formalizing the namespace of the base vocabulary of object types and
activity types
</li>
<li>
Extensibility framework for other types and properties
</li>
<li>
Compatibility with JSON-LD
</li>
</ul>
<p>
The terms <code>displayName</code>, <code>verb</code>,
<code>title</code> and <code>objectType</code> should be treated as
reserved terms that SHOULD NOT be used within Activity Streams 2.0
documents. When encountered in an Activity Streams 2.0 document, they
SHOULD be processed in accordance to the guidelines listed in
<a href="#activitystreams-1.0a"></a>
</p>
</section>
</section>
<section id="syntaxconventions">
<h2>Serialization</h2>
<p>
This specification describes a JSON-based [[!RFC7159]] serialization
syntax for the <a href="#vocabulary">Activity
Vocabulary</a> that conforms to a subset of [[!JSON-LD]] syntax
constraints but does not require JSON-LD processing. While other
serialization forms are possible, such alternatives are not discussed
by this document.
</p>
<p>
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.
</p>
<p>
An <dfn>Activity Streams
Document</dfn> is a JSON document whose root value is an
Activity Streams <a>Object</a> of any type, including a
<a>Collection</a>, and whose MIME media type is
"<code>application/activity+json</code>".
</p>
<p>
Activity Streams 2.0 documents MUST be serialized using the UTF-8
character encoding.
</p>
<section id="jsonld">
<h3>JSON-LD</h3>
<p>
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 <a href="https://www.w3.org/ns/activitystreams">here</a>.
Implementations MAY augment the provided @context with additional
@context definitions but MUST NOT override or change the normative
context. Implementations MAY also use 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
<a href="#extensibility">Extensibility</a> section for more information
on handling extensions within Activity Streams 2.0 documents.
</p>
<p>
JSON-LD uses the special <code>@context</code> property to define the
<a href="https://www.w3.org/TR/json-ld/#the-context">processing
context</a>. The value of the <code>@context</code> property is defined
by the [[JSON-LD]] specification. Implementations producing Activity
Streams 2.0 documents SHOULD include a <code>@context</code> property
with a value that includes a reference to the normative
<a href="https://www.w3.org/ns/activitystreams">Activity Streams 2.0 JSON-LD
@context definition</a> using the URL
"<code>https://www.w3.org/ns/activitystreams</code>". Implementations
MAY use the alternative URL
"<code>http://www.w3.org/ns/activitystreams</code>"
instead. This can be done using a string, object, or array.
</p>
<section id="example-1context">
<h2>Context with a string</h2>
<figure>
<figcaption>
Document providing a context as a string.
</figcaption>
<div id="ex1-context" style="display: block;">
<pre class="example highlight json">
{
"@context": "https://www.w3.org/ns/activitystreams",
"summary": "A note",
"type": "Note",
"content": "My dog has fleas."
}
</pre>
</div>
</figure>
</section>
<section id="example-2context">
<h2>Context with an object</h2>
<figure>
<figcaption>
Document providing context as an object using the <code>@vocab</code> keyword and a prefix for extension terms.
</figcaption>
<div id="ex2-context" style="display: block;">
<pre class="example highlight json">
{
"@context": {
"@vocab": "https://www.w3.org/ns/activitystreams#",
"ext": "https://canine-extension.example/terms/",
"@language": "en"
},
"summary": "A note",
"type": "Note",
"content": "My dog has fleas.",
"ext:nose": 0,
"ext:smell": "terrible"
}
</pre>
</div>
</figure>
</section>
<section id="example-3context">
<h2>Context with an array</h2>
<figure>
<figcaption>
Document providing context as an array, and including an alias for an additional term.
</figcaption>
<div id="ex3-context" style="display: block;">
<pre class="example highlight json">
{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"css": "http://www.w3.org/ns/oa#styledBy"
}
],
"summary": "A note",
"type": "Note",
"content": "My dog has fleas.",
"css": "https://www.csszengarden.com/217/217.css?v=8may2013"
}
</pre>
</div>
</figure>
</section>
<p>
When a JSON-LD enabled Activity Streams 2.0 implementation encounters
a JSON document identified using the
"<code>application/activity+json</code>" MIME media type, and
that document does not contain a <code>@context</code> property
whose value includes a reference to the normative
<a href="https://www.w3.org/ns/activitystreams">Activity Streams 2.0 JSON-LD
@context definition</a>, the implementation MUST assume that the
normative @context definition still applies.
</p>
</section>
<section id="urls">
<h3>IRIs and URLs</h3>
<p>
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.
</p>
<p>
Relative IRI (and URL) references SHOULD NOT be used within an
Activity Streams 2.0 document due to the fact that many JSON
parser implementations are not capable of reliably preserving the base
context necessary to properly resolve relative references.
</p>
</section>
<section id="dates">
<h3>Date and Times</h3>
<p>
All properties with date and time values MUST conform to the
"date-time" production in [[!RFC3339]] with the one exception
that seconds MAY be omitted. An uppercase "T"
character MUST be used to separate date and time, and an
uppercase "Z" character MUST be used in the absence of a numeric time
zone offset.
</p>
<p>
This is specified using the following [[ABNF]] syntax description.
The "time-hour", "time-minute", "time-second", "time-secfrac",
"time-offset" and "full-date" constructs are as defined in
[[RFC3339]].
</p>
<pre>
as2-partial-time = time-hour ":" time-minute [":" time-second [time-secfrac]]
as2-full-time = as2-partial-time time-offset
as2-date-time = full-date "T" as2-full-time
</pre>
<p>
It is important to note that the `time-offset` component does not
correlate to time-zones, and while times that include the
`time-offset` component work well for timestamps, they cannot be
reliably converted to and from local "wall times" without additional
information and processing.
</p>
</section>
</section>
<section id="examples" class="informative">
<h2>Examples</h2>
<p>
Following are three examples of activities with varying degrees of detail.
</p>
<p>
Each example is shown using the normative JSON serialization defined
by this specification.
</p>
<section id="example-1">
<h2>Minimal Activity</h2>
<figure>
<figcaption>
Expresses the statement <code>'https://www.test.example/martin' created
'https://example.org/foo.jpg'</code>. No additional detail is given.
</figcaption>
<div id="ex1-jsonld" style="display: block;">
<pre class="example highlight json">{
"@context": "https://www.w3.org/ns/activitystreams",
"summary": "Martin created an image",
"type": "Create",
"actor": "https://www.test.example/martin",
"object": "https://example.org/foo.jpg"
}</pre>
</div>
</figure>
</section>
<section id="example-2">
<h2>Basic activity with some additional detail</h2>
<figure>
<figcaption>
Expresses the statement "Martin Smith added an article to the blog
'Martin's Blog' at 3:04 PM UTC on February 10, 2015." Some additional
details about the article, actor and target blog are given using
properties defined by the
<a href="#vocabulary">Activity Streams 2.0
Vocabulary</a>.
</figcaption>
<div id="ex2-jsonld" style="display: block;">
<pre class="example highlight json">{
"@context": "https://www.w3.org/ns/activitystreams",
"summary": "Martin added an article to his blog",
"type": "Add",
"published": "2015-02-10T15:04:55Z",
"actor": {
"type": "Person",
"id": "https://www.test.example/martin",
"name": "Martin Smith",
"url": "https://example.org/martin",
"image": {
"type": "Link",
"href": "https://example.org/martin/image.jpg",
"mediaType": "image/jpeg"
}
},
"object" : {
"id": "https://www.test.example/blog/abc123/xyz",
"type": "Article",
"url": "https://example.org/blog/2011/02/entry",
"name": "Why I love Activity Streams"
},
"target" : {
"id": "https://example.org/blog/",
"type": "OrderedCollection",
"name": "Martin's Blog"
}
}</pre>
</div>
</figure>
</section>
<section id="example-3">
<h2>An extended activity</h2>
<figure>
<figcaption>
A more extensive, single-entry "Activity Stream" follows.
</figcaption>
<div id="ex3-jsonld" style="display: block;">
<pre class="example highlight json">{
"@context": "https://www.w3.org/ns/activitystreams",
"summary": "Martin's recent activities",
"type": "Collection",
"totalItems": 1,
"items" : [
{
"type": "Add",
"published": "2011-02-10T15:04:55Z",
"generator": "https://example.org/activities-app",
"nameMap": {
"en": "Martin added a new image to his album.",
"ga": "Martin phost le fisean nua a albam."
},
"actor": {
"type": "Person",
"id": "https://www.test.example/martin",
"name": "Martin Smith",
"url": "https://example.org/martin",
"image": {
"type": "Link",
"href": "https://example.org/martin/image",
"mediaType": "image/jpeg",
"width": 250,
"height": 250
}
},
"object" : {
"name": "My fluffy cat",
"type": "Image",
"id": "https://example.org/album/máiréad.jpg",
"preview": {
"type": "Link",
"href": "https://example.org/album/máiréad.jpg",
"mediaType": "image/jpeg"
},
"url": [
{
"type": "Link",
"href": "https://example.org/album/máiréad.jpg",
"mediaType": "image/jpeg"
},
{
"type": "Link",
"href": "https://example.org/album/máiréad.png",
"mediaType": "image/png"
}
]
},
"target": {
"type": "Collection",
"id": "https://example.org/album/",
"nameMap": {
"en": "Martin's Photo Album",
"ga": "Grianghraif Mairtin"
},
"image": {
"type": "Link",
"href": "https://example.org/album/thumbnail.jpg",
"mediaType": "image/jpeg"
}
}
}
]
}</pre>
</div>
</figure>
</section>
</section>
<section id="model">
<h2>Model</h2>
<p>
The <a href="#vocabulary">Activity Vocabulary</a>
normatively defines the core object types and properties for Activity
Streams 2.0.
</p>
<p>
The object types defined by the vocabulary are segmented into a set of
eight core types and an extended set of Activity and Object types common
to many social Web applications. The core types are:
<ul>
<li><a>Object</a>,</li>
<li><a>Link</a>,</li>
<li><a>Activity</a>,</li>
<li><a>IntransitiveActivity</a>,</li>
<li><a>Collection</a>,</li>
<li><a>OrderedCollection</a>,</li>
<li><a>CollectionPage</a>, and</li>
<li><a>OrderedCollectionPage</a>.</li>
</ul>
</p>
<p>
Every JSON object in an Activity Streams 2.0 document is either an
<code><a>Object</a></code> or a <code><a>Link</a></code>. All other types
defined in the Activity Vocabulary, as well as all extension types, are
derived from these two base types.
</p>
<p>
A JSON object in the Activity Streams 2.0 document is a
<code><a>Link</a></code> if either: (a) the object contains a
<code>type</code> property whose value includes "<code>Link</code>" or
(b) any of the types included in the value of the <code>type</code>
property are defined as extensions of <a>Link</a> (see
<a href="#dfn-mention">Mention</a> for
instance); otherwise the JSON object is considered an instance
or extension of <code><a>Object</a></code>.
</p>
<section id="object">
<h2><dfn id="asobject">Object</dfn></h2>
<p>
The <code><a href="#dfn-object">Object</a></code>
is the primary base type for the Activity Streams vocabulary.
</p>
<p>
In addition to having a global identifier (expressed as an
absolute IRI using the <code>id</code> property) and an
"object type" (expressed using the <code>type</code>
property), all instances of the <code>Object</code> type share a
common set of properties normatively defined by the
<a href="#vocabulary">Activity Vocabulary</a>.
These include:
<code>
<code><a href="#dfn-attachment">attachment</a></code> |
<code><a href="#dfn-attributedto">attributedTo</a></code> |
<code><a href="#dfn-audience">audience</a></code> |
<code><a href="#dfn-content">content</a></code> |
<code><a href="#dfn-context">context</a></code> |
<code><a href="#dfn-content">contentMap</a></code> |
<code><a href="#dfn-name">name</a></code> |
<code><a href="#dfn-name">nameMap</a></code> |
<code><a href="#dfn-endtime">endTime</a></code> |
<code><a href="#dfn-generator">generator</a></code> |
<code><a href="#dfn-icon">icon</a></code> |
<code><a href="#image-prop">image</a></code> |
<code><a href="#dfn-inreplyto">inReplyTo</a></code> |
<code><a href="#dfn-location">location</a></code> |
<code><a href="#dfn-preview">preview</a></code> |
<code><a href="#dfn-published">published</a></code> |
<code><a href="#dfn-replies">replies</a></code> |
<code><a href="#dfn-starttime">startTime</a></code> |
<code><a href="#dfn-summary">summary</a></code> |
<code><a href="#dfn-summary">summaryMap</a></code> |
<code><a href="#dfn-tag">tag</a></code> |
<code><a href="#dfn-updated">updated</a></code> |
<code><a href="#dfn-url">url</a></code> |
<code><a href="#dfn-to">to</a></code> |
<code><a href="#dfn-bto">bto</a></code> |
<code><a href="#dfn-cc">cc</a></code> |
<code><a href="#dfn-bcc">bcc</a></code> |
<code><a href="#dfn-mediatype">mediaType</a></code> |
<code><a href="#dfn-duration">duration</a></code>
</code>
</p>
<p>
All properties are optional (including the <code>id</code> and
<code>type</code>).
</p>
<figure>
<figcaption>
Following is an example Object that uses the <code>id</code> and
<code>type</code> properties to express the global identifier and object
type:
</figcaption>
<div id="ex4-jsonld" style="display: block;">
<pre class="example highlight json">{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://example.org/foo",
"type": "Note",
"name": "My favourite stew recipe",
"attributedTo": {
"id": "https://joe.website.example/",
"type": "Person",
"name": "Joe Smith"
},
"published": "2014-08-21T12:34:56Z"
}</pre>
</div>
</figure>
<p>
The <a href="#vocabulary">Activity Vocabulary</a>
defines a range of <code>Object</code> 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.
</p>
<p>
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.
</p>
<p>
When an implementation uses an extension type that overlaps with a core
vocabulary type, the implementation MUST also specify the core vocabulary
type. For instance, some vocabularies (e.g. The Good Relations
Vocabulary) define their own types for describing locations. An
implementation that wishes, for example, to use a
<code><a href="https://www.heppnetz.de/ontologies/goodrelations/v1.html#Location">http://purl.org/goodrelations/v1#Location</a></code>
as an object type MUST also identify the object as being a
<code><a href="#dfn-place">Place</a></code>
as illustrated in the following:
</p>
<figure><figcaption>An Object that is both a <code>Place</code> and a <code>gr:Location</code>:</figcaption>
<div id="ex6-jsonld" style="display: block;">
<pre class="example highlight json">{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"gr": "http://purl.org/goodrelations/v1#"
}
],
"type": ["Place", "gr:Location"],
"name": "Sally's Restaurant",
"longitude": 12.34,
"latitude": 56.78,
"gr:category": "restaurants/french_restaurants"
}</pre>
</div>
</figure>
<p>
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, implementations
MUST favor the use of properties defined by the Activity Vocabulary.
</p>
<section id="text-representations">
<h3>Text representations of Object types</h3>
<p>
Activity Streams consumers often need a text representation of an
Activity Streams object, e.g. for display in a Web browser or console
interface.
</p>
<p>
The <code><a href="#dfn-name">name</a></code>
property SHOULD be derived from input by the creator or another user.
</p>
<p>
The <code><a href="#dfn-summary">summary</a></code>
property SHOULD be used as a fallback text representation, possibly
automatically generated by the publisher. If there is no <code>name</code> property,
the <code>summary</code> property SHOULD NOT include markup, and SHOULD be short
enough to be used as a reasonable text representation of the object.
</p>
<figure>
<figcaption>
A note with a name defined by the author
</figcaption>
<div id="ex11e-jsonld" style="display: block;">
<pre class="example highlight json">{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Note",
"id": "https://example.org/note/123",
"name": "Our Weather Is Fine",
"content": "I feel that the weather is appropriate to our season and location."
}</pre>
</div>
</figure>
<figure>
<figcaption>
A note with an automatically-generated summary
</figcaption>
<div id="ex11f-jsonld" style="display: block;">
<pre class="example highlight json">{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Note",
"id": "https://example.org/note/124",
"summary": "A note by Sally",
"content": "Everything is OK here."
}</pre>
</div>
</figure>
<p>
The <code>name</code> and <code>summary</code> MAY be absent,
MAY lack explicit values in the end user's current language,
and MAY be longer than appropriate for use as a text representation of
the Object in the current language context. Consumer implementations
SHOULD have fallback strategies for text representation of Objects in
these cases.
</p>
</section>
</section>
<section id="link">
<h2><dfn>Link</dfn></h2>
<p>
A <code>Link</code> describes a qualified, indirect reference to another
resource that is closely related to the conceptual model of Links as
established in [[!RFC5988]]. The properties of the Link object are not
the properties of the referenced resource, but are provided as hints
for rendering agents to understand how to make use of the resource. For
example, <code>height</code> and <code>width</code> might represent the
desired rendered size of a referenced image, rather than the actual
pixel dimensions of the referenced image.
</p>
<p>
The target URI of the Link is expressed using the required
<code><a href="#dfn-href">href</a></code>
property. In addition, all <code>Link</code> instances share the
following common set of optional properties as normatively defined by
the <a href="#vocabulary">Activity Vocabulary</a>:
<code><a href="#dfn-id">id</a></code> |
<code><a href="#dfn-name">name</a></code> |
<code><a href="#dfn-name">nameMap</a></code> |
<code><a href="#dfn-hreflang">hreflang</a></code> |
<code><a href="#dfn-mediatype">mediaType</a></code> |
<code><a href="#dfn-rel">rel</a></code> |
<code><a href="#dfn-height">height</a></code> |
<code><a href="#dfn-width">width</a></code> |
<code><a href="#dfn-preview">preview</a></code> |
<code><a href="#dfn-attributedto">attributedTo</a></code>
</p>
<p>
For example, all <a data-lt="Object">Objects</a> can contain an
<code><a href="#image-prop">image</a></code>
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.
</p>
<figure><figcaption>To reference a single image without any additional
metadata, a direct association can be expressed as a JSON string
containing an absolute IRI.</figcaption>
<div id="ex12-jsonld" style="display: block;">
<pre class="example highlight json">{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Application",
"id": "https://example.org/application/123",
"name": "Exampletron 3000",
<b>"image": "https://example.org/application/123.png"</b>
}</pre>
</div>
</figure>
<figure><figcaption>
Alternatively, if additional metadata is required (such as the MIME
content type of the referenced resource) a <a>Link</a> can be used:
</figcaption>
<div id="ex13-jsonld" style="display: block;">
<pre class="example highlight json">{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Application",
"id": "https://example.org/application/123",
"name": "Exampletron 3000",
<b>"image": {
"type": "Link",
"href": "https://example.org/application/123.png",
"mediaType": "image/png"
}</b>
}</pre>
</div>
</figure>
<p>
Formally, the former example establishes an unqualified
direct relationship with the image resource while the
latter creates a <a href="https://patterns.dataincubator.org/book/qualified-relation.html">qualified,
indirect relationship</a> that allows additional properties about the
relationship to be specified.
</p>
<figure><figcaption>
If more than one value is to be expressed, A JSON Array with a
mix of strings and <a>Link</a>s can be used:
</figcaption>
<div id="ex14-jsonld" style="display: block;">
<pre class="example highlight json">{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Application",
"id": "https://example.org/application/123",
"name": "Exampletron 3000",
<b>"image": [
"https://example.org/application/abc.gif",
{
"type": "Link",
"href": "https://example.org/application/123.png",
"mediaType": "image/png"
}
]</b>
}</pre>
</div>
</figure>
<p>
Individual items contained in such an array are independent of one
another and no significance is given to the ordering.
</p>
<p>
RFC 5988 defines that all Links have a "link relation" that describes
the contextual purpose of the link. Within a <a>Link</a>,
the <code><a href="#dfn-rel">rel</a></code> property
provides the link relation value. If no <code>rel</code> property is
specified, the link relation is considered to be unspecified. Any given
Link can have multiple link relation values. In the JSON
serialization, a single link relation is expressed as a single JSON
string. Multiple link relations are expressed as an array of JSON
strings.
</p>
<p>
The scope of the link relation is the object in which the <a>Link</a>
is an immediate child.
</p>
<p>
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 "<code>thumbnail</code>".
</p>
<figure><figcaption></figcaption>
<div id="ex15-jsonld" style="display: block;">
<pre class="example highlight json">{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Application",
"id": "https://example.org/application/123",
"name": "Exampletron 3000",
"image": [
"https://example.org/application/abc.gif",
{
"type": "Link",
"href": "https://example.org/application/123.png",
"mediaType": "image/png",
"rel": "thumbnail"
}
]
}</pre>
</div>
</figure>
<p>
It ought to be noted that the [[!HTML5]] specification provides its
own alternative definition of a "link relation" that differs slightly
from the [[RFC5988]] definition. In the HTML5 definition, any string