Not considering the apparent errors in your example query, the solution is to use SELECT
instead of CONSTRUCT
. The former allows you to limit the number of results.
If you totally need a triple as result, you can use limited SELECT
as a subquery
To select only one triple from a CONSTRUCT
query you can use the LIMIT
clause just like with SELECT
Construct { ?Example <urn:Book:Title> ?Title }
Where {
?Example <urn:Book:For> "5 years old" .
?Example <urn:Book:Title> ?Title .
}
limit 1
This will select the first result (order undetermined).
And no, the judging by the SPARQL Grammar, it is not possible to use the LIMIT
clause with SPARQL Updates.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…