Views of non-collection

From Hydra Community Group

I think that views don't only apply to filtering collection members. An example is serving resources translated into various languages. As a business case let's have a collaborative translation application

I'm assuming "@container":"@language" where obvious.

GET /document

Let's assume that English is default and we are served that (possibly including a Content-Location header?)

 {
   "@id": "/document",
   "title": { "en": "My resource" },
   "description": { "en": "My resource description" },
   "viewTemplate": {
      "@type": [ "ViewTemplate", "SelectView" ],
      "template": "/document?expand={prop}",
      "mapping": [
        { "variable": "property", "property": "rdf:Property" }
      ]
   }
 }

GET /document?lang=pl

When the client constructs the "TranslatedView", all textual content is served in the desired language instead

 {
   "@id": "/document",
   "title": { "pl": "Mój zasób" },
   "description": { "pl": "Opis mojego zasobu" },
   "view": {
     "@id": "/document?lang=pl",
   },
   "viewTemplate": {
      "@type": "ViewTemplate",
      "template": "/document?lang={lang}",
      "mapping": [
        { "variable": "lang", "property": "lexvo:language" }
      ]
   }
 }

Another example would touch a matter of the resource's triples received by the client. It could be possible to provide a view that would allow a client to specify which properties it is interested in, i.e.:

GET /document?expand=foaf:primaryTopic

 {
   "@id": "/document",
   "title": { "en": "My resource" },
   "primaryTopic": {
     "@id": "/subject",
     "description:": "Event deepr resource's description"
   },
   "description": { "en": "My resource description" },
   "viewTemplate": {
      "@type": [ "ViewTemplate", "TranslatedView" ],
      "template": "/document?lang={lang}",
      "mapping": [
        { "variable": "lang", "property": "lexvo:language" }
      ]
   }
 }

It would also allow to trim the _default_ response from unwanted relations. This doesn't imply on how the client would be informed on the underlying data model it could query.