Description
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-mediatype
When used on a Link, identifies the MIME media type of the referenced resource.
When used on an Object, identifies the MIME media type of the value of the content property. If not specified, the content property is assumed to contain text/html content.
This kind of "multiple applicability" is generally bad semantic design, since you are using the same term/symbol for different concepts. When used differently, there should be different terms.
I would say that in a next version, we consider doing something like:
mediaType
: Domain: Link
: Range: MIME media type
: Functional: True
: Comment: Identifies the MIME media type of the referenced resource (href
of a Link
).
contentType
: Domain: Object
: Range: MIME media type
: Functional: True
: Comment: Identifies the MIME media type of the value of the content property. If not specified, the content property is assumed to contain text/html
content.
Motivationally, mediaType
has incredibly limited applicability in general when applied to Object.content
, with binary representations not really making sense for values of content
. But it makes sense to use all kinds of different values when applied to Link.href
, as the referenced resource can be basically anything (text or binary).
Tangentially, one other thing that might work and might align better with JSON-LD / RDF is to look into "typed values", so basically something like this in expanded JSON-LD form:
{
"https://www.w3.org/ns/activitystreams#content": {
"@value": "<p lang='en'>hello world</p>",
"@type": "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML"
}
}
Which is equivalent to the following Turtle/N-Triples:
_:b0 <https://www.w3.org/ns/activitystreams#content> "<p lang='en'>hello world</p>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML>
Not sure how much sense this makes, though... What we currently have is that we use the language tag @language
which cannot be used at the same type as @type
. An RDF Literal is either language/direction-tagged, or it is coerced to a different type, but not both. So it might make sense to leave it as a sort of contentType
property while the value of content
remains a language-tagged literal string.