Abstract

Post Type Discovery specifies an algorithm 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.

Status of This Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This is a W3C specification, derived from the IndieWeb specification of the same name.

This document was published by the Social Web Working Group as a First Public Working Draft. This document is intended to become a W3C Recommendation. If you wish to make comments regarding this document, please send them to public-socialweb@w3.org (subscribe, archives). All comments are welcome.

Publication as a First Public Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 September 2015 W3C Process Document.

1. Introduction

This section is non-normative.

Post type discovery is an explicit algorithm for inferring the type of a post from other properties of that post.

Inferring the type of a post helps provide a bridge between systems without explicit post types (e.g. [Micropub], jf2) to systems with explicit post types (e.g. [ActivityPub], [AS2]).

1.1 Use Cases

This section is non-normative.

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.

1.2 Synthesizing explicit type formats

This section is non-normative.

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.

2. Conformance

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.

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].

3. Algorithm

The Post Type Discovery algorithm ("the algorithm") discovers the type of a post given a data structure representing a post with a flat set of properties (e.g. Activity Streams (1.0 or 2.0) JSON, or 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.

Quoted property names in the algorithm are defined in [h-entry].

4. Methodology

This section is non-normative.

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).

4.1 Scope

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.

4.2 Order

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.

5. Other Types Under Consideration

This section is non-normative.

Other types are being considered and will be included in the future iterations of the algorithm based on convergence of publishing patterns and critical mass of adoption thereof.

6. Examples

This section is non-normative.

6.1 Like Post

Here is an example [h-entry] post from Activity Streams 2.0 Vocabulary examples [AS2-vocab]:

<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>

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 " like" post.

Given this semantic, an implementation can generate (or process as if generated and consumed) the following AS2 JSON, in particular the "@type": "Like" in this output is what is determined by this algorithm:

{
  "@type": "Like",
  "actor": {
    "@type": "Person",
    "displayName": "Sally"
  },
  "object": "http://example.org/notes/1"
} 

7. FAQ

This section is non-normative.

7.1 What about a photo reply

Q: What about a reply that includes a photo?

A: It's a reply.

Q2: Should that show up as a "photo" post?

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.

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.

Is a video tag sufficient

Q: Is a video tag sufficient to imply a video post?

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.

8. Implementations

This section is non-normative.

Implementations, in progress, partial, or complete, of Post Type Discovery.

8.1 Granary

Granary 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:

8.2 p3k

p3k (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.

8.3 mf2util

mf2util exposes a function for post_type_discovery that takes an h-entry and returns "like", "reply", "note", "article", etc.

A. References

A.1 Normative references

[RFC2119]
S. Bradner. IETF. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
[h-entry]
Tantek Çelik. http://microformats.org. h-entry. Living Specification. URL: http://microformats.org/wiki/h-entry

A.2 Informative references

[AS1]
J. Snell; M. Atkins; W. Norris; C. Messina; M. Wilkinson; R. Dolin. http://activitystrea.ms. JSON Activity Streams 1.0. unofficial. URL: http://activitystrea.ms/specs/json/1.0/
[AS2]
J. Snell; E. Prodromou. https://www.w3.org/. Activity Streams 2.0. Working Draft. URL: https://www.w3.org/TR/activitystreams-core/
[AS2-vocab]
J. Snell; E. Prodromou. https://www.w3.org/. Activity Vocabulary. Working Draft. URL: http://www.w3.org/TR/activitystreams-vocabulary
[ActivityPub]
Christopher Webber; Jessica Tallon; Owen Shepherd. W3C. ActivityPub. 14 June 2016. W3C Working Draft. URL: https://www.w3.org/TR/activitypub/
[Micropub]
Aaron Parecki. https://www.w3.org. Micropub. Working Draft. URL: https://www.w3.org/TR/micropub
[RFC4287]
M. Nottingham, Ed.; R. Sayre, Ed.. IETF. The Atom Syndication Format. December 2005. Proposed Standard. URL: https://tools.ietf.org/html/rfc4287
[microformats2]
Tantek Çelik. http://microformats.org. Microformats2. Living Specification. URL: http://microformats.org/wiki/microformats2
[microformats2-parsing]
Tantek Çelik. http://microformats.org. Microformats2 Parsing. Living Specification. URL: http://microformats.org/wiki/microformats2-parsing
[micropub]
Aaron Parecki. W3C. Micropub. 13 July 2016. W3C Working Draft. URL: https://www.w3.org/TR/micropub/