Why isn't Note a subclass of Document?

The spec says that the object type Note extends Object.

On the other hand, Page, Audio, and Video extend Document.

Shouldn’t Note be a subclass of Document as well?

2 Likes

I agree, I think this is actually just an error in the spec.

the object hierarchy doesn’t really mean much in activitystreams, since most properties are just inherited directly from Object. but Document is intended to be an actual file. Note is just a generic Object.

2 Likes

is the distinction actually meaningful though?

@kaniini I don’t know. Possibly not, but if the spec is going to put Document as the superclass for some of the classes, it should be consistent!

@trwnh that makes sense to me, on an intuitive level. But I’m not convinced the distinction between files and other streams of bytes makes much sense to anyone except programmers tbh.

The distinction is probably only as useful as you actually care about it. The only inheritance that actually means anything is Collection / CollectionPage / OrderedCollection / OrderedCollectionPage – and it’s probably worth noting that these are all “core” types.

Certainly this critique has been raised before: https://indieweb.org/ActivityStreams#Imposes_unnecessary_hierarchy

For example, Audio extends Document, but Article does not. Document does not even define any new properties.

You could probably remove the Document type altogether and have no negative consequences, tbh… but in any case, if you look at the examples, every single Document or anything that extends from it will have a file extension – pdf, mkv, array of Link to png or jpeg, embedded Link to mp3, html, and so on.

1 Like

Are you saying we should rely on the file extension to determine the content type, then?

No, I’m just saying that it’s really not important to follow the Object hierarchy in ActivityStreams, aside from the core types. Just as a best practice, you should probably not care too much about whether something is a Document or not. It’s probably more semantically relevant to declare that it is an Image or Video or Audio or Page, if that would be more appropriate. Document would just be a catch-all for other files that don’t fit one of those four more-specific types.

In other words, a Note doesn’t have a file extension, it’s just text being passed around. Similarly, an Article is basically just a Note but longer. Frankly, the distinction between an Article and a Note is more of an issue than whether they subclass Document – a Document is a file, Article and Note are native content (of ill-defined difference).

1 Like