@@ -357,6 +357,60 @@ SELECT ANNOTATION WHERE
357
357
[ DATA "myset" "part-of-speech" = "noun" OR DATA "myset" "syntactic-unit" = "noun-phrase" ];
358
358
```
359
359
360
+ ### Limit Constraint
361
+
362
+ * ** Syntax (1)** : ` LIMIT ` * items*
363
+ * ** Syntax (2)** : ` LIMIT ` -* items*
364
+ * ** Syntax (3)** : ` LIMIT ` * begin* * end*
365
+
366
+ This selects a subpart of a sequence, it comes in three forms.
367
+
368
+ * With a positive integer (` LIMIT ` * n* ), it returns the first * n* items.
369
+ * With a negative integer (` LIMIT ` * -n* ), it returns the last * n* items.
370
+ * With two integers (` LIMIT ` * begin* * end* ), it returns the items * begin* to * end* (0-indexed, non-inclusive end).
371
+ * The integers may be signed
372
+ * And ` end ` value of 0 is interpreted as * until the very end* .
373
+
374
+ * ** Example:** * Return the first sentence*
375
+
376
+ ``` sparql
377
+ SELECT ANNOTATION ?sentence WHERE
378
+ DATA "myset" "type" = "sentence";
379
+ LIMIT 1;
380
+ ```
381
+
382
+ * ** Example:** * Return the last two sentences*
383
+
384
+ ``` sparql
385
+ SELECT ANNOTATION ?a WHERE
386
+ DATA "myset" "type" = "sentence";
387
+ LIMIT -2;
388
+ ```
389
+
390
+ * ** Example:** * Return the second, third and fourth sentence*
391
+
392
+ ``` sparql
393
+ SELECT ANNOTATION ?a WHERE
394
+ DATA "myset" "type" = "sentence";
395
+ LIMIT 1 4;
396
+ ```
397
+
398
+ * ** Example:** * Return all sentences except the first*
399
+
400
+ ``` sparql
401
+ SELECT ANNOTATION ?a WHERE
402
+ DATA "myset" "type" = "sentence";
403
+ LIMIT 1 0;
404
+ ```
405
+
406
+ * ** Example:** * Return all sentences except the last*
407
+
408
+ ``` sparql
409
+ SELECT ANNOTATION ?a WHERE
410
+ DATA "myset" "type" = "sentence";
411
+ LIMIT 0 -1;
412
+ ```
413
+
360
414
### Query Composition
361
415
362
416
A single query is not always expressive enough to retrieve the data you a
0 commit comments