Re: Pagination best practices

The W3C Web Annotation specifications also use the ActivityStreams2
pagination technique.  We explored LDP-Paging but found that the lack of
in-page ordering was both confusing and a blocker for use cases such as
relevance ranking where the sort value was response specific, not resource
specific.
The IIIF APIs also use the same model, with the intent to update to the Web
Annotation specifications in the next major version.  We went with
ActivityStreams over Hydra as AS2 will be a full technical recommendation.
(Congratulations Amy and SWWG!)

You can see the details:
    https://www.w3.org/TR/annotation-model/#collections
    https://www.w3.org/TR/annotation-protocol/#annotation-pages
    http://iiif.io/api/presentation/2.1/#paging-properties

We also evaluated other headers (eg link rel=next|prev|first|last) but the
complexity outweighed the purity of separating paging operation from the
data model.  Putting paging into the headers means that the only useful
representation is the full HTTP response, making offline/in-memory caching
much harder.

Given the Annotation WG and IIIF community's experiences with AS2 paging,
we would strongly recommend it.

Rob


On Mon, May 22, 2017 at 2:07 AM, Daniel Smedegaard Buus <
danielbuus@gmail.com> wrote:

> Hi guys :)
>
> I've been fiddling with JSON-LD for an API I'm building for a couple of
> weeks. I'm at the point where I'd like to add pagination to lists of stuff,
> but I find it a bit confusing googling for it.
>
> It's also not entirely clear to me where and how I should define the
> pagination properties. For instance, you can query my API for /users, and
> it'll return a document with a @context of "my:User" and a @graph with the
> first page of users found.
>
> Ideally, it'd be great to have something like a 'pagination' property on
> the same level as @context and @graph, which would contain IRIs for more
> pages, the total number of users in the database, and so on. But it's not
> apparent to me where I'd define that. It feels like it shouldn't be in my
> User context, as I'd then have to add it to every user in the @graph...
>
> How are you guys handling this in the most elegant and JSON-LD compliant
> way?
>
> Thanks :)
>
> Daniel
>



-- 
Rob Sanderson
Semantic Architect
The Getty Trust
Los Angeles, CA 90049

Received on Monday, 22 May 2017 15:11:46 UTC