<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE spec SYSTEM "../shared/xmlspec.dtd" [
	<!ENTITY base.uri "http://www.w3.org/2009/sparql/docs/update-1.1/">
	<!ENTITY maturity.level "WD">
	<!ENTITY doc.shortname "sparql11-update">
	<!ENTITY draft.year "2010">
	<!ENTITY draft.month.name "October">
	<!ENTITY draft.month "10">
	<!ENTITY draft.day "14">
	<!ENTITY iso6.doc.date "&draft.year;&draft.month;&draft.day;">
	<!ENTITY doc.ident "&maturity.level;-&doc.shortname;-&iso6.doc.date;">
	<!ENTITY this.version "&base.uri;&doc.ident;">
<!--	<!ENTITY xml.version "&doc.ident;.xml">
	<!ENTITY review.version "&doc.ident;-review.html">
	<!ENTITY pdf.version "&doc.ident;.pdf">
	<!ENTITY errataloc "http://www.w3.org/XML/xml-V10-5e-errata">
	<!ENTITY preverrataloc "http://www.w3.org/XML/xml-V10-4e-errata">
	<!ENTITY translationloc "http://www.w3.org/2003/03/Translations/byTechnology?technology=&doc.shortname;">
	<!ENTITY impreploc "http://www.w3.org/XML/2008/01/xml10-5e-implementation.html">     -->
	<!ENTITY versionOfSPARQLUpdate "1.1">
<!--	<!ENTITY WebSGML "WebSGML Adaptations Annex to ISO 8879">   -->
	<!ENTITY nbsp "&#160;">
	<!ENTITY mdash "&#x2014;">
	<!ENTITY magicents "<code>amp</code>,
<code>lt</code>,
<code>gt</code>,
<code>apos</code>,
<code>quot</code>">
	<!ENTITY may "may">
	<!ENTITY MAY "<rfc2119>MAY</rfc2119>">
	<!ENTITY % local.common.att "xml:lang    CDATA  #IMPLIED">
]>

<?xml-stylesheet type="text/xsl" href="../shared/xmlspec.xsl"?> 

<spec w3c-doctype="" xml:lang="en">



				<div3 id="copy">
          <head>COPY</head>

<p>The <code>COPY</code> operation is a shortcut for inserting all data from an input graph into a destination graph. Data from the input graph is not affected, but data from the destination graph, if any, is removed before insertion.</p>

<pre class="defn"><strong>COPY [SILENT] ([GRAPH] &lt;fromURI&gt; | DEFAULT) TO ([GRAPH] &lt;toURI&gt; | DEFAULT)</strong>
</pre>

<p>Is equivalent to:</p>

<pre class="defn"><strong>DROP SILENT (GRAPH &lt;toURI&gt; | DEFAULT);
INSERT { ( GRAPH &lt;toURI&gt; | DEFAULT) { ?s ?p ?o } } WHERE { ( GRAPH &lt;fromURI&gt; | DEFAULT) { ?s ?p ?o } }
</strong></pre>

<p>
If the destination graph does not exist, it will be created.
By default, the service is expected to return <em>failure</em> if the input graph does not exist. 
If <code>SILENT</code> is present, the result of the operation will always be success.
</p>

<p><b>Example:</b></p>
<p><a name="example_i"/>An example to copy all statements from the default graph into a named graph.</p>
<pre class="query">COPY DEFAULT TO &lt;http://example.org/named&gt;
</pre>

<p>Data before:</p>

<pre class="data"><b># Default graph</b>

@prefix foaf:  &lt;http://xmlns.com/foaf/0.1/&gt;

&lt;http://example/william&gt; a foaf:Person .
&lt;http://example/william&gt; foaf:firstName &quot;William&quot; .
&lt;http://example/william&gt; foaf:mbox &quot;bill@example&quot; .

# Graph http://example.org/named

&lt;http://example/fred&gt; a foaf:Person .</pre>

<p>Data after:</p>

<pre class="data"><b># Default graph</b>

&lt;http://example/william&gt; a foaf:Person .
&lt;http://example/william&gt; foaf:firstName &quot;William&quot; .
&lt;http://example/william&gt; foaf:mbox &quot;bill@example&quot; .

<b># Graph http://example.org/named</b>

&lt;http://example/william&gt; a foaf:Person .
&lt;http://example/william&gt; foaf:firstName &quot;William&quot; .
&lt;http://example/william&gt; foaf:mbox &quot;bill@example&quot; .</pre>

				</div3>


								<div3 id="move">
	<head>MOVE</head>
				
<p>The <code>MOVE</code> operation is a shortcut for moving all data from an input graph into a destination graph. The input graph is removed after insertion and data from the destination graph, if any, is removed before insertion.</p>

<pre class="defn"><strong>MOVE [SILENT] ([GRAPH] &lt;fromURI&gt; | DEFAULT) TO ([GRAPH] &lt;toURI&gt; | DEFAULT)</strong>
</pre>

<p>Is equivalent to:</p>

<pre class="defn"><strong>DROP SILENT (GRAPH &lt;toURI&gt; | DEFAULT);
INSERT { ( GRAPH &lt;toURI&gt; | DEFAULT) { ?s ?p ?o } } WHERE { ( GRAPH &lt;fromURI&gt; | DEFAULT) { ?s ?p ?o } };
DROP ( GRAPH &lt;fromURI&gt; | DEFAULT)</strong></pre>

<p>
As for <code>COPY</code>, if the destination graph does not exist, it will be created.
By default, the service is expected to return <em>failure</em> if the input graph does not exist. 
If <code>SILENT</code> is present, the result of the operation will always be success.
</p>

<p><b>Example:</b></p>
<p><a name="example_i"/>An example to move all statements from the default graph into a named graph.</p>
<pre class="query">MOVE DEFAULT TO &lt;http://example.org/named&gt;
</pre>

<p>Data before:</p>

<pre class="data"><b># Default graph</b>

@prefix foaf:  &lt;http://xmlns.com/foaf/0.1/&gt;

&lt;http://example/william&gt; a foaf:Person .
&lt;http://example/william&gt; foaf:firstName &quot;William&quot; .
&lt;http://example/william&gt; foaf:mbox &quot;bill@example&quot; .

# Graph http://example.org/named

&lt;http://example/fred&gt; a foaf:Person .</pre>

<p>Data after:</p>

<pre class="data"><b># Default graph</b>

<b># Graph http://example.org/named</b>

&lt;http://example/william&gt; a foaf:Person .
&lt;http://example/william&gt; foaf:firstName &quot;William&quot; .
&lt;http://example/william&gt; foaf:mbox &quot;bill@example&quot; .</pre>

</div3>

	<div3 id="add">
	<head>ADD</head>
				
<p>The <code>ADD</code> operation is a shortcut for inserting all data from an input graph into a destination graph. Data from the input graph is not affected, and initial data from the destination graph, if any, is kept intact.</p>

<pre class="defn"><strong>ADD [SILENT] ([GRAPH] &lt;fromURI&gt; | DEFAULT) TO ([GRAPH] &lt;toURI&gt; | DEFAULT)</strong>
</pre>

<p>Is equivalent to:</p>

<pre class="defn"><strong>INSERT { ( GRAPH &lt;toURI&gt; | DEFAULT) { ?s ?p ?o } } WHERE { ( GRAPH &lt;fromURI&gt; | DEFAULT) { ?s ?p ?o } }</strong></pre>

<p>
As for <code>COPY</code>, if the destination graph does not exist, it will be created.
By default, the service is expected to return <em>failure</em> if the input graph does not exist. 
If <code>SILENT</code> is present, the result of the operation will always be success.
</p>

<p><b>Example:</b></p>
<p><a name="example_i"/>An example to add all statements from the default graph into a named graph.</p>
<pre class="query">ADD DEFAULT TO &lt;http://example.org/named&gt;
</pre>

<p>Data before:</p>

<pre class="data"><b># Default graph</b>

@prefix foaf:  &lt;http://xmlns.com/foaf/0.1/&gt;

&lt;http://example/william&gt; a foaf:Person .
&lt;http://example/william&gt; foaf:firstName &quot;William&quot; .
&lt;http://example/william&gt; foaf:mbox &quot;bill@example&quot; .

# Graph http://example.org/named

@prefix foaf:  &lt;http://xmlns.com/foaf/0.1/&gt;

&lt;http://example/fred&gt; a foaf:Person .</pre>

<p>Data after:</p>

<pre class="data"><b># Default graph</b>

@prefix foaf:  &lt;http://xmlns.com/foaf/0.1/&gt;

&lt;http://example/william&gt; a foaf:Person .
&lt;http://example/william&gt; foaf:firstName &quot;William&quot; .
&lt;http://example/william&gt; foaf:mbox &quot;bill@example&quot; .

<b># Graph http://example.org/named</b>

@prefix foaf:  &lt;http://xmlns.com/foaf/0.1/&gt;

&lt;http://example/fred&gt; a foaf:Person .

&lt;http://example/william&gt; a foaf:Person .
&lt;http://example/william&gt; foaf:firstName &quot;William&quot; .
&lt;http://example/william&gt; foaf:mbox &quot;bill@example&quot; .</pre>

</div3>

</spec>
