Hi,

For the pagination issue combined with client side caching (and adding delay for not overloading the endpoint), I have written this utility lib some time ago:

https://github.com/AKSW/jena-sparql-api

Its currently for the prior Jena 2.10.0, but will be upgraded soon.

As for

>> 2) Get the size of ResultSet. but there are no way to get the total number that ResultSet contains.

A cheap way of getting the count is doing a query for it with "Select (Count(*) As ?c) { { <your original query here>} }". Although I prefer modifying the projection in Jena's Query object as I dislike string hacks.


Best,
Claus


On 22.10.2013 19:21, Wang Dongsheng wrote:
By the way, I want to ask you two questions accordingly,

For 1), Can I get the total number first? cause it's better to
calculate how much pages there are in advance.
For 2), If the resultSet is very Large, will the transferring to List
being broken up easily?

On Tue, Oct 22, 2013 at 6:31 PM, Wang Dongsheng <dswang2...@gmail.com> wrote:
Hi Samuel,
  Thanks a lot, It's very cool~ :)

Sincere~
Wang



On Tue, Oct 22, 2013 at 4:22 PM, Samuel Croset <samuel.cro...@gmail.com> wrote:
Hi,

For 1) you can use the OFFSET and LIMIT constructs
For 2) You can use:  ResultSetFormatter.toList()

See this answer
http://answers.semanticweb.com/questions/9456/jena-pagination-for-sparql for
more details.

Cheers,

Samuel


On Tue, Oct 22, 2013 at 8:24 AM, Wang Dongsheng <dswang2...@gmail.com>wrote:

Hi, all
I want to implement pagination for ResultSet of Sparql.
I guess there are generally two ways:

1, Through a specified SPARQL format, but I dont know how to write the
query,
2. Get the size of ResultSet. but there are no way to get the total
number that ResultSet contains.

I prefer to implement the second way, But Doc of API seems unavailable.

Any one tried this kind of effort? Or it was not suitable to paginate
the result?

Thank in advance~



--
Dipl. Inf. Claus Stadler
Department of Computer Science, University of Leipzig
Research Group: http://aksw.org/
Workpage & WebID: http://aksw.org/ClausStadler
Phone: +49 341 97-32260

Reply via email to