Replication Example: Star Topology
- Introduction
- Prerequisites
- Create a Publication on the Host Virtuoso Instance -- db1
- Insert Data into a Named Graph on the Host Virtuoso Instance
- Subscribe to the Publication on the a Destination Virtuoso Instance -- db2, db3, etc.
- Insert Triples into the Host Virtuoso Instance Graph and check availability at Destination Virtuoso Instance Graph
- Related
Introduction
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:
- 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 ...
- 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 ...
- 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
- Go to Conductor -> Replication -> Transactional -> Publications:
- Click Enable RDF Publishing.
- A publication with the name RDF Publication should be created:
- Click the link which is the publication name.
- You will be shown the publication items page:
- Enter for Graph IRI
http://example.org
- Click Add New.
- The item will be created and shown in the list of items for the currently viewed publication.
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 Guide, we will use the Virtuoso Conductor's Import RDF feature:
- In the Virtuoso Conductor, go to Linked Data -> Quad Store Upload:
- In the presented 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
- Tick the box for Resource URL and enter your resource URL, for e.g.:
- Click Upload
- A successful upload will result in this message:
- 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 }
- See how many triples have been inserted in your graph:
SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o }
Subscribe to the Publication on the a Destination Virtuoso Instance -- db2, db3, etc.
- Go to Conductor -> Replication -> Transactional -> Subscriptions:
- Click New Subscription:
- Specify a new Data Source Enter or selected target data source from the available connected Data Sources:
- Click Publications list:
- Select the RDF Publication and click List Items:
- Click Subscribe.
- The subscription will be created:
- Click Sync.
- Check the retrieved triples by executing the following query:
SELECT * FROM <http://example.org> WHERE {?s ?p ?o}
- 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}
These steps may be repeated for any number of Subscribers.
Insert Triples into the Host Virtuoso Instance Graph and check availability at Destination Virtuoso Instance Graph
- To check the starting count, on the Destination Virtuoso Instance SPARQL Endpoint, execute:
SELECT COUNT(*) FROM <http://example.org> WHERE { ?s ?p ?o }
- 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> } ;
- 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 }
Related
- Replication Example: Chain Topology
- Replication Example: 2-node Bi-directional Topology
- Set up RDF Replication via procedure calls
- Example of Linked Data Usage of PubSubHubbub Implementation
- Exploit Virtuoso's Replication Functionality Web based Solutions