www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

RDF Data Access and Data Management

Data Representation
SPARQL
Extensions
RDF Graphs Security
Linked Data Views over RDBMS Data Source
Automated Generation of RDF Views over Relational Data Sources
Examples of Linked Data Views
RDF Insert Methods in Virtuoso
RDFizer Middleware (Sponger)
Virtuoso Faceted Browser Installation and configuration
Virtuoso Faceted Web Service
Linked Data
Inference Rules & Reasoning
RDF and Geometry
RDF Performance Tuning
RDF Data Access Providers (Drivers)
RDF Graph Replication
Replication Scenarios Replication Topologies Set up RDF Replication via procedure calls

14.17. RDF Graph Replication

The following section demonstrates how to replicate graphs from one Virtuoso instance to (an)other Virtuoso instance(s), using the RDF Replication Feature.

Terms used in this section:

See Also:

DB.DBA.RDF_REPL_START()

DB.DBA.RDF_REPL_GRAPH_INS()

DB.DBA.RDF_RDF_REPL_GRAPH_DEL()

The basic outline:

14.17.1. Replication Scenarios

Figure: 14.17.1.1.

14.17.1.2. Introduction

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.

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.

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.


14.17.1.3. Setup

14.17.1.3.1. Installing Virtuoso

All machines in this setup should be installed with similar installation paths like:

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.

Here are the quick installation steps:

  1. Login as root.
  2. Create local user called virtuoso using the chosen installation path as home direcotory.
  3. Login as virtuoso.
  4. Extract virtuoso-universal-server-6.1.tar in home directory.
  5. Run sh install.sh to install Virtuoso.
  6. Remove the file install.sh virtuoso-universal-server-6.1.tar virtuoso-server.taz if not otherwise needed.
  7. Run bin/virtuoso-stop.sh to shutdown this Virtuoso instance.
  8. Install virtuoso.lic for this system in $HOME/bin directory.

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:

[ODBC Data Sources]
..
MASTER_DSN = OpenLink Virtuoso

..
[MASTER_DSN]
Driver = OpenLink Virtuoso
Address = MASTER_IP:1111	

14.17.1.3.2. Setting up MASTER

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.

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.

Changes to database/virtuoso.ini:

...
[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
...

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.

To enable publishing of the graph we use the isql program to connect to the MASTER instance:

$ 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');

Next we create a backup directory inside the database directory and setup the online backup, again using the isql program:

$ 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'));

The following files can now be backed up using rsync or similar tool to another machine:

Table: 14.17.1.3.2.1. Files that can be backed up using rsync or similar tool to another machine
Files Description
database/backup/*.bp the incremental backup files
database/virtuoso.trx the main transaction log containing the most recent updates to the database that have not been checkpointed into the database
database/virtuosoTIMESTAMP.trx all the previous transaction logs which can be used to reconstruct the database
database/__rdf_repl*.log all the replication logs containing the changes to the published graph

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.


14.17.1.3.3. Setup SPARE master

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.

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.

Changes to database/virtuoso.ini:

...
[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
...

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.

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:

$ 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);

Next we create a backup directory inside the database directory and setup the online backup, again using the isql program:

$ 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'));

The following files can now be backed up using rsync or similar tool to another machine:

Table: 14.17.1.3.3.1. Files that can be backed up using rsync or similar tool to another machine
Files Description
database/backup/*.bp the incremental backup files
database/virtuoso.trx the main transaction log containing the most recent updates to the database that have not been checkpointed into the database
database/virtuosoTIMESTAMP.trx all the previous transaction logs which can be used to reconstruct the database
database/__rdf_repl*.log all the replication logs containing the changes to the published graph

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.


14.17.1.3.4. Setup FARM-1

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.

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.

Change the database/virtuoso.ini file:

...
[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
...

Next we start up the Virtuoso instance using the bin/virtuoso-start.sh command and use the isql program to subscribe to the MASTER:

$ 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);

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.


14.17.1.3.5. Setup FARM-2 from scratch

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.

Change bin/virtuoso.ini:

[Replication]
ServerName = FARM-2	

14.17.1.3.6. Setup FARM-3 using blueprint from FARM-1 installation

Extract the tarred/zipped copy of the installation made at the end of the setup of FARM-1.

Before starting up the instance, we only need to give this instance a unique name for replication:

Change bin/virtuoso.ini:

[Replication]
ServerName = FARM-3	

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:

$ 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();

14.17.1.3.7. Setup FARM-4 using clone of FARM-1

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.

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.

In both cases we shutdown the virtuoso instance and remove the database, as we are going to replace this.

$ bin/virtuoso-stop.sh
$ cd database
$ rm virtuoso.db virtuoso.trx virtuoso.log virtuoso.pxa	

Change the database/virtuoso.ini file:

...
[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
...

Next we are going to temporarily disable checkpointing on FARM-1 machine so we can copy its database without risking corruption:

$ isql FARM-1-IP:1111

-- disable automatic checkpointing
checkpoint_interval (-1);

-- and do an explicit checkpoint
checkpoint;	

It is now safe to copy the database across using the rsync command:

$ rsync -avz virtuoso@FARM-1-IP:/path/to/virtuoso/database/virtuoso.db database/virtuoso.db

Next we re-enable checkpoint interval on FARM-1:

$ isql FARM-1-IP:1111

-- re-enable checkpointing
checkpoint_interval(60);	

The last step is to start the database:

$ 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();	



14.17.2. Replication Topologies

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.

14.17.2.1. Star Replication Topology

In a Star, there is one Publisher, and many Subscribers.

Star Replication Topology
Figure: 14.17.2.1.1. Star Replication Topology

To set up a Star, follow the scenario:

  1. Configure Instance #1 to Publish.
  2. Configure Instance #2 to Subscribe to #1.
  3. Repeat as necessary.
14.17.2.1.2. Star Replication Topology Example

The following How-To walks you through setting up Virtuoso RDF Graph Replication in a Star Topology.

Prerequisites
Database INI Parameters

Suppose there are 3 Virtuoso instances respectively with the following ini parameters values:

  1. virtuoso1.ini:
    ...
    [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
    ...
    	
    
  2. virtuoso2.ini:
    ...
    [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
    ...	
    
  3. virtuoso3.ini:
    ...
    [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
    ...
    
Database DSNs

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.

Install Conductor package

On each of the 3 Virtuoso instances install the conductor_dav.vad package.


Create a Publication on the Host Virtuoso Instance db1
  1. Go to Conductor -> Replication -> Transactional -> Publications
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  2. Click Enable RDF Publishing
  3. A publication with the name RDF Publication should be created:
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  4. Click the link which is the publication name.
  5. You will be shown the publication items page:
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  6. Enter for Graph IRI:
    http://example.org	
    
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  7. Click Add New
  8. The item will be created and shown in the list of items for the currently viewed publication.
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology

Insert Data into a Named Graph on the Host Virtuoso Instance

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:

  1. In the Virtuoso Conductor, go to Linked Data -> Quad Store Upload:
    Replication Topology
    Figure: 14.17.2.1.2.1. Replication Topology
  2. In the form:
    • Tick the box for Resource URL and enter your resource URL, for e.g.:
      http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this	
      
    • Enter for Named Graph IRI:
      http://example.org	
      
    Replication Topology
    Figure: 14.17.2.1.2.1. Replication Topology
  3. Click Upload
  4. A successful upload will result in this message:
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  5. Check the inserted triples by executing a query like the following against the SPARQL endpoint, http://cname:port/sparql:
    SELECT * 
      FROM <http://example.org>
     WHERE { ?s ?p ?o }
    
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  6. See how many triples have been inserted in your graph:
    SELECT COUNT(*) 
      FROM <http://example.org>
     WHERE { ?s ?p ?o }	
    
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology

Subscribe to the Publication on the a Destination Virtuoso Instance db2, db3, etc.
  1. Go to Conductor -> Replication -> Transactional -> Subscriptions
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  2. Click New Subscription
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  3. Specify a new Data Source Enter or selected target data source from the available connected Data Sources:
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
    Star Replication Topology
    Figure: 14.17.2.1.2.2. Star Replication Topology
  4. Click Publications list
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  5. Select the RDF Publication and click List Items
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  6. Click Subscribe
  7. The subscription will be created
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  8. Click Sync
  9. Check the retrieved triples by executing the following query
    SELECT * 
      FROM <http://example.org>
     WHERE {?s ?p ?o}	
    
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
  10. See how many triples have been inserted into your graph by executing the following query:
    SELECT COUNT(*) 
      FROM <http://example.org>
     WHERE {?s ?p ?o}	
    
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology

These steps may be repeated for any number of Subscriber.


Insert Triples into the Host Virtuoso Instance Graph and check availability at Destination Virtuoso Instance Graph
  1. To check the starting count, on the Destination Virtuoso Instance SPARQL Endpoint, execute:
    SELECT COUNT(*) 
      FROM <http://example.org>
     WHERE { ?s ?p ?o }	
    
  2. On the Host Virtuoso Instance go to Conductor -> Database -> Interactive SQL and execute the following statement:
    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> 
      } ;	
    
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology
    Star Replication Topology
    Figure: 14.17.2.1.2.2. Star Replication Topology
  3. To confirm that the triple count has increased by the number of inserted triples, execute the following on the Destination Virtuoso Instance SPARQL Endpoint:
    SELECT COUNT(*) 
      FROM <http://example.org>
     WHERE { ?s ?p ?o }	
    
    Star Replication Topology
    Figure: 14.17.2.1.2.1. Star Replication Topology



14.17.2.2. Chain Replication Topology

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.

Chain Replication Topology
Figure: 14.17.2.2.1. Chain Replication Topology

To set up a Chain, follow the scenario:

  1. Configure Instance #1 to Publish.
  2. Configure Instance #2 to Subscribe to #1.
  3. Configure Instance #2 to Publish.
  4. Configure Instance #3 to Subscribe to #2.
  5. Repeat as necessary.
14.17.2.2.2. Chain Replication Topology Example

The following How-To walks you through setting up Virtuoso RDF Graph Replication in a Chain Topology.

Prerequisites
Database INI Parameters

Suppose there are 3 Virtuoso instances respectively with the following ini parameters values:

  1. virtuoso1.ini:
    ...
    [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
    ...
    
    
  2. virtuoso2.ini:
    ...
    [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
    ...	
    
  3. virtuoso3.ini:
    ...
    [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
    ...
    
Database DSNs

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.

Install Conductor package

On each of the 3 Virtuoso instances install the conductor_dav.vad package.


Create Publication on db1
  1. Go to http://localhost:8891/conductor and log in as dba
  2. Go to Conductor - > Replication - > Transactional - > Publications
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  3. Click Enable RDF Publishing
  4. As result publication with the name RDF Publication should be created
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  5. Click the link which is the publication name.
  6. You will be shown the publication items page
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  7. Enter for Graph IRI:
    http://example.org
    
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  8. Click Add New
  9. The item will be created and shown in the list of items for the currently viewed publication.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology

Create subscription from db2 to db1's Publication
  1. Log in at http://localhost:8892/conductor
  2. Go to Replication - > Transactional - > Subscriptions
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  3. Click New Subscription
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  4. From the list of "Specify new data source" select Data Source db1
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  5. Enter for db1 dba user credentials
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  6. Click "Add Data Source"
  7. As result db1 will be shown in the "Connected Data Sources" list.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  8. Select db1 the "Connected Data Sources" list and click "Publications list"
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  9. 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".
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  10. As result will be shown the "Confirm subscription" page.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  11. The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  12. Click "Subscribe"
  13. The subscription will be created.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology

Create Publication on db2
  1. Go to http://localhost:8892/conductor and log in as dba
  2. Go to Conductor - > Replication - > Transactional - > Publications
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  3. Click Enable RDF Publishing
  4. As result publication with the name RDF Publication should be created
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  5. Click the link which is the publication name.
  6. You will be shown the publication items page
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  7. Enter for Graph IRI:
    http://example.org
    
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  8. Click Add New
  9. The item will be created and shown in the list of items for the currently viewed publication.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology

Create subscription from db3 to db2's Publication
  1. Log in at http://localhost:8893/conductor
  2. Go to Replication - > Transactional - > Subscriptions
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  3. Click New Subscription
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  4. From the list of "Specify new data source" select Data Source db2
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  5. Enter for db2 dba user credentials
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  6. Click "Add Data Source"
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  7. As result db2 will be shown in the "Connected Data Sources" list. Select it and click "Publications list"
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  8. 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".
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  9. As result will be shown the "Confirm subscription" page.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  10. The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  11. Click "Subscribe"
  12. The subscription will be created.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology

Insert Data into a Named Graph on the db1 Virtuoso Instance
  1. Log in at http://localhost:8891/conductor
  2. Go to Linked Data -> Quad Store Upload:
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  3. In the shown form:
    1. Tick the box for Resource URL and enter your resource URL, e.g.:
      http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
      
    2. Enter for Named Graph IRI:
      http://example.org
      
      Chain Replication Topology
      Figure: 14.17.2.2.2.1. Chain Replication Topology
  4. Click Upload
  5. A successful upload will result in a shown message.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  6. Check the count of the inserted triples by executing a query like the following against the SPARQL endpoint, http://localhost:8891/sparql:
    SELECT COUNT(*) 
       FROM <http://example.org>
    WHERE { ?s ?p ?o }
    
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  7. Should return 57 as total.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology

Check data on the Destination instances db2 and db3
  1. To check the starting count, on each of the Destination Virtuoso Instances db2 and db3 from SPARQL Endpoint execute:
    SELECT COUNT(*) 
       FROM <http://example.org>
    WHERE { ?s ?p ?o }
    
  2. Should return 57 as total.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology

Add new data on db1
  1. Disconnect db2 and db3.
  2. On the Host Virtuoso Instance db1 go to Conductor - > Database - > Interactive SQL enter the following statement:
    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> 
      } ;
    
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  3. Click "Execute"
  4. As result the triples will be inserted
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology
  5. Check the count of the destination instance graph's triples by executing the following query like against the SPARQL endpoint, http://localhost:8891/sparql:
    SELECT COUNT(*) 
       FROM <http://example.org>
    WHERE { ?s ?p ?o }
    
  6. Should return 60 as total.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology

Check data on the Destination instances db2 and db3
  1. Start instances db2 and db3
  2. 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:
    SELECT COUNT(*) 
       FROM <http://example.org>
    WHERE { ?s ?p ?o }
    
  3. Should return 60 as total.
    Chain Replication Topology
    Figure: 14.17.2.2.2.1. Chain Replication Topology



14.17.2.3. Bi-directional Replication Topology

14.17.2.3.1. Bi-directional Replication Topology Example

The following How-To walks you through setting up Virtuoso RDF Graph Replication in a Bi-directional Topology.

db1 <---- db2
db1 ----> db2
Prerequisites
Database INI Parameters

Suppose there are 2 Virtuoso instances respectively with the following ini parameters values:

  1. virtuoso1.ini:
    ...
    [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
    ...
    	
    
  2. virtuoso2.ini:
    ...
    [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
    ...	
    
Database DSNs

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.

Install Conductor package

On each of the 2 Virtuoso instances install the conductor_dav.vad package.


Create Publication on db2
  1. Go to http://localhost:8892/conductor and log in as dba
  2. Go to Conductor -> Replication -> Transactional -> Publications
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  3. Click Enable RDF Publishing
  4. As result publication with the name RDF Publication should be created
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  5. Click the link which is the publication name.
  6. You will be shown the publication items page
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  7. Enter for Graph IRI:
    http://example.org
    
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  8. Click Add New
  9. The item will be created and shown in the list of items for the currently viewed publication.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology

Create subscription from db1 to db2's Publication
  1. Log in at http://localhost:8891/conductor
  2. Go to Replication -> Transactional -> Subscriptions
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  3. Click New Subscription
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  4. From the list of "Specify new data source" select Data Source db2
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  5. Enter for db2 dba user credentials
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  6. Click "Add Data Source"
  7. As result db2 will be shown in the "Connected Data Sources" list.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  8. Select db2 the "Connected Data Sources" list and click "Publications list"
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  9. 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".
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  10. As result will be shown the "Confirm subscription" page.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  11. The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  12. Click "Subscribe"
  13. The subscription will be created.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology

Create Publication on db1
  1. Go to http://localhost:8891/conductor and log in as dba
  2. Go to Conductor -> Replication -> Transactional -> Publications
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  3. Click Enable RDF Publishing
  4. As result publication with the name RDF Publication should be created
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  5. Click the link which is the publication name.
  6. You will be shown the publication items page
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  7. Enter for Graph IRI:
    http://example.org
    
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  8. Click Add New
  9. The item will be created and shown in the list of items for the currently viewed publication.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology

Create subscription from db2 to db1's Publication
  1. Log in at http://localhost:8892/conductor
  2. Go to Replication -> Transactional -> Subscriptions
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  3. Click New Subscription
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  4. From the list of "Specify new data source" select Data Source db1
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  5. Enter for db1 dba user credentials
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  6. Click "Add Data Source"
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  7. As result db1 will be shown in the "Connected Data Sources" list. Select it and click "Publications list"
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  8. 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".
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  9. As result will be shown the "Confirm subscription" page.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  10. The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  11. Click "Subscribe"
  12. The subscription will be created.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology

Insert Data into a Named Graph on the db2 Virtuoso Instance
  1. Log in at http://localhost:8892/conductor
  2. Go to Linked Data -> Quad Store Upload:
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  3. In the shown form:
  4. Tick the box for Resource URL and enter your resource URL, e.g.:
    http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
    
  5. Enter for Named Graph IRI:
    http://example.org
    
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  6. Click Upload
  7. A successful upload will result in a shown message.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  8. Check the count of the inserted triples by executing a query like the following against the SPARQL endpoint, http://localhost:8892/sparql:
    SELECT COUNT(*) 
       FROM <http://example.org>
    WHERE { ?s ?p ?o }
    
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  9. Should return 57 as total.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology

Check data on the Destination instance db1
  1. To check the starting count, execute from db1's SPARQL Endpoint:
    SELECT COUNT(*) 
       FROM <http://example.org>
    WHERE { ?s ?p ?o }
    
  2. Should return 57 as total.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology

Add new data on db2
  1. Disconnect db1.
  2. On the Host Virtuoso Instance db2 go to Conductor -> Database -> Interactive SQL enter the following statement:
    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> 
      } ;
    
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  3. Click "Execute"
  4. As result the triples will be inserted
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  5. Check the count of the destination instance graph's triples by executing the following query like against the SPARQL endpoint, http://localhost:8892/sparql:
    SELECT COUNT(*) 
       FROM <http://example.org>
    WHERE { ?s ?p ?o }
    
  6. Should return 58 as total.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology

Check data on the Destination instance db1
  1. Start instance db1
  2. To confirm that the triple count has increased by the number of inserted triples, execute the following statement on db1's SPARQL Endpoint:
    SELECT COUNT(*) 
       FROM <http://example.org>
    WHERE { ?s ?p ?o }
    
  3. Should return 58 as total.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology

Add new data on db1
  1. Disconnect db2.
  2. On the Host Virtuoso Instance db1 go to Conductor -> Database -> Interactive SQL enter the following statement:
    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> 
      } ;
    
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  3. Click "Execute"
  4. As result the triples will be inserted
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology
  5. Check the count of the destination instance graph's triples by executing the following query like against the SPARQL endpoint, http://localhost:8891/sparql:
    SELECT COUNT(*) 
       FROM <http://example.org>
    WHERE { ?s ?p ?o }
    
  6. Should return 60 as total.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology

Check data on the Destination instance db2
  1. Start instance db2
  2. To confirm that the triple count has increased by the number of inserted triples, execute the following statement on db2's SPARQL Endpoint:
    SELECT COUNT(*) 
       FROM <http://example.org>
    WHERE { ?s ?p ?o }
    
  3. Should return 60 as total.
    Bi-directional Replication Topology
    Figure: 14.17.2.3.1.1. Bi-directional Replication Topology




14.17.3. Set up RDF Replication via procedure calls

14.17.3.1. Example

The following example shows how to use SQL procedures to set up Virtuoso RDF Graph Replication in a Chain Topology.

Chain Replication Topology
Figure: 14.17.3.1.1. Chain Replication Topology

This can also be done through the HTTP-based Virtuoso Conductor.

14.17.3.1.2. Prerequisites
Database INI Parameters

Suppose there are 3 Virtuoso instances on the same machine.

The first instance holds the master copy of the data and publishes its changes to all other instances that subscribe to this master.

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.

The third instance only subscribes to the publication of the second instance.

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):

  1. repl1/virtuoso.ini:
    ...
    [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
    ...
    
  2. repl2/virtuoso.ini:
    ...
    [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
    ...
    
  3. repl3/virtuoso.ini:
    
    ...
    [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
    ...
    

Database DSNs

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.



14.17.3.1.3. Configure Publishers and Subscribers
  1. Run the databases by starting start.sh, which has the following content:
    cd repl1
    virtuoso -f &
    cd ../repl2
    virtuoso -f &
    cd ../repl3
    virtuoso -f &
    cd ..	
    
  2. Use the isql command to execute the following rep.sql file:
    --
    --  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);