W3C home > Mailing lists > Public > public-hydra@w3.org > June 2014

Re: How to avoid that collections "break" relationships (ISSUE-41)

From: Gregg Kellogg <gregg@greggkellogg.net>
Date: Sun, 15 Jun 2014 12:34:33 -0600
Cc: public-hydra@w3.org
Message-Id: <BF0D0CE7-225C-4823-8FDA-01AA856CEA79@greggkellogg.net>
To: ☮ elf Pavlik ☮ <perpetual-tripper@wwelves.org>
On Jun 15, 2014, at 10:16 AM, ☮ elf Pavlik ☮ <perpetual-tripper@wwelves.org> wrote:

> On 06/13/2014 12:14 AM, Markus Lanthaler wrote:
> 
>> Sure. I just created a Wiki page summarizing the current state of affairs:
>> 
>>  https://www.w3.org/community/hydra/wiki/Collection_Design
>> 
>> Hope this helps. If not, please let me know.
> I assume one can also use such collection this way?
> {
>  "@id": "/alice/friends",
>  "@type": "Collection",
>  "manages": {
>    "property": "schema:knows",
>    "subject": {
>      "@id": "/alice",
>      "schema:name": "Alice"
>      "schema:image": "https://photos.example.me/saying-tofuuuu.png"
>    }
>  }
> }
> 
> http://www.w3.org/TR/json-ld/#embedding
> 
> I don't argue that it has any advantages over getting data about
> </alice> with separate request, just wondering if embedding also applies
> here.

From an RDF/JSON-LD perspective, this is of course perfectly fine. Putting the collection in context, you might have something like the following:

{
  “@id”: “/alice”,
  “@type”: “Person”,
  “name”: “Alice”,
  “image”: "https://photos.example.me/saying-tofuuuu.png”,
  “hasCollection”: [{
    “@id”: “/alice/friends”,
    “@type”: “Collection”,
    “manages”: {“property”: “knows”, “subject”: “/alice”}
  }]
}

As RDF, the two representations are semantically equivalent, and just from JSON-LD, if you flatten you’ll also coalesce the properties from both the outer- and inner- versions of alice to something like the following:

[
  {
    “@id”: “/alice”,
    “@type”: “Person”,
    “name”: “Alice”,
    “image”: "https://photos.example.me/saying-tofuuuu.png”,
    “hasCollection”: “/alice/friends”
  }, {
    “@id”: “/alice/friends”,
    “@type”: “Collection”,
    “manages”: “_:a”
  }, {
    “@id”: “_:a”,
    “property”: “knows”,
    “subject”: “/alice”
  }
]

Gregg
Received on Sunday, 15 June 2014 18:35:04 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 15:53:59 UTC