Socialwg/MediaObject

From W3C Wiki

Problem Definition

Media objects (Image, Video, Audio etc.) have broad use on Social Web. We can identify two distinct aspects of them

  1. Social artifact - something people Like, Comment, Review, Share etc.
  2. Data encoding - actual binary data which which encodes this media

In many cases one social artifact will have multiple encoding variants e.g different width/height or compression/quality. Most of the time all of those have distinct URIs

Challenge: how to model it?

  1. can ObjectProperties like image, photo, avatar, logo etc. accept URI of social artifact or need URI of particular encoding?
  2. how social artifact can describe available size and encoding variants?
  3. can we Content Negotiate on data encoding URI?

User Story

Socialwg/Social_API/More_user_stories#Liking_a_Photo_found_in_an_Album

Real world example

MediaGoblin

{
    "updated": "2015-03-23T23:29:16.374358+00:00",
    "displayName": "me :(",
    "links": {
        "self": {
            "href": "http://127.0.0.1:6543/api/image/1/"
        }
    },
    "fullImage": {
        "url": "http://127.0.0.1:6543/mgoblin_media/media_entries/1/tsyesika-avatar.png",
        "width": 2148,
        "height": 2147
    },
    "url": "http://127.0.0.1:6543/u/tsyesika/m/me/",
    "image": {
        "url": "http://127.0.0.1:6543/mgoblin_media/media_entries/1/tsyesika-avatar.thumbnail.png",
        "width": 180,
        "height": 180
    },
    "author": {
        "preferredUsername": "tsyesika",
        "displayName": "tsyesika@127.0.0.1:6543",
        "links": {
            "activity-outbox": {
                "href": "http://127.0.0.1:6543/api/user/tsyesika/feed/"
            },
            "self": {
                "href": "http://127.0.0.1:6543/api/user/tsyesika/profile/"
            },
            "activity-inbox": {
                "href": "http://127.0.0.1:6543/api/user/tsyesika/inbox/"
            }
        },
        "pump_io": {
            "shared": false,
            "followed": false
        },
        "published": "2015-03-23T23:28:52.851579+00:00",
        "id": "acct:tsyesika@127.0.0.1:6543",
        "objectType": "person"
    },
    "published": "2015-03-23T23:29:16.374358+00:00",
    "pump_io": {
        "shared": false
    },
    "replies": {
        "totalItems": 0,
        "items": [],
        "url": "http://127.0.0.1:6543/api/image/1/comments/"
    },
    "id": "http://127.0.0.1:6543/api/image/1/",
    "objectType": "image"
}

Flickr

Social artifact: https://www.flickr.com/photos/canon_chas/14405380943
List of available encodings: https://www.flickr.com/photos/canon_chas/14405380943/sizes/l
* https://farm6.staticflickr.com/5076/14405380943_692dea2ea7_b.jpg
* https://farm6.staticflickr.com/5076/14405380943_692dea2ea7_t.jpg
* https://farm6.staticflickr.com/5076/14405380943_692dea2ea7_z.jpg
etc.

Youtube

https://developers.google.com/structured-data/testing-tool/?url=http://m.youtube.com/details?v=eXSJ3PO9Tas

via: https://github.com/schemaorg/schemaorg/issues/239#issuecomment-72021134

Research

URLs in Data Primer

http://www.w3.org/TR/urls-in-data/

NOTE
If the URL http://photo.example.com/psd/12345 supported content negotiation such that a request with Accept: text/html provided an HTML page but a request with Accept: image/jpeg returned the image, the URL is being used for two distinct resources: the image and the landing page. The two resources have different values for important properties that cannot be content-negotiated on, such as their creator and license. As discussed in The Architecture of the World Wide Web [WEBARCH], content negotiation should not be used between two different resources: instead, different resources should be named with different URLs. It is up to the publisher to determine whether two resources are different. — http://www.w3.org/TR/urls-in-data/#landing-pages

HTML5 Forms

http://www.w3.org/TR/html5/forms.html#url-encoded-form-data

NOTE
This form data set encoding is in many ways an aberrant monstrosity, the result of many years of implementation accidents and compromises leading to a set of requirements necessary for interoperability, but in no way representing good design practices. In particular, readers are cautioned to pay close attention to the twisted details involving repeated (and in some cases nested) conversions between character encodings and byte sequences.

http://www.w3.org/TR/html5/forms.html#multipart-form-data

The parts of the generated multipart/form-data resource that correspond to non-file fields must not have a Content-Type header specified. Their names and values must be encoded using the character encoding selected above (field names in particular do not get converted to a 7-bit safe encoding as suggested in RFC 2388).


URI Templates

Examples of creating thumbnails 'on fly' with URI Templates

Autodiscovery Pattern

http://patterns.dataincubator.org/book/autodiscovery.html

When publishing a web page derived from linked data include a link element in the head of the web page pointing to the original data.

<link rel="meta" type="application/rdf+xml" title="Raw Data" href="http://example.com/data.rdf"/>

Candidates

Activity Streams 2.0

as:Link as:Content

http://www.w3.org/TR/activitystreams-core/#example-2

{
  "@context": "http://www.w3.org/ns/activitystreams",
  "@type": "Post",
  "published": "2015-02-10T15:04:55Z",
  "actor": {
   "@type": "Person",
   "@id": "urn:example:person:martin",
   "displayName": "Martin Smith",
   "url": "http://example.org/martin",
   "image": {
     "@type": "Link",
     "href": "http://example.org/martin/image.jpg",
     "mediaType": "image/jpeg"
   }
  },
  "object" : {
   "@id": "urn:example:blog:abc123/xyz",
   "@type": "Article",
   "url": "http://example.org/blog/2011/02/entry",
   "displayName": "Why I love Activity Streams"
  },
  "target" : {
   "@id": "http://example.org/blog/",
   "@type": "urn:example:types:blog",
   "displayName": "Martin's Blog"
  }
}

Schema.org

Schema.org uses MediaObject

http://schema.org/image

An image of the item. This can be a URL or a fully described ImageObject.

Values expected to be one of these types: ImageObject, URL

http://schema.org/ImageObject

JSON-LD

{
  "@context": "http://schema.org",
  "@type": "ImageObject",
  "author": "Jane Doe",
  "contentLocation": "Puerto Vallarta, Mexico",
  "contentUrl": "mexico-beach.jpg",
  "datePublished": "2008-01-25",
  "description": "I took this picture while on vacation last year.",
  "name": "Beach in Mexico"
}

RDFa

<div vocab="http://schema.org/" typeof="ImageObject">
  <h2 property="name">Beach in Mexico</h2>
  <img src="mexico-beach.jpg" alt="Sunny, sandy beach."
  property="contentUrl" />
  By <span property="author">Jane Doe</span>
  Photographed in
    <span property="contentLocation">Puerto Vallarta, Mexico</span>
  Date uploaded:
    <meta property="datePublished" content="2008-01-25">Jan 25, 2008
  <span property="description">I took this picture while on vacation last year.</span>
</div>

IndieWeb

See also

Twitter