The Virtuoso Conductor can be used for importing existing R2RML scripts into Virtuoso and generate the necessary RDF Linked Data Views for Virtuoso hosting and deployment.

  1. Ensure the R2RML rdb2rdf_dav.vad and latest Conductor conductor_dav.vad VAD packages are installed.

  2. Create a test table with sample data:

    SQL> CREATE TABLE "R2RML"."TEST"."PRODUCT"
    (
      "id" INTEGER,
      "name" VARCHAR(100),
      PRIMARY KEY ("id")
    );
    Done. -- 16 msec.
    SQL> INSERT SOFT "R2RML"."TEST"."PRODUCT" VALUES(1, 'Virtuoso');
    Done. -- 0 msec.
    SQL> INSERT SOFT "R2RML"."TEST"."PRODUCT" VALUES(2, 'UDA');
    Done. -- 0 msec.
    SQL>
    
  3. Grant select privileges on the "R2RML"."TEST"."PRODUCT" table to the SPARQL user to enable execution via SPARQL endpoint:

    SQL> GRANT SELECT ON R2RML.TEST.PRODUCT  TO "SPARQL", "SPARQL_UPDATE"
    Done. -- 1 msec.
    
  4. Create the following R2RML mapping script for the "R2RML"."TEST"."PRODUCT" table:

    $ cat demo.n3
    @prefix rr: <http://www.w3.org/ns/r2rml#> .
    @prefix exa: <http://example.com/ns#> .
    @prefix product: <http://example.com/product#> .
    
    <http://example.com/ns#TriplesMap1>
        a rr:TriplesMap;
    
        rr:logicalTable
        [
          rr:tableSchema "R2RML";
          rr:tableOwner "TEST";
          rr:tableName  "PRODUCT"
        ];
    
        rr:subjectMap
        [
          rr:template "http://example.com/product/{id}";
          rr:class exa:product;
        ];
    
        rr:predicateObjectMap
        [
          rr:predicate product:id;
          rr:objectMap [ rr:column "id" ];
        ];
    
        rr:predicateObjectMap
        [
          rr:predicate product:name;
          rr:objectMap [ rr:column "name" ];
        ];
    .
    $
    
  5. Got to the Linked Data -> R2RML tab of the Virtuoso Conductor:

    Figure 16.66. Conductor R2RML Import Wizard

    Conductor R2RML Import Wizard

  6. Select the Choose File button and select the R2RML file to load:

    Figure 16.67. Conductor R2RML Import Wizard

    Conductor R2RML Import Wizard

  7. Select the Validate button to verify the R2RML mapping script:

    Figure 16.68. Conductor R2RML Import Wizard

    Conductor R2RML Import Wizard

  8. Select the Generate button to generate the RDF Linked Data Views mappings for the R2RML mapping script:

    Figure 16.69. Conductor R2RML Import Wizard

    Conductor R2RML Import Wizard

  9. Select the Execute button to create the RDF Linked Data Views mapping the the Quad Store:

    Figure 16.70. Conductor R2RML Import Wizard

    Conductor R2RML Import Wizard

  10. The RDF Linked Data View creation is complete and status is displayed:

    Figure 16.71. Conductor R2RML Import Wizard

    Conductor R2RML Import Wizard

  11. The Default Graph Name (transient) specified http://demo.openlinksw.com/r2rml# can now be used to run a SPARQL query against the created Linked Data View. If the Generate RDB2RDF triggers and Enable Data Syncs with Physical Quad Store check boxes are selected the Physical Graph Name (persistent) specified urn:demo.openlinksw.com/r2rml# can be used to run a SPARQL query against the materialized triples in the Quad Store.

    Figure 16.72. Conductor R2RML Import Wizard

    Conductor R2RML Import Wizard

  12. The results set for the Linked Data View graph are displayed:

    Figure 16.73. Conductor R2RML Import Wizard

    Conductor R2RML Import Wizard