@prefix: <http://example.org/book/> . @prefix ns: <http://example.org/ns#> . :book1 <http://purl.org/dc/elements/1.1/title> "SPARQL Tutorial" . :book1 ns:price 42 . :book1 ns:discount 0.2 . :book2 <http://purl.org/dc/elements/1.1/title> "The Semantic Web" . :book2 ns:price 23 . :book2 ns:discount 0.25 .
PREFIX : <http://example.org/book/> PREFIX ns: <http://example.org/ns#> INSERT { GRAPH <urn:sparql:bind:tests> { :book1 <http://purl.org/dc/elements/1.1/title> "SPARQL Tutorial" . :book1 ns:price 42 . :book1 ns:discount 0.2 . :book2 <http://purl.org/dc/elements/1.1/title> "The Semantic Web" . :book2 ns:price 23 . :book2 ns:discount 0.25 . } }
BIND
:
PREFIX ns: <http://example.org/ns#> SELECT ?title ?price FROM <urn:sparql:bind:tests> { ?x ns:price ?p . ?x ns:discount ?discount . ?x <http://purl.org/dc/elements/1.1/title> ?title . BIND (?p*(1-?discount) AS ?price) FILTER( ?price < 20 ) }