RE: Reading hydra:Collection as link relation

On 27 Feb 2015 at 07:26, Dietrich Schulten wrote:
> 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).

Yes. You could look at it as a reified statement (http://www.w3.org/TR/rdf11-mt/#whatnot).


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

Yeah, that's the whole purpose of it :-)


> 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?".

I thought I did that already 4 years ago in the comments :-) In JSON-LD (and RDF in general) the link relation type is the property (or predicate if you like). Using RDF5988 terminology

   context IRI -- link relation type --> target IRI

   subject -- property/predicate --> object


> Turns out he was right when a link to a remote collection is needed.

Yes, but it was always there...


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

Good :-)


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

We already had hydra:property (used in IriTemplateMapping). We might need those things in other contexts as well. It's much easier to reuse these concepts, and thus keep the vocabulary smaller, by keeping them generic and using them on different types (the "manages block", IriTemplateMapping, ...) than to "denormalize" them.


Cheers,
Markus


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

--
Markus Lanthaler
@markuslanthaler

Received on Wednesday, 4 March 2015 21:55:14 UTC