Skip to content

Commit

Permalink
Do not add limit or offset when not needed in SPARQL queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Schultz committed Nov 23, 2020
1 parent 4355ae2 commit 4c88f0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ object PagingSparqlTraversable {
if(Thread.currentThread().isInterrupted) {
return
}
parsedQuery.setLimit(math.min(params.pageSize, limit - offset))
parsedQuery.setOffset(offset)
if(params.pageSize != Int.MaxValue && limit > params.pageSize) {
parsedQuery.setOffset(offset)
}
if(limit != Int.MaxValue || params.pageSize != Int.MaxValue) {
parsedQuery.setLimit(math.min(params.pageSize, limit - offset))
}
val inputStream = executeQuery(parsedQuery.serialize(Syntax.syntaxSPARQL_11))
try {
val resultCount = outputResults(inputStream, f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@ object RemoteSparqlEndpoint {
val rt = cfg.getInt("silk.remoteSparqlEndpoint.defaults.read.timeout.ms")
(ct, rt)
}
}
}

0 comments on commit 4c88f0a

Please sign in to comment.