# Semantics-Preserving RDB2 RDF Data Transformation Using Hierarchical Direct Mapping
## 1 Introduction  
The transformation of relational databases (RDB) into resource-description-framework (RDF) data is a key information extraction method used to publish semantics web data [1; 2; 3]. In 1998, [PERSON] proposed the concept of mapping RDBs to the Semantic Web [4]. Since then, several approaches have been proposed to improve the mapping of RDBs to semantic data. Additionally, the World Wide Web Consortium (W3C) has organized working groups to help standardize the technologies used for transforming RDBs into RDF data. Direct mapping is a representative mapping method recommended by the W3C to support the automatic mapping of relational data to semantic data [5]. Figure 1 illustrates an example of direct mapping, which defines mapping rules for transforming both relational schema and instance data into RDF data. In the field of direct mapping, researchers have long-studied effective automated processes that focus on semantics preservation. The semantics preservation of the direct mapping process reflects the relational integrity constraints within the mapping result [6; 7]. Because integrity constraints define the semantics of a database, mapping with integrity constraints generates more semantically accurate results. Although the transformation of relational data using integrity constraints has been long-studied [8; 9; 10; 11; 12; 13; 14; 15; 16], several problems still occur during the direct-mapping processes under specific conditions (see Figure 2). If an attribute has two or more integrity constraints (e.g., _NotNull_ and _Unique_ in Figure 2a), the mapping result will output a single RDF graph structure that combines all of the integrity constraints (the subgraph rooted by name in Figure 2b). The mapping result preserves the semantics in view of the previous methods because relational data is transformed into RDF data. However, to date, no explicit transforming meta-information or well-designed hierarchical structure has been provided to trace the input relational data into the mapping result. RDF _NotNull_ and _Unique_ triples should have meta-information that reveals their _NotNull_ and _Unique_ constraints respectively, regarding the attribute name in table _Lecture_. Without this information, a new subgraph can be extracted from the merged RDF graph, which can then be misinterpreted, generating unintended constraints not found in the original data (see the primary key in Figure 2c). Thus, mapping methods based on weak definitions of semantics preservation can cause information loss and incorrect data generation. Therefore, to ensure the accuracy of the mapping process in all cases, a stringent definition is needed to quantify semantics preservation. Figure 1: A simplified example of direct mapping. RDB represents relational database, RDF represents relational databases resource-description-framework. Figure 2: An example of problems encountered during a direct-mapping process. This paper proposes a hierarchical direct-mapping algorithm that prevents the problem illustrated in Figure 2 and preserves the semantics based on strict logical rules. Mapping problems occur when a mapping method simply focuses on data-type transformations. To prevent this, the proposed method uses a hierarchical semantics vocabulary and advanced mapping rules to map without semantic information loss. This paper also defines an evaluation metric using the inverse-mapping phase. That is, a mapping method is said to preserve the semantics if the result of inverse-mapping is semantically identical to the original input data (Figure 3). Evaluation results confirm the effectiveness and accuracy of semantics preservation of the proposed mapping methods. This paper makes the following contributions:  
* Lemmas are defined to ensure semantics preservation and to demonstrate the soundness and completeness of direct mapping. * Hierarchical mapping rules are defined based on lemmas to perform semantics-preserving RDB-to-RDF (RDB2 RDF) transformations and to prevent the loss of semantics and incorrect semantic data generation problems.