Abstract
The integration of relational databases (RDBs) into the Semantic Web is often hindered by the "impedance mismatch" between rigid table structures and flexible graph-based ontologies. This paper presents a robust framework for bridging this gap through automated mapping rules that transform RDB schemas into OWL ontologies and translate SQL relational algebra into equivalent SPARQL queries. By specifically addressing the handling of null values and complex relationships, the proposed method ensures data parity. Evaluation on the RDBLAB dataset shows that the system achieves 100% accuracy compared to original SQL queries, preventing the data loss common in naive SPARQL translations.
Introduction
The "Deep Web" contains vast amounts of data stored in legacy relational databases. While the Semantic Web aims to make this data machine-understandable via RDF and OWL, migrating massive databases to triple stores is often impractical. The primary challenge lies in translating rigid SQL logic into graph-based SPARQL queries without losing information, particularly when dealing with many-to-many relationships or null values. Previous attempts often struggled with "data evaporation," where missing values caused entire result rows to be dropped in the semantic graph.
Methodology
The authors propose a two-phase approach: Ontology Construction and Query Rewriting.
Ontology Construction
The system utilizes "Direct Mapping Rules" to convert RDB components into OWL/RDF. Tables are mapped to classes, and columns to datatype properties. Crucially, the system identifies 1:1, 1:m, and m:n relationships by analyzing Primary and Foreign Keys, mapping them to object properties. To prevent data loss, the mapping ensures that rows containing null values do not break the resulting graph structure.
Query Rewriting
The core innovation is the translation of Relational Algebra—the mathematical foundation of SQL—into SPARQL. Fundamental operations like Selection (σ) and Projection (Π) are mapped to SPARQL FILTER and SELECT patterns. Joins are handled using graph patterns and the OPTIONAL keyword. By systematically utilizing OPTIONAL and BOUND operators, the authors mimic SQL's handling of missing data, ensuring semantic queries return the exact same row count as their SQL counterparts.
Evaluation and Results
The approach was evaluated using RDBLAB, a custom dataset scaled to 70,000 rows (generating over 440,000 RDF triples). The dataset was specifically designed to include "dirty" data with thousands of null values in various columns to test the robustness of the mapping rules.
Experimental results confirmed zero data loss. In tests across six complex query types (Q1-Q6), the number of rows returned by the SQL engine matched the number of tuples from the optimized SPARQL engine ($Q^o$) exactly.
As shown in the results, naive SPARQL queries ($Q'$)—which do not account for null values or complex join logic—lost significant amounts of data. For instance, in Q2, the naive query missed nearly 7,000 results that the proposed method successfully captured. This confirms that the proposed algebra-based translation layer maintains 100% accuracy relative to the relational source.
Conclusion
By focusing on relational algebra, the authors created a universal translation layer that bridges the gap between RDBs and the Semantic Web. While the current framework handles fundamental operations successfully, future work will focus on extending the system to handle deeply nested SQL subqueries and optimizing performance for large-scale "Big Data" scenarios involving billions of triples.
Summary updated