-
Notifications
You must be signed in to change notification settings - Fork 4
/
index-src.html
571 lines (547 loc) · 25 KB
/
index-src.html
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
<!DOCTYPE html>
<html>
<head>
<title>Post Type Discovery</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 = {
license: "w3c-software-doc",
specStatus: "ED",
shortName: "post-type-discovery",
edDraftURI: "http://ptd.spec.indieweb.org/",
editors: [
{ name: "Tantek Çelik",
url: "http://tantek.com/",
w3cid: "1464" },
],
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",
license: "w3c-software-doc",
otherLinks: [{
key: 'Repository',
data: [
{
value: 'Github',
href: 'https://github.com/tantek/post-type-discovery'
},
{
value: 'Issues',
href: 'https://github.com/tantek/post-type-discovery/issues'
},
{
value: 'Commits',
href: 'https://github.com/tantek/post-type-discovery/commits/master'
}
]
}],
localBiblio: {
"AS1": {
title: "JSON Activity Streams 1.0",
href: "http://activitystrea.ms/specs/json/1.0/",
authors: [
"J. Snell",
"M. Atkins",
"W. Norris",
"C. Messina",
"M. Wilkinson",
"R. Dolin"
],
status: "unofficial",
publisher: "http://activitystrea.ms"
},
"AS2": {
title: "Activity Streams 2.0",
href: "https://www.w3.org/TR/activitystreams-core/",
authors: [
"J. Snell",
"E. Prodromou"
],
status: "Candidate Recommendation",
publisher: "https://www.w3.org/"
},
"AS2-vocab": {
title: "Activity Vocabulary",
href: "http://www.w3.org/TR/activitystreams-vocabulary",
authors: [
"J. Snell",
"E. Prodromou"
],
status: "Candidate Recommendation",
publisher: "https://www.w3.org/"
},
"h-entry": {
title: "h-entry",
href: "http://microformats.org/wiki/h-entry",
authors: ["Tantek Çelik"],
status: "Living Specification",
publisher: "http://microformats.org"
},
"h-event": {
title: "h-event",
href: "http://microformats.org/wiki/h-event",
authors: ["Tantek Çelik"],
status: "Living Specification",
publisher: "http://microformats.org"
},
"microformats2": {
title: "Microformats2",
href: "http://microformats.org/wiki/microformats2",
authors: ["Tantek Çelik"],
status: "Living Specification",
publisher: "http://microformats.org"
},
"microformats2-parsing": {
title: "Microformats2 Parsing",
href: "http://microformats.org/wiki/microformats2-parsing",
authors: [ "Tantek Çelik"],
status: "Living Specification",
publisher: "http://microformats.org"
},
"Activitypub": {
title: "ActivityPub",
href: "https://www.w3.org/TR/activitypub",
authors: [
"Christopher Allan Webber",
"Jessica Tallon",
"Owen Shepherd"
],
status: "Working Draft",
publisher: "https://www.w3.org"
},
"RSS-2.0": {
title: "RSS 2.0",
href: "http://www.rssboard.org/rss-specification",
authors: ["Dave Winer"],
status: "Stable",
publisher: "RSS Board"
},
}
};
</script>
<link rel="webmention" href="https://webmention.io/w3c/webmention">
</head>
<body>
<section id='abstract' class='informative'>
<p>
Post Type Discovery specifies algorithms for determining the type of a post
by what properties it has and potentially what value(s) they have, which helps
avoid the need for explicit post types that are being abandoned by modern post
creation UIs.
</p>
<p>The <a href="#response-algorithm">Response Type Algorithm</a> in particular specifies
how a [[Webmention]] receiver determines whether a webmention is a comment, like, repost, RSVP,
or other type of mention, widely implemented in practice by Webmention receivers
to determine when and how to display various peer-to-peer social responses.
</p>
</section>
<section id='sotd'>
<p>This specification was contributed to the W3C from the
<a href="https://indieweb.org/">IndieWeb</a> community
and was one of several related specifications being produced by the Social Web Working Group.
Now published as a W3C Note, the Post Type Discovery living specification is
maintained at <a href="http://ptd.spec.indieweb.org">ptd.spec.indieweb.org</a>.
More history and evolution of Post Type Discovery can be found on the
<a href="https://indieweb.org/post-type-discovery">IndieWeb wiki</a>.
</p>
</section>
<section class='informative'>
<h2>Introduction</h2>
<p>
Post type discovery defines explicit algorithms for inferring the type of a post from other properties of that post.
</p>
<p>
Inferring the type of a post helps provide a bridge between formats and protocols without explicit post types
(e.g. [[h-entry]], [[jf2]], [[micropub]], Atom ([[RFC4287]]), [[RSS-2.0]]) to those with explicit post types (e.g. [[ActivityPub]], [[AS2]]).
For more details on those specifications see references, and for how they relate, see the overview document [[social-web-protocols]].
Post type discovery can apply to any post data structure independent of serialization (e.g. HTML, JSON, etc.)
</p>
</section>
<section id='usecases' class='informative'>
<h2>Use Cases</h2>
<p>
Both creation user interfaces, and post presentation designs are evolving to
directly use the presence or absence of specific properties (and their values)
directly, rather than depending on any kind of explicit "post type", thus why
bother discovering a post type in the first place? This section documents the
(few) use-case(s) that is/are known to date.
</p>
<section id='synthesizing'>
<h3>Synthesizing explicit type formats</h3>
<p>
There are existing formats that require explicit post types
(e.g. ActivityStreams [[AS1]]), or are based on explicit post types,
(e.g. ActivityStreams2 [[AS2]]), and code that consumes them expects explicit
post types. Post type discovery enabling automatic synthesizing of such
formats from posts that merely have a set of content related properties.
</p>
</section>
<section id='aggregating-responses'>
<h3>Aggregating responses by type</h3>
<p>
Modern social web posting systems implement multiple types of responses
and provide user interfaces that show aggregate counts or collections of
those responses grouped by type, e.g. number of likes, reposts, replies.
</p>
</section>
<section id='notifications-wording'>
<h3>Notifications wording and filtering</h3>
<p>
Many social web implementations provide notifications to a user
with response type specific wording, e.g.
"Alice commented on your photo", "7 people liked your video".
Automatically generating both the specific wording of these notifications,
and deciding which to provide to the user, based on preferences and/or filtering,
requires determining the specific response type.
</p>
</section>
</section>
<section id='conform'>
<h2>Conformance</h2>
<section id='conformance-keywords'>
<h3>Conformance Keywords</h3>
<p>As well as sections marked as non-normative, all authoring guidelines, diagrams,
examples, and notes in this specification are non-normative.
Everything else in this specification is normative.</p>
<p>The key words "MAY", "MUST", "MUST NOT", "OPTIONAL", "RECOMMENDED", "REQUIRED",
"SHALL", "SHALL NOT", "SHOULD", and "SHOULD NOT" are to be interpreted as described in
[[!RFC2119]].</p>
</section>
<section id='conformance-classes'>
<h3>Conformance Classes</h3>
<p>There are many possible ways a Post Type Discovery implementation can be used and tested.
This section describes possible conformance classes from existing implementations and use-cases.
</p>
<section id='type-discovery-function'>
<h4>Type Discovery Function</h4>
<p>A Type Discovery Function consumes untyped posts from a possibly untyped format or protocol,
(e.g. the h-entry microformat) and outputs the type output
(e.g. a simple one-word string like "note" or "article")
of the algorithm implemented
(either the Response Type Algorithm or the Post Type Algorithm).</p>
</section>
<section id='as2-proxy'>
<h4>AS2 Proxy</h4>
<p>An AS2 Proxy consumes untyped posts from an untyped format or protocol,
and outputs valid [[!AS2]] JSON using the equivalent AS2 Activity and/or Object Types.
</p>
</section>
</section>
</section>
<section id='response-algorithm'>
<h2>Response Type Algorithm</h2>
<p>
The Response Type Algorithm ("the response algorithm") is for specifically discovering the type of a response,
in particular as a result of receiving a [[!Webmention]], by analyzing the "source" from the Webmention,
called the "response" in the response algorithm.
It is a proper subset of the general Post Type Algorithm (defined below).
</p>
<ul>
<li>If the response has an "rsvp" property with a valid value (one of "yes", "no", "maybe", "interested"),
<br>Then it is an RSVP.</li>
<li>If the response has a "repost-of" property with a valid URL,
<br>Then it is a repost (AKA share).</li>
<li>If the response has a "like-of" property with a valid URL,
<br>Then it is a like (AKA favorite).</li>
<li>If the response has an "in-reply-to" property with a valid URL,
<br>Then it is a reply (AKA comment).</li>
<li>Else it is a mention.</li>
</ul>
<p>
Quoted property names in the response algorithm are defined in [[!h-entry]].
</p>
</section>
<section id='algorithm'>
<h2>Post Type Algorithm</h2>
<p>
The Post Type Algorithm ("the algorithm") discovers the type of a
post given a data structure representing an item with a flat set of properties
(e.g. JSON output from [[microformats2-parsing]]),
each with one or more values, by following these steps
until reaching the first "it is a(n) ... post" statement at which point the
"..." is the discovered post type.
</p>
<ul>
<li>If the post is an "event" item (may be a [[microformats2]] root class name of [[!h-event]]),
<br>Then it is an event.</li>
<li>If the post has an "rsvp" property with a valid value (one of "yes", "no", "maybe", "interested"),
<br>Then it is an RSVP post.</li>
<li>If the post has a "repost-of" property with a valid URL,
<br>Then it is a repost (AKA "share") post.</li>
<li>If the post has a "like-of" property with a valid URL,
<br>Then it is a like (AKA "favorite") post.</li>
<li>If the post has an "in-reply-to" property with a valid URL,
<br>Then it is a reply post.</li>
<li>If the post has a "video" property with a valid URL,
<br>Then it is a video post. </li>
<li>If the post has a "photo" property with a valid URL,
<br>Then it is a photo post. </li>
<li>If the post has a "content" property with a non-empty value,
<br>Then use its first non-empty value as the content</li>
<li>Else if the post has a "summary" property with a non-empty value,
<br>Then use its first non-empty value as the content</li>
<li>Else it is a note post.</li>
<li>If the post has no "name" property
<br> or has a "name" property with an empty string value (or no value)
<br>Then it is a note post.</li>
<li>Take the first non-empty value of the "name" property</li>
<li>Trim all leading/trailing whitespace</li>
<li>Collapse all sequences of internal whitespace to a single space (0x20) character each</li>
<li>Do the same with the content</li>
<li>If this processed "name" property value is NOT a prefix of the processed content,
<br>Then it is an article post.</li>
<li>Else it is a note post.</li>
</ul>
<p>
Quoted property names in the algorithm are defined in [[!h-entry]].
</p>
<p class="note">Note: for [[RFC4287]],
use the Atom entry title for the "name" property,
and the Atom entry content for the content as mentioned in the algorithm.
</p>
<p class="note">Note: for [[RSS-2.0]],
use the RSS item title for the "name" property,
and the RSS item description for the content as mentioned in the algorithm.
</p>
</section>
<section id='post-types-table'>
<h2>Post Types Table</h2>
<p>The following table documents the conversion from
the output of the algorithms to [[!AS2]] equivalents.</p>
<table>
<tr><th>Post Type</th> <th>AS2 equivalent</th></tr>
<tr><td>event</td> <td><a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event">Event</a></td></tr>
<tr><td>rsvp</td> <td><a href="https://www.w3.org/TR/activitystreams-vocabulary/#motivations-rsvp">Event RSVP</a></td></tr>
<tr><td>repost</td> <td><a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-announce">Announce</a></td></tr>
<tr><td>like</td> <td><a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-like">Like</a></td></tr>
<tr><td>reply</td> <td><a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-note">Note</a> with <a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-inreplyto">inReplyTo</a></td></tr>
<tr><td>video</td> <td><a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-video">Video</a></td></tr>
<tr><td>photo</td> <td><a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-image">Image</a></td></tr>
<tr><td>note</td> <td><a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-note">Note</a></td></tr>
<tr><td>article</td> <td><a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-article">Article</a></td></tr>
</table>
</section>
<section id='methodology' class='informative'>
<h2>Methodology</h2>
<p>
There are two important aspects to the methodology of the Post Type Discovery
algorithm: scope (why is something explicitly in the algorithm), and order
(why is something where it is in the algorithm).
</p>
<section id="scope">
<h3>Scope</h3>
<p>
The algorithm could attempt to cover innumerable potential hypothetical post
types, or take an evidence based approach, focusing on real world publishing
practices. This specification does the latter, specifically by placing a
minimum bar of documented real world publishing practices of different visually
apparent post types on the open web at recent (< 1 year old) permalinks, each
with at least three independent implementations that have converged on what
properties (and potentially values thereof) they have to imply their visually
apparent post types. As a result of being evidence based, it is likely this
specification will expand over time as more apparent post types are published by
more convergent implementations.
</p>
</section>
<section id="order">
<h3>Order</h3>
<p>
The algorithm must also specify an order (e.g. of precedence) that various
properties (and their values) imply various post types. The algorithm is
ordered by post types that are in general "richer" in terms of content as
well as show greater cognitive effort by the author.
</p>
</section>
</section>
<section id='othertypes' class='informative'>
<h2>Other Types To Consider</h2>
<p>
Other types may be included in future iterations
of the algorithms based on convergence of publishing patterns and critical mass
of adoption thereof.
</p>
<p>
See: <a href="https://indieweb.org/posts#Kinds_of_Posts">IndieWeb wiki: Kinds of Posts</a>
for a list of additional possible post types that have growing adoption.
</p>
</section>
<section id='examples' class='informative'>
<h2>Examples</h2>
<section id="ex-like">
<h3>Like Post</h3>
<p>
Here is an example [[h-entry]] post from
<a href="http://www.w3.org/TR/activitystreams-vocabulary/#dfn-like">Activity Streams 2.0 Vocabulary examples</a> [[AS2-vocab]]:
</p>
<pre>
<div class="h-entry p-name">
<span class="p-author h-card">Sally</span>
liked
<a class="u-like-of"
href="http://example.org/notes/1">
http://example.org/notes/1
</a>
</div></pre>
<p>
Following the algorithm, the step "If the post has a "like-of" property with
a valid URL" is satisfied and thus the algorithm returns that the post is a
"<a href="https://indieweb.org/like">like</a>" post.
</p>
<p>
Given this semantic, an implementation can generate (or process as if generated
and consumed) the following AS2 JSON, in particular the <code>"@type": "Like"</code>
in this output is what is determined by this algorithm:
</p>
<pre>{
"@type": "Like",
"actor": {
"@type": "Person",
"displayName": "Sally"
},
"object": "http://example.org/notes/1"
} </pre>
</section>
</section>
<section id='faq' class='informative'>
<h2>FAQ</h2>
<section>
<h3>What about a photo reply</h3>
<p>
Q: What about a reply that includes a photo?
</p>
<p>
A: It's a reply.
</p>
<p>
Q2: Should that show up as a "photo" post?
</p>
<p>
A2: It should show up as a "reply" and not be in a user's published feed of their
photos. The user-centric design here is to treat replies separately, because in
practice, when users post replies to others' posts, and include a photo, the photos
typically assume the context of that other post, and would look odd outside of it
(e.g. in a generic "photos" feed). In addition, by not including reply photos in a
user's feed of their photos, it gives the user the freedom to reply to other posts
with whatever they wish, including photos, and not have those reply-specific photos
pollute their streams of "their stuff" that their followers subscribe to.
</p>
<p>
A2a: From a presentation perspective, a reply should primarily be displayed as a
reply first, and then adapt accordingly to whatever other properties it may have.
</p>
</section>
<section>
<h3> Is a video tag sufficient </h3>
<p>
Q: Is a video tag sufficient to imply a video post?
</p>
<p>
A: No, video tags can be used for additional content e.g. inside an article.
Only relying on video tag markup would lead to false positives.
</p>
</section>
</section>
<section id="implementations" class="informative">
<h2>Implementations</h2>
<p>
Implementations, in progress, partial, or complete, of Post Type Discovery.
</p>
<section id="granary">
<h3>Granary</h3>
<p>
<a href="https://github.com/snarfed/granary/">Granary</a> synthesizes ActivityStreams [[AS1]],
[[microformats2]], and Atom [[RFC4287]] from various input feeds and sources, and
as such has some code that can be considered in progress or even a partial
implementation of Post Type Discovery:
</p>
<ul>
<li>Live public demo site: https://granary-demo.appspot.com/ </li>
<li>Issue(s) related to implementing Post Type Discovery:
<a href="https://github.com/snarfed/granary/issues/41">#41</a></li>
</ul>
</section>
<section id="p3k">
<h3>p3k</h3>
<p>
<a href="https://indieweb.org/p3k">p3k</a> (a CMS) implements Post Type
Discovery internally within its [[micropub]] endpoint to automatically add
posts to various collections. E.g.: if this post is a reply, it goes in the
"replies" collection. if it's an RSVP, it goes in the "rsvps" and "replies"
collections.
</p>
<ul>
<li>Live example: http://aaronparecki.com/</li>
</ul>
</section>
<section id="mf2util">
<h3>mf2util</h3>
<p>
mf2util exposes a function for post_type_discovery that takes an h-entry and
returns "like", "reply", "note", "article", etc.
</p>
<ul>
<li>Live demo: https://kylewm.com/services/mf2util</li>
</ul>
</section>
</section>
<section class="appendix informative">
<h2>Change Log</h2>
<section>
<h3>Changes from <a href="https://www.w3.org/TR/2017/WD-post-type-discovery-20170801/">1 August 2017 WD</a> to
this version</h3>
<ul>
<li>Add Conformance Classes
(<a href="https://github.com/tantek/post-type-discovery/issues/10">#10</a>)
</li>
<li>Add "event" discovery per sufficient implementations
(<a href="https://github.com/tantek/post-type-discovery/issues/19">#19</a>)
</li>
<li>Add informative Atom and RSS handling of their known/unchanging elements for determining
at least "note" vs "article", generalizing beyond mf2
(<a href="https://github.com/tantek/post-type-discovery/issues/2">#2</a>)
</li>
<li>Additional use cases for Response Type Discovery
(<a href="https://github.com/tantek/post-type-discovery/issues/33">#33</a>)
</li>
<li>Add post types to AS2 equivalents table
(<a href="https://github.com/tantek/post-type-discovery/issues/9">#9</a>)
(<a href="https://github.com/tantek/post-type-discovery/issues/15">#15</a>)
</li>
</ul>
</section>
<section>
<h3>Changes from <a href="https://www.w3.org/TR/2017/WD-post-type-discovery-20170614/">14 June 2017 WD</a> to
<a href="https://www.w3.org/TR/2017/WD-post-type-discovery-20170801/">1 August 2017 WD</a></h3>
<ul>
<li>Response Type: move "reply" to last explicitly recognized response type to enable p-summary fallback use-cases
(<a href="https://github.com/tantek/post-type-discovery/issues/25">#25</a>)</li>
</ul>
</section>
<section>
<h3>Changes from <a href="https://www.w3.org/TR/2017/WD-post-type-discovery-20170301/">1 March 2017 WD</a> to
<a href="https://www.w3.org/TR/2017/WD-post-type-discovery-20170614/">14 June 2017 WD</a></h3>
<ul>
<li>Added new section Response Type Algorithm
(<a href="https://github.com/tantek/post-type-discovery/issues/24">#24</a>)</li>
<li>Editorial improvements</li>
</ul>
</section>
<section>
<h3>Changes from <a href="https://www.w3.org/TR/2016/WD-post-type-discovery-20161028/">28 October 2016 WD</a> to
<a href="https://www.w3.org/TR/2017/WD-post-type-discovery-20170301/">1 March 2017 WD</a></h3>
<ul>
<li>Explicitly note applies to any post data structure independent of serialization
(<a href="https://github.com/tantek/post-type-discovery/issues/13">#13</a>)</li>
<li>Reference Social Web Protocols
(<a href="https://github.com/tantek/post-type-discovery/issues/16">#16</a>)</li>
<li>End algorithm with explicit "Else"
(<a href="https://github.com/tantek/post-type-discovery/issues/18">#18</a>)</li>
<li>Editorial improvements</li>
</ul>
</section>
</section>
</body>
</html>