Source-linked AI summary

On Directly Mapping Relational Databases to RDF and OWL (Extended Version)

Juan F. Sequeda, Marcelo Arenas, Daniel P. Miranker

arXiv:1202.3667v3cs.DB

TL;DR

Relational databases are central potential sources for Semantic Web data, motivating direct mappings to RDF and OWL. The paper defines a Datalog-based mapping and studies whether it preserves information and queries while remaining monotone and semantics preserving. It proves preservation and monotonicity even with nulls, but shows that no monotone mapping can preserve semantics with foreign keys; a non-monotone semantics-preserving mapping is therefore presented.

  • Problem

    Directly mapping relational databases to RDF with OWL vocabulary is important for exploiting relational data in the Semantic Web.

  • Method

    The paper defines a Datalog-based direct mapping from relational schemas, integrity constraints, and instances to RDF graphs with OWL vocabulary.

  • Results

    The mapping is monotone, information preserving, and query preserving with null values, but no monotone mapping is semantics preserving when foreign keys are considered.

  • Takeaways & Limitations

    Monotonicity obstructs semantics preservation under OWL with foreign keys, while a non-monotone direct mapping can overcome this obstacle.

  • Takeaways & Limitations

    The approach does not yet cover datatypes or relational databases under bag semantics, and large-database evaluation remains future work.

Abstract

from arXiv · show

Mapping relational databases to RDF is a fundamental problem for the development of the Semantic Web. We present a solution, inspired by draft methods defined by the W3C where relational databases are directly mapped to RDF and OWL. Given a relational database schema and its integrity constraints, this direct mapping produces an OWL ontology, which, provides the basis for generating RDF instances. The semantics of this mapping is defined using Datalog. Two fundamental properties are information preservation and query preservation. We prove that our mapping satisfies both conditions, even for relational databases that contain null values. We also consider two desirable properties: monotonicity and semantics preservation. We prove that our mapping is monotone and also prove that no monotone mapping, including ours, is semantic preserving. We realize that monotonicity is an obstacle for semantic preservation and thus present a non-monotone direct mapping that is semantics preserving.

1. INTRODUCTION

The paper develops and evaluates a direct mapping from relational databases to RDF with OWL vocabulary, targeting information and query preservation alongside monotonicity and semantics preservation. The proposed mapping preserves information and queries, including null values, but monotonicity conflicts with semantics preservation when foreign keys are considered; a non-monotone alternative addresses this limitation.

  • Motivation: The mapping directly translates relational databases into RDF graphs using OWL vocabulary, motivated by the prevalence and scale of relationally backed Web data.One report cited by the paper estimates that Internet-accessible databases contained up to 500 times more data than the static Web, and roughly 70% of websites were backed by relational databases.
  • Properties: The paper studies information preservation, query preservation, monotonicity, and semantics preservation as fundamental or desirable properties of direct mappings.Information preservation concerns reconstructing the original database; query preservation concerns translating relational queries into equivalent queries over the RDF result.
  • Results: The proposed mapping is monotone, information preserving, and query preserving even when relational databases contain null values.
  • Results: When a database violates an integrity constraint, the proposed mapping still generates a consistent RDF graph and therefore is not semantics preserving.
  • Results: No monotone direct mapping is semantics preserving when foreign keys are considered, because OWL constraint checking uses satisfiability testing.The paper identifies monotonicity as an obstacle and notes the practical risk of observing consistency where inconsistency would be expected.
  • Resolution: The paper presents a non-monotone direct mapping that is semantics preserving and discusses monotone mappings under an epistemic extension of OWL.

2. PRELIMINARIES

The preliminaries define relational schemas, instances, null-aware relational algebra, RDF and OWL graphs, and SPARQL graph-pattern semantics. They also formalize keys and foreign keys used as integrity constraints.

  • Relational databases: A relational schema is a finite set of relation names with nonempty finite attribute sets, and an instance assigns finite tuple sets whose values may include NULL.
  • Relational algebra: The paper uses relational algebra with selection, projection, renaming, joins, union, and difference, including explicit operators for NULL and non-NULL tests.
  • Relational algebra: The algebra also includes union and difference, while left-, right-, and full-outer joins are expressible using the preceding operators.
  • Relational algebra: Relational algebra expressions are evaluated recursively over database instances, with joins matching shared non-NULL attribute values and set operators combining compatible results.
  • Integrity constraints: Keys require non-NULL key values and uniqueness, while foreign keys require referenced keys and either NULL referencing values or matching referenced tuples.
  • RDF, OWL, and SPARQL: RDF graphs are finite sets of triples, and OWL consistency means that a model exists for the graph under OWL vocabulary semantics.
  • RDF, OWL, and SPARQL: SPARQL graph patterns combine triple patterns with AND, OPTIONAL, UNION, MINUS, FILTER, and SELECT/AS constructs, and queries return sets of variable mappings.The paper restricts built-in conditions to Boolean combinations involving equality and bound tests, while also using selected SPARQL 1.1 features.

3. DIRECT MAPPINGS: DEFINITION AND PROPERTIES

The paper defines direct mappings as automatic functions from relational schemas, constraints, and instances to RDF graphs, then formalizes information, query, monotonicity, and semantics preservation. These properties address recoverability, query translation, update stability, and encoding constraint satisfaction.

  • Definition: A direct mapping automatically translates a relational schema, PKs, FKs, and instance into an RDF graph with OWL vocabulary.
  • Fundamental properties: Information preservation requires a computable procedure that recovers every source instance from the RDF graph produced by the mapping.
  • Fundamental properties: Query preservation requires each relational algebra query to have an equivalent SPARQL query over the mapped RDF graph.The translation function converts relational query tuples into SPARQL mappings, including the paper’s treatment of NULL values.
  • Fundamental properties: Information preservation and query preservation are incomparable: either property can hold without guaranteeing the other.The paper explains that information recovery does not ensure query expressibility, while query preservation can hold without storing schema information.
  • Desirable properties: Monotonicity requires the mapped graph for an expanded instance to contain the graph for the original instance, leaving previously computed mapping elements unchanged.
  • Desirable properties: Semantics preservation requires consistency of the OWL graph exactly when the relational instance satisfies its primary-key and foreign-key constraints.

4. THE DIRECT MAPPING DM

DM is a Datalog-defined direct mapping that translates relational schemas, integrity constraints, and instances into RDF with OWL vocabulary. It classifies schema elements and generates IRIs for the resulting classes, relations, and properties.

  • Overview: DM integrates and extends earlier direct mappings and is defined as Datalog rules for translating relational schemas and instances.The rules are divided into schema-translation and instance-translation parts.
  • Input representation: The mapping stores relations, attributes, primary keys, foreign keys, and tuple values using predicates such as REL, ATTR, PKn, FKn, and VALUE.VALUE records attribute values, including NULL, for identified tuples.
  • Ontology extraction: DM classifies relations as classes or binary relations, represents foreign keys as object properties, and represents relation attributes as datatype properties.Binary relations support many-to-many relationships between entities.
  • Binary-relation detection: A relation is identified as binary when it has exactly two primary-key attributes that are foreign keys to other relations, subject to additional structural conditions.The conditions exclude certain three-attribute, multiple-foreign-key, composite-key, and incoming-foreign-key cases.
  • IRI generation: The mapping generates IRIs for identified classes, binary relations, object properties, and datatype properties by concatenating strings with a supplied base IRI.Generated IRIs can later be replaced or mapped to existing Semantic Web IRIs.

5. PROPERTIES OF DM

The paper proves that DM preserves information and queries, including databases with null values, and that it is monotone. It also shows that DM is not semantics preserving because monotonicity conflicts with constraint checking involving foreign keys.

  • Information preservation: DM is information preserving: a computable mapping can reconstruct the initial relational instance from the generated RDF graph.This establishes that the direct mapping does not lose information from the translated relational instance.
  • Query preservation: DM is query preserving: every relational algebra query has an equivalent SPARQL query over the generated RDF graph.The proof covers databases possibly containing null values and proceeds by induction over query structure.
  • Query translation: The query translation handles base relations, binary relations, empty relations, selection, projection, rename, join, union, and difference.Optional patterns preserve information when DM does not translate NULL values, and nested SELECT queries support projection and base cases.
  • Monotonicity: DM is monotone because its negative Datalog atoms refer only to the fixed schema, primary keys, and foreign keys.Thus, recomputing the entire mapping is unnecessary after database updates.
  • Semantics preservation: DM is not semantics preserving: an inconsistent relational database can produce a consistent RDF graph, and DM always generates a consistent RDF graph.The paper gives duplicate primary-key values as an example and generalizes the result in Proposition 1.

6. SEMANTICS PRESERVATION OF DIRECT MAPPINGS

The section shows that monotonicity conflicts with semantics preservation when foreign keys are considered, while a non-monotone extension restores semantics preservation. It also establishes semantics preservation for primary keys alone.

  • Semantics preservation: A semantics-preserving mapping must produce a consistent RDF graph exactly when the relational instance satisfies its primary- and foreign-key constraints.This property encodes relational integrity constraints in the RDF translation.
  • Primary keys: Primary-key violations can be detected by adding Datalog rules for repeated values and nulls, then generating artificial triples that force OWL inconsistency.The extension DMpk handles both repeated primary-key values and NULL values.
  • Primary keys: DMpk is information preserving, query preserving, monotone, and semantics preserving when only primary keys are considered.The result is stated formally for every schema, primary-key set, and database instance.
  • Foreign keys: No monotone direct mapping is semantics preserving when foreign keys are included, because OWL constraint checking relies on satisfiability testing.The paper attributes this obstacle to OWL's Open World Assumption and lack of the Unique Name Assumption, unlike relational databases.
  • Foreign keys: DMpk+fk restores semantics preservation for primary and foreign keys by checking foreign-key violations beforehand and generating an artificial inconsistency.The construction is non-monotone because a previously generated artificial triple must be retracted when added data satisfies the foreign-key constraint.
  • Alternatives: An alternative route would extend OWL or description logic with an epistemic operator capable of expressing integrity constraints.The paper presents this as a possible way to obtain a mapping satisfying all four properties.

7. CONCLUDING REMARKS

The conclusion presents the paper's direct mapping as information preserving and query preserving with null values, while distinguishing monotone and non-monotone routes to semantics preservation. It also identifies datatypes, bag semantics, and large-scale evaluation as future work.

  • Contributions: The paper studies direct relational-database-to-RDF mapping using information preservation, query preservation, monotonicity, and semantics preservation.The mapping targets RDF graphs with OWL vocabulary and is analyzed through these four properties.
  • Contributions: The initial mapping is monotone, information preserving, and query preserving even for databases containing null values.The conclusion then states that monotonicity prevents this mapping from also being semantics preserving.
  • Contributions: A non-monotone direct mapping is presented that is semantics preserving, alongside discussion of a possible monotone mapping using an epistemic extension of OWL.The conclusion frames these as two ways to address the conflict between monotonicity and semantics preservation.
  • Future work: Future work includes datatypes, bag semantics, and evaluation of the rule-based approach on large relational databases.The authors state that the bag-semantics extension is straightforward because each tuple already has its own identifier.

D.1 Proof of Theorem 1

The proof reconstructs a relational instance from the generated RDF graph by identifying ontology elements, translating graph patterns with SPARQL, and converting solution mappings back into tuples.

  • Reconstruction steps: The reconstruction first identifies RDF triples declaring ontological classes and maps each recovered class to a relational relation.Class IRIs are used to recover relation names.
  • Reconstruction steps: Datatype-property triples reveal attributes and their domains, which are used to recover relation columns.The proof inspects datatype properties together with their domain declarations.
  • Reconstruction steps: Object-property triples identify binary relations, with domain and range triples supplying the referenced relation structure.The object-property IRI encodes information about the binary relation and its attributes.
  • Query reconstruction: The proof constructs SPARQL queries whose solution mappings represent tuples, including joins between entities and their properties.A representative query joins two entity variables through an object property and retrieves their attributes.
  • Tuple reconstruction: Each SPARQL solution mapping is converted back into a relational tuple using the inverse transformation tr^-1.For every variable in the mapping domain, tr^-1 assigns the mapped value to the corresponding tuple attribute.

D.2 Proof of Theorem 2

The proof establishes query preservation by translating every relational-algebra query into an equivalent SPARQL query over the direct mapping, including null-valued attributes. It proceeds by induction over query structure and handles the relational operators used in the translation.

  • Theorem 2 requires a SPARQL query Q⋆ equivalent to every relational-algebra query Q for every database instance, including null values.
  • A lemma handles projected variable domains, while the difference case uses the induction hypothesis to establish equivalence between relational and SPARQL results.
  • The proof proceeds by induction on the structure of Q, beginning with base cases for relation queries.
  • For a non-binary relation, the translated SPARQL pattern identifies tuple resources by rdf:type and retrieves available attribute values with an optional pattern.
  • The base-case equivalence is proved in both directions: each relational tuple mapping satisfies the SPARQL pattern, and each matching SPARQL solution corresponds to a relational tuple.
  • The inductive step covers selection, projection, rename, join, union, and difference by constructing corresponding SPARQL expressions from translations of subqueries.

D.3 Proof of Proposition 1

The proof shows that the direct mapping is not semantics preserving when a primary-key violation occurs, because an inconsistent relational database can produce a consistent RDF graph under OWL semantics.

  • A STUDENT instance with two tuples sharing primary-key value SID = 1 violates the primary-key constraint and is therefore inconsistent.
  • The direct mapping generates OWL class and datatype-property triples for STUDENT, NAME, and SID from this inconsistent instance.
  • Because the resulting RDF graph remains consistent under OWL semantics, the direct mapping is not semantics preserving.

D.4 Proof of Proposition 2

With only primary keys, the mapping can encode violations directly in RDF so that OWL semantics detects inconsistency.

  • For primary-key-only constraints, a satisfying database instance yields an RDF graph consistent under OWL semantics.
  • When a primary-key constraint is violated, the mapping produces a triple TRIPLE(a, "owl:differentFrom", a), which makes the RDF graph inconsistent under OWL semantics.

D.5 Proof of Theorem 3

The proof shows that no direct mapping can be both monotone and semantics preserving when foreign keys are included among the constraints.

  • The contradiction uses instances I1 ⊆ I2 where I1 violates the constraints and I2 satisfies them, so semantic preservation requires inconsistent and consistent mapping results respectively.
  • Monotonicity would make the mapping of I1 a subset of the mapping of I2, forcing the inconsistent result to inherit consistency from the larger consistent graph.

D.6 Proof of Theorem 4

The direct mapping is OWL-consistent exactly when the relational instance satisfies its primary-key and foreign-key constraints; violations produce an explicit inconsistency.

  • If instance I satisfies the primary-key and foreign-key constraints Σ, DMpk+fk(R, Σ, I) is consistent under OWL semantics.
  • If I violates Σ, the resulting RDF graph contains TRIPLE(a, "owl:differentFrom", a), generating an OWL inconsistency.
  • Thus, the mapping reflects relational constraint satisfaction through OWL consistency or inconsistency.
Loading 1202.3667v3…