%META:TOPICPARENT{name="VirtTipsAndTricksSPARQL11FeaturesExamplesCollection"}%
---+ Using SPARQL 1.1 Assignments
---++What?
Using SPARQL 1.1 assignments.
---++Why?
Allows the creation of new values in a query.
---++How?
Here is example showcasing Virtuoso's support for this functionality:
1 Assume the following Raw Data Representation in Turtle:
<#lemonade> <#price> 4 .
<#wine> <#price> 6 .
<#water> <#price> 1 .
<#beer> <#price> 3 .
<#liqueur> <#price> 5 .
1 Load the sample data using SPARQL 1.1. INSERT Syntax:
INSERT
{
GRAPH
{
<#lemonade> <#price> 4 .
<#wine> <#price> 6 .
<#water> <#price> 1 .
<#beer> <#price> 3 .
<#liqueur> <#price> 5 .
}
}
1 Let's assign new price:
SELECT ?item (?price*2.3 as ?NewPrice)
FROM
WHERE
{
?item <#price> ?price
}
* [[http://bit.ly/VpdZ0Q][View the SPARQL Query Definition via SPARQL Protocol URL]]
* [[http://bit.ly/Z8r4vg][View the SPARQL Query Results via SPARQL Protocol URL]]
---++Related
* [[VirtTipsAndTricksSPARQL11FeaturesExamplesCollection][SPARQL 1.1 Features Examples Collection]]
* [[http://www.w3.org/TR/2010/WD-sparql11-property-paths-20100126/][SPARQL 1.1. Property Paths]]
* [[http://www.w3.org/TR/sparql11-query/#inline-data][SPARQL inline data via use of VALUES clause]]
* [[http://virtuoso.openlinksw.com/tutorials/sparql/SPARQL_Tutorials_Part_9/SPARQL_Tutorials_Part_9.html][Virtuoso SPARQL 1.1 Syntax Tutorial]]
* [[http://www.w3.org/TR/2010/WD-sparql11-query-20100126/#subqueries][SPARQL 1.1 Sub-queries]]
* [[http://www.w3.org/TR/sparql11-query/][SPARQL 1.1 Specification]]
* [[http://www.w3.org/TR/rdf-sparql-protocol/][SPARQL Protocol (HTTP based Query Service)]]
* [[http://docs.openlinksw.com/virtuoso/rdfsparql.html][Virtuoso Documentation]]
* [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]]