RDB-to-RDF mapping: A SQL-based Approach

From RDB2RDF
Revision as of 15:50, 23 March 2010 by Rcygania2 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Example of SQL-Query based Approach

The following example illustrates the SQL-Query based approach described below. (This example assumes database and SQL engine support only on the host system that serves the RDB data. It does not assume database or SQL engine support on the client-side that accesses the RDB data.)

Proposed SQL-based RDB-to-RDF mapping

- use SQL to specify the view definition on relational data

 o the expressive power of SQL allows arbitrarily complex view definitions

- the mapping between the SQL view definition (i.e., view name and column names, including referential integrity constraints) AND the RDF schema elements (i.e., class name and property names, including key property names) can be done in two ways:

   o No DB: creating the following mappings and definitions
     - SQLdefStrings to RDF Classes
     - Column Positions in SQLdefString to RDF Properties
     - Capture the definitions of the key properties (such as referential constraints)
   o DB:
     - Define viewname to be the same as the target RDF classname. 
         This automatically captures the “SQLdefStrings to RDF Classes” mapping
     - Define view column names to be the same as the target RDF property names. 
         This automatically captures the “Column Positions in SQLdefString to RDF Properties” mapping, 
           except for the key property names.
     - Define view constraint names to be the same as the key property names. 
         The constraint definitions stored in the database will automatically contain the key property
         definitions. (Note: If the database on the client side does not support view constraints, 
         then we need create the mappings for defining the key properties as shown below.)

The following examples are based on the examples used in our presentation ([1])

Example of a syntax for mapping:

No DB:

- Mapping for defining classes

 - Class (ClassName, SQLdefString)
 o Class (“xyz:dept”, <sql-def-for-dept>)
 o Class (“xyz:emp”, <sql-def-for-emp>)

- Mapping for defining properties

 - Property (PropertyName, ClassName, ColPosInSQLdefString)
 o Property (“dept:InstURI”, "xyz:dept”, 1)
 o Property (“dept:deptno”, "xyz:dept”, 2)
 o Property (“emp:InstURI”, “xyz:emp”, 1)
 o Property ("emp:deptNum”, “xyz:emp”, 6)
 o Property (“emp:c_ref_deptno”, “xyz:emp”, 0)

- Mapping for defining key properties (corresponds to key constraint definitions)

 - KeyProperty (KeyPropertyName, KeyType, ClassName, RefKeyPropertyName)
 o KeyProperty (“dept:c_unq_deptno”, Unique, “xyz:dept”, NULL)
 o KeyProperty (“emp:c_ref_deptno”, Reference, “xyz:emp”, “dept:c_unq_deptno”) 
 - KeyPropertyDef (KeyPropertyName, ClassName, PropertyName, PosInKey)
 o KeyPropertyDef (“dept:c_unq_deptno”, “xyz:dept”, “dept:deptno”, 1)
 o KeyPropertyDef (“emp:c_ref_deptno”,  “xyz:emp”, emp:deptNum”, 1)

DB:

- Mapping for defining classes

 o The intended RDF class name is used as the view name when defining the view.

- Mapping for defining properties

 o The intended RDF property names are used as the view column names

- Mapping for defining key properties

 o The intended RDF (key) property names are used as the names of key constraints on the view. 
   (If constraint definitions are not allowed on views, we need to use the mappings for defining 
    key properties as shown above.)


Example: A sample relational schema, a mapping specification (using XML) for mapping it to RDF, the generated RDF schema, sample relational data and corresponding (virtual) RDF instance triples

The following example illustrates the SQL-Query based approach described ABOVE. (This example assumes database and SQL engine support only on the host system that serves the RDB data. It does not assume database or SQL engine support on the client-side that accesses the RDB data.)