Virtuoso SPARQL 1.1.
COPY Usage Examples
What?
This guide contains Virtuoso SPARQL 1.1.
COPY Usage examples 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?
Use as shortcut for inserting all data from an input graph into a destination graph.
Note that the original content in the destination graph is lost by a COPY operation.
How?
Here are some examples showcasing Virtuoso's support for this functionality:
COPY Example
This example copies all triples from a named graph identified by the IRI <urn:sparql:tests:copy:data> to a named graph identified by the IRI <urn:sparql:tests:copy2:data>
- Assume the following Raw Data Representation in Turtle:
<#book1> <#price> 41 .
<#book2> <#price> 42 .
- Load the sample data into <urn:sparql:tests:copy:data>:
INSERT DATA
{
GRAPH <urn:sparql:tests:copy:data>
{
<#book1> <#price> 41 .
<#book2> <#price> 42 .
}
}
- Query graph <urn:sparql:tests:copy:data> data:
SELECT *
FROM <urn:sparql:tests:copy:data>
WHERE
{
?s ?p ?o
}
- Assume the following Raw Data Representation in Turtle:
<#book3> <#price> 43 .
<#book4> <#price> 44 .
- Load the sample data into <urn:sparql:tests:copy2:data>:
INSERT DATA
{
GRAPH <urn:sparql:tests:copy2:data>
{
<#book3> <#price> 43 .
<#book4> <#price> 44 .
}
}
- Query graph <urn:sparql:tests:copy2:data> data:
SELECT *
FROM <urn:sparql:tests:copy2:data>
WHERE
{
?s ?p ?o
}
- Copy all triples from <urn:sparql:tests:copy:data> to <urn:sparql:tests:copy2:data>
COPY <urn:sparql:tests:copy:data> TO <urn:sparql:tests:copy2:data>;
- Query graph <urn:sparql:tests:copy2:data> data: Note that the original content in <urn:sparql:tests:copy2:data> is lost by a COPY operation:
SELECT *
FROM <urn:sparql:tests:copy2:data>
WHERE
{
?s ?p ?o
}
Related