%META:TOPICPARENT{name="VOSIndex"}%
---+Mapping SQL Data to Linked Data Views
%TOC%
---++ Introduction
Virtuoso uses a SPARQL-based Meta Schema Language to provide RDBMS-to-RDF mapping functionality (also described as, Linked Data Views of SQL data). The language is an extension of the SPARQL query language, meshed with Virtuoso's SPASQL (SPARQL-inside-SQL) functionality. The language enables you to declaratively map relational database schema tables, columns, rows, and foreign key relationships to Classes, Attributes, Relationships, and Instances (Objects/Entities/Individuals) defined by RDF Schemas or OWL Ontologies. The mapping process uses a special built-in Virtuoso function to generate IRIs / URIs in "Subject" or "Object" position of a SPARQL graph pattern, /en route/ to building a set of SQL compiler rules and optimizations for translating SPARQL queries into SQL on the fly.
While the full power of the Meta Schema Language is always available to the advanced user, many users (both beginners and experts) will find that the more recently enabled [[VirtRdb2RDFViewsGeneration][Automated Generation of Linked Data Views]] is more than sufficient.
---++ Generating Linked Data Views from SQL data
---+++ Automated Generation of Linked Data Views over Relational Data Sources
* [[VirtRdb2RDFViewsGeneration][Automated Generation of Linked Data Views]]
---+++ Manual Mapping Process
The basic steps are as follows:
1 Identify the tables, views, and procedure views to be mapped.
1 Decide if you are performing a 1:1 mapping or a more customized mapping to a specific RDF Schema or Ontology.
1 Declare Virtuoso-URI-Generator functions for each Class in the target RDF Schema or Ontology.
1 Use the Virtuoso-URI-Generator functions in SPARQL graph patterns within the ALTER QUAD STORAGE
part of a SPASQL-based mapping statement.
1 Check to ensure the cartridges
VAD package is installed using the System Admin -> Packages
tab of the Virtuoso Conductor, and if not select the install
button to the right of the package to install for use.
1 Use Virtuoso's built-in URL-Rewrite Rules APIs (or Conductor UI) to publish the Linked Data URIs which result from the mapping above.
---++++ Manual Mapping Example
* View [[VOSSQL2RDFMappingExample][an example of mapping]] the phpBB3 SQL schema to the classes defined by the SIOC and FOAF ontologies.
---++++ More Examples, Linking Remote Tables into Virtuoso (Commercial Edition only)
* View [[VirtLinkRemoteTables][how to perform linking]] across several supported targets, including Oracle, SQL Server, DB2, Sybase, Informix, Ingres, MySQL, PostgreSQL, and other ODBC and JDBC data sources.
---+++ Sample Mapping Scripts for Various Purposes
---++++ Enterprise Data Access & Integration
* [[VirtRDFViewTutorialNorthwind][RDF-based Linked Data View atop Virtuoso using Tutorial Northwind SQL Schema]] / [[VirtRDFViewTutorialNorthwindDemo][Live Demo]]
* [[VirtRDFViewNorthwind][RDF-based Linked Data View atop Microsoft SQL Server using the Northwind Demo Database]] / [[VirtRDFViewNorthwindDemo][Live Demo]]
* [[VirtRDFViewsOracleHrDb][RDF-based Linked Data View atop Oracle using the demonstration 'Human Resources' database]] / [[VirtRDFViewsOracleHrDbDemo][Live Demo]]
* [[VirtRDFViewsDB2SampleDb][RDF-based Linked Data View atop DB2 using the demonstration 'Sample' database]] / [[VirtRDFViewsDB2SampleDbDemo][Live Demo]]
* [[VirtRDFViewsInformixStoresDemo][RDF-based Linked Data View atop Informix using the demonstration 'Stores' database]] / [[VirtRDFViewsInformixStoresDemoLinks][Live Demo]]
* [[VirtRDFViewsIngresTutDb][RDF-based Linked Data View atop Ingres using the demonstration 'Tutorial' database]] / [[VirtRDFViewsIngresTutDbDemo][Live Demo]]
* [[VirtRDFViewsSybasePubs2Db][RDF-based Linked Data View atop Sybase using the demonstration 'pubs2' database]] / [[VirtRDFViewsSybasePubs2DbDemo][Live Demo]]
* [[VirtRDFViewsProgressSQ89ISports][RDF-based Linked Data View atop Progress (SQL-89) using the demonstration 'iSports' database]] / [[VirtRDFViewsProgressSQ89ISportsDemo][Live Demo]]
* [[VirtRDFViewsProgressSQ92ISports][RDF-based Linked Data View atop Progress (SQL-92) using the demonstration 'iSports' database]] / [[VirtRDFViewsProgressSQ92ISportsDemo][Live Demo]]
---++++ Linked Data Views of ODS Application Data
* [[VOSODSViews][RDF-based Linked Data Views atop Enterprise Collaboration (ODS) SQL Schema]] / [[VOSODSViewsDemo][Live Demo]]
* [[VOSeCRMViews][RDF-based Linked Data Views atop Socially enhanced CRM (ODS-eCRM) SQL Schema]] / [[VOSeCRMViewsDemo][Live Demo]]
---++++ Business Intelligence
* [[VirtRDFViewTPCH][RDF-based Linked Data Views atop TPCH Benchmark SQL Schema]] / [[VirtRDFViewTPCHDemo][Live Demo]]
* [[VirtRDFViewTPCD][RDF-based Linked Data Views atop TPCD Benchmark SQL Schema]] / [[VirtRDFViewTPCDDemo][Live Demo]]
* [[VirtRDFViewsThalia][RDF-based Linked Data Views atop Thalia Benchmark SQL Schema]] / [[VirtRDFViewsThaliaDemo][Live Demo]]
* [[VirtRDFViewMusicbrainz][RDF-based Linked Data Views atop MusicBrainz SQL Schema]]
---++++ Semi-Structured Content Examples
* [[VirtRDFViewDocs][Virtuoso Product Documentation (DocBook) to RDF]] / [[VirtRDFViewDocsDemo][Live Demo]]
* [[VirtRDFViewTutorial][Virtuoso Online Tutorials to RDF]] / [[VirtRDFViewTutorialDemo][Live Demo]]
---++++ Web 2.0 Platforms
* [[VirtRDFViewPHPBB3][RDF-based Linked Data Views atop phpBB3 SQL Schema]] / [[VirtRDFViewPHPBB3Demo][Live Demo]]
* [[VirtRDFViewWordpress][RDF-based Linked Data Views atop WordPress SQL Schema]] / [[VirtRDFViewWordpressDemo][Live Demo]]
* [[VirtRDFViewMediaWiki][RDF-based Linked Data Views atop MediaWiki SQL Schema]] / [[VirtRDFViewMediaWikiDemo][Live Demo]]
* [[VirtRDFViewDrupal][RDF-based Linked Data Views atop Drupal SQL Schema]] / [[VirtRDFViewDrupalDemo][Live Demo]]
* [[VirtRDFViewBugzilla][RDF-based Linked Data Views atop Bugzilla SQL Schema]]
---++ How Do I ...?
* [[NorthWindREF][...Use SPARQL to query RDF Linked Data View of Virtuoso's SQL based Demo Database (Northwind Schema)]]
* [[SIOCRefTutorial][...Use SPARQL to query RDF Linked Data View of Virtuoso Online Tutorials SQL Schema]]
* [[SIOCRefDocs][...Use SPARQL to query RDF Linked Data View of Virtuoso online Documentation SQL Schema]]
* [[WordPressSIOCRef][...Use SPARQL to query RDF Linked Data View of WordPress SQL Schema]]
* [[MediaWikiSIOCRef][...Use SPARQL to query RDF Linked Data View of MediaWiki SQL Schema]]
* [[PHPBB3SIOCRef][...Use SPARQL to query RDF Linked Data View of phpBB SQL Schema]]
* [[ECRMRef][...Use SPARQL to query RDF Linked Data View of Socially enhanced CRM (ODS eCRM SQL Schema)]]
* [[http://ods.openlinksw.com/dataspace/dav/wiki/ODS/VOSODSSparqlSamples][...Use SPARQL to query RDF Linked Data Views of Enterprise Collaboration (ODS SQL Schema)]]
---++ Technical White Papers & Advanced Tutorials
* [[VOSSQLRDF][Declarative Meta Schema Language for SQL Schema to RDF Ontology Mapping - White Paper]]
* [[http://virtuoso.openlinksw.com/Whitepapers/html/rdf_views/virtuoso_rdf_views_example.html][Declarative Meta Schema Language for SQL Schema to RDF Ontology Mapping - Tutorial]]
---++ Screencast Demos
* [[http://www.youtube.com/watch?v=bj7AbJ0ZYCk&feature=channel][Virtuoso Linked Data Views over RDBMS Data Sources - Part 1]]
* [[http://www.youtube.com/watch?v=yXNlcISS0aY&feature=channel][Virtuoso Linked Data Views over RDBMS Data Sources - Part 2]]