You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Maarten van Dessel <ma...@ugent.be> on 2015/03/31 10:00:40 UTC

ARQ — LIMIT clause

Hi everyone,

SPARQL 1.1 Query Language specifies a LIMIT clause. Eg.
> CONSTRUCT { ?s pre:predicate2 ?o }
> WHERE { ?s pre:predicate1 ?o }
> LIMIT 1
This would result in only one statement (if a match was found). This statement can then be added to the original model. 

SPARQL 1.1 Update does not specify this functionality. Is it however possible to mimic 'LIMIT' behavior in ARQ? Eg.
> INSERT { ?s pre:predicate2 ?o }
> WHERE { ?s pre:predicate1 ?o }
This update would fill in the INSERT template for every match. For some reason I have to limit this insert to only the first 'x' matches.

Thanks in advance,

Maarten

Re: ARQ — LIMIT clause

Posted by Andy Seaborne <an...@apache.org>.
On 31/03/15 09:00, Maarten van Dessel wrote:
> Hi everyone,
>
> SPARQL 1.1 Query Language specifies a LIMIT clause. Eg.
>> CONSTRUCT { ?s pre:predicate2 ?o }
>> WHERE { ?s pre:predicate1 ?o }
>> LIMIT 1
> This would result in only one statement (if a match was found). This statement can then be added to the original model.
>
> SPARQL 1.1 Update does not specify this functionality. Is it however possible to mimic 'LIMIT' behavior in ARQ? Eg.
>> INSERT { ?s pre:predicate2 ?o }
>> WHERE { ?s pre:predicate1 ?o }
> This update would fill in the INSERT template for every match. For some reason I have to limit this insert to only the first 'x' matches.
>
> Thanks in advance,
>
> Maarten

The WHERE clause can have subqueries:

INSERT { ?s pre:predicate2 ?o }
WHERE {
   SELECT ?s ?o
   { ?s pre:predicate1 ?o }
   LIMIT 1
}

	Andy