<docbook><section><title>VirtGraphReplicationChain</title><title> Replication Example: Chain Topology</title> Replication Example: Chain Topology
<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Introduction</bridgehead>
<para>The following How-To walks you through setting up Virtuoso RDF Graph Replication in a Chain Topology.
<figure><graphic fileref="VirtGraphReplicationChain/topo-chain.png" /></figure></para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Prerequisites</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Database INI Parameters</bridgehead>
<para>Suppose there are 3 Virtuoso instances respectively with the following ini parameters values:</para>
<orderedlist spacing="compact"><listitem>virtuoso1.ini: <programlisting>...
[Database]
DatabaseFile    = virtuoso1.db
TransactionFile = virtuoso1.trx
ErrorLogFile     = virtuoso1.log
...
[Parameters]
ServerPort               = 1111
SchedulerInterval        = 1
...
[HTTPServer]
ServerPort                  = 8891
...
[URIQA]
DefaultHost = localhost:8891
...
[Replication]
ServerName   = db1
...
</programlisting></listitem>
<listitem>virtuoso2.ini: <programlisting>...
[Database]
DatabaseFile    = virtuoso2.db
TransactionFile = virtuoso2.trx
ErrorLogFile     = virtuoso2.log
...
[Parameters]
ServerPort               = 1112
SchedulerInterval        = 1
...
[HTTPServer]
ServerPort                  = 8892
...
[URIQA]
DefaultHost = localhost:8892
...
[Replication]
ServerName   = db2
...
</programlisting></listitem>
<listitem>virtuoso3.ini: <programlisting>...
[Database]
DatabaseFile    = virtuoso3.db
TransactionFile = virtuoso3.trx
ErrorLogFile     = virtuoso3.log
...
[Parameters]
ServerPort               = 1113
SchedulerInterval        = 1
...
[HTTPServer]
ServerPort                  = 8893
...
[URIQA]
DefaultHost = localhost:8893
...
[Replication]
ServerName   = db3
...
</programlisting></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3">Database DSNs</bridgehead>
<para>Use the ODBC Administrator on your Virtuoso host (e.g., on Windows, <emphasis>Start</emphasis> menu -&gt; <emphasis>Control Panel</emphasis> -&gt; <emphasis>Administrative Tools</emphasis> -&gt; <emphasis>Data Sources (ODBC)</emphasis>; on Mac OS X, /Applications/Utilities/OpenLink ODBC Administrator.app) to create a System DSN for each of db1, db2, db3, with names db1, db2 and db3, respectively.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Install Conductor package</bridgehead>
<para>On each of the 3 Virtuoso instances install the <ulink url="https://virtuoso.openlinksw.com/download/">conductor_dav.vad</ulink> package.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Create Publication on db1</bridgehead>
<orderedlist spacing="compact"><listitem>Go to <ulink url="http://localhost:8891/conductor">http://localhost:8891/conductor</ulink> and log in as dba </listitem>
<listitem>Go to Conductor -&gt; Replication -&gt; Transactional -&gt; Publications <figure><graphic fileref="VirtGraphReplicationChain/m1.png" /></figure> </listitem>
<listitem>Click <emphasis>Enable RDF Publishing</emphasis> </listitem>
<listitem>As result publication with the name <emphasis>RDF Publication</emphasis> should be created <figure><graphic fileref="VirtGraphReplicationChain/m2.png" /></figure> </listitem>
<listitem>Click the link which is the publication name.
</listitem>
<listitem>The publication items page will be shown: <figure><graphic fileref="VirtGraphReplicationChain/m3.png" /></figure> </listitem>
<listitem>Enter for Graph IRI: <programlisting>http://example.org
</programlisting><figure><graphic fileref="VirtGraphReplicationChain/m4.png" /></figure> </listitem>
<listitem>Click Add New </listitem>
<listitem>The item will be created and shown in the list of items for the currently viewed publication.
<figure><graphic fileref="VirtGraphReplicationChain/m5.png" /></figure></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Create subscription from db2 to db1&#39;s Publication</bridgehead>
<orderedlist spacing="compact"><listitem>Log in at <ulink url="http://localhost:8892/conductor.">http://localhost:8892/conductor.</ulink> </listitem>
<listitem>Go to Replication -&gt; Transactional -&gt; Subscriptions: <figure><graphic fileref="VirtGraphReplicationChain/m6.png" /></figure> </listitem>
<listitem>Click <emphasis>New Subscription</emphasis>: <figure><graphic fileref="VirtGraphReplicationChain/m7.png" /></figure> </listitem>
<listitem>From the list of &quot;Specify new data source&quot; select Data Source db1: <figure><graphic fileref="VirtGraphReplicationChain/m8.png" /></figure> </listitem>
<listitem>Enter for db1 dba user credentials: <figure><graphic fileref="VirtGraphReplicationChain/m9.png" /></figure> </listitem>
<listitem>Click &quot;Add Data Source&quot;: </listitem>
<listitem>As result <emphasis>db1</emphasis> will be shown in the &quot;Connected Data Sources&quot; list.
<figure><graphic fileref="VirtGraphReplicationChain/m10.png" /></figure> </listitem>
<listitem>Click &quot;Publications list&quot;: <figure><graphic fileref="VirtGraphReplicationChain/m11.png" /></figure> </listitem>
<listitem>As result will be shown the list of available publications for the selected data source.
 Select the one with name &quot;RDF Publication&quot; and click &quot;List Items&quot;.
<figure><graphic fileref="VirtGraphReplicationChain/m12.png" /></figure> </listitem>
<listitem>As result will be shown the &quot;Confirm subscription&quot; page.
<figure><graphic fileref="VirtGraphReplicationChain/m13.png" /></figure> </listitem>
<listitem>The sync interval by default is 10 minutes.
 For the testing purposes, we will change it to 1 minute.
<figure><graphic fileref="VirtGraphReplicationChain/m14.png" /></figure> </listitem>
<listitem>Click &quot;Subscribe&quot;.
</listitem>
<listitem>The subscription will be created.
<figure><graphic fileref="VirtGraphReplicationChain/m15.png" /></figure></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Create Publication on db2</bridgehead>
<orderedlist spacing="compact"><listitem>Go to <ulink url="http://localhost:8892/conductor">http://localhost:8892/conductor</ulink> and log in as dba, </listitem>
<listitem>Go to Conductor -&gt; Replication -&gt; Transactional -&gt; Publications: <figure><graphic fileref="VirtGraphReplicationChain/m16.png" /></figure> </listitem>
<listitem>Click <emphasis>Enable RDF Publishing</emphasis>: </listitem>
<listitem>As result publication with the name <emphasis>RDF Publication</emphasis> should be created: <figure><graphic fileref="VirtGraphReplicationChain/m17.png" /></figure> </listitem>
<listitem>Click the link which is the publication name.
</listitem>
<listitem>The publication items page will be shown: <figure><graphic fileref="VirtGraphReplicationChain/m18.png" /></figure> </listitem>
<listitem>Enter for Graph IRI: <programlisting>http://example.org
</programlisting><figure><graphic fileref="VirtGraphReplicationChain/m19.png" /></figure> </listitem>
<listitem>Click Add New.
</listitem>
<listitem>The item will be created and shown in the list of items for the currently viewed publication.
<figure><graphic fileref="VirtGraphReplicationChain/m20.png" /></figure></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Create subscription from db3 to db2&#39;s Publication</bridgehead>
<orderedlist spacing="compact"><listitem>Log in at <ulink url="http://localhost:8893/conductor.">http://localhost:8893/conductor.</ulink> </listitem>
<listitem>Go to Replication -&gt; Transactional -&gt; Subscriptions: <figure><graphic fileref="VirtGraphReplicationChain/m21.png" /></figure> </listitem>
<listitem>Click <emphasis>New Subscription</emphasis>: <figure><graphic fileref="VirtGraphReplicationChain/m22.png" /></figure> </listitem>
<listitem>From the list of &quot;Specify new data source&quot; select Data Source db2: <figure><graphic fileref="VirtGraphReplicationChain/m23.png" /></figure> </listitem>
<listitem>Enter for db2 dba user credentials: <figure><graphic fileref="VirtGraphReplicationChain/m24.png" /></figure> </listitem>
<listitem>Click &quot;Add Data Source&quot;: <figure><graphic fileref="VirtGraphReplicationChain/m25.png" /></figure> </listitem>
<listitem>As result <emphasis>db2</emphasis> will be shown in the &quot;Connected Data Sources&quot; list.
 Select it and click &quot;Publications list&quot;: <figure><graphic fileref="VirtGraphReplicationChain/m26.png" /></figure> </listitem>
<listitem>As result will be shown the list of available publications for the selected data source.
 Select the one with name &quot;RDF Publication&quot; and click &quot;List Items&quot;.
<figure><graphic fileref="VirtGraphReplicationChain/m27.png" /></figure> </listitem>
<listitem>As result will be shown the &quot;Confirm subscription&quot; page.
<figure><graphic fileref="VirtGraphReplicationChain/m28.png" /></figure> </listitem>
<listitem>The sync interval by default is 10 minutes.
 For the testing purposes, we will change it to 1 minute.
<figure><graphic fileref="VirtGraphReplicationChain/m29.png" /></figure> </listitem>
<listitem>Click &quot;Subscribe&quot;.
</listitem>
<listitem>The subscription will be created.
<figure><graphic fileref="VirtGraphReplicationChain/m30.png" /></figure></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Insert Data into a Named Graph on the db1 Virtuoso Instance</bridgehead>
<orderedlist spacing="compact"><listitem>Log in at <ulink url="http://localhost:8891/conductor.">http://localhost:8891/conductor.</ulink> </listitem>
<listitem>Go to Linked Data-&gt; Quad Store Upload: <figure><graphic fileref="VirtGraphReplicationChain/m31.png" /></figure> </listitem>
<listitem>In the shown form: <orderedlist spacing="compact"><listitem>Tick the box for <emphasis>Resource URL</emphasis> and enter your resource URL, e.g.: <programlisting>http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
</programlisting></listitem>
<listitem>Enter for Named Graph IRI: <programlisting>http://example.org
</programlisting><figure><graphic fileref="VirtGraphReplicationChain/m32.png" /></figure> </listitem>
</orderedlist></listitem>
<listitem>Click Upload.
</listitem>
<listitem>Should be shown message for successful upload: <figure><graphic fileref="VirtGraphReplicationChain/m33.png" /></figure> </listitem>
<listitem>Check the count of the inserted triples by executing a query like the following against the SPARQL endpoint, <ulink url="http://localhost:8891/sparql:">http://localhost:8891/sparql:</ulink> <programlisting>SELECT COUNT(*) 
   FROM &lt;http://example.org&gt;
WHERE { ?s ?p ?o }
</programlisting><figure><graphic fileref="VirtGraphReplicationChain/m34.png" /></figure> </listitem>
<listitem>Should be shown <emphasis>57</emphasis> as total.
<figure><graphic fileref="VirtGraphReplicationChain/m35.png" /></figure></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Check data on the Destination instances db2 and db3</bridgehead>
<orderedlist spacing="compact"><listitem>To check the starting count, on each of the Destination Virtuoso Instances db2 and db3 from  SPARQL Endpoint execute: <programlisting>SELECT COUNT(*) 
   FROM &lt;http://example.org&gt;
WHERE { ?s ?p ?o }
</programlisting></listitem>
<listitem>Should return <emphasis>57</emphasis> as total.
<figure><graphic fileref="VirtGraphReplicationChain/m35.png" /></figure></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Add new data on db1</bridgehead>
<orderedlist spacing="compact"><listitem>Disconnect db2 and db3.
</listitem>
<listitem>On the Host Virtuoso Instance db1 go to Conductor -&gt; Database -&gt; Interactive SQL enter the following statement: <programlisting>SPARQL INSERT INTO GRAPH &lt;http://example.org&gt; 
  { 
     &lt;http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this&gt;
     &lt;http://xmlns.com/foaf/0.1/interest&gt;
     &lt;http://dbpedia.org/resource/Web_Services&gt; 
  } ;
SPARQL INSERT INTO GRAPH &lt;http://example.org&gt; 
  { 
    &lt;http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this&gt;  	
    &lt;http://xmlns.com/foaf/0.1/interest&gt;  	
    &lt;http://dbpedia.org/resource/Web_Clients&gt; 
  } ;
SPARQL INSERT INTO GRAPH &lt;http://example.org&gt; 
  { 
    &lt;http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this&gt;  	
    &lt;http://xmlns.com/foaf/0.1/interest&gt;  	
    &lt;http://dbpedia.org/resource/SPARQL&gt; 
  } ;
</programlisting><figure><graphic fileref="VirtGraphReplicationChain/m36.png" /></figure> </listitem>
<listitem>Click &quot;Execute&quot;.
</listitem>
<listitem>As result the triples will be inserted: <figure><graphic fileref="VirtGraphReplicationChain/m36a.png" /></figure> </listitem>
<listitem>Check the count of the destination instance graph&#39;s triples by executing the following query like against the SPARQL endpoint, <ulink url="http://localhost:8891/sparql:">http://localhost:8891/sparql:</ulink> <programlisting>SELECT COUNT(*) 
   FROM &lt;http://example.org&gt;
WHERE { ?s ?p ?o }
</programlisting></listitem>
<listitem>Should be shown <emphasis>60</emphasis> as total.
<figure><graphic fileref="VirtGraphReplicationChain/m38.png" /></figure></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Check again data on the Destination instances db2 and db3</bridgehead>
<orderedlist spacing="compact"><listitem>Start instances db2 and db3.
</listitem>
<listitem>To confirm that the triple count has increased by the number of inserted triples, execute the following on the Destination Virtuoso Instance db2 and db3 SPARQL Endpoint: <programlisting>SELECT COUNT(*) 
   FROM &lt;http://example.org&gt;
WHERE { ?s ?p ?o }
</programlisting></listitem>
<listitem>Should be shown <emphasis>60</emphasis> as total: <figure><graphic fileref="VirtGraphReplicationChain/m38.png" /></figure></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="VirtGraphReplicationStar">Replication Example: Star Topology</ulink> </listitem>
<listitem><ulink url="VirtGraphReplicationBiDirectional">Replication Example: 2-node Bi-directional Topology</ulink> </listitem>
<listitem><ulink url="VirtGraphReplicationPSQL">Set up RDF Replication via procedure calls</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/VirtPubSubHub">Example of Linked Data Usage of PubSubHubbub Implementation</ulink> </listitem>
<listitem><ulink url="VirtRdfReplScenarios">Exploit Virtuoso&#39;s Replication Functionality Web based Solutions</ulink></listitem>
</itemizedlist></section></docbook>