W3C home > Mailing lists > Public > public-sparql-dev@w3.org > July to September 2010

Re: changing literal values with CONSTRUCT

From: Damian Steer <d.steer@bristol.ac.uk>
Date: Sat, 21 Aug 2010 09:20:19 +0100
Cc: public-sparql-dev@w3.org
Message-Id: <E0332124-DB64-48A0-938A-3542F138163F@bristol.ac.uk>
To: Olaf Hartig <hartig@informatik.hu-berlin.de>

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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:15:50 UTC