Re: relate a Collection and a PagedCollection

On Apr 24, 2014, at 8:46 AM, Ruben Verborgh <ruben.verborgh@ugent.be> wrote:

> Hi Markus,
> 
>>> But this contradicts what you said earlier:
>> 
>> If so, it's because I have troubles explaining it properly. 
> 
> Interesting… It was supposed to be the easy solution, right? ;-)
> 
>>> So is [a PagedCollection]:
>>> a) the sum of all pages
>>> b) a single page
>>> c) both
>>> 
>>> At the moment, it behaves like c), which is quite unfortunate.
>> 
>> Let me answer with a question: What is an rdf:List?
>> a) the sum of all list nodes (the things with rdf:first/rdf:rest properties)
>> b) a single list node
>> c) both
> 
> a), no doubt about that. Example:
> 
> :l1 rdf:first :a;
>     rdf:next :l2.
> :l2 rdf:first :b;
>     rdf:next rdf:nil.
> 
> :l1 is a list. :l2 is a list (and a sublist of :l2).
> :nil is a list (and a sublist of :l1 and :l2).
> 
> :a is a list node.
> :b is a list node.
> 
> None are both.
> 
> Could you still say whether PageCollection is a/b/c?
> 
>>> That's where blank nodes come in handy:
>>>   :p5 hydra:pageOf [ hydra:firstPage :p1 ].
>>> meaning
>>>   page 5 is a page of something, here is its first page
>> 
>> I don't see how this improves things.. quite the contrary actually.
> 
> Well, for starters, no troubles in explaining this ;-)
> It corresponds to the real world.
> 
>> I do agree though that from a theoretical point of view this is more precise. On
>> the Web, however, theoretical pureness rarely wins. Pragmatism and
>> simplicity typically does.
> 
> The pragmatism here is that it corresponds to real collections;
> you don't need theoretically abstract concepts that are a hybrid of a collection and a member.
> 
>> Also, if you use blank nodes for this, what's the advantage? You won't even
>> know anymore whether different pages belong to the same collection.
> 
> Yes you do:
>>> :p5 hydra:pageOf [ hydra:firstPage :p1 ].
> 
> :p5 and :p1 belong to the same collection
> because hydra:pageOf and hydra:firstPage are functional.
> 
>>> Seems to make more sense than
>>>   :x hydra:firstPage :p1
>>> which does *not* mean
>>>   "here is the first page of x"
>>> but
>>>   "here is the first page of the thing that :x also is a page of"
>> 
>> I don't really see a problem with the latter.
> 
> The thing. What is the thing?
> Just because you don't mention it, doesn't mean it doesn't exist.
> It clearly does—hiding it doesn't simplify things.
> 
>> Surely correct, but if you look at how current systems are being build, the
>> distinction rarely matters. From search engine result pages to photo
>> galleries you almost always have next/previous page pointers and direct
>> links to the first and sometimes also last page. 
> 
> Of course. Just realize that "next" and "previous" relate to the page,
> while "first" and "last" relate tot te entire collection.
> 
>> I would like to hear other peoples' opinion on this.
> 
> +1

Just looking at it from a pragmatics perspective, when I retrieve a collection, I want that to include the first page of members, at least. So, that resource should include everything I need to know about the collection: the number of items in the collection, a reference to the last page of the collection, and certainly a reference to the next page in the collection. This could allow the meta-collection properties to be recorded under a separate subject from that resource, or not. If it is, and we're trying to adhere to the principles of Linked Data, then that subject should have an IRI, which could be a fragment identifier relative to the first page. Practically speaking, this seems a little upside down, and any other page referencing the collection is doing so relative to the first page of the collection anyway, but it doesn't add any utility when working with the collection (unless semantic purity has utility).

I can certainly understand the perspective that a collection of pages is different than the first page of a collection, or any page of the collection. I do take Markus' assertion that a page of a collection can be likened to a specific rdf:List, but that really just says that all pages are collections, not that they're the same collection, which is probably more important.

IMO, it would be simpler if we just side-step this whole thing and just reference the first page and simply describe properties on that page resource and not introduce another subject for its own sake.

Slightly related, I don't expect to repeat things like lastPage and totalItems on each page of the collection, which would unnecessarily involve invalidating them when something changes; invalidating just the first and last page seems adequate. Maybe there's a FirstCollectionPage resource which serves dual roles, with subsequent pages just being CollectionPage (or whatever we choose).

Gregg

>>> It's not related. With rdf:List, I can point to the list,
>>> and I can point to the individual.
>> 
>> Which individual? A list looks as follows
>> 
>> node1 a rdf:List
>>            rdf:first "Value of node 1"
>>            rdf:rest node2
>> node2 a rdf:List
>>            rdf:first "Value of node 2"
>>            rdf:rest node3
>> ...
>> nodeN a rdf:List
>>            rdf:first "Value of node N"
>>            rdf:rest rdf:nil
>> 
>> So you point to the list by referencing node1... but you could also point to
>> node2 and the result would still be valid (but you wouldn't find node1 anymore).
> 
> The problem is in your terminology. "node1" is not a node, it is a list.
> Clearer terms:
> 
> :list1 a rdf:List
>            rdf:first item1
>            rdf:rest list2
> :list2 a rdf:List
>            rdf:first item2
>            rdf:rest list3
> …
> :listN a rdf:List
>            rdf:first itemN
>            rdf:rest rdf:nil
> 
> list1 is the entire list;
> list2 is a sublist;
> item1 is an item of list1, and so is item2.
> 
>> PagedCollection's are like double linked lists which might also
>> include links to the head and the tail:
>> 
>> node1 a hydra:PagedCollection
>>            hydra:member "Members of page 1"
>>            hydra:firstPage node1
>>            hydra:nextPage node2
>>            hydra:lastPage nodeN
>> node2 a hydra:PagedCollection
>>            hydra:member "Members of page 2"
>>            hydra:firstPage node1
>>            hydra:previousPage node1
>>            hydra:nextPage node3
>>            hydra:lastPage nodeN
>> ...
>> nodeN a hydra:PagedCollection
>>            hydra:member "Members of page N"
>>            hydra:firstPage node1
>>            hydra:previousPage nodeN-1
>>            hydra:lastPage nodeN
>> 
>> So in my opinion they are strongly related.
> 
> They're not. rdf:List distinguishes between the item and the collection,
> which is exactly what I'd want in Hydra.
> 
>>> With the hybrid PagedCollection that acts both as a page and a collection,
>>> I can point to neither.
>> 
>> Just as with lists, you can simply point to the first page.
> 
> No. With the list, I can point to item1 and list1;
> with the current PagedCollection, I can point to node1
> (which would be a hybrid of item1 and list1).
> 
>> The difference
>> is that, as long as you provide first+next page or first+next or
>> last+previous on each page, you can always reconstruct the complete
>> PagedCollection no matter to which page you link.
> 
> I appreciate that,
> but we don't need to sacrifice the item/whole distinction for it.
> 
>>> But the question is:
>>> can Hydra correctly describe collections and their pages?
>>> At the moment, it can't.
>> 
>> Can't it describe these things or is it that it doesn't describe these
>> things in the way you want them to be described?
> 
> Hydra can't describe the collection,
> because its collection is the same as the first page.
> (Or the same as any page.)
> 
>>> Second: messy modeling.
>>> Concrete concepts would be preferred over an abstract hybrid concept.
>> 
>> I certainly agree with this point. But it could also be solved differently.
>> The things that would really change is the metadata about the "complete
>> collection". So an alternative would be to rename
>> 
>> firstPage to firstPageOfTheCollectionThisPageBelongsTo
>> lastPage to lastPageOfTheCollectionThisPageBelongsTo
>> totalItems to totalItemsOfTheCollectionThisPageBelongsTo
>> 
>> The result would be the same. Wouldn't it?
> 
> Yes, but at least the long names are explicit about the messy modeling ;-)
> 
> In all seriousness, the important thing for me is this:
> please allow the separate identification of collections and pages.
> No matter how you define (the domain of) firstPage and lastPage,
> at least allow us to say things about the collection,
> which are different than the things we want to say about a page.
> 
> Best,
> 
> Ruben

Received on Thursday, 24 April 2014 17:05:17 UTC