Views and templates separate
Appearance
I propose a separate property for view and view template. Such structure could be it easier for clients to process to determine that a resource is a view. In JSON-LD this would allow reversing the view property to produce a more idiomatic document.
GET /some/resource
{
"@id": "/some/resource",
"view": {
"@id": "/some/resource?filter=x"
},
"viewTemplate": {
"@type": "ViewTemplate",
"template": "/some/resource{?filter}"
}
}
GET /some/resource?filter=x
{
"@id": "/some/resource",
"view": {
"@id": "/some/resource?filter=x"
},
"viewTemplate": {
"@type": "ViewTemplate",
"template": "/some/resource{?filter}"
}
}
which can also be framed differently
This way the view becomes the root in JSON-LD tree
{
"@context": {
"viewOf": { "@reverse": "view" }
},
"@id": "/some/resource?filter=x",
"viewOf": {
"@id": "/some/resource",
"viewTemplate": {
"@type": "ViewTemplate",
"template": "/some/resource{?filter}"
}
}
}