Re: totalItems with pagination and filtering

Maik,

On 2015-11-14 20:09, Maik Riechert wrote:
> Hi Tomasz!
>
>> I would turn this around. Where does /users go when the @id is
>> /users?name=Bob? How about sth like that
>>
>> GET /users?name=Bob&p=1
>> {
>>    "@id": "/users?name=Bob",
>>    "partOf": "/users"
>>    "@type": "Collection",
>>    "member": [ ...10 Bob items... ],
>>    "totalItems": 50,
>>    "view": { .. the page links ... }
>> }
>>
>> My idea would be to always use the parametrized @id (so that you can
>> bookmark it) and add a link to the unfiltered collection, here
>> "partOf" as an example.
>
> After I sent the email I had the same thoughts and I agree, it makes
> more sense to browse through the filtered collection, especially because
> totalItems works then. I also thought about how to link to the
> unfiltered collection, that's tricky.
>

To complete this train of thought, I would point out that this is how 
this works in HTML. You normally see a summary similar to "displaying 10 
out of 50 items" and that total number usually (always?) means the 
number of filtered results.

> To help think about it, let's imagine we subclass Collection and use
> something like FilteredCollection which could then include some custom
> predicates like "appliedFilter": {"name": "Bob"}, and the link to the
> unfiltered collection which should be unambiguous. I think partOf
> (dct:isPartOf) is way too generic and doesn't really fit. I typically
> think of partOf as non-overlapping things that make up a given resource.
> What about dct:source instead? "A related resource from which the
> described resource is derived."
>

Your idea seems sound. I'd have to defer that to other on this list for 
detailed discussion. My thought is that the "appliedFilter" is 
essentially an instance of a IriTemplate with variables filled in. I 
would model it with the IriTemplate in mind.

Regarding partOf preficate, I didn't mean Dublin Core specifically. 
Though dct:source probably has a different intended use.

Regards,
Tom

Received on Saturday, 14 November 2015 20:00:15 UTC