Attributes | Values |
---|
type
| |
Date Created
| |
Date Modified
| |
label
| - VirtTipsAndTricksSPARQL11BIND
|
maker
| |
Title
| - VirtTipsAndTricksSPARQL11BIND
|
isDescribedUsing
| |
has creator
| |
content
| - %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:
<verbatim>
@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 .
</verbatim>
1 Load the sample data:
<verbatim>
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 .
}
}
</verbatim>
1 Assume the following SPARQL query using <code>BIND</code>:
<verbatim>
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 )
}
</verbatim>
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]]
|
id
| - 428140e6d9456d2e6a4d5a5576989f7f
|
link
| |
has container
| |
http://rdfs.org/si...ices#has_services
| |
atom:title
| - VirtTipsAndTricksSPARQL11BIND
|
links to
| |
atom:source
| |
atom:author
| |
atom:published
| |
atom:updated
| |
topic
| |
is made
of | |
is container of
of | |
is link
of | |
is http://rdfs.org/si...vices#services_of
of | |
is creator of
of | |
is atom:entry
of | |
is atom:contains
of | |