Generate Relational Tables to RDF Entity Relationship Graphs mappings— using Virtuoso’s RDF Views Wizard

Situation Analysis

You want to exploit the power of Relational Data Virtualization but would prefer the help of a tool for some of the fairly simple but repetitive and monotonous RDB2RDF mapping work.

In this post, I will use a sequence of screenshots and comments to walk through generating RDF Graph Relations from SQL Tabular Relations using the "Demo"."demo"."Suppliers" table in the Northwind Demo Database.

Here are a few views of the "Demo"."demo"."Suppliers" table before any RDF graph relations are derived from it.

(1) Columns and Data Types

(2) Primary Key Column(s)

(3) Foreign Key Column(s)

(4) Simple Query Results

Click Here for a Live Demonstration (note: when prompted to “Authenticate to access:
SPASQL Query Builder”, use “
vdb” for both username and password)

Steps for Generating Mappings from Relational Tables to RDF Graphs

[1] Select the SQL Tabular Relations (Tables) of interest from the "Demo" Database.

[2] Tick the checkbox for the "Demo"."demo"."Suppliers" table, and click on Generate Via Wizard.

[3] Click on the Edit button to verify the state of the underlying schema, e.g., confirm the existence of a Primary Key that uniquely identifies records.

Here, you have an additional option to associate your Table with Classes from one or more shared ontologies, previously imported into Virtuoso for use by this tool.

[4] Optionally, tick the boxes to generate an Ontology, Instance Data for said Ontology, and/or Dataset Statistics (using terms from the voID Ontology) generated as part of this process.

[5] Click the Generate button, and the Wizard will produce a collection of Virtuoso Quad Map Definitions that describe how RDF Graph Relations are to be derived from the SQL Tabular Relations, using Virtuoso’s native Mapping Language (which is a proprietary mix of SQL Functions and RDF-Turtle, originally created years before the W3C standardized R2RML).

Quad Map Definitions using Virtuoso’s SQL and RDF-Turtle Hybrid Language

The Wizard also generates a matching set of mapping definitions using the R2RML open standard (which is obviously more portable).

Quad Map Definitions using RDF and terms from W3C’s R2RML Vocabulary

Finally, the Wizard generates an Ontology (using terms from the RDF Schema Vocabulary), and presents several buttons for performing various actions. In this case, we simply want to generate an RDF Relation from the Tabular Relation named "Demo"."demo"."Suppliers", so clicking the Execute button will complete the task at hand.

Following successful generation of the Virtuoso Quad Maps, a sampling of Entity Identifiers will be presented. These enable immediate demonstration of the power of the Semantic Web of Linked Data generated from your existing Relational Table(s).

At this point you have a Semantic Web of Linked Data with the following characteristics:

  • The Key Column of every Row in the original Tabular Relation is now associated with an Entity Identified by an HTTP URI (hyperlink)
  • Each Column (Field) Name in the original Tabular Relation is also associated with an Entity Identified by an HTTP URI
  • Each Column (Field) Value in the original Tabular Relation is associated with a Literal Identifier (Typed using the Datatype of the column)
  • Clicking on each Entity Identifier resolves to an Entity Description Document comprising RDF sentences where the Entity in question is Identified as the sentence Subject or Object
  • All Class and Property definitions from the generated Ontology are automatically applied — thus, if you want to perform additional mapping you can do this on the Ontology level without altering any instance data (i.e., you can immediately begin exploiting Reasoning and Inference)

Now that we have a collection of relations represented as RDF Graphs that adhere to Semantic Web of Linked Data principles, we can explore the additional power unleashed by performing the steps that follow.

We’ll start with a sample Entity Identifier, a clickable HTTP URI (hyperlink):

http://demo.openlinksw.com/Demo/suppliers/SupplierID/12#this

Here’s a screenshot of the Entity Description Page to which it resolves.

Here’s a pivot into the generated Ontology, reached by clicking on the object (or value) of the rdf:type (labeled type) relation (or property).

You can also explore using a SPARQL Query, such as —

SELECT DISTINCT ?EntityType
FROM <http://demo.openlinksw.com/Demo#>
WHERE { ?Entity a ?EntityType }
LIMIT 50

That produces the following results (or solution) page

Click HERE to experience the Drill-Down effect, also known as the Follow-Your-Nose pattern, delivered by Linked Data

Conclusion

Digital Transformation at any level, across enterprise and personal endeavors alike, inevitably needs to deal with the challenge of “Data Wrangling” — harmonizing heterogeneously-shaped data (Tables or Graphs), from disparate data sources. As demonstrated in this post, and others in the series, Virtuoso provides a unique high-performance, secure, and cross-platform solution for addressing these challenges — using existing open standards to preserve prior technology investments while ensuring future investments are coherent and cost-effective.

Related

OpenLink Virtuoso Weblog

News & Articles related to OpenLink Virtuoso & Related Technologies

Kingsley Uyi Idehen

Written by

Founder & CEO, OpenLink Software — provider of Secure, High-Performance, and Cross-Platform Data Access, Integration, Virtualization, and Management Technology.

OpenLink Virtuoso Weblog

News & Articles related to OpenLink Virtuoso & Related Technologies

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade