<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head profile="http://internetalchemy.org/2003/02/profile"> <link rel="foaf" type="application/rdf+xml" title="FOAF" href="http://www.openlinksw.com/dataspace/uda/about.rdf" /> <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" /> <meta name="dc.title" content="14. RDF Data Access and Data Management" /> <meta name="dc.subject" content="14. RDF Data Access and Data Management" /> <meta name="dc.creator" content="OpenLink Software Documentation Team ; " /> <meta name="dc.copyright" content="OpenLink Software, 1999 - 2009" /> <link rel="top" href="index.html" title="OpenLink Virtuoso Universal Server: Documentation" /> <link rel="search" href="/doc/adv_search.vspx" title="Search OpenLink Virtuoso Universal Server: Documentation" /> <link rel="parent" href="rdfandsparql.html" title="Chapter Contents" /> <link rel="prev" href="rdfnativestorageproviders.html" title="RDF Data Access Providers (Drivers)" /> <link rel="next" href="contents.html" title="Contents" /> <link rel="shortcut icon" href="../images/misc/favicon.ico" type="image/x-icon" /> <link rel="stylesheet" type="text/css" href="doc.css" /> <link rel="stylesheet" type="text/css" href="/doc/translation.css" /> <title>14. RDF Data Access and Data Management</title> <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" /> <meta name="author" content="OpenLink Software Documentation Team ; " /> <meta name="copyright" content="OpenLink Software, 1999 - 2009" /> <meta name="keywords" content="" /> <meta name="GENERATOR" content="OpenLink XSLT Team" /> </head> <body> <div id="header"> <a name="rdfgraphreplication" /> <img src="../images/misc/logo.jpg" alt="" /> <h1>14. RDF Data Access and Data Management</h1> </div> <div id="navbartop"> <div> <a class="link" href="rdfandsparql.html">Chapter Contents</a> | <a class="link" href="rdfnativestorageproviders.html" title="RDF Data Access Providers (Drivers)">Prev</a> | <a class="link" href="webservices.html" title="Web Services">Next</a> </div> </div> <div id="currenttoc"> <form method="post" action="/doc/adv_search.vspx"> <div class="search">Keyword Search: <br /> <input type="text" name="q" /> <input type="submit" name="go" value="Go" /> </div> </form> <div> <a href="http://www.openlinksw.com/">www.openlinksw.com</a> </div> <div> <a href="http://docs.openlinksw.com/">docs.openlinksw.com</a> </div> <br /> <div> <a href="index.html">Book Home</a> </div> <br /> <div> <a href="contents.html">Contents</a> </div> <div> <a href="preface.html">Preface</a> </div> <br /> <div class="selected"> <a href="rdfandsparql.html">RDF Data Access and Data Management</a> </div> <br /> <div> <a href="rdfdatarepresentation.html">Data Representation</a> </div> <div> <a href="rdfsparql.html">SPARQL</a> </div> <div> <a href="sparqlextensions.html">Extensions</a> </div> <div> <a href="rdfgraphsecurity.html">RDF Graphs Security</a> </div> <div> <a href="rdfviews.html">Linked Data Views over RDBMS Data Source</a> </div> <div> <a href="rdfrdfviewgnr.html">Automated Generation of RDF Views over Relational Data Sources</a> </div> <div> <a href="rdfviewsenterpr.html">Examples of Linked Data Views</a> </div> <div> <a href="rdfinsertmethods.html">RDF Insert Methods in Virtuoso</a> </div> <div> <a href="virtuososponger.html">RDFizer Middleware (Sponger)</a> </div> <div> <a href="virtuosospongerfacetinstall.html">Virtuoso Faceted Browser Installation and configuration</a> </div> <div> <a href="virtuosospongerfacent.html">Virtuoso Faceted Web Service</a> </div> <div> <a href="rdfiridereferencing.html">Linked Data</a> </div> <div> <a href="rdfsparqlrule.html">Inference Rules & Reasoning</a> </div> <div> <a href="rdfsparqlgeospat.html">RDF and Geometry</a> </div> <div> <a href="rdfperformancetuning.html">RDF Performance Tuning</a> </div> <div> <a href="rdfnativestorageproviders.html">RDF Data Access Providers (Drivers)</a> </div> <div class="selected"> <a href="rdfgraphreplication.html">RDF Graph Replication</a> <div> <a href="#rdfgraphreplicationscenr" title="Replication Scenarios">Replication Scenarios</a> <a href="#rdfgraphreplicationtopl" title="Replication Topologies">Replication Topologies</a> <a href="#rdfgraphreplicationsql" title="Set up RDF Replication via procedure calls">Set up RDF Replication via procedure calls</a> </div> </div> <br /> </div> <div id="text"> <a name="rdfgraphreplication" /> <h2>14.17. RDF Graph Replication</h2> <p>The following section demonstrates how to replicate graphs from one Virtuoso instance to (an)other Virtuoso instance(s), using the RDF Replication Feature.</p> <p>Terms used in this section:</p> <ul> <li> <strong>Host Virtuoso Instance</strong>, aka the publisher: the instance where we will insert RDF data into a Named Graph; then create a publication of this graph.</li> <li> <strong>Destination Virtuoso Instance</strong>, aka the subscriber: the instance which will subscribe to the publication from the Host Virtuoso Instance.</li> </ul> <div class="tip"> <div class="tiptitle">See Also:</div> <p> <a href="fn_rdf_repl_start.html">DB.DBA.RDF_REPL_START()</a> </p> <p> <a href="fn_rdf_repl_graph_ins.html">DB.DBA.RDF_REPL_GRAPH_INS()</a> </p> <p> <a href="fn_rdf_repl_graph_del.html">DB.DBA.RDF_RDF_REPL_GRAPH_DEL()</a> </p> </div> <p>The basic outline:</p> <ul> <li>First, use the Virtuoso Conductor on a Host Virtuoso Instance to publish a named graph.</li> <li>Then, use the Virtuoso Conductor on a Destination Virtuoso Instance to subscribe to deltas from the published graph.</li> <li>Finally, see how a change in the publisher's graph will appear in the subscriber's graph.</li> </ul> <a name="rdfgraphreplicationscenr" /> <h3>14.17.1. Replication Scenarios</h3> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="" src="../images/ui/topo-scenario.png" /> </td> </tr> <tr> <td>Figure: 14.17.1.1. </td> </tr> </table> <a name="rdfgraphreplicationscenrint" /> <h4>14.17.1.2. Introduction</h4> <p>In this section we will examine a proposed setup for a back-end server called MASTER which publishes a number of graphs to a set of front-end machines called FARM-1 .. FARM-n and discuss a couple of common scenarios like adding an extra machine to the farm, or replacing a broken instance of MASTER.</p> <p>In this example we will assume each virtuoso instance running on its own machine, so they can use the same port numbers for both the main server (default 1111) as well as the http port (default 8890) as each machine has an unique IP addresses. In the example we use MASTER-IP and FARM-x-IP which should be replaced by either the real IP address or the DNS name of the machine in question.</p> <p>Since there will be a reverse-proxy service in front of the farm, all virtuoso instances should have the URIQA Default host set to the outside name for this service. In this example we will use http://test.example.com as the web service we are trying to setup.</p> <br /> <a name="rdfgraphreplicationscenrsup" /> <h4>14.17.1.3. Setup</h4> <a name="rdfgraphreplicationscenrsupinstv" /> <h5>14.17.1.3.1. Installing Virtuoso</h5> <p>All machines in this setup should be installed with similar installation paths like:</p> <ul> <li>/opt/virtuoso</li> <li>/dbs/virtuoso</li> <li>/virtuoso</li> <li>...</li> </ul> <p>The partition should be big enough to have room for the Virtuoso binaries and libraries, the transaction logs, backups and, if you do not want to use the striping feature of Virtuoso, it will need to have room for the main database files as well.</p> <p>Here are the quick installation steps:</p> <ol> <li>Login as root.</li> <li>Create local user called virtuoso using the chosen installation path as home direcotory.</li> <li>Login as virtuoso.</li> <li>Extract virtuoso-universal-server-6.1.tar in home directory.</li> <li>Run sh install.sh to install Virtuoso.</li> <li>Remove the file install.sh virtuoso-universal-server-6.1.tar virtuoso-server.taz if not otherwise needed.</li> <li>Run bin/virtuoso-stop.sh to shutdown this Virtuoso instance.</li> <li>Install virtuoso.lic for this system in $HOME/bin directory.</li> </ol> <p>As the replication process needs to make an ODBC connection to the MASTER machine, all machines should have the following information in the $HOME/bin/odbc.ini:</p> <div> <pre class="programlisting"> [ODBC Data Sources] .. MASTER_DSN = OpenLink Virtuoso .. [MASTER_DSN] Driver = OpenLink Virtuoso Address = MASTER_IP:1111 </pre> </div> <br /> <a name="rdfgraphreplicationscenrsupinstm" /> <h5>14.17.1.3.2. Setting up MASTER</h5> <p>The MASTER machine is the back-end server machine. Various applications feed SPARQL data into this machine it publishes a set of graphs using RDF Replication.</p> <p>The MASTER machine should ideally be equipped with multiple redundant disks in RAID-1 or RAID-6 mode to minimize the risk that a single bad disk takes down the system. From a Virtuoso point of view we will use a combination of online backups combined with checkpoint audit trail to backup the content of the database in a safe way. The online backups, the checkpoint audit trail as well as the replication logs can also be copied to secondary storage using the rsync command and can be easily scripted as a cron job.</p> <p>Changes to database/virtuoso.ini:</p> <div> <pre class="programlisting"> ... [Parameters] SchedulerInterval = 1 ; run the internal scheduler every minute CheckpointAuditTrail = 1 ; enable audit trail on transaction logs CheckpointInterval = 60 ; perform an automated checkpoint every 60 minutes ... [URIQA] DefaultHost = test.example.com ... [Replication] ServerName = MASTER ServerEnable = 1 QueueMax = 5000000 ... </pre> </div> <p>Once the MASTER is started using the bin/virtuoso-start.sh script we must enable RDF replication before we start add data to the graphs we wish to replicate, so every record is accounted for by the replication process. If there is existing data in the graphs to be published, then this data would need to be added to a subscriber manually since the replication process creates a delta set of changes since publishing was enabled.</p> <p>To enable publishing of the graph we use the isql program to connect to the MASTER instance:</p> <div> <pre class="programlisting"> $ isql MASTER-IP:1111 -- and run the following commands: -- enable this instance as a publisher rdf_repl_start(); -- add graphs to replication list rdf_repl_graph_ins('http://test.example.com'); </pre> </div> <p>Next we create a backup directory inside the database directory and setup the online backup, again using the isql program:</p> <div> <pre class="programlisting"> $ cd database $ mkdir backup $ isql MASTER_IP:1111 -- and run the following commands: -- clear any previous context backup_context_clear(); -- start the backup backup_online ('bkup-#', 1000000, 0, vector ('backup')); </pre> </div> <p>The following files can now be backed up using rsync or similar tool to another machine:</p> <table class="data"> <caption>Table: 14.17.1.3.2.1. Files that can be backed up using rsync or similar tool to another machine</caption> <tr> <th class="data">Files</th> <th class="data">Description</th> </tr> <tr> <td class="data">database/backup/*.bp</td> <td class="data"> the incremental backup files</td> </tr> <tr> <td class="data">database/virtuoso.trx</td> <td class="data"> the main transaction log containing the most recent updates to the database that have not been checkpointed into the database</td> </tr> <tr> <td class="data">database/virtuosoTIMESTAMP.trx</td> <td class="data">all the previous transaction logs which can be used to reconstruct the database</td> </tr> <tr> <td class="data">database/__rdf_repl*.log</td> <td class="data">all the replication logs containing the changes to the published graph</td> </tr> </table> <br /> <p>NOTE: Since the database is constantly modified during operation, it is of NO use to backup the virtuoso.db using an rsync script unless the virtuoso instance was shutdown beforehand, or certain extra precautions are taken which we will explain later on.</p> <br /> <a name="rdfgraphreplicationscenrsupinstp" /> <h5>14.17.1.3.3. Setup SPARE master</h5> <p>The SPARE machine is a replica of the MASTER machine. This machine subscribes to the publication of the MASTER to keep an exact match of the RDF graphs, but also publishes this data without any initial subscribers.</p> <p>The SPARE machine should ideally be equipped similar to the MASTER machine, with multiple redundant disks in RAID-1 or RAID-6 mode to minimize the risk that a single bad disk takes down the system. From a Virtuoso point of view we will use a combination of online backups combined with checkpoint audit trail to backup the content of the database in a safe way. The online backups, the checkpoint audit trail as well as the replication logs can also be copied to secondary storage using the rsync command and can be easily scripted as a cron job.</p> <p>Changes to database/virtuoso.ini:</p> <div> <pre class="programlisting"> ... [Parameters] SchedulerInterval = 1 ; run the internal scheduler every minute CheckpointAuditTrail = 1 ; enable audit trail on transaction logs CheckpointInterval = 60 ; perform an automated checkpoint every 60 minutes ... [URIQA] DefaultHost = test.example.com ... [Replication] ServerName = SPARE ServerEnable = 1 QueueMax = 5000000 ... </pre> </div> <p>We must enable RDF replication before we start add data to the graphs we wish to replicate, so every record is accounted for by the replication process. If there is existing data in the graphs to be published, then this data would need to be added to a subscriber manually since the replication process creates a delta set of changes since publishing was enabled.</p> <p>To enable publishing of the graph, as well as subscribing to the MASTER, we first start up this Virtuoso instance with bin/virtuoso-start.sh and then use the isql program to connect to the SPARE instance:</p> <div> <pre class="programlisting"> $ bin/virtuoso-start.sh $ isql SPARE-IP:1111 -- and run the following commands: -- enable this instance as a publisher rdf_repl_start(); -- add graphs to replication list rdf_repl_graph_ins('http://test.example.com'); -- connect to master repl_server ('MASTER', 'MASTER_DSN'); -- start subscribing to __rdf_repl repl_subscribe ('MASTER', '__rdf_repl', 'dav', 'dav', 'dba', 'dba'); -- start initial replication repl_sync_all (); -- add subscription to scheduler DB.DBA.SUB_SCHEDULE ('MASTER', '__rdf_repl', 1); </pre> </div> <p>Next we create a backup directory inside the database directory and setup the online backup, again using the isql program:</p> <div> <pre class="programlisting"> $ cd database $ mkdir backup $ isql SPARE_IP:1111 --and run the following commands: -- clear any previous context backup_context_clear(); -- start the backup backup_online ('bkup-#', 1000000, 0, vector ('backup')); </pre> </div> <p>The following files can now be backed up using rsync or similar tool to another machine:</p> <table class="data"> <caption>Table: 14.17.1.3.3.1. Files that can be backed up using rsync or similar tool to another machine</caption> <tr> <th class="data">Files</th> <th class="data">Description</th> </tr> <tr> <td class="data">database/backup/*.bp</td> <td class="data"> the incremental backup files</td> </tr> <tr> <td class="data">database/virtuoso.trx</td> <td class="data">the main transaction log containing the most recent updates to the database that have not been checkpointed into the database</td> </tr> <tr> <td class="data">database/virtuosoTIMESTAMP.trx</td> <td class="data">all the previous transaction logs which can be used to reconstruct the database</td> </tr> <tr> <td class="data">database/__rdf_repl*.log</td> <td class="data">all the replication logs containing the changes to the published graph</td> </tr> </table> <br /> <p>Note: Since the database is constantly modified during operation, it is of NO use to backup the virtuoso.db using an rsync script unless the virtuoso instance was shutdown beforehand, or certain extra precautions are taken which we will explain later on.</p> <br /> <a name="rdfgraphreplicationscenrsupinstpf" /> <h5>14.17.1.3.4. Setup FARM-1</h5> <p>The FARM-1 machine is the first front-end server machine. It subscribes to the publication of the MASTER instance to keep up-to-date.</p> <p>The FARM-1 machine can be run on simpler hardware than the MASTER instance.It does not require the same level of redundancy in terms of hard disks etc, as there are a number of these machines running in parallel each capable of returning results to the proxy. If one FARM machine dies, it can simply be taken from the reverse-proxy list, repaired or replaced with a fresh machine before it is added to the list of servers in the reverse proxy. As such it does not need to be backed up separately, although we could make a backup of this installation to quickly install the rest of the identical FARM boxes.</p> <p>Change the database/virtuoso.ini file:</p> <div> <pre class="programlisting"> ... [Parameters] SchedulerInterval = 1 ; run the internal scheduler every minute CheckpointAuditTrail = 0 ; disable audit trail on transaction logs CheckpointInterval = 60 ; perform an automated checkpoint every 60 minutes ... [URIQA] DefaultHost = test.example.com ... [Replication] ServerName = FARM-1 ; each FARM machine needs to have a unique replication name ServerEnable = 1 QueueMax = 5000000 ... </pre> </div> <p>Next we start up the Virtuoso instance using the bin/virtuoso-start.sh command and use the isql program to subscribe to the MASTER:</p> <div> <pre class="programlisting"> $ bin/virtuoso-start.sh $ isql FARM-1-IP:1111 -- connect to master repl_server ('MASTER', 'MASTER_DSN'); -- start subscribing to __rdf_repl repl_subscribe ('MASTER', '__rdf_repl', 'dav', 'dav', 'dba', 'dba'); -- start initial replication repl_sync_all (); -- add subscription to scheduler DB.DBA.SUB_SCHEDULE ('MASTER', '__rdf_repl', 1); </pre> </div> <p>At this point we can shutdown this Virtuoso instance using the bin/virtuoso-stop.sh command and make a copy of the whole virtuoso installation as a blueprint to copy to another FARM-x machine.</p> <br /> <a name="rdfgraphreplicationscenrsupinstpfs" /> <h5>14.17.1.3.5. Setup FARM-2 from scratch</h5> <p>We can repeat the same steps we did for the FARM-1 machine, and just make sure we use FARM-2 as the replication name in the database/virtuoso.ini file and use FARM-2-IP:1111 as an argument to the isql program.</p> <p>Change bin/virtuoso.ini:</p> <div> <pre class="programlisting"> [Replication] ServerName = FARM-2 </pre> </div> <br /> <a name="rdfgraphreplicationscenrsupinstpfsi" /> <h5>14.17.1.3.6. Setup FARM-3 using blueprint from FARM-1 installation</h5> <p>Extract the tarred/zipped copy of the installation made at the end of the setup of FARM-1.</p> <p>Before starting up the instance, we only need to give this instance a unique name for replication:</p> <p>Change bin/virtuoso.ini:</p> <div> <pre class="programlisting"> [Replication] ServerName = FARM-3 </pre> </div> <p>Next we start up the Virtuoso instance using the bin/virtuoso-start.sh command and since the subscription records and schedule are already performed in the previous step, we just use the isql program to perform a sync against the MASTER:</p> <div> <pre class="programlisting"> $ bin/virtuoso-start.sh $ isql FARM-3-IP:1111 -- change replication name DB.DBA.REPL_SERVER_RENAME ('FARM-1', 'FARM-3') -- sync against master repl_sync_all(); </pre> </div> <br /> <a name="rdfgraphreplicationscenrsupinstpfsc" /> <h5>14.17.1.3.7. Setup FARM-4 using clone of FARM-1</h5> <p>If the system has been running for some time, it may not be practical to do a replication from start, so there is an alternative way to setup a new FARM-4 machine.</p> <p>We can either restore the blue-print backup we make at the end of FARM-1 installation, or we do a fresh installation of virtuoso on the FARM-4 machine.</p> <p>In both cases we shutdown the virtuoso instance and remove the database, as we are going to replace this.</p> <div> <pre class="programlisting"> $ bin/virtuoso-stop.sh $ cd database $ rm virtuoso.db virtuoso.trx virtuoso.log virtuoso.pxa </pre> </div> <p>Change the database/virtuoso.ini file:</p> <div> <pre class="programlisting"> ... [Parameters] SchedulerInterval = 1 ; run the internal scheduler every minute CheckpointAuditTrail = 0 ; disable audit trail on transaction logs CheckpointInterval = 60 ; perform an automated checkpoint every 60 minutes ... [URIQA] DefaultHost = test.example.com ... [Replication] ServerName = FARM-4 ; each FARM machine needs to have a unique replication name ServerEnable = 1 QueueMax = 5000000 ... </pre> </div> <p>Next we are going to temporarily disable checkpointing on FARM-1 machine so we can copy its database without risking corruption: </p> <div> <pre class="programlisting"> $ isql FARM-1-IP:1111 -- disable automatic checkpointing checkpoint_interval (-1); -- and do an explicit checkpoint checkpoint; </pre> </div> <p>It is now safe to copy the database across using the rsync command:</p> <div> <pre class="programlisting"> $ rsync -avz virtuoso@FARM-1-IP:/path/to/virtuoso/database/virtuoso.db database/virtuoso.db </pre> </div> <p>Next we re-enable checkpoint interval on FARM-1:</p> <div> <pre class="programlisting"> $ isql FARM-1-IP:1111 -- re-enable checkpointing checkpoint_interval(60); </pre> </div> <p>The last step is to start the database:</p> <div> <pre class="programlisting"> $ bin/virtuoso-start.sh $ isql FARM-4-IP:1111 -- change replication name DB.DBA.REPL_SERVER_RENAME ('FARM-1', 'FARM-4') -- sync against master repl_sync_all(); </pre> </div> <br /> <br /> <br /> <a name="rdfgraphreplicationtopl" /> <h3>14.17.2. Replication Topologies</h3> <p>Typical replication topologies are Chains, Stars and Bi-directional. They can be achieved with Virtuoso, by repeating the "Publish" and/or "Subscribe" steps on each relevant node.</p> <a name="rdfgraphreplicationtoplstar" /> <h4>14.17.2.1. Star Replication Topology</h4> <p>In a Star, there is one Publisher, and many Subscribers.</p> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/topo-star.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.1. Star Replication Topology</td> </tr> </table> <p>To set up a Star, follow the scenario:</p> <ol> <li>Configure Instance #1 to Publish.</li> <li>Configure Instance #2 to Subscribe to #1.</li> <li>Repeat as necessary.</li> </ol> <a name="rdfgraphreplicationtoplstarex" /> <h5>14.17.2.1.2. Star Replication Topology Example</h5> <p>The following How-To walks you through setting up Virtuoso RDF Graph Replication in a Star Topology.</p> <a name="rdfgraphreplicationtoplstarexpr" /> <h6>Prerequisites</h6> Database INI Parameters <p>Suppose there are 3 Virtuoso instances respectively with the following ini parameters values:</p> <ol> <li>virtuoso1.ini: <div> <pre class="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 ... </pre> </div> </li> <li>virtuoso2.ini: <div> <pre class="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 ... </pre> </div> </li> <li>virtuoso3.ini: <div> <pre class="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 ... </pre> </div> </li> </ol> Database DSNs <p>Use the ODBC Administrator on your Virtuoso host (e.g., on Windows, Start menu -> Control Panel -> Administrative Tools -> Data Sources (ODBC); 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.</p> Install Conductor package <p>On each of the 3 Virtuoso instances install the <a href="http://s3.amazonaws.com/opldownload/uda/vad-packages/6.1/virtuoso/conductor_dav.vad">conductor_dav.vad</a> package.</p> <br /> <a name="rdfgraphreplicationtoplstarexprph" /> <h6>Create a Publication on the Host Virtuoso Instance db1</h6> <ol> <li>Go to Conductor -> Replication -> Transactional -> Publications <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r6.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>Click Enable RDF Publishing</li> <li>A publication with the name RDF Publication should be created: <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r7.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>Click the link which is the publication name.</li> <li>You will be shown the publication items page: <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r8.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>Enter for Graph IRI: <div> <pre class="programlisting"> http://example.org </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r9.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>Click Add New</li> <li>The item will be created and shown in the list of items for the currently viewed publication. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r10.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplstarexprih" /> <h6>Insert Data into a Named Graph on the Host Virtuoso Instance</h6> <p>There are several ways to insert data into a Virtuoso Named Graph. In this example, we will use the Virtuoso Conductor's Import RDF feature:</p> <ol> <li>In the Virtuoso Conductor, go to Linked Data -> Quad Store Upload: <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Replication Topology" src="../images/ui/uc1.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Replication Topology</td> </tr> </table> </li> <li>In the form: <ul> <li>Tick the box for Resource URL and enter your resource URL, for e.g.: <div> <pre class="programlisting"> http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this </pre> </div> </li> <li>Enter for Named Graph IRI: <div> <pre class="programlisting"> http://example.org </pre> </div> </li> </ul> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Replication Topology" src="../images/ui/r2.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Replication Topology</td> </tr> </table> </li> <li>Click Upload</li> <li>A successful upload will result in this message: <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r3.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>Check the inserted triples by executing a query like the following against the SPARQL endpoint, http://cname:port/sparql: <div> <pre class="programlisting"> SELECT * FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r4.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>See how many triples have been inserted in your graph: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r5.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplstarexprsp" /> <h6>Subscribe to the Publication on the a Destination Virtuoso Instance db2, db3, etc.</h6> <ol> <li>Go to Conductor -> Replication -> Transactional -> Subscriptions <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r11.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>Click New Subscription <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r12.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>Specify a new Data Source Enter or selected target data source from the available connected Data Sources: <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r13.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r13a.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.2. Star Replication Topology</td> </tr> </table> </li> <li>Click Publications list <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r15.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>Select the RDF Publication and click List Items <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r16.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>Click Subscribe</li> <li>The subscription will be created <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r18.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>Click Sync</li> <li>Check the retrieved triples by executing the following query <div> <pre class="programlisting"> SELECT * FROM <http://example.org> WHERE {?s ?p ?o} </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r19.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> <li>See how many triples have been inserted into your graph by executing the following query: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE {?s ?p ?o} </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r5.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> </ol> <p>These steps may be repeated for any number of Subscriber.</p> <br /> <a name="rdfgraphreplicationtoplstarexprch" /> <h6>Insert Triples into the Host Virtuoso Instance Graph and check availability at Destination Virtuoso Instance Graph</h6> <ol> <li>To check the starting count, on the Destination Virtuoso Instance SPARQL Endpoint, execute: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> </li> <li>On the Host Virtuoso Instance go to Conductor -> Database -> Interactive SQL and execute the following statement: <div> <pre class="programlisting"> SPARQL INSERT INTO GRAPH <http://example.org> { <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> <http://xmlns.com/foaf/0.1/interest> <http://dbpedia.org/resource/Web_Services> } ; SPARQL INSERT INTO GRAPH <http://example.org> { <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> <http://xmlns.com/foaf/0.1/interest> <http://dbpedia.org/resource/Web_Clients> } ; SPARQL INSERT INTO GRAPH <http://example.org> { <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> <http://xmlns.com/foaf/0.1/interest> <http://dbpedia.org/resource/SPARQL> } ; </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r22.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r23.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.2. Star Replication Topology</td> </tr> </table> </li> <li>To confirm that the triple count has increased by the number of inserted triples, execute the following on the Destination Virtuoso Instance SPARQL Endpoint: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Star Replication Topology" src="../images/ui/r24.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.1.2.1. Star Replication Topology</td> </tr> </table> </li> </ol> <br /> <br /> <br /> <a name="rdfgraphreplicationtoplchain" /> <h4>14.17.2.2. Chain Replication Topology</h4> <p>In a Chain, there is one original Publisher, to which there is only one Subscriber. That Subscriber may also serve as a Publisher, again with only one Subscriber. The chain ends with a Subscriber which does not Publish.</p> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/topo-chain.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.1. Chain Replication Topology</td> </tr> </table> <p>To set up a Chain, follow the scenario:</p> <ol> <li>Configure Instance #1 to Publish.</li> <li>Configure Instance #2 to Subscribe to #1.</li> <li>Configure Instance #2 to Publish.</li> <li>Configure Instance #3 to Subscribe to #2.</li> <li>Repeat as necessary.</li> </ol> <a name="rdfgraphreplicationtoplchainex" /> <h5>14.17.2.2.2. Chain Replication Topology Example</h5> <p>The following How-To walks you through setting up Virtuoso RDF Graph Replication in a Chain Topology.</p> <a name="rdfgraphreplicationtoplchainexpr" /> <h6>Prerequisites</h6> Database INI Parameters <p>Suppose there are 3 Virtuoso instances respectively with the following ini parameters values:</p> <ol> <li>virtuoso1.ini: <div> <pre class="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 ... </pre> </div> </li> <li>virtuoso2.ini: <div> <pre class="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 ... </pre> </div> </li> <li>virtuoso3.ini: <div> <pre class="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 ... </pre> </div> </li> </ol> Database DSNs <p>Use the ODBC Administrator on your Virtuoso host (e.g., on Windows, Start menu -> Control Panel -> Administrative Tools -> Data Sources (ODBC); 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.</p> Install Conductor package <p>On each of the 3 Virtuoso instances install the <a href="http://s3.amazonaws.com/opldownload/uda/vad-packages/6.1/virtuoso/conductor_dav.vad">conductor_dav.vad</a> package.</p> <br /> <a name="rdfgraphreplicationtoplchainexpr" /> <h6>Create Publication on db1</h6> <ol> <li>Go to http://localhost:8891/conductor and log in as dba</li> <li>Go to Conductor - > Replication - > Transactional - > Publications <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m1.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click <strong>Enable RDF Publishing</strong> </li> <li>As result publication with the name <strong>RDF Publication</strong> should be created <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m2.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click the link which is the publication name. </li> <li>You will be shown the publication items page <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m3.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Enter for Graph IRI: <div> <pre class="programlisting"> http://example.org </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m4.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click Add New</li> <li>The item will be created and shown in the list of items for the currently viewed publication. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m5.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplchainexpr" /> <h6>Create subscription from db2 to db1's Publication</h6> <ol> <li>Log in at http://localhost:8892/conductor</li> <li>Go to Replication - > Transactional - > Subscriptions <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m6.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click <strong>New Subscription</strong> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m7.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>From the list of "Specify new data source" select Data Source db1 <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m8.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Enter for db1 dba user credentials <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m9.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click "Add Data Source"</li> <li>As result <strong>db1</strong> will be shown in the "Connected Data Sources" list. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m10.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Select <strong>db1</strong> the "Connected Data Sources" list and click "Publications list" <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m11.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>As result will be shown the list of available publications for the selected data source. Select the one with name "RDF Publication" and click "List Items". <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m12.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>As result will be shown the "Confirm subscription" page. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m13.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m14.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click "Subscribe"</li> <li>The subscription will be created. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m15.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplchainexpr" /> <h6>Create Publication on db2</h6> <ol> <li>Go to http://localhost:8892/conductor and log in as dba</li> <li>Go to Conductor - > Replication - > Transactional - > Publications <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m16.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click <strong>Enable RDF Publishing</strong> </li> <li>As result publication with the name <strong>RDF Publication</strong> should be created <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m17.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click the link which is the publication name.</li> <li>You will be shown the publication items page <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m18.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Enter for Graph IRI: <div> <pre class="programlisting"> http://example.org </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m19.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click Add New</li> <li>The item will be created and shown in the list of items for the currently viewed publication. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m20.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplchainexpr" /> <h6>Create subscription from db3 to db2's Publication</h6> <ol> <li>Log in at http://localhost:8893/conductor</li> <li>Go to Replication - > Transactional - > Subscriptions <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m21.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click <strong>New Subscription</strong> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m22.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>From the list of "Specify new data source" select Data Source db2 <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m23.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Enter for db2 dba user credentials <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m24.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click "Add Data Source" <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m25.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>As result <strong>db2</strong> will be shown in the "Connected Data Sources" list. Select it and click "Publications list" <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m26.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>As result will be shown the list of available publications for the selected data source. Select the one with name "RDF Publication" and click "List Items". <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m27.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>As result will be shown the "Confirm subscription" page. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m28.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m29.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click "Subscribe"</li> <li>The subscription will be created. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m30.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplchainind" /> <h6>Insert Data into a Named Graph on the db1 Virtuoso Instance</h6> <ol> <li>Log in at http://localhost:8891/conductor</li> <li>Go to Linked Data -> Quad Store Upload: <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/uc1.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>In the shown form: <ol> <li>Tick the box for <strong>Resource URL</strong> and enter your resource URL, e.g.: <div> <pre class="programlisting"> http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this </pre> </div> </li> <li>Enter for Named Graph IRI: <div> <pre class="programlisting"> http://example.org </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m32.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> </ol> </li> <li>Click Upload</li> <li>A successful upload will result in a shown message. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m33.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Check the count of the inserted triples by executing a query like the following against the SPARQL endpoint, http://localhost:8891/sparql: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m34.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Should return <strong>57</strong> as total. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m35.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplchainexcdd" /> <h6>Check data on the Destination instances db2 and db3</h6> <ol> <li>To check the starting count, on each of the Destination Virtuoso Instances db2 and db3 from SPARQL Endpoint execute: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> </li> <li>Should return <strong>57</strong> as total. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m35.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplchainexadd" /> <h6>Add new data on db1</h6> <ol> <li>Disconnect db2 and db3.</li> <li>On the Host Virtuoso Instance db1 go to Conductor - > Database - > Interactive SQL enter the following statement: <div> <pre class="programlisting"> SPARQL INSERT INTO GRAPH <http://example.org> { <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> <http://xmlns.com/foaf/0.1/interest> <http://dbpedia.org/resource/Web_Services> } ; SPARQL INSERT INTO GRAPH <http://example.org> { <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> <http://xmlns.com/foaf/0.1/interest> <http://dbpedia.org/resource/Web_Clients> } ; SPARQL INSERT INTO GRAPH <http://example.org> { <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> <http://xmlns.com/foaf/0.1/interest> <http://dbpedia.org/resource/SPARQL> } ; </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m36.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Click "Execute"</li> <li>As result the triples will be inserted <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m36a.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> <li>Check the count of the destination instance graph's triples by executing the following query like against the SPARQL endpoint, http://localhost:8891/sparql: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> </li> <li>Should return <strong>60</strong> as total. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m38.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplchainexchki" /> <h6>Check data on the Destination instances db2 and db3</h6> <ol> <li>Start instances db2 and db3</li> <li>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: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> </li> <li>Should return <strong>60</strong> as total. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/m38.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.2.2.1. Chain Replication Topology</td> </tr> </table> </li> </ol> <br /> <br /> <br /> <a name="rdfgraphreplicationtoplbid" /> <h4>14.17.2.3. Bi-directional Replication Topology</h4> <a name="rdfgraphreplicationtoplbidex" /> <h5>14.17.2.3.1. Bi-directional Replication Topology Example</h5> <p>The following How-To walks you through setting up Virtuoso RDF Graph Replication in a Bi-directional Topology.</p> <div> <pre class="programlisting"> db1 <---- db2 db1 ----> db2 </pre> </div> <a name="rdfgraphreplicationtoplbidexpr" /> <h6>Prerequisites</h6> Database INI Parameters <p>Suppose there are 2 Virtuoso instances respectively with the following ini parameters values:</p> <ol> <li>virtuoso1.ini: <div> <pre class="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 ... </pre> </div> </li> <li>virtuoso2.ini: <div> <pre class="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 ... </pre> </div> </li> </ol> Database DSNs <p>Use the ODBC Administrator on your Virtuoso host (e.g., on Windows, Start menu -> Control Panel -> Administrative Tools -> Data Sources (ODBC); on Mac OS X, /Applications/Utilities/OpenLink ODBC Administrator.app) to create a System DSN for db1 and db2 with names db1 and db2 respectively.</p> Install Conductor package <p>On each of the 2 Virtuoso instances install the <a href="http://s3.amazonaws.com/opldownload/uda/vad-packages/6.1/virtuoso/conductor_dav.vad">conductor_dav.vad</a> package.</p> <br /> <a name="rdfgraphreplicationtoplbidexprcph" /> <h6>Create Publication on db2</h6> <ol> <li>Go to http://localhost:8892/conductor and log in as dba</li> <li>Go to Conductor -> Replication -> Transactional -> Publications <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd1.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click <strong>Enable RDF Publishing</strong> </li> <li>As result publication with the name <strong>RDF Publication</strong> should be created <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd2.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click the link which is the publication name.</li> <li>You will be shown the publication items page <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd3.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Enter for Graph IRI: <div> <pre class="programlisting"> http://example.org </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd4.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click Add New </li> <li>The item will be created and shown in the list of items for the currently viewed publication. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd5.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplbidexprcs" /> <h6>Create subscription from db1 to db2's Publication</h6> <ol> <li>Log in at http://localhost:8891/conductor </li> <li>Go to Replication -> Transactional -> Subscriptions <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd6.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click <strong>New Subscription</strong> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd7.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>From the list of "Specify new data source" select Data Source db2 <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd8.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Enter for db2 dba user credentials <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd9.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click "Add Data Source" </li> <li>As result <strong>db2</strong> will be shown in the "Connected Data Sources" list. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd10.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Select <strong>db2</strong> the "Connected Data Sources" list and click "Publications list" <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd11.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>As result will be shown the list of available publications for the selected data source. Select the one with name "RDF Publication" and click "List Items". <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd12.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>As result will be shown the "Confirm subscription" page. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd13.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd14.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click "Subscribe" </li> <li>The subscription will be created. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd15.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplbidexprcpd" /> <h6>Create Publication on db1</h6> <ol> <li>Go to http://localhost:8891/conductor and log in as dba </li> <li>Go to Conductor -> Replication -> Transactional -> Publications <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd16.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click <strong>Enable RDF Publishing</strong> </li> <li>As result publication with the name <strong>RDF Publication</strong> should be created <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd17.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click the link which is the publication name. </li> <li>You will be shown the publication items page <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd18.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Enter for Graph IRI: <div> <pre class="programlisting"> http://example.org </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd19.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click Add New </li> <li>The item will be created and shown in the list of items for the currently viewed publication. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd20.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplbidexprcsh" /> <h6>Create subscription from db2 to db1's Publication</h6> <ol> <li>Log in at http://localhost:8892/conductor </li> <li>Go to Replication -> Transactional -> Subscriptions <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd21.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click <strong>New Subscription</strong> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd22.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>From the list of "Specify new data source" select Data Source db1 <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd23.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Enter for db1 dba user credentials <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd24.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click "Add Data Source" <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd25.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>As result <strong>db1</strong> will be shown in the "Connected Data Sources" list. Select it and click "Publications list" <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd26.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>As result will be shown the list of available publications for the selected data source. Select the one with name "RDF Publication" and click "List Items". <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd27.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>As result will be shown the "Confirm subscription" page. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd28.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd29.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click "Subscribe" </li> <li>The subscription will be created. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd30.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplbidexprinsh" /> <h6>Insert Data into a Named Graph on the db2 Virtuoso Instance</h6> <ol> <li>Log in at http://localhost:8892/conductor </li> <li>Go to Linked Data -> Quad Store Upload: <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/uc1.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>In the shown form: </li> <li>Tick the box for <strong>Resource URL</strong> and enter your resource URL, e.g.: <div> <pre class="programlisting"> http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this </pre> </div> </li> <li>Enter for Named Graph IRI: <div> <pre class="programlisting"> http://example.org </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd32.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click Upload </li> <li>A successful upload will result in a shown message. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/m33.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Check the count of the inserted triples by executing a query like the following against the SPARQL endpoint, http://localhost:8892/sparql: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd34.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Should return <strong>57</strong> as total. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd35.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplbidexprcdin" /> <h6>Check data on the Destination instance db1</h6> <ol> <li>To check the starting count, execute from db1's SPARQL Endpoint: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> </li> <li>Should return <strong>57</strong> as total. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd35.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplbidexprinsd" /> <h6>Add new data on db2</h6> <ol> <li>Disconnect db1. </li> <li>On the Host Virtuoso Instance db2 go to Conductor -> Database -> Interactive SQL enter the following statement: <div> <pre class="programlisting"> SPARQL INSERT INTO GRAPH <http://example.org> { <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> <http://xmlns.com/foaf/0.1/interest> <http://dbpedia.org/resource/Web_Services> } ; </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd36.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click "Execute" </li> <li>As result the triples will be inserted <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd37.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Check the count of the destination instance graph's triples by executing the following query like against the SPARQL endpoint, http://localhost:8892/sparql: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> </li> <li>Should return <strong>58</strong> as total. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd38.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplbidexprcddi" /> <h6>Check data on the Destination instance db1</h6> <ol> <li>Start instance db1 </li> <li>To confirm that the triple count has increased by the number of inserted triples, execute the following statement on db1's SPARQL Endpoint: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> </li> <li>Should return <strong>58</strong> as total. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd38.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplbidexprinsah" /> <h6>Add new data on db1</h6> <ol> <li>Disconnect db2. </li> <li>On the Host Virtuoso Instance db1 go to Conductor -> Database -> Interactive SQL enter the following statement: <div> <pre class="programlisting"> SPARQL INSERT INTO GRAPH <http://example.org> { <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> <http://xmlns.com/foaf/0.1/interest> <http://dbpedia.org/resource/Web_Clients> } ; SPARQL INSERT INTO GRAPH <http://example.org> { <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> <http://xmlns.com/foaf/0.1/interest> <http://dbpedia.org/resource/SPARQL> } ; </pre> </div> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd39.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Click "Execute" </li> <li>As result the triples will be inserted <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd40.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> <li>Check the count of the destination instance graph's triples by executing the following query like against the SPARQL endpoint, http://localhost:8891/sparql: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> </li> <li>Should return <strong>60</strong> as total. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd41.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> </ol> <br /> <a name="rdfgraphreplicationtoplbidexprcdadi" /> <h6>Check data on the Destination instance db2</h6> <ol> <li>Start instance db2 </li> <li>To confirm that the triple count has increased by the number of inserted triples, execute the following statement on db2's SPARQL Endpoint: <div> <pre class="programlisting"> SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o } </pre> </div> </li> <li>Should return <strong>60</strong> as total. <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Bi-directional Replication Topology" src="../images/ui/bd41.png" /> </td> </tr> <tr> <td>Figure: 14.17.2.3.1.1. Bi-directional Replication Topology</td> </tr> </table> </li> </ol> <br /> <br /> <br /> <br /> <a name="rdfgraphreplicationsql" /> <h3>14.17.3. Set up RDF Replication via procedure calls</h3> <a name="rdfgraphreplicationsqlex" /> <h4>14.17.3.1. Example</h4> <p>The following example shows how to use SQL procedures to set up Virtuoso RDF Graph Replication in a Chain Topology.</p> <table class="figure" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="Chain Replication Topology" src="../images/ui/topo-chain.png" /> </td> </tr> <tr> <td>Figure: 14.17.3.1.1. Chain Replication Topology</td> </tr> </table> <p>This can also be done <a href="rdfgraphreplication.html#rdfgraphreplicationtoplchainex">through the HTTP-based Virtuoso Conductor</a>.</p> <a name="rdfgraphreplicationsqlexprx" /> <h5>14.17.3.1.2. Prerequisites</h5> <a name="rdfgraphreplicationsqlexprxini" /> <h6>Database INI Parameters</h6> <p>Suppose there are 3 Virtuoso instances on the same machine.</p> <p>The first instance holds the master copy of the data and publishes its changes to all other instances that subscribe to this master.</p> <p>The second instance subscribes to the publication of the master copy, but also publishes all of these changes to any instance that subscribes to it.</p> <p>The third instance only subscribes to the publication of the second instance.</p> <p>Each of these 3 servers need unique ports and ServerName, DefaultHost for this replication scheme to work properly. Although not needed, this example also sets separate names for the database and related files. This results in the following ini parameters values (only changes are shown, the rest can remain default):</p> <ol> <li>repl1/virtuoso.ini: <div> <pre class="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-r ... </pre> </div> </li> <li>repl2/virtuoso.ini: <div> <pre class="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-r ... </pre> </div> </li> <li>repl3/virtuoso.ini: <div> <pre class="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-r ... </pre> </div> </li> </ol> <br /> <a name="rdfgraphreplicationsqlexprxdsn" /> <h6>Database DSNs</h6> <p>Use the ODBC Administrator on your Virtuoso host (e.g., on Windows, Start menu -> Control Panel -> Administrative Tools -> Data Sources (ODBC); 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.</p> <br /> <br /> <a name="rdfgraphreplicationsqlcrb" /> <h5>14.17.3.1.3. Configure Publishers and Subscribers</h5> <ol> <li>Run the databases by starting start.sh, which has the following content: <div> <pre class="programlisting"> cd repl1 virtuoso -f & cd ../repl2 virtuoso -f & cd ../repl3 virtuoso -f & cd .. </pre> </div> </li> <li>Use the <strong>isql</strong> command to execute the following rep.sql file: <div> <pre class="programlisting"> -- -- connect to the first database which is only a publisher -- set DSN=localhost:1111; reconnect; -- -- start publishing the graph http://test.org --- DB.DBA.RDF_REPL_START(); DB.DBA.RDF_REPL_GRAPH_INS ('http://test.org'); -- -- connect to the second database in the chain, which is both a publisher and a subscriber -- set DSN=localhost:1112; reconnect; -- -- start publishing the graph http://test.org -- DB.DBA.RDF_REPL_START(); DB.DBA.RDF_REPL_GRAPH_INS ('http://test.org'); -- -- contact the first database -- repl_server ('db1-r', 'db1', 'localhost:1111'); -- -- subscribe to its RDF publication(s) -- repl_subscribe ('db1-r', '__rdf_repl', 'dav', 'dav', 'dba', 'dba'); -- -- bring the replication service online -- repl_sync_all(); -- -- and set scheduler to check every minute -- DB.DBA.SUB_SCHEDULE ('db1-r', '__rdf_repl', 1); -- -- connect to the third database in the chain, which is only a subscriber -- set DSN=localhost:1113; reconnect; -- -- uncomment next 2 commands if this database should also be a publisher -- --DB.DBA.RDF_REPL_START(); --DB.DBA.RDF_REPL_GRAPH_INS ('http://test.org'); -- -- contact second database -- repl_server ('db2-r', 'db2', 'localhost:1112'); -- -- subscribe to its RDF publication(s) -- repl_subscribe ('db2-r', '__rdf_repl', 'dav', 'dav', 'dba', 'dba'); -- -- bring the replication service online -- repl_sync_all(); -- -- and set schedule to check every minute -- DB.DBA.SUB_SCHEDULE ('db2-r', '__rdf_repl', 1); </pre> </div> </li> </ol> <br /> <br /> <br /> <table border="0" width="90%" id="navbarbottom"> <tr> <td align="left" width="33%"> <a href="rdfnativestorageproviders.html" title="RDF Data Access Providers (Drivers)">Previous</a> <br />RDF Data Access Providers (Drivers)</td> <td align="center" width="34%"> <a href="rdfandsparql.html">Chapter Contents</a> </td> <td align="right" width="33%"> <a href="webservices.html" title="Web Services">Next</a> <br />Contents of Web Services</td> </tr> </table> </div> <div id="footer"> <div>Copyright© 1999 - 2009 OpenLink Software All rights reserved.</div> <div id="validation"> <a href="http://validator.w3.org/check/referer"> <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /> </a> <a href="http://jigsaw.w3.org/css-validator/"> <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" /> </a> </div> </div> </body> </html>