Assignment

Created on Feb. 23, 2013, 12:15 p.m. by Hevok & updated by Hevok on May 2, 2013, 5:19 p.m.

SPARQL 1.1 allows Assignment of new Variables, i.e. create new Values on the fly simple with the Query.

For example given some data about gene scores and one wants to select those as well as give them a new score which is 10% higher than the score that is given in the Database. What one can do here is to formulate a SELECT Statement where one can compute a new score with the Variable ?Pr multiplied with 1.1 and one can take this as new created variable. In the answer table one can see the Result where one has all new Scores for the Variable computed and already available. One has only to take one thing into account, namely Variables that are not bound at the Time when the Statement is written which does not hold or work for already bound Variables.

Data:

@prefix ex: <http://exmaple.org/>] .

ex:SIRT1 ex:score 3 .
ex:mTOR ex:score 5 .
ex:TERT ex:score 3.5 .
ex:PPARG ex:socre "n/a" .

Query:

PREFIX ex: <http://example.org/>]
SELECT ?Gene (?Sc*1.1 AS ?NewS )
WHERE { ?Gene ex:score ?Sc }

Result:

?Gene ?NewS
SIRT1 3.3
mTOR  3.3
TERT  3.85
PPARG
assignment.jpg

Tags: assigning, coding, programming, information, data
Categories: Tutorial
Parent: SPARQL 1.1

Update entry (Admin) | See changes

Comment on This Data Unit