Reading hydra:Collection as link relation

Hi,

I wanted to share an observation. With our Collection type we have
created an interesting thing, if you look at it the following way.

If I were to invent a LinkRelation type (only hypothetically, I am not
proposing to add such a type), it might look like this:

{
  "@context": {
    "@vocab": "http://www.w3.org/ns/hydra/core#",
    "foaf": "http://xmlns.com/foaf/0.1/"
  },
  "@id": "/alice",
  "linkRelations": [
    {
      "@type": "LinkRelation",
      "@id": "/alice/friends",
      "rel": "foaf:knows",
    }
  ]
}

I took the freedom to flatten the manages block and the result was the
following. You can map every single item from the LinkRelation above to
the Collection below.

{
  "@context": {
    "@vocab": "http://www.w3.org/ns/hydra/core#",
    "foaf": "http://xmlns.com/foaf/0.1/"
  },
  "@id": "/alice",
  "collection": [
    {
      "@type": "Collection",
      "@id": "/alice/friends",
      "managesProperty": "foaf:knows",
      "managesSubject": "/alice",
    }
  ]
}

So a hydra:Collection can be seen as a two-faced link relation. When
used on the origin object it is an rfc-5988 link relation (walks and
quacks like a duck, see above).

When used as the target object of the relation, it becomes a container
where you can say more things about the :Collection.

We have in fact answered a criticism Mark Nottingham brought up about
json-ld back in 2011, when he said that json-ld "also fails to provide a
mapping from 5988; where do I put the link relation type?". Turns out he
was right when a link to a remote collection is needed.

Seen that way I think I can make peace with our collection design :)

What was the reason why we introduced a manages block, rather than
flattening it to managesProperty, managesSubject, managesObject?

Best regards,
Dietrich

[1] https://www.mnot.net/blog/2011/11/25/linking_in_json

Received on Friday, 27 February 2015 06:33:09 UTC