%META:TOPICPARENT{name="VirtTipsAndTricksSPARQL11FeaturesExamplesCollection"}% ---+Virtuoso SPARQL 1.1. BIND Usage Examples ---++What? This guide contains Virtuoso SPARQL 1.1. BIND 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? To make a SPARQL query more flexible by assigning value(s) to variable(s) and having options for more precised filtering the query results by these variables. ---++How? 1 Assume the following Raw Data Representation in Turtle: @prefix: . @prefix ns: . :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 Load the sample data: 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 Assume the following SPARQL query using BIND: PREFIX ns: SELECT ?title ?price FROM { ?x ns:price ?p . ?x ns:discount ?discount . ?x ?title . BIND (?p*(1-?discount) AS ?price) FILTER( ?price < 20 ) } 1 [[http://bit.ly/18Whdgh][View the SPARQL Query Definition via SPARQL Protocol URL]] 1 [[http://bit.ly/18WhbVR][View the SPARQL Query Results via SPARQL Protocol URL]] ---++Related * [[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/WHtTAG][Virtuoso SPARQL 1.1. BIND Tutorial]] * [[http://docs.openlinksw.com/virtuoso/rdfsparql.html][Virtuoso Documentation]]