Virtuoso RDF Replication of Public Graphs Only

What

Virtuoso RDF Graph Replication can be configured to only publish Graphs that are not part of the special Virtuoso private graph group, essentially enabling selective publishing and un-publishing of graphs to subscriber nodes.

Why

In some cases users do not what to publish all graphs in the RDF Quad Store with the RDF_RDF_REPL_GRAPH_INS() function special http://www.openlinksw.com/schemas/virtrdf#rdf_repl_all graph IRI name or may want to have the ability to selectively publish and un-publish graphs to subscriber nodes.

How

This can be done using the RDF_RDF_REPL_GRAPH_INS() functions special http://www.openlinksw.com/schemas/virtrdf#rdf_repl_world graph IRI name, run on the MASTER Publisher, which instructs the RDF Graph replication process to check the special graph group http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs for the list of graphs that should not be published ie be treated as private/embargoed.

If a graph in the http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs graph group needs to be published, simply delete is from the graph group. Likewise should a graph published need to be made private simply add it to the http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs graph group and it will automatically be deleted from the subscriber nodes.

The steps to setup are:

  1. Run the DB.DBA.RDF_REPL_GRAPH_INS ('http://www.openlinksw.com/schemas/virtrdf#rdf_repl_world') command to enable publishing of only those graph not in the http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs graph group.
  2. Create the http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs graph group with the command DB.DBA.RDF_GRAPH_GROUP_CREATE ('http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs',1);
  3. Add graph not to be published to the http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs graph group with the command `DB.DBA.RDF_GRAPH_GROUP_INS (‘http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs’, ‘graph-not-to-publish’);

Example

  1. Setup Graph Replication on a MASTER Publisher to replicate public graphs ONLY ie ‘http://www.openlinksw.com/schemas/virtrdf#rdf_repl_world
DB.DBA.RDF_REPL_START();
DB.DBA.RDF_REPL_GRAPH_INS ('http://www.openlinksw.com/schemas/virtrdf#rdf_repl_world');
  1. Setup a Graph Replication SLAVE Subscriber (assuming publisher Replication server name “MASTER” and publisher ODBC DSN called “MASTER_DSN”):
repl_server ('MASTER', 'MASTER_DSN');
repl_subscribe ('MASTER', '__rdf_repl', 'dav', 'dav', 'dba', 'dba'); 
repl_sync_all ();
DB.DBA.SUB_SCHEDULE ('MASTER', '__rdf_repl', 1);
  1. Insert test data on the MASTER Publisher:
SPARQL INSERT INTO GRAPH <http://example.org> { <1> <2> <3> };
SPARQL SELECT * FROM <http://example.org> WHERE {?s ?p ?o};
repl_stat();
  1. Check on the SLAVE subscriber that data in http://example.org graph has been replicated:
SPARQL SELECT * FROM <http://example.org> WHERE {?s ?p ?o};
repl_stat();
  1. Add http://example.org graph to Private graph group on the MASTER Publisher:
DB.DBA.RDF_GRAPH_GROUP_CREATE ('http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs',1);
DB.DBA.RDF_GRAPH_GROUP_INS ('http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs', 'http://example.org');
SPARQL SELECT * FROM <http://example.org> WHERE {?s ?p ?o};
repl_stat();
  1. Check on the SLAVE subscriber that the data in the now private http://example.org graph has been removed:
SPARQL SELECT * FROM <http://example.org> WHERE {?s ?p ?o};
repl_stat();
  1. Make the private http://example.org graph public again on the MASTER Publisher:
SELECT id_to_iri (RGGM_GROUP_IID), id_to_iri(RGGM_MEMBER_IID) FROM DB.DBA.RDF_GRAPH_GROUP_MEMBER;
DB.DBA.RDF_GRAPH_GROUP_DEL ('http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs', 'http://example.org');
SELECT id_to_iri (RGGM_GROUP_IID), id_to_iri(RGGM_MEMBER_IID) FROM DB.DBA.RDF_GRAPH_GROUP_MEMBER;
SPARQL SELECT * FROM <http://example.org> WHERE {?s ?p ?o};
repl_stat();
  1. Check on the SLAVE subscriber that the now public http://example.org graph’s data has been replicated to it:
SPARQL SELECT * FROM <http://example.org> WHERE {?s ?p ?o};
repl_stat();

Related