Paginating SPARQL results

后端 未结 1 966
滥情空心
滥情空心 2020-12-19 03:30

Suppose I have the following SPARQL query:

SELECT DISTINCT ?result ?label
WHERE {
  ?result a database:Column .
  ?r         


        
相关标签:
1条回答
  • 2020-12-19 04:13

    I'm trying to implement a system of paging for a table that visualizes the returned data.

    You want to use limit, order by, and offset. They're described pretty well in the standard:

    15.4 OFFSET

    OFFSET causes the solutions generated to start after the specified number of solutions. An OFFSET of zero has no effect.

    Using LIMIT and OFFSET to select different subsets of the query solutions will not be useful unless the order is made predictable by using ORDER BY.

    15.5 LIMIT

    The LIMIT clause puts an upper bound on the number of solutions returned. If the number of actual solutions, after OFFSET is applied, is greater than the limit, then at most the limit number of solutions will be returned.

    In your case, your query would be something like this to show the fourth page of results when you are showing ten results per page:

    SELECT DISTINCT ?result ?label
    WHERE {
      ?result a database:Column .
      ?result rdfs:label ?label .
    }
    ORDER BY (LCASE(?label))
    LIMIT 10
    OFFSET 30
    
    0 讨论(0)
提交回复
热议问题