Re: [AS2] Deprecate "url" in favor of "id" and "self" link relations

On 21 August 2014 20:29, James M Snell <jasnell@gmail.com> wrote:

> On Thu, Aug 21, 2014 at 12:10 PM, Owen Shepherd <owen.shepherd@e43.eu>
> wrote:
> [snip]
> >
> > Precedent from some AS1 deployments is that link rel "self" is used in
> cases
> > where the "id" property is a non-dereferencable URL to point to the
> activity
> > streams document for this resource. As an example, see
> > https://gist.github.com/oshepherd/8c879449b3a55316cd73 (which is taken
> from
> > the real world example of Pump.io)
> >
>
> This precedent is just fine with the suggested change.
>
> > Three things I'd like to see:
> >
> > What is the algorithm for finding the dereferencable to an
> ActivityStreams
> > document URI?
>
> {
>   "self": {
>     "id": "http://example.org/foo",
>     "mediaType": "application/activity+json"
>   }
> }
>
> What is the algorithm for finding the dereferencable to a human readable
> > document URI?
>
> {
>   "alternate": {
>     "id": "http://example.org/foo",
>     "mediaType": "text/html"
>   }
> }
>
> > What is the algorithm for finding the embedded content URI? (For image,
> > video, etc objects)
>
> {
>   "image": {
>     "id": "http://example.org/foo.jpg",
>     "mediaType": "image/jpeg"
>   }
> }
>
> "self", "alternate" and "image" are all link relations.
>
> If necessary, because of how Link Values are defined, we can also do:
>
> {
>   "self": [
>     {
>       "id": "http://example.org/foo",
>       "mediaType": "application/activity+json"
>     },
>     {
>       "id": "http://example.org/foo.html",
>       "mediaType": "text/html"
>     }
>   ],
>   "image": "http://example.org/foo.jpg"
> }
>
> Again, you look for the link relations you care about, then look for
> the mediaType you care about. The algorithm really is not all that
> complicated.
>
>
*Algorithm*. Preferably in pseudo code (Or JavaScript-ish would work, since
we are dealing with JSON objects here). Taking into account cases where the
id of the object is not dereferencable, etc. (You might probably make the
same simplification I did, in that in my pseudo code I took the view that
obj[key] == null when obj == null, to simplify matters)


> >
> > For AS1, these are:
> >
> > obj["links"]["self"]["href"] || obj["id"]
> > obj["url"] (unless it's a collection, in which case you're screwed -
> > SPECBUG!)
> > obj[type]["url"]
> >
> > As much as I appreciate simplifying the spec, we should make sure that
> use
> > of the spec remains simple. I am not convinced that this is the case for
> > some of the changes in AS2
> >
>
> Such as?
>
>
This is why I asked for the algorithms above :-)


> > ---
> >
> > As a side note: I'm not a fan of the way that AS2 seems to be causing
> > unnamed Objects to proliferate where in AS1 Media Links would have been
> > used. We should remember the distinction between objects - things which
> form
> > the vertices of a graph (or, which on a website would have distinct web
> > pages)  and the embedded content thereof  - what AS1 called media links.
> >
> > This is very important to the many applications and clients which place
> the
> > objects as distinct entries in a database, because this proliferation of
> > objects makes their lives so much harder.
> >
>
> Can you please give some concrete examples? I'll see if I can explain
> the rationale for the changes using those examples.
>
>
I hope you will understand if I say this will take a bit of extra time to
put together. I'll try to do so soonish :-)

One simple example, a video object in AS1 looks like

 {
    "objectType": "video",
    "displayName": "Cute little kittens",
    "embedCode": "<video width='320' height='240'
controls='controls'>...</video>",
    "stream": {
      "url": "http://example.org/my_video.mpg"
    },
    "image": { "url": "http://example.com/my_video.mpg.jpg"},}



Per your AS2 examples, this image would go from being a Media Link to an
Object. Therefore, it would "decompose" into a separate object, and would
require fetching from the database by processors.

This object is not *meaningful*. It has no purpose on it's own, and no
identifier. In other words, it is pointless it being an object; hence why I
like the distinction between media links and objects, because they avoid
such meaningless objects.

- James
>
> >
>
> > Owen Shepherd
> > http://owenshepherd.net | owen.shepherd@e43.eu
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Activity Streams" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to activity-streams+unsubscribe@googlegroups.com.
> > To post to this group, send email to activity-streams@googlegroups.com.
> > Visit this group at http://groups.google.com/group/activity-streams.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Activity Streams" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to activity-streams+unsubscribe@googlegroups.com.
> To post to this group, send email to activity-streams@googlegroups.com.
> Visit this group at http://groups.google.com/group/activity-streams.
> For more options, visit https://groups.google.com/d/optout.
>

Received on Thursday, 21 August 2014 20:16:27 UTC