SPARQL Examples – Limit

Limit the number of results returned

PREFIX rdfs:<> PREFIX bc: <> SELECT * WHERE { ?subject bc:hasEmployer <> . ?subject bc:hasBusinessEmail ?email . } LIMIT 5

The LIMIT keyword is used after the WHERE clause, followed by a numerical value. In this case, of course, only 5 results are returned.

  • LIMIT is a solution modifier that limits the number of rows returned from a query. SPARQL has two other solution modifiers:
    • ORDER BY for sorting query solutions on the value of one or more variables
    • OFFSET, used in conjunction with LIMIT and ORDER BY to take a slice of a sorted solution set (e.g. for paging)