RE: relate a Collection and a PagedCollection

On Friday, April 25, 2014 6:57 PM, Ruben Verborgh wrote:
> > So, forgetting about totalItems and firstPage/lastPage for the moment,
would
> > you agree in
> >
> >  :pc1 hydra:member :a, :b
> >          hydra:nextPage :pc2
> >  :pc2 hydra:member :c, :d
> >          hydra:previousPage :pc2
> >
> > both :pc1 and :pc2 are paged collections? If not, why not? Where's the
> > difference to the list above?
> 
> Okay but you need to treat them on the same level.
> We're not talking about the collection as a list of items here,
> but about the collection as a list of pages.
> So the list that corresponds to your example above is:
> 
> :l1 rdf:first :pc1;
>     rdf:next :l2.
> :l2 rdf:first :pc2;
>     rdf:next rdf:nil.

You could also say it is

  :pc1 rdf:first :a, :b
          rdf:rest :pc2
  :pc2 rdf:first :c, :d
          rdf:rest rdf:nil

Right?


> Note in general how rdf:first relates a collection to an item
> (and not an item to an item, as you relate a page to a page).

No, but rdf:rest does. So rdf:first = hydra:member and rdf:rest =
hydra:nextPage


> Hydra, by contrast, relates a page to a page with hydra:first.

... with hydra:firstPage, right. An RDF list is a very simple linked list
(rdf:rest). A Hydra PagedCollection is a double-linked list (hydra:nextPage
& hydra:previousPage) that also provides a pointer to the lists head and
tail (hydra:firstPage & hydra:lastPage).


> >> None are both [a list node and an item].
> >
> > Same for collections IMO.
> 
> Sorry that I keep digging up old quotes :-)
> But earlier, you said:
> 
> >>> Do you think we need to
> >>> separate a PagedCollection into two things, namely a Collection (with
links
> >>> to first/last page) and individual pages (with next/prev links) or is
it
> >>> clear enough if we mingle all of those links into a PagedCollection as
we
> >>> currently do?
> 
> So if you say "mingle",
> this somehow implies that a PagedCollection is both, right?
> So both a page, and both the collection?

I think we need to be a bit clearer and consistent with the terminology we
use otherwise we talk past each other. In the first sentence above, we talk
about "list nodes" and "item". In the last sentence you talk about "page"
and "collection". For me a "list node" is the thing with the
rdf:first/rdf:rest properties, a "list item" on the other hand is the value
of rdf:first. In a sense, I cannot point to a single "list node" as it will
always be interpreted as a complete list (the list node I point to is that
list's head and I lose all list node's that precede it if there are any;
effectively I create a sublist).

Similarly, for me a "PagedCollection node" is the thing with
hydra:nextPage/hydra:previousPage properties. A "collection member or item"
is the value of hydra:member. The logical collection is the union of all
PagedCollection node's hydra:member. The question is whether we need to make
that logical collection explicit and give it an identifier.


> Because you said that, in order to refer to a collection,
> we could just refer to the first page.
> So does that make them the same thing?
> 
> > Given that I just found out that we use the term list node for different
> > terms, I would say clearly a). For me it's really the same as a
> > (double-linked) list.
> 
> So a PagedCollection is a) the sum of all pages of a collection.
> 
> But then follows that
> <foo?page=2> and <foo?page=5> are the same thing,
> because both are the sum of all pages the collection <foo>.
> Right?

No, both lead to the same logical collection. That doesn't mean they are
that themselves. :l1 in the rdf:List example is not the same thing as :l2.
That also wouldn't change if you would add something equivalent to
hydra:previousPage to turn it into a rdf:DoubleLinkedList.


> >>>> 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?
> >
> > You wrote that sentence :-)
> 
> Yeah, in reply to your "I don't really see a problem" :-)
> 
> You say you don't see a problem with
>     "here is the first page of the thing that :x also is a page of"
> I say that the problem I see is
>    What is the thing?
> It's not clear what that thing is.

It's the logical collection.



--
Markus Lanthaler
@markuslanthaler

Received on Sunday, 27 April 2014 14:17:58 UTC