Unless there is a better way to use offset or structure my data to ensure the offset is quick. TDB has been mentioned so I will look at that.
On 10/03/2021 09:56, Lorenz Buehmann wrote:
On 09.03.21 17:57, Donald McIntosh wrote:Ultimately however, it's definitely not a scalable solution. If two users run the same paging screen at the same time on my system, it will double the work.. which is already sub-optimal due to lack of indexes. I guess - and I do not mean this as a criticism - this is just the nature of Jena and perhaps RDF datastores more broadly. Their "sweet spot" is exploring linked data in a natural item-to-item way, rather than sub-selecting for use with say a UI where there a multiple users and responsiveness is important. I should mitigate by running slow reports when quiet and save the output... or is there a Jena/RDF feature that I am not leveraging that could help here?From my point of view, this is a task for some caching mechanism. There do exist several solutions for caching at different steps in your workflow. While this indeed could be done at database level, it's from my point of view more a client side task.Or did you mean some different issue here?On 09/03/2021 09:34, Jean-Claude Moissinac wrote:I think we have there a performance issue.When the complete result is big, and you take a slice with LIMIT/OFFSET, isuspect the Jena implementation is going through the dataset until the offset, then it get the result. It doesn't take advantage of a previous offset/limit with the same query; so, going through the complete resultpage by page using LIMIT/OFFSET can become infeasible because the responsetime augment with the OFFSET value. Is there a best practice about such use case? -- Jean-Claude Moissinac Le mar. 9 mars 2021 à 10:16, Lorenz Buehmann < buehm...@informatik.uni-leipzig.de> a écrit :just some comments as you already got the answer:pagination in SPARQL can only be done via limit + offset, as you alreadyhave figured out - but, formally, it is only guaranteed to be correct when sorting the data. depending on the size of the data this can be expensive - especiallywhat people always find strange is hat offset operator in SPARQL is notas simple as it might be in SQL because of the semantics of SPARQL. There isn't a "simple" cursor like in SQL database, so it might be rather slow for large offsets.Jena usually doesn't know the result size during query execution as it's(afaik) using a pipelined execution (aka lazy or Volcano) - only foroperations where it has to have to whole intermediate result computed toproceed to the next stage (e.,g. aggregates) this assumption holds. long story short: if you really think that a user needs to see allpages, as already suggest, a count in a separate query before would do it.On 09.03.21 09:52, Donald McIntosh wrote:Hi.. I have an implementation where I would like to page through dataretrieved via a SPARQL query on Apache Jena on a UI. offset and limitfeatures take me some of the way there but do not tell me the full size ofthe overall result set so that users can skip to the end or to page xknowing that it will exist. I am guessing that internally Jena will knowthe result set size from a query but perhaps this not available to the caller, as the full set will have been retrieved and sorted.Is there a correct and efficient way to implement this type of use caseinApache Jena ?Thanks, Donald