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

On May 15, 2014, at 1:07 PM, Markus Lanthaler <markus.lanthaler@gmx.net> wrote:

> Ruben, I've CC'ed you because I would like to hear your opinion on this
> design
> 
> On Thursday, May 15, 2014 8:21 PM, Gregg Kellogg wrote:
>> On another use case for collections, and the relationship to the
> referencing entity, I
>> commonly use the same Collection subclass to manage members from either
> direction. For
>> example, I might use a sub-class of Collection ArticleCollection, whose
> members are
>> Articles referenced from something. I use the same ArticleCollection from
> the Article entity
>> using a reverse property, to collect all of the things that the Article
> might be about (e.g.,
>> SFGiants and Buster Posey).
>> 
>> If we use the :manages entity, as suggested, rather than using :subject,
> to identify the
>> common subject of all members, I would use :object, to represent the
> common object of all
>> members.  The two collections might look like the following:
>> 
>> </giants/articles> a :ArticleCollection;
>>  :manages [:subject </giants>; :property :article];
>>  :member </articles/1>, </articles/2>, </articals/3>, ...
>> </giants> :article </articles/1> .
>> </giants> :article </articles/2> .
>> ...
>> 
>> From the other side, it might look like this:
>> 
>> </articles/1/abouts> a ArticleCollection;
>>  :manages [:object </articles/1>; property :article];
>>  :member </giants>, </BusterPosey>, ...
>> </giants> :article </articles/1> .
>> </BusterPosey> :article </articles/2> .
> 
> The last triple would be
> 
>  </BusterPosey> :article </articles/1> .
> 
> Right? In that case, it seems a bit odd to me to call this thing a
> ArticleCollection because it is really just about a single article. Calling
> it a TopicCollection would make it clearer IMO. But perhaps you also just
> reduced a concrete scenario you are modeling too much!?

Yes, all the articles would be the same, but the subjects referencing them would differ. Given that the form for this collection is identical in either direction, it seems appropriate to use the same representation, but I do see your point that it's odd to call it an ArticleCollection, if there's really only one article specified in the collection.

Perhaps what's misleading is that it's described as being a collection of Articles, whereas it's really a collection of subject/object relationships, where the Article is the object. Maybe it would be more accurate to call it an ArticleReferenceCollection, but the essence wouldn't really change.

Gregg

> Anyway.. I think supporting also "object" would be a good idea.
> 
> Ruben, how do you find this design? Is it helpful for your work on Linked
> Data Fragments? If I remember correctly, you have some collections which
> manage certain property/object pairs, right?
> 
> (Yeah, I know, it doesn't address the collection vs. page issue you raised
> yet.. we will hopefully get to that one soon)

> --
> Markus Lanthaler
> @markuslanthaler
> 

Received on Thursday, 15 May 2014 21:13:17 UTC