• Topic
  • Discussion
  • VOS.VirtGraphReplicationBiDirectional(1.2) -- Owiki? , 2018-04-13 12:06:40 Edit owiki 2018-04-13 12:06:40

    Replication Example: 2-node Bi-directional Topology

    Introduction

    The following Guide demonstrates the Virtuoso RDF Bi-directional Graph Replication, e.g.,



    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



    3. Click Enable RDF Publishing
    4. As result publication with the name RDF Publication should be created



    5. Click the link which is the publication name.
    6. You will be shown the publication items page



    7. Enter for Graph IRI:

      http://example.org





    8. Click Add New
    9. The item will be created and shown in the list of items for the currently viewed publication.



    Create subscription from db1 to db2's Publication

    1. Log in at http://localhost:8891/conductor
    2. Go to Replication -> Transactional -> Subscriptions



    3. Click New Subscription



    4. From the list of "Specify new data source" select Data Source db2



    5. Enter for db2 dba user credentials



    6. Click "Add Data Source"
    7. As result db2 will be shown in the "Connected Data Sources" list.



    8. Select db2 the "Connected Data Sources" list and click "Publications list"



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



    10. As result will be shown the "Confirm subscription" page.



    11. The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute.



    12. Click "Subscribe"
    13. The subscription will be created.



    Create Publication on db1

    1. Go to http://localhost:8891/conductor and log in as dba
    2. Go to Conductor -> Replication -> Transactional -> Publications



    3. Click Enable RDF Publishing
    4. As result publication with the name RDF Publication should be created



    5. Click the link which is the publication name.
    6. You will be shown the publication items page



    7. Enter for Graph IRI:

      http://example.org





    8. Click Add New
    9. The item will be created and shown in the list of items for the currently viewed publication.



    Create subscription from db2 to db1's Publication

    1. Log in at http://localhost:8892/conductor
    2. Go to Replication -> Transactional -> Subscriptions



    3. Click New Subscription



    4. From the list of "Specify new data source" select Data Source db1



    5. Enter for db1 dba user credentials



    6. Click "Add Data Source"



    7. As result db1 will be shown in the "Connected Data Sources" list. Select it and click "Publications list"



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



    9. As result will be shown the "Confirm subscription" page.



    10. The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute.



    11. Click "Subscribe"
    12. The subscription will be created.



    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



    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





    4. Click Upload
    5. A successful upload will result in a shown message.



    6. 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 }





    7. Should return 57 as total.



    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.



    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> } ;





    3. Click "Execute"
    4. As result the triples will be inserted



    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.



    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.



    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> } ;





    3. Click "Execute"
    4. As result the triples will be inserted



    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.



    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.



    Related