Re: changing literal values with CONSTRUCT

On 21 Aug 2010, at 08:50, Olaf Hartig wrote:

> My question is: Is something similar possible with CONSTRUCT queries? 
> Something that I could use to create -for instance- an RDF triple
> 
>  <http://example.org/Bob>  ex:ageAfterBDay  12 .
> 
> from the triple
> 
>  <http://example.org/Bob>  ex:age  11 .
> 
> by increasing the value bound to the ?year variable.
> 
> I studied the latest working draft of SPARQL 1.1 but I couldn't find something.

You can do this in SPARQL 1.1 currently using subqueries:

construct { <http://example.org/Bob>  ex:ageAfterBDay  ?nextYear }
          { select (?year + 1 AS ?nextYear) { <http://example.org/Bob>  ex:age  ?year } }

Which, even in this simple case, has a syntax only a mother could love.

I believe assignment [1] has been discussed, which is like ARQ's LET. [2]

construct { <http://example.org/Bob>  ex:ageAfterBDay  ?nextYear }
          { <http://example.org/Bob>  ex:age  ?year . ( let ?nextYear := ?year + 1 ) }

Damian

[1] <http://www.w3.org/2009/sparql/wiki/Feature:Assignment>
[2] <http://jena.sourceforge.net/ARQ/assignment.html>

Received on Saturday, 21 August 2010 08:20:55 UTC