Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce property src and explicit type for binary data e.g Blob #223

Closed
elf-pavlik opened this issue Oct 26, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@elf-pavlik
Copy link
Member

commented Oct 26, 2015

Currently AS has IMO confusing way of describing binary resources (image, audio, video etc.)

This way to find binary source of someone's avatar one needs to stay prepare for traversing

as:Person - as:image -> as:Image - as:url -> as:Link - as:href -> ???

With simplest case

as:Person - as:image -> as:Link - as:href -> ???

Given instance of as:Link

{
  "@context": "http://www.w3.org/ns/activitystreams",
  "@type": "Link",
  "href": "http://example.org/album/my_fluffy_cat.png",
  "mediaType": "image/png"
}

Currently we don't have a type which we could use of object with @id same as value of href above

{
  "@context": "http://www.w3.org/ns/activitystreams",
  "@id": "http://example.org/album/my_fluffy_cat.png",
  "@type": "???",
  "mediaType": "image/png"
}

While as:Object acts as top level class for structured resources as:Blob could act as similar for binary resources. It could go in similar direction as LDP Non-RDF Source. In example above we could use "@type": "ImageBlob"

In HTML <img> <audio> <video> tags, all have src attribute

If we add as:src with recommendation to use instances of Blob (and it's subclasses) as its value. And recommend ImageBlob as possible value of as:image, we would have:

as:Person - as:image -> as:ImageBlob
instead of
as:Person - as:image -> as:Link - as:href -> ???

and

as:Person - as:image -> as:Image - as:src -> ImageBlob
instead of
as:Person - as:image -> as:Image - as:url -> as:Link - as:href -> ???

I believe many people can find it more intuitive than always having to deal with
as:Link - as:href -> ???

as:Link has this exceptional magic future where subject of mediaType becomes denoted by the value of href and not the link entity (blank node) itself. This proposal would allow using mediaType in the same way as other properties.

as:Object vs. as:Link diagram

I also find it similar to schema:contentUrl

We could also explain now subtypes of as:Blob relate to media types

  • as:ImageBlob - common mediaType: image/png, image/jpeg, image/gif IANA image/*
  • as:AudioBlob - common mediaType: audio/ogg, audio/mp3 IANA audio/*
  • as:VideoBlob - common mediaType: video/mp4, video/webm, video/ogg IANA video/*
@jasnell

This comment has been minimized.

Copy link
Collaborator

commented Oct 26, 2015

-1, adding an as:src property is not needed. We already have Image, Video and others as object types, those already have url properties that can be used to point to the actual data. If you want to encapsulate the binary data within the object, you can easily use base64 encoded content or data urls. The most I think we'd want to do is allow mediaType on Content objects as well as Link.

@jasnell jasnell added the proposal label Oct 26, 2015

@elf-pavlik

This comment has been minimized.

Copy link
Member Author

commented Oct 26, 2015

The most I think we'd want to do is allow mediaType on Content objects as well as Link

I thought that all instances of as:Object and its sub classes have implicit
"mediaType": "application/activity+json"

And as:Link pretty much serves purpose of handling other media types than this one. If we compare as:Object to ldp:RDFSource, suggested as:Blob would make equivalent of ldp:NonRDFSource.

This way we have consistent EAV/SPO

  • "@id": sets subject (which entity we describe)
  • "someProperty": predicate (which attribute of that entity)
  • : "some value" object (value of that attribute)

Currently as:Link seems to have identity crisis (also see illustration in issue description):

  • properties which use link entity itself as subject: as:href, as:rel, as:displayName, as:title
  • properties which use entity denoted by value of href property as subject: as:mediaType as:hreflang, as:height, as:width, as:duration

If no introducing as:Blob ~= ldp:NonRDFSource. (or whatever we want to name resources with other media types than application/activity+json ~= ldp:RDFSource)., than maybe renaming properties which use value of href property as subject? To follow as:hreflang approach - as:hrefmediatype, as:hrefheight, as:hrefwidth, as:hrefduration

@jasnell

This comment has been minimized.

Copy link
Collaborator

commented Oct 26, 2015

I thought that all instances of as:Object and its sub classes have implicit
"mediaType": "application/activity+json"

Nope.

@elf-pavlik

This comment has been minimized.

Copy link
Member Author

commented Oct 31, 2015

I just came across http://www.w3.org/TR/mediaont-10/ @cwebber

@jasnell If I use as:Link, can I write following

{
  "@context": [
    "http://www.w3.org/ns/activitystreams",
    { "ma": "http://www.w3.org/ns/ma-ont#" }
  ],
  "@type": "Link",
  "href": {
    "@id": "http://example.org/videos/b-day.ogg",
    "@type": "ma:VideoTrack",
    "ma:duration": 763
  },
  "mediaType": "video/ogg"
}

?

@azaroth42

This comment has been minimized.

Copy link
Contributor

commented Dec 2, 2015

Propose that this is solved by dropping Content type and clarification of Link semantics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.