You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by ro...@tiscali.it on 2021/12/06 13:15:36 UTC

Use LIMIT/OFFSET

  

Hello
I have to use limit and offset on a sparql query run on Jena
Fuseki to get paginated results.

But reading the w3c documentation I
find:
_"OFFSET CAUSES GENERATED SOLUTIONS TO START AFTER THE SPECIFIED
NUMBER OF SOLUTIONS. AN OFFSET OF ZERO HAS NO EFFECT._
_USING LIMIT AND
OFFSET TO SELECT DIFFERENT SUBSETS OF QUERY SOLUTIONS WILL NOT BE USEFUL
UNLESS THE ORDER IS MADE PREDICTABLE USING ORDER BY "._
Also on
stackoverflow there are the same
indications:
https://stackoverflow.com/questions/55146844/offset-in-sparql

However,
assuming there will be _NO UPDATES_ on the dataset but only reads, can
I avoid the ORDER BY clause?
I have done various tests without ORDER BY
and the results seem consistent. I would like to avoid the ORDER BY
clause because I slow down the query a lot.

Thanks
  



Con Tiscali Mobile Smart 70 hai 70 GB in 4G, minuti illimitati e 100 SMS a soli 7,99€ al mese http://tisca.li/Smart70


Re: Use LIMIT/OFFSET

Posted by ro...@tiscali.it.
  

Thanks for the reply

Il 06.12.2021 14:31 Rob Vesse ha scritto: 

>
Assuming the queries and the underlying data storage used remain the
same then Jena will likely generate results in a consistent manner
> 
>
BUT you should never rely upon this. The only way to guarantee the
behaviour you want is to provide an explicit ORDER BY clause
> 
> For
example adding an extra triple pattern to your query could cause the
optimizer to execute your query differently leading to a different
ordering of results. Similarly internal changes to improve the optimizer
can cause execution to be different when you change Jena versions
> 
>
Rob
> 
> On 06/12/2021, 13:16, "robert.barry@tiscali.it [1]" wrote:
> 
>
Hello
> I have to use limit and offset on a sparql query run on Jena
>
Fuseki to get paginated results.
> 
> But reading the w3c documentation
I
> find:
> _"OFFSET CAUSES GENERATED SOLUTIONS TO START AFTER THE
SPECIFIED
> NUMBER OF SOLUTIONS. AN OFFSET OF ZERO HAS NO EFFECT._
>
_USING LIMIT AND
> OFFSET TO SELECT DIFFERENT SUBSETS OF QUERY SOLUTIONS
WILL NOT BE USEFUL
> UNLESS THE ORDER IS MADE PREDICTABLE USING ORDER BY
"._
> Also on
> stackoverflow there are the same
> indications:
>
https://stackoverflow.com/questions/55146844/offset-in-sparql [3]
> 
>
However,
> assuming there will be _NO UPDATES_ on the dataset but only
reads, can
> I avoid the ORDER BY clause?
> I have done various tests
without ORDER BY
> and the results seem consistent. I would like to
avoid the ORDER BY
> clause because I slow down the query a lot.
> 
>
Thanks
> 
> Con Tiscali Mobile Smart 70 hai 70 GB in 4G, minuti
illimitati e 100 SMS a soli 7,99EUR al mese http://tisca.li/Smart70
[4]

   


Con Tiscali Mobile Smart 70 hai 70 GB in 4G, minuti illimitati e 100 SMS a soli 7,99€ al mese http://tisca.li/Smart70


Re: Use LIMIT/OFFSET

Posted by Rob Vesse <rv...@dotnetrdf.org>.
Assuming the queries and the underlying data storage used remain the same then Jena will likely generate results in a consistent manner

BUT you should never rely upon this.  The only way to guarantee the behaviour you want is to provide an explicit ORDER BY clause

For example adding an extra triple pattern to your query could cause the optimizer to execute your query differently leading to a different ordering of results.  Similarly internal changes to improve the optimizer can cause execution to be different when you change Jena versions

Rob

On 06/12/2021, 13:16, "robert.barry@tiscali.it" <ro...@tiscali.it> wrote:



    Hello
    I have to use limit and offset on a sparql query run on Jena
    Fuseki to get paginated results.

    But reading the w3c documentation I
    find:
    _"OFFSET CAUSES GENERATED SOLUTIONS TO START AFTER THE SPECIFIED
    NUMBER OF SOLUTIONS. AN OFFSET OF ZERO HAS NO EFFECT._
    _USING LIMIT AND
    OFFSET TO SELECT DIFFERENT SUBSETS OF QUERY SOLUTIONS WILL NOT BE USEFUL
    UNLESS THE ORDER IS MADE PREDICTABLE USING ORDER BY "._
    Also on
    stackoverflow there are the same
    indications:
    https://stackoverflow.com/questions/55146844/offset-in-sparql

    However,
    assuming there will be _NO UPDATES_ on the dataset but only reads, can
    I avoid the ORDER BY clause?
    I have done various tests without ORDER BY
    and the results seem consistent. I would like to avoid the ORDER BY
    clause because I slow down the query a lot.

    Thanks




    Con Tiscali Mobile Smart 70 hai 70 GB in 4G, minuti illimitati e 100 SMS a soli 7,99€ al mese http://tisca.li/Smart70