Preserving Semantics when Transforming Conceptual Spatio-Temporal Schemas

Similar documents
Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

ORACLE DATABASE 12C INTRODUCTION

Data Modelling and Databases. Exercise Session 7: Integrity Constraints

COSC 304 Introduction to Database Systems SQL DDL. Dr. Ramon Lawrence University of British Columbia Okanagan

SQL: Data De ni on. B0B36DBS, BD6B36DBS: Database Systems. h p:// Lecture 3

An Introduction to Structured Query Language

An Introduction to Structured Query Language

An Introduction to Structured Query Language

An Introduction to Structured Query Language

ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION

An Introduction to Structured Query Language

Relational Database Systems Part 01. Karine Reis Ferreira

Basant Group of Institution

Mahathma Gandhi University

Data Manipulation (DML) and Data Definition (DDL)

The Basic (Flat) Relational Model. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Integrity Constraints (Reminder)

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Relational Databases Fall 2017 Lecture 7

Relational Data Model. Christopher Simpkins

Microsoft. [MS20762]: Developing SQL Databases

Hierarchies in a multidimensional model: From conceptual modeling to logical representation

Principles of Data Management

1 Active Databases (3 points)

CONSTRAINTS AND UPDATES CHAPTER 3 (6/E) CHAPTER 5 (5/E)

SQL: Data Definition Language. csc343, Introduction to Databases Diane Horton Fall 2017

Developing SQL Databases

Data about data is database Select correct option: True False Partially True None of the Above

Oracle Database 11g: SQL and PL/SQL Fundamentals

The Relational Model. Chapter 3

Relational Model. Topics. Relational Model. Why Study the Relational Model? Linda Wu (CMPT )

DATA AND SCHEMA MODIFICATIONS CHAPTERS 4,5 (6/E) CHAPTER 8 (5/E)

Where are we? Week -4: Data definition (Creation of the schema) Week -3: Data definition (Triggers) Week -1: Transactions and concurrency in ORACLE.

The Relational Model. Chapter 3. Database Management Systems, R. Ramakrishnan and J. Gehrke 1

Essay Question: Explain 4 different means by which constrains are represented in the Conceptual Data Model (CDM).

The Relational Model. Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC)

Relational Databases

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

20762B: DEVELOPING SQL DATABASES

Chapter 1 SQL and Data

; Spring 2008 Prof. Sang-goo Lee (14:30pm: Mon & Wed: Room ) ADVANCED DATABASES

II B.Sc(IT) [ BATCH] IV SEMESTER CORE: RELATIONAL DATABASE MANAGEMENT SYSTEM - 412A Multiple Choice Questions.

The Relational Model

Chapter 11 Object and Object- Relational Databases

SQL Server Development 20762: Developing SQL Databases in Microsoft SQL Server Upcoming Dates. Course Description.

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Information Technology Audit & Cyber Security

Approach for Mapping Ontologies to Relational Databases

SQL: A COMMERCIAL DATABASE LANGUAGE. Complex Constraints

Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa

Where Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams

Introduction to Computer Science and Business

Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata

Comp 5311 Database Management Systems. 4b. Structured Query Language 3

Constraints. Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers. John Edgar 2

Enhanced Data Models for Advanced Applications. Active Database Concepts

Object-Relational Representation of a Conceptual Model for Temporal Data Warehouses

Contents I Introduction 1 Introduction to PL/SQL iii

GITA 338: Spatial Information Processing Systems

Part VIII Transactions, Integrity and Triggers

Module 9: Managing Schema Objects

Relational Model: History

CSE 530A. ER Model to Relational Schema. Washington University Fall 2013

Sql Server Syllabus. Overview

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

CT13 DATABASE MANAGEMENT SYSTEMS DEC 2015

Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course:

Chapter 19 Query Optimization

CS W Introduction to Databases Spring Computer Science Department Columbia University

Slides by: Ms. Shree Jaswal

The Relational Model 2. Week 3

The Relational Model. Why Study the Relational Model? Relational Database: Definitions

Announcements (September 18) SQL: Part II. Solution 1. Incomplete information. Solution 3? Solution 2. Homework #1 due today (11:59pm)

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Why Study the Relational Model? The Relational Model. Relational Database: Definitions. The SQL Query Language. Relational Query Languages

Lecture 2 SQL. Instructor: Sudeepa Roy. CompSci 516: Data Intensive Computing Systems

Assertions, Views, and Programming. CS157A Chris Pollett Oct. 31, 2005.

Data Modeling. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke

Conceptual Design. The Entity-Relationship (ER) Model

Oracle Database: SQL and PL/SQL Fundamentals NEW

3. Object-Oriented Databases

SQL: Part III. Announcements. Constraints. CPS 216 Advanced Database Systems

5. Single-row function

Database Management System (15ECSC208) UNIT I: Chapter 2: Relational Data Model and Relational Algebra

COSC344 Database Theory and Applications. σ a= c (P) Lecture 3 The Relational Data. Model. π A, COSC344 Lecture 3 1

Course Details Duration: 3 days Starting time: 9.00 am Finishing time: 4.30 pm Lunch and refreshments are provided.

Introduction to Data Management. Lecture #4 (E-R à Relational Design)

Oracle Database: SQL and PL/SQL Fundamentals Ed 2

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)

Optional SQL Feature Summary

Relational Model History. COSC 304 Introduction to Database Systems. Relational Model and Algebra. Relational Model Definitions.

The Relational Model

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Course 492 Supplementary Materials. Mutating Tables

DATABASE MANAGEMENT SYSTEMS

More SQL: Complex Queries, Triggers, Views, and Schema Modification

Introduction to Data Management. Lecture #4 (E-R Relational Translation)

MySQL for Developers with Developer Techniques Accelerated

PASSWORDS TREES AND HIERARCHIES. CS121: Relational Databases Fall 2017 Lecture 24

Transcription:

Preserving Semantics when Transforming Conceptual Spatio-Temporal Schemas Esteban ZIMÁNYI, Mohammed MINOUT Department of Computer & Network Engineering Université Libre de Bruxelles {ezimanyi,mminout}@ulb.ac.be http://cs.ulb.ac.be Semantic-based Geographical Information Systems (SeBGIS 05) November 3, 2005

Contents Information Systems Design The MADS model Translating conceptual schemas Logical schemas Physical schemas Preserving semantics when translating schemas Logical constraints Physical constraints Examples of spatial and temporal constraints Conclusions & future works

(Geographical) Information Systems Design Realized on a three-step approach Conceptual schema: Captures application requirements without taking into account implementation considerations Logical schema: Targets a family of implementation platforms, e.g., relational, objectrelational Physical schema: Takes into account particularities of a specific operational platform, e.g., Oracle Typically, (semi-)automatic transformation of these levels using a CASE tool Basic transformation rules are simple Additional information must be input at logical and physical levels Optimization issues are important and require human expertise

The MADS Model Conceptual spatio-temporal model with 4 orthogonal modeling dimensions Structural: novel approach with semantically-rich relationships and multiinstantiation capabilities Spatial and Temporal: based on rich hierarchies of data types orthogonality for associating spatial/temporal features to types/attributes both an object-based and a continuous views of space/time constrained relationship types: topological, synchronization Multi-representation: supporting multiple alternative viewpoints on the same information Conceptual framework for both data definition and data manipulation C. Parent, S. Spaccapietra, E. Zimányi, Conceptual Modeling for Traditional and Spatio- Temporal Applications: The MADS approach, Springer, 2005, 500p., to appear

The MADS Model: Example Conceptual Schema WaterBody name (1,1) othernames (1,n) polution (1,1) Dike dikeno (1,1) (0,n) Destroy Lake faunatype (1,1) floratype (1,1) depth (1,1) f() River riverno (1,1) reservoirs (1,n) (0,n) Overflow (1,n) Flood (0,n) floodno (1,1)

Translating MADS Schemas Transformational approach replacing rich MADS concept with a set of constructs available in the target implementation platform Logical models: Relational, Object-Relational,... Spatial models: Oracle, MapInfo, ArcInfo,... Relationship types: several rules depending on their types and the cardinality of their roles Spatial O/R types: materializing predefined geometry attribute specialized spatial types generic one (e.g., for Oracle) Varying attributes: Complex multivalued attribute encoding its defining function spatial, temporal, and/or perception extent value Temporal O/R types: Complex attribute encoding the lifecycle, including time-varying status: scheduled, active, suspended, disabled

The MADS Model: Example Conceptual Schema WaterBody name (1,1) othernames (1,n) polution (1,1) Dike dikeno (1,1) (0,n) Destroy Lake faunatype (1,1) floratype (1,1) depth (1,1) f() River riverno (1,1) reservoirs (1,n) (0,n) Overflow (1,n) Flood (0,n) floodno (1,1)

Translating MADS Schemas: O-R Logical Schema! " # $

Translating MADS Schemas: Oracle Physical Schema Rewriting the logical schema generated by the translator schema expressed in the language of the target platform create or replace type DInterval as object ( starts date, ends date); create or replace type DLifecycleValue as object ( interval DInterval, status varchar2(10)); create or replace type DLifecycle as table of DLifecycleValue; create or replace type DRiverSetRef as table of ref DRiver; create or replace type DDikeSetRef as table of ref DDike; create or replace type DFlood as object (idflood Did, geometry mdsys.sdo_geometry, lifecycle DLifecycle, floodno integer, riverref DRiverSetRef, dikeref DDikeSetRef); create table Flood of DFlood nested table lifecycle store as FloodLifecycleNT nested table riverref store as FloodRiverRefNT nested table dikeref store as FloodDikeRefNT; [...]

Preserving Semantics when Transforming Schemas At each step of the transformation some semantics is lost Data invalid in the original conceptual schema is accepted by the corresponding physical schema Reason: Limited expressive power of logical and physical models Integrity constraints are needed for ensuring the semantic equivalence between the conceptual and physical schemas Such constraints must be implemented into the DBMS/GIS Encoded once and for all in the database, instead of being encoded in each application accessing it Available to all applications accessing the database, thus enforcing data quality Encapsulated with the data, facilitating the overall application lifecycle

Support of Integrity Constraints in SQL:2003 Choices for implementing constraints (1) Declarative (built-in) constraints (2) Triggers which fire upon predefined updates of particular tables (3) Stored procedures activated by predefined transaction events (4) Directly embedded in the code of applications SQL:2003 provides a few types of declarative integrity constraints NOT NULL, DEFAULT, UNIQUE, PRIMARY KEY, FOREIGN KEY (REFERENCES) CHECK: defines a general IC that must hold for each row of a table DOMAIN: creates a (restricted) column domain ASSERTION: defines a named general IC that may refer to more than one table

Support of Integrity Constraints in DBMSs DBMSs having an ASSERTION statement do not encourage its use Most DBMSs only support domain, uniqueness, and foreign key constraints Expressive power of these constructs is quite limited, e.g. foreign key constraint: referenced columns must satisfy uniqueness condition domain constraints: tied to single columns only uniqueness contraints: apply only within a single table DBMSs recommend to implement user-defined ICs non-declaratively (by triggers or stored procedures) for efficiency reasons ICs typically involve several tables, potentially huge joins, full table scans, nested subqueries, nested negation,... evaluation becomes prohibitively expensive Typical OLTP applications and time-critical data warehousing processes cannot afford integrity checking

Preserving Semantic Equivalence: Methodology Integrity constraints expressed at Logical level: first-order formulas that use the methods provided by spatial/temporal data types Physical level: declarative constraints or triggers depending on target platform Automatic process complementing traditional transformational approach Conceptual Logical: Each transformation rule associated with a set of logical constraints ensuring semantic equivalence Result: Repertoire of logical constraints patterns Logical Physical: Analysis of implementation possibilites of each constraint pattern of the repertoire

Temporal Constraints: Lifecyle (1) Translation of lifecycle requires a set of temporal constraints Basic declarative integrity constraints in Oracle alter table FloodLifecycleNT add constraint uniquestarts unique (interval.starts); alter table FloodLifecycleNT add constraint uniqueends unique (interval.ends); alter table FloodLifecycleNT add constraint validinterval check (interval.starts < interval.ends); alter table FloodLifecycleNT add constraint validstatus check (status in ( scheduled, active, suspended, disabled ));

Temporal Constraints: Lifecyle (2) The intervals of the lifecycle must be disjoint f Flood, l 1 f.lifecycle, l 2 f.lifecycle ( l 1.interval.starts < l 2.interval.ends l 2.interval.starts < l 1.interval.ends l 1.interval.starts = l 2.interval.starts l 1.interval.ends = l 2.interval.ends ) Physical level: triggers in Oracle create or replace trigger FloodLifecycleOverlappingIntervals before insert on Flood for each row declare rowcnt number; begin select count(*) into rowcnt from table(:new.lifecycle) l1, table(:new.lifecycle) l2 where l1.interval.starts < l2.interval.ends and l2.interval.starts < l1.interval.ends and l1.interval.starts <> l2.interval.starts if rowcnt <> 0 then raise_application_error(-20300, Overlapping intervals ) end if; end

Temporal Constraints: Synchronization Relationships Synchronization constraints lost in translation Only underlying binary relationship represented in the schema A set of triggers generated automatically for preserving such semantics create or replace trigger FloodDestroySynchronization before insert on Flood for each row declare rowcnt number; begin select count(*) into rowcnt from table(:new.lifecycle) l1, table(:new.dikeref) d, where not exists ( select * from table(d.column_value.lifecycle) l2, table(d.column_value.floodref) f where f.column_value.idflood=:new.idflood and l1.interval.starts < l2.interval.ends and l2.interval.starts < l1.interval.ends and l1.status= active and l2.status= active ) if count <> 0 then raise_application_error(-20302, Violation of synchronization ) end if; end;

Spatial Constraints: Spatial Types If only a generic spatial type (Oracle) values of spatial attributes must be of the type in the conceptual schema Geometries of rivers are of type multiline or multicurve alter table River add constraint validgeometrytype check (geometry.get gtype() = 6); (not valid in Oracle 10g a trigger instead) Each value of the attribute reservoirs of River is of spatial type point create or replace trigger RiverReservoirsPointType before insert on River for each row declare rowcnt number; begin select count(*) into rowcnt from table(:new.reservoirs) r where r.get_gtype()!= 2 ) if rowcnt <> 0 then raise_application_error(-20401, Reservoirs must be of spatial type point ) end if; end;

Spatial Constraints: Topological (1) Topological constraints may relate a spatial attribute with geometry of its type The spatiality of reservoirs is inside the spatiality of River r 1 River, r 2 r 1.reservoirs ( r 1.geometry.within(r 2.geometry) ) Trigger at the physical level create or replace trigger RiverReservoirsInside before insert on River for each row declare rowcnt number; begin select count(*) into rowcnt from table(:new.reservoirs) r where sdo_inside(r,:new.geometry)= FALSE ) if rowcnt <> 0 then raise_application_error(-20402, Reservoirs must be located inside its river ) end if; end;

Spatial Constraints: Topological (2) Topological constraints for relationships are lost in the translation Overflow is a topological relationship of type intersect an instance of River may be linked to an instance of Flood only if their geometries intersect Trigger at the physical level create or replace trigger FloodOverflowTopological after insert on Flood for each row declare rowcnt number; begin select count(*) into rowcnt from table(:new.riverref) r, where not exists ( select * from table(r.column_value.floodref) f where f.column_value.idflood=:new.idflood and sdo_overlaps(:new.geometry,r.column_value.geometry)= TRUE ) if rowcnt <> 0 then raise_application_error(-20404, Violation of Overflow topological relationship ) end if; end;

Space-Varying Attributes Many constraints apply to varying attributes depend on the type of the underlying function: discrete, stepwise, continuous Attribute depth in Lake: every value of attribute point (1) is of spatial type point (2) is located inside the geometry of the lake Another constraint: the points are at least 1 meter from each other. create or replace trigger LakeDepthDistance1m before insert on Lake for each row declare rowcnt number; begin select count(*) into rowcnt from table(:new.depth) d1, table(:new.depth) d2 where sdo_within_distance(d1.point,d2.point, distance=1 )= TRUE ) if rowcnt <> 0 then raise_application_error(-20403, Points must be at least 1 m. from each other ) end if; end;

Conclusions Usual approach for information systems design induces important semantic loss We presented a methodology to ensure semantic equivalence between conceptual and physical schemas This requires implicit integrity constraints at the logical and physical levels We showed our methodology using the MADS conceptual model The methodology is generic and can be applied to any conceptual model Important issues to be addressed Scalability: real-size application would generate 100s of constraints selection of which constraints will be implemented Optimization: implication of constraints could lead to performance increase

Future Works: Explicit Integrity Constraints Visual specifications of the constraints at a conceptual level Constraint Editor Constraint Name SalarySupervisor Targeted at Employee Constraint Description The supervisor of an employee must have a salary greater than or equal to the salary of the employee Verification Immediate Deferred 1. Range Definition Forall Exists Negate Delete Forall e in Employee 2. Predicate AND NOT Function OR IMPLIES Clear e.subordinate.employee.salary >= e.salary OK Validate Cancel Semi-automatic translation of such constraints

Preserving Semantics when Transforming Conceptual Spatio-Temporal Schemas Questions?