W3C home > Mailing lists > Public > public-hydra@w3.org > April 2016

RE: Regarding Collections and size

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Tue, 5 Apr 2016 22:42:28 +0200
To: "'Adam Christie'" <adam.christie@digirati.com>, <public-hydra@w3c.org>
Message-ID: <02ea01d18f7b$aba260f0$02e722d0$@gmx.net>
Hi Adam,

Sorry for the late reply.

On Friday, March 18, 2016 4:19 PM, Adam Christie wrote:
> I'm long overdue giving a proper introduction to this list. The one I
> did send a month or two ago was regarding how to put together a Hydra
> API for a particular URL scheme. We've long since sorted that out -
> sorry for not updating the issue, but I hope that what we are
> currently doing will be a nice example for Hydra.

Can't await to see it

> It's making a lot of
> sense to us and once we had our URL scheme laid out, the whole process
> has been quite straightforward (+1 for emerging standards!)

Great to hear that

> The problem I have at the moment is regarding the Collection
> definition. I am writing a website which consumes our fledgling Hydra
> API and makes use of Collections of entities for display. The issue is
> that the information in a Collection isn't quite enough to drive the
> interface in a simple fashion. Essentially, what I really need is the
> ability to communicate the page size of a PartialCollectionView (PCV),
> maybe as part of the parent Collection, or on the PCV itself. This
> allows the interface to very simply determine whether to show
> First/Next/Previous/Last navigation by considering the current paging
> index, the total number of items and the page size.
> I can think of two methods to get that information at the moment, both
> of which ideally I'd like to avoid:
> 1.  Looking for a PCV in the returned data from the API and reacting
> to whether there are first/next/previous/last items within it, but
> that feels brittle somehow.

This is not brittle at all but is probably the most stable and reliable
method you will be able to implement. It	 doesn't break if the
collection size changes while you traverse the collection for instance.

> 2.  By always trying to retrieve the first page of results, the page
> size can be discovered, i.e. the totalItems value is greater than the
> count of the members, so assume page size is the number of members
> returned.
> Would a viewSize or pageSize item added to the definition of a
> Collection (or PartialCollectionView) be amenable?

Yeah, in fact we have been discussing this as part of the filtering
discussions. There hasn't been a decision yet though as we haven't reached
consensus yet.

> Once we have some resources available for the API documentation then
> I'll gladly pass them on.

Cool, thanks

Markus Lanthaler
Received on Tuesday, 5 April 2016 20:43:03 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 5 April 2016 20:43:03 UTC