[Developers] Paging through result sets.

Alec Flett alecf at metaweb.com
Mon Jun 9 22:41:01 UTC 2008


On Jun 7, 2008, at 4:58 PM, Arthur van Hoff wrote:

> Hi Kendra,
>
> Currently you can only move forward, but you can keep all the old  
> cursors and reuse them if you want to move back.
>
> I’ve asked if the cursor could include the current offset and an  
> approximate result set size. It would be great if you could specify  
> the cursor offset so that you can seek through the result set at  
> random.  This would allow you to move backwards more easily. Not  
> sure if this will get implemented.


I think this is a general problem with cursors - really they are ideal  
for streaming data - you need to iterate all your data once, in  
chunks. You also need some kind of guarantee that the pages don't  
overlap.

But most web applications need pseudo-random access - i.e. I'm on page  
5, jump me to page 6... or 4, or 10. Plus, web apps are probably  
slightly more flexible to page overlaps if the data changes (i.e. if  
I'm on page 6 of actors, and someone else adds an actor, then I go to  
page 7, it's probably ok if I see an actor that I saw on page 6, on  
the 7th page)

It seems like what MQL really needs is an "offset" (similar to  
"limit") into the set of results.

We could prevent the overlap if we also included some kind of cursor- 
like handle (perhaps just a 'as-of-time' or what we sometimes call a  
'dateline' internally) to allow the results to be fixed in time to  
when the user did the first query.

Alec

>
> From: developers-bounces at freebase.com [mailto:developers-bounces at freebase.com 
> ] On Behalf Of Kendra Kuhl
> Sent: Saturday, June 07, 2008 2:40 PM
> To: 'For discussions about MQL,Freebase API and apps built on  
> Freebase'
> Subject: [Developers] Paging through result sets.
>
> I’m attempting to create some system of paging through result sets  
> retrieved from Freebase. I am using a cursor to move forward through  
> the result set, but can’t figure out how to move backwards through  
> the result set (without some difficulty). I’ve looked through the  
> documentation and the mailing list archive and didn’t find a  
> solution. Does mql offer some kind of page, offset, skip parameter?  
> Or a back / forward for the cursor? I saw the offset reserved  
> keyword, but can’t find any documentation on how to use it or figure  
> out if it even does what I think it does.
>
> Thanks in advance,
>
> Kendra
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freebase.com/pipermail/developers/attachments/20080609/85c4d232/attachment-0001.htm 


More information about the Developers mailing list