%META:TOPICPARENT{name="VirtTipsAndTricksSPARQL11FeaturesExamplesCollection"}%
---+Virtuoso SPARQL 1.1. VALUES Usage Examples
---++What?
This guide contains Virtuoso SPARQL 1.1. VALUES Usage example queries which you can run against
any SPARQL endpoint that supports SPARQL 1.1 and the ability to allow a verified user perform
INSERT operations.
---++Why?
SPARQL 1.1 provides a mechanism for inline incorporation of Data as part SPARQL query patterns.
---++How?
Here are some examples showcasing Virtuoso's support for this functionality:
1 Assume the following statement for inserting triples INTO DBMS or Store:
PREFIX :
PREFIX ns:
INSERT
{
GRAPH
{
:book1 "SPARQL Tutorial" .
:book1 ns:price 42 .
:book1 ns:discount 0.2 .
:book2 "The Semantic Web" .
:book2 ns:price 23 .
:book2 ns:discount 0.25 .
}
}
1 From a Virtuoso SPARQL Endpoint ( http://host:port/sparql ) query the graph by executing the query from below for ex.:
PREFIX :
PREFIX ns:
SELECT ?book ?title ?price
FROM
WHERE
{
VALUES ?book { :book1 :book3 }
?book ?title ;
ns:price ?price .
}
1 [[http://bit.ly/1mHUVGI][View the SPARQL Query Definition via SPARQL Protocol URL]];
1 [[http://bit.ly/1i75jDz][View the SPARQL Query Results via SPARQL Protocol URL]];
1 Alternative variant of the query:
PREFIX :
PREFIX ns:
SELECT ?book ?title ?price
FROM
WHERE
{
?book ?title ;
ns:price ?price .
VALUES (?book ?title)
{ (UNDEF "SPARQL Tutorial")
(:book2 UNDEF)
}
}
1 [[http://bit.ly/1fRt1Dz][View the SPARQL Query Definition via SPARQL Protocol URL]];
1 [[http://bit.ly/VnjeeG][View the SPARQL Query Results via SPARQL Protocol URL]].
---++Related
* [[http://www.w3.org/TR/sparql11-query/#inline-data][SPARQL 1.1. inline data via use of VALUES clause]]
* [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]]
* [[VirtTipsAndTricksSPARQL11FeaturesExamplesCollection][Virtuoso SPARQL 1.1 Usage Examples Collection]]
* [[http://virtuoso.openlinksw.com/tutorials/sparql/SPARQL_Tutorials_Part_9/SPARQL_Tutorials_Part_9.html][Virtuoso SPARQL 1.1 Syntax Tutorial]]
* [[http://bit.ly/U0q7Hb][Virtuoso SPARQL 1.1 VALUES Tutorial]]
* [[http://bit.ly/Uo5hP6][Virtuoso SPASQL And SPARQL Tutorial]]
* [[http://docs.openlinksw.com/virtuoso/rdfsparql.html][Virtuoso Documentation]]